Build fully-functioning computer vision models with PyTorch


Keywords
python, machine-learning, computer-vision, pytorch, faster-rcnn, object-detection
License
MIT
Install
pip install detecto==1.2.1

Documentation

CircleCI Documentation Status

Detecto

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.

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'])
model.fit(loader)

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

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

Contributing

All issues and pull requests are welcome! To run the code locally, first fork and then clone this repository.

When adding code, be sure 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.

Contact

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