Zamba

A Python package for identifying hundreds of kinds of animals, training custom models, and estimating distance from camera trap videos and images.
https://github.com/drivendataorg/zamba

Category: Biosphere
Sub Category: Terrestrial Wildlife

Keywords

animals camera-traps chimps cli conservation deep-learning ecology gpu images jungle machine-learning neural-network python pytorch pytorch-lightning video-processing videos

Keywords from Contributors

cyanobacteria habs sentinel-2

Last synced: about 14 hours ago
JSON representation

Repository metadata

A Python package for identifying hundreds of kinds of animals, training custom models, and estimating distance from camera trap videos and images

README.md

Zamba

Docs Status
tests
codecov

https://user-images.githubusercontent.com/46792169/138346340-98ee196a-5ecd-4753-b9df-380528091f9e.mp4

Zamba means "forest" in Lingala, a Bantu language spoken throughout the Democratic Republic of the Congo and the Republic of the Congo.

zamba is a tool built in Python that uses machine learning and computer vision to automatically detect and classify animals in camera trap images and videos. You can use zamba to:

  • Identify which species appear in each image or video
  • Filter out blank images or videos
  • Create your own custom models that identify your species in your habitats
  • Estimate the distance between animals in the frame and the video camera
  • And more! 🙈 🙉 🙊

The official video models in zamba can identify blank videos (where no animal is present) along with 32 species common to Africa and 11 species common to Europe. The official image models can identify 178 species from throughout the world. Users can also finetune models using their own labeled images and videos to then make predictions for new species and/or new ecologies.

zamba can be used both as a command-line tool and as a Python package. It is also available as a user-friendly website application, Zamba Cloud.

We encourage people to share their custom models trained with Zamba. If you train a model and want to make it available, please add it to the Model Zoo Wiki for others to be able to use!

Visit https://zamba.drivendata.org/docs/ for full documentation and tutorials.

Installing zamba

First, make sure you have the prerequisites installed:

  • Python >= 3.11
  • FFmpeg > 4.3

Then run:

pip install https://github.com/drivendataorg/zamba/releases/latest/download/zamba.tar.gz

See the Installation page of the documentation for details.

Getting started

Once you have zamba installed, some good starting points are:

Example usage

Once zamba is installed, you can see the basic command options with:

$ zamba --help

 Usage: zamba [OPTIONS] COMMAND [ARGS]...

 Zamba is a tool built in Python to automatically identify the species seen in camera trap
 videos from sites in Africa and Europe. Visit https://zamba.drivendata.org/docs for more
 in-depth documentation.

╭─ Options ─────────────────────────────────────────────────────────────────────────────────╮
│ --version                     Show zamba version and exit.                                │
│ --install-completion          Install completion for the current shell.                   │
│ --show-completion             Show completion for the current shell, to copy it or        │
│                               customize the installation.                                 │
│ --help                        Show this message and exit.                                 │
╰───────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ────────────────────────────────────────────────────────────────────────────────╮
│ densepose      Run densepose algorithm on videos.                                         │
│ depth          Estimate animal distance at each second in the video.                      │
│ predict        Identify species in a video.                                               │
│ train          Train a model on your labeled data.                                        │
| image          Tools for working with images instead of videos.                           |
╰───────────────────────────────────────────────────────────────────────────────────────────╯

zamba can be used "out of the box" to generate predictions or train a model using your own images and videos. zamba supports the same image formats as pillow and the same video formats as FFmpeg, which are listed here. Any images or videos that fail a set of validation checks will be skipped during inference or training.

Classifying unlabeled images and videos

Zamba classifies videos by default, but can easily be set to classify images instead. To get classifications for videos:

$ zamba predict --data-dir path/to/videos

and for images:

$ zamba image predict --data-dir path/to/videos

By default, predictions will be saved to zamba_predictions.csv. Run zamba predict --help or zamba image predict --help to list all possible options to pass to predict.

See the Quickstart page or the user tutorial on classifying images or classifying videos for more details.

Training a model

Zamba defaults to training a model for classifying videos:

$ zamba train --data-dir path/to/videos --labels path_to_labels.csv --save_dir my_trained_model

Training a model for images is similar:

$ zamba image train --data-dir path/to/images --labels path_to_labels.csv --save_dir my_trained_model

The newly trained model will be saved to the specified save directory. The folder will contain a model checkpoint as well as training configuration, model hyperparameters, and validation and test metrics. Run zamba train --help or zamba image train --help to list all possible options to pass to train.

You can use your trained model on new images or videos by editing the train_configuration.yaml that is generated by zamba. Add a predict_config section to the yaml that points to the checkpoint file that is generated:

...
# generated train_config
...

predict_config:
  checkpoint: PATH_TO_YOUR_CHECKPOINT_FILE

Now you can pass this configuration to the command line. See the Quickstart page or the user tutorial on training a model for more details.

You can then share your model with others by adding it to the Model Zoo Wiki.

Estimating distance between animals and the camera

Depth-estimation models are also supported, but only for video files. For example:

$ zamba depth --data-dir path/to/videos

By default, predictions will be saved to depth_predictions.csv. Run zamba depth --help to list all possible options to pass to depth.

See the depth estimation page for more details.

Contributing

We would love your contributions of code fixes, new models, additional training data, docs revisions, and anything else you can bring to the project!

See the docs page on contributing to zamba for details.

Reference paper

Dorne, E., Qi, J., Bull, P., Stephens, C., Bessone, M., Debetencourt, B., Fruth, B., Morgan, D., Palmer, M. S., Sanz, C., Wendefeuer, J., Crockford, C., Deschner, T., Langergraber, K. E., Piel, A. K., Robbins, M., Sommer, V., Stewart, F. A., Wittig, R. M., . . . Arandjelovic, M. (2025). Zamba: Computer vision for wildlife conservation. Proceedings of the Python in Science Conferences, 85–111. https://doi.org/10.25080/crcw9835


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 261
Total Committers: 16
Avg Commits per committer: 16.313
Development Distribution Score (DDS): 0.724

