Skip to main content

Human object learning benchmarks

Project description

hobj: human object learning benchmarks

CI

This repository contains benchmarks for comparing models of object learning against measurements of human behavior, from Lee and DiCarlo 2023 ("How well do rudimentary plasticity rules predict adult visual object learning?"). It also lets you download the raw data and images from the experiments in the paper.

Alt text

If you just want to download the raw data and images without using the hobj library, check out the OSF repository for this project.

Quickstart

Install

The hobj package works for Python >=3.12.

After cloning this repository, cd to the hobj directory. Ensure you have uv installed, then run:

uv sync

This creates a virtual environment in .venv and installs the package plus its runtime dependencies.

Using hobj to comparing a linear learner against human learning data

The template script below shows you how you can run a benchmark on a linear learning model based on your image encoding model.

All you need to do is have a way to process a PIL.Image into a vector of image features (as an np.ndarray). There are ~18,000 images that you'd need to compute image features for.

import hobj
import numpy as np 

# Compute your features for the images 
my_image_features: dict[str, np.ndarray] = {}
for image_id in hobj.list_image_ids():
    image = hobj.load_image(image_id=image_id) # PIL.Image
    
    # Compute your features here:  
    my_image_features[image_id] = ... # replace right hand side with your image-computable model

# Assemble the learning model:
model = hobj.create_linear_learner(
    image_id_to_features=my_image_features,
    update_rule_name='Square', # "Square", "Perceptron", "Hinge", "MAE", "Exponential", "CE", "REINFORCE",
    alpha=1, # learning rate between [0, 1]
)

# Load the benchmark:
benchmark = hobj.MutatorHighVarBenchmark()  # or hobj.MutatorOneshotBenchmark()

# Score the model:
result = benchmark.score_model(model)

# Print its score and its CI:
print(result.msen, result.msen_CI95)

# You can also check out more granular statistics of the model's behavior, like its learning curves: 
# print(result.model_statistics)

For more details (e.g., how to load the raw behavioral data or images in Python), check out the Jupyter notebooks in examples/.

To use a different location, pass cachedir=... to a data loader or benchmark constructor, or prefetch manually with hobj-download-data --cachedir /path/to/data.

Contact

If you have any questions, need help, or experience a bug, please don't hesitate to email me (mil@mit.edu), or open an issue on this repo!

Changes to codebase since publication

This codebase was overhauled in 2026 to improve its accessibility, performance, and quality. Along the way, minor changes to the statistical analysis procedure were introduced, along with changes to the names of the original filenames (see changelist). To see the codebase at the time of publication, check out the repo with the v1 tag here.

Citation

@article{lee2023well,
  title={How well do rudimentary plasticity rules predict adult visual object learning?},
  author={Lee, Michael J and DiCarlo, James J},
  journal={PLOS Computational Biology},
  volume={19},
  number={12},
  pages={e1011713},
  year={2023},
  publisher={Public Library of Science San Francisco, CA USA}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hobj-2.0.0.dev1.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hobj-2.0.0.dev1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file hobj-2.0.0.dev1.tar.gz.

File metadata

  • Download URL: hobj-2.0.0.dev1.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for hobj-2.0.0.dev1.tar.gz
Algorithm Hash digest
SHA256 03f0754c8b78ecc34a2e709db9fdec9c3057ef0e51743549853e54a469d267d8
MD5 53562cb6980d49d1e17b2615441399d1
BLAKE2b-256 9313aa3a2b94881c4281f5fdb6344e548ecb772773d4ec8e436af5c05df0f98b

See more details on using hashes here.

File details

Details for the file hobj-2.0.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: hobj-2.0.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.12

File hashes

Hashes for hobj-2.0.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 53b292adb991eb4040e16036df7e4deeb976d3a6062751ef8b52eb371a703d11
MD5 58d29fa455776aee47edee386f9d41ea
BLAKE2b-256 a185647e0813b38be1202be3912c9171e199d9ca4bd244dc420e40ad1c8850c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page