README.md
March 5, 2026 · View on GitHub
Paying Attention to Other Animal Detections Improves Camera Trap Classification Models
Gaspard Dussert, Stéphane Dray, Simon Chamaillé-Jammes, Vincent Miele
Overview
Multi-Crop Attention-based Classifier uses self-attention to improve classification by levaring the context of other detection within the camera trap sequence.

Quick Start
Clone this repository and install the dependencies.
git clone git@github.com:gdussert/MCA_Classifier.git
cd MCA_Classifier
pip install -e .
Interactive Demo

On Hugging Face
Try out the demo without any installation on Hugging Face.
On your local machine
Download the models:
bash download_models.sh
Then run the demo:
python gradio_demo.py
Training and testing
Download the data on Zenodo and put them in data/.
Each zip file includes the crop embeddings of several datasets:
serengeti_train.zip: training set of Snapshot Serengeti (8.9GB)serengeti_test.zip: test set of Snapshot Serengeti (3.4GB)serengeti_toy.zip: toy dataset to quickly test all the scripts, it contains only the pictures of Snapshot Serengeti camera trap location C12 (45.3MB)safari2024.zip: whole Snapshot Safari 2024 Expansion dataset (4.6GB)
The data directory structure should look like this:
.
├── data/
│ ├── serengeti_train/
│ │ ├── metadata.csv
│ │ ├── embeddings.bl2
│ │ └── scores.bl2
│ ├── serengeti_test/
│ │ └── ...
│ ├── serengeti_toy/
│ │ └── ...
│ ├── safari2024/
│ │ └── ...
│ └── crop_images/
│ └── lilaser/
├── models/
│ ├── crop_classifier.pt
│ ├── mca_classifier.pt
│ └── MDV6-yolov10-e-1280.pt
└── mca_clasifier/
└── ...
Both datasets being very large, crop_images.zip includes only the picture of serengeti_toy.
Training
python train.py --dataset $DATASET
Testing
python test.py --dataset $DATASET --dataset_type $DATASET_TYPE
With $DATASET_TYPE being either real or synthetic.
Cite us
@article{dussert_paying_2026,
author = {Dussert, Gaspard and Dray, Stéphane and Chamaillé-Jammes, Simon and Miele, Vincent},
title = {Paying attention to other animal detections improves camera trap classification models},
year = {2026},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/2041-210x.70260},
doi = {10.1111/2041-210x.70260},
journal = {Methods in Ecology and Evolution},
publisher={Wiley Online Library}
}
Acknowledgements
This work was granted access to the HPC resources of IDRIS under the allocation 2022-AD010113729 made by GENCI.
Thanks to LILA BC for hosting the two datasets, Snapshot Safari 2024 Expansion and Snapshot Serengeti, and for all those who contributed to it.
Thanks MegaDetector and PytorchWildlife: MDv5a was used for preprocessing and MDV6-Ultralytics-YoloV10-Extra is used by the Gradio demo.
Thanks to the amazing timm repository.