Commits in past year: 3
Committers in past year: 2
Avg Commits per committer in past year: 1.5
Development Distribution Score (DDS) in past year: 0.333

Name Email Commits
caseyfitz c****z 72
Peter Bull p****l@g****m 63
Emily Miller e****4@g****m 60
Dmytro Poplavskiy d****y@g****m 23
AllenDowney d****y@a****m 13
Jay Qi 2****i 8
Robert Gibboni r****t@d****g 5
jdcc j****n@d****g 4
Katie Wetstone 4****e 4
dependabot[bot] 4****] 3
westford14 w****4@g****m 1
drivendata i****o@d****g 1
Tammy Glazer 4****r 1
Shankhadeep Dey s****9@g****m 1
Christian Krause c****e@i****e 1
bull b****l@C****M 1

Committer domains:


Issue and Pull Request metadata

Last synced: 10 days ago

Total issues: 127
Total pull requests: 128
Average time to close issues: 4 months
Average time to close pull requests: 23 days
Total issue authors: 12
Total pull request authors: 18
Average comments per issue: 1.09
Average comments per pull request: 2.98
Merged pull request: 81
Bot issues: 57
Bot pull requests: 0

Past year issues: 3
Past year pull requests: 11
Past year average time to close issues: 1 day
Past year average time to close pull requests: 21 minutes
Past year issue authors: 2
Past year pull request authors: 5
Past year average comments per issue: 2.0
Past year average comments per pull request: 2.0
Past year merged pull request: 2
Past year bot issues: 2
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/drivendataorg/zamba

Top Issue Authors

  • github-actions[bot] (57)
  • pjbull (32)
  • ejm714 (17)
  • AllenDowney (10)
  • jdcc (3)
  • glipstein (2)
  • klwetstone (1)
  • jayqi (1)
  • VLucet (1)
  • CrazyGeG (1)
  • victoria-kabeli (1)
  • lakik (1)

Top Pull Request Authors

  • ejm714 (46)
  • pjbull (21)
  • jayqi (13)
  • AllenDowney (8)
  • sambujangfofana (6)
  • jdcc (6)
  • papapizzachess (4)
  • aaronphilip19 (4)
  • alanzhangithub (3)
  • klwetstone (3)
  • lundybernard (2)
  • westford14 (2)
  • tongyu0924 (2)
  • minhaj3 (2)
  • intagliated (2)

Top Issue Labels

  • bug (59)
  • enhancement (14)
  • good first issue (10)
  • dependencies (7)
  • docs (4)
  • v2 (4)
  • build failed (3)
  • documentation (3)
  • question (2)
  • tests (1)

Top Pull Request Labels


Package metadata

proxy.golang.org: github.com/drivendataorg/zamba

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/drivendataorg/zamba#section-documentation
  • Licenses:
  • Latest release: v2.6.1+incompatible (published about 1 year ago)
  • Last Synced: 2026-05-19T12:27:14.700Z (4 days ago)
  • Versions: 20
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent packages count: 4.811%
    • Average: 4.973%
    • Dependent repos count: 5.135%
pypi.org: zamba

Zamba is a tool to identify the species seen in camera trap videos from sites in central Africa.

  • Homepage: http://zamba.drivendata.org
  • Documentation: http://zamba.drivendata.org/docs/
  • Licenses: MIT License
  • Latest release: 0.1.6 (published almost 8 years ago)
  • Last Synced: 2026-05-19T12:27:13.050Z (4 days ago)
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 32 Last month
  • Rankings:
    • Dependent packages count: 7.373%
    • Stargazers count: 7.995%
    • Forks count: 9.37%
    • Dependent repos count: 22.233%
    • Average: 23.571%
    • Downloads: 70.883%
  • Maintainers (1)

Dependencies

.github/workflows/docs-latest.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • nwtgck/actions-netlify v1.1 composite
.github/workflows/docs-preview.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • nwtgck/actions-netlify v1.1 composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • nwtgck/actions-netlify v1.1 composite
.github/workflows/tests.yml actions
  • Iamshankhadeep/setup-ffmpeg v1.2 composite
  • Iamshankhadeep/setup-ffmpeg v1.1 composite
  • JasonEtco/create-an-issue v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v3 composite
  • ilammy/msvc-dev-cmd v1 composite
requirements-dev/docs.txt pypi
  • mike * development
  • mkdocs >=1.2.2 development
  • mkdocs-material >=7.3.4 development
  • mkdocstrings >=0.19.0 development
requirements-dev/lint.txt pypi
  • black * development
  • flake8 * development
pyproject.toml pypi
  • appdirs *
  • av *
  • cloudpathlib [s3]
  • ffmpeg-python *
  • future *
  • fvcore *
  • gitpython *
  • loguru *
  • numpy *
  • opencv-python-headless *
  • openpyxl *
  • pandas >=2.0.0
  • pandas_path *
  • pqdm *
  • pydantic <2.0.0
  • python-dotenv *
  • pytorch-lightning >=2.0.0
  • pytorchvideo *
  • scikit-learn *
  • tensorboard *
  • thop ==0.0.31.post2005241907
  • timm *
  • torch *
  • torchinfo *
  • torchvision >=0.10.0
  • tqdm *
  • typer [all]
  • yolox @ git+https://github.com/r-b-g-b/YOLOX.git@build-requirements
requirements-dev.txt pypi

Score: 11.683444309645031