PyTorch-YOLOv3
Minimal PyTorch implementation of YOLOv3
A minimal PyTorch implementation of YOLOv3 for detecting and locating multiple objects in images in a single pass, with command-line tools for detection, custom-dataset training, and accuracy evaluation.
This is a Python implementation of YOLOv3, an object detection algorithm that can identify and locate multiple objects in a photograph or video frame in a single pass. YOLO stands for "You Only Look Once," which refers to how the algorithm processes the whole image at once rather than scanning it piece by piece. The result is fast detection that can run in near real time. This implementation uses PyTorch, a popular Python library for building and running machine learning models.
The repository covers three things: detecting objects in new images using existing trained weights, training the model on a dataset from scratch or fine-tuning it on a custom dataset, and evaluating how accurate the trained model is. It includes command-line tools named yolo-detect, yolo-train, and yolo-test that cover each of these tasks. The implementation is described as minimal, meaning it focuses on clarity rather than packing in every possible optimization.
You can also use this as a Python library in your own code. The README shows a short example where you load a model, read in an image with OpenCV, and call a detect function that returns a list of bounding boxes with coordinates and confidence scores for each object found.
Training on a custom dataset is supported. You provide a folder of images, a folder of annotation files that describe what is in each image and where, and a file listing the class names. The README walks through the exact folder structure and file formats required.
Pretrained weights from the original YOLOv3 paper are available to download, and the implementation results shown in the README match the original paper's reported accuracy closely. Weights from YOLOv4 and YOLOv7 are also compatible with this code. The package installs via pip and is published under an open source license.
Where it fits
- Run YOLOv3 object detection on your own photos to identify and locate multiple objects with bounding boxes and confidence scores
- Fine-tune YOLOv3 on a custom labeled image dataset to detect objects specific to your use case
- Evaluate detection accuracy of a trained model against ground-truth annotations using the yolo-test tool