Skip to main content

Automated exploration behavior analysis for object recognition tests using CLIP

Project description

EXPLORE

Automated exploration behavior analysis for object recognition and location tests
CLIP-based classification with an iterative labeling loop — no GPU required.

CI PyPI Python License: MIT


Overview

EXPLORE analyzes rodent object exploration from overhead video recordings. It uses CLIP (ViT-B/32) to classify frames and a lightweight logistic-regression head that you train interactively in a few minutes.

Core workflow (browser GUI):

  1. Add videos and name your project
  2. Draw bounding boxes around each object on a reference frame
  3. Verify that boxes are correctly re-localized across all videos
  4. Sample 1-minute windows, correct proximity-based labels, train the classifier
  5. Run the full analysis — annotated videos, exploration CSVs, trajectory plots

Installation

# 1. Install PyTorch (CPU)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

# 2. Install EXPLORE
pip install explore-behavior

For GPU (CUDA 12):

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
pip install explore-behavior

Quick start

GUI (recommended)

explore gui

The browser app opens automatically. Work through the six tabs in order:

Tab What you do
1. Project Enter a project name, choose an output folder, add video files
2. Label Objects Get a reference frame from any video; draw a bounding box around each object and name it
3. Verify Boxes ORB feature matching re-localizes boxes across all other videos; drag any box to correct it
4. Label Frames Sample 1-minute windows → proximity labels applied automatically → correct wrong labels → Train + Preview to fit the classifier and preview the next window with model predictions. Repeat until labels look right.
5. Analyze Set min bout duration; toggle DI/RI (computed for every object pair); choose low-res (fast) or high-res prediction video; click Run
6. Results Browse the results table; output files are in your project folder

Session state is saved automatically at each step — use Load project on Tab 1 to resume from where you left off.


Output files

File Description
results/<project>.csv Tidy per-animal, per-minute table: exploration time, frequency, DI and RI for every object pair
results/prediction_videos/*.mp4 Annotated video at 12 fps / half resolution (low-res mode) with coloured overlays at exploration moments
results/tracking/<video>_tracking.csv Animal centroid (x, y) per analysis frame
results/tracking/<video>_trajectory.png Trajectory plot colour-coded by time with object boxes overlaid
model/head.pkl Fitted logistic-regression head (~5 kB, shareable across experiments)
session.json Full project state — reopen any session with Load project in the GUI
config.yaml Experiment configuration including behavioral prompts

DI and RI

Discrimination Index and Recognition Index are computed for every pair of objects when Compute DI / RI is enabled. With objects A and B:

DI_A_vs_B = (t_A − t_B) / (t_A + t_B)
RI_A_vs_B = t_A / (t_A + t_B)

Values are based on total session exploration time (not per-bin), which avoids instability from empty time bins.


Development

git clone https://github.com/victorjonathanibanez/EXPLORE
cd EXPLORE

pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[dev]"

# Run tests (no GPU, no model download)
pytest -m "not slow and not gpu"

# Lint + format
ruff check src/ tests/
ruff format src/ tests/

Contributing

Pull requests welcome. Areas where contributions are most valuable:

  • Pose estimation integration for more robust tracking
  • Better object assignment when multiple objects are very close together
  • Windows-specific testing

Please open an issue before submitting large changes.


License

MIT — see LICENSE.


Citation

If you use EXPLORE in your research, please cite:

Ibañez, V., Bohlen, L., Manuella, F. et al. EXPLORE: a novel deep learning-based analysis method for exploration behaviour in object recognition tests. Sci Rep 13, 4249 (2023). https://doi.org/10.1038/s41598-023-31094-w


Contact

Victor Ibañezvictor.ibanez@uzh.ch
Anna-Sophia WahlAnnaSophia.Wahl@med.uni-muenchen.de

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

explore_behavior-2.0.2.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

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

explore_behavior-2.0.2-py3-none-any.whl (2.9 MB view details)

Uploaded Python 3

File details

Details for the file explore_behavior-2.0.2.tar.gz.

File metadata

  • Download URL: explore_behavior-2.0.2.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for explore_behavior-2.0.2.tar.gz
Algorithm Hash digest
SHA256 f5a092f9b85bd81dcfd6150085d2288bd7fa9c5f1c431cb95ca6351163bfc4bf
MD5 d4e1bdac64bb9b6bf05b3735468ded89
BLAKE2b-256 555b914737a4108eb329ddead47e4e5c7726c832345566524d040e149ecd261e

See more details on using hashes here.

Provenance

The following attestation bundles were made for explore_behavior-2.0.2.tar.gz:

Publisher: release.yml on victorjonathanibanez/EXPLORE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file explore_behavior-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for explore_behavior-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f52aae3fd2899032d321a8fae628a01709048508f8b461fe27159b82093b32e7
MD5 bd8a7f07ccc619d51e929296308a6b02
BLAKE2b-256 034f53f0647c8c062d26760be6eeff7317f1bdec1f32a059942c00eb68e5c964

See more details on using hashes here.

Provenance

The following attestation bundles were made for explore_behavior-2.0.2-py3-none-any.whl:

Publisher: release.yml on victorjonathanibanez/EXPLORE

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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