Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A Python package for quick and easy object detection

Project description

Detecto Logo

CircleCI Documentation Status

Detecto is a Python package for quick and easy object detection. Below are just a few of the features available:

  • Train models on custom datasets
  • Get all or top predictions on an image
  • Run object detection on videos
  • Save and load models from files

Detecto is built on top of PyTorch, meaning models trained with Detecto can easily be extracted and used with PyTorch code.

Video demo of Detecto

Usage and Docs

To install Detecto using pip, run the following command:

pip install detecto

After installing Detecto, you can train a machine learning model on a custom dataset and run object detection on a video with under ten lines of code:

from detecto.core import Model, Dataset, DataLoader
from detecto.utils import xml_to_csv
from detecto.visualize import detect_video

xml_to_csv('xml_labels/', 'labels.csv')
dataset = Dataset('labels.csv', 'images/')
loader = DataLoader(dataset)

model = Model(['dog', 'cat', 'rabbit'])

detect_video(model, 'input_video.mp4', 'output_video.avi')

Visit the docs for a full guide, including a quickstart tutorial.

Alternatively, check out the demo on Colab.


All issues and pull requests are welcome! To run the code locally, first fork the repository and then run the following commands on your computer:

git clone<your-username>/detecto.git
cd detecto
# Recommended to create a virtual environment before the next step
pip3 install -r requirements.txt

When adding code, be sure to write unit tests and docstrings where necessary.

Tests are located in detecto/tests and can be run using pytest:

python -m pytest

To generate the documentation locally, run the following commands:

cd docs
make html

The documentation can then be viewed at docs/_build/html/index.html.


Detecto was created by Alan Bi. Feel free to reach out on Twitter or through email!

Project details

Download files

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

Files for detecto, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size detecto-1.0.2-py3-none-any.whl (20.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size detecto-1.0.2.tar.gz (16.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page