Skip to main content

YOLOv3-PyTorch

Contents

Introduction

This repository contains an op-for-op PyTorch reimplementation of YOLOv3: An Incremental Improvement.

Getting Started

Requirements

  • Python 3.10+
  • PyTorch 2.0.0+
  • CUDA 11.8+
  • Ubuntu 22.04+

From PyPI

pip3 install yolov3_pytorch -i https://pypi.org/simple

Local Install

git clone https://github.com/Lornatang/YOLOv3-PyTorch.git
cd YOLOv3-PyTorch
pip3 install -r requirements.txt
pip3 install -e .

All pretrained model weights

Inference (e.g YOLOv3_Tiny-VOC0712)

# Download YOLOv3_Tiny-VOC0712 model weights to `./results/pretrained_models`
wget https://github.com/Lornatang/YOLOv3-PyTorch/releases/download/0.1.5/YOLOv3_Tiny-VOC0712-20231107.pth.tar -O ./resutls/pretrained_models/YOLOv3_Tiny-VOC0712-20231107.pth.tar
python3 ./tools/inference.py ./data/examples/dog.jpg
# Result will be saved to `./results/predict/YOLOv3_Tiny-VOC0712/dog.jpg`

Test

VOC0712

# Download dataset to `./data`
cd ./scripts
bash ./process_voc0712_dataset.sh
cd ..
# Download pretrained model weights to `./results/pretrained_models`
wget https://github.com/Lornatang/YOLOv3-PyTorch/releases/download/0.1.5/YOLOv3_Tiny-VOC0712-20231107.pth.tar -O ./resutls/pretrained_models/YOLOv3_Tiny-VOC0712-20231107.pth.tar
python3 ./tools/test.py ./configs/YOLOv3_Tiny-VOC0712.yaml

Results

COCO2014

Model Size mAPval
0.5:0.95
FLOPs(G) Parameters(M) Memory(MB)
YOLOv3_Tiny-COCO2014 416 18.7 5.6 0.71 8.9
YOLOv3_Tiny_PRN-COCO2014 416 11.1 3.5 0.66 4.9
YOLOv3-COCO2014 416 66.7 66.2 0.88 61.9
YOLOv3_SPP-COCO2014 416 66.7 66.5 0.88 63.0

VOC

Model Size mAPval
0.5:0.95
FLOPs(B) Memory(MB) Parameters(M)
YOLOv3_Tiny-VOC0712 416 58.8 5.5 0.27 8.7
YOLOv3_Tiny_PRN-VOC0712 416 47.9 3.5 0.27 4.9
YOLOv3-VOC0712 416 82.9 65.7 0.61 61.6
YOLOv3_SPP-VOC0712 416 83.2 66.1 0.88 62.7
YOLOv3_MobileNetV1-VOC0712 416 65.6 6.6 0.69 6.2
YOLOv3_MobileNetV2-VOC0712 416 68.2 3.5 0.49 4.3
YOLOv3_MobileNetV3_Large-VOC0712 416 70.1 2.8 0.50 4.7
YOLOv3_MobileNetV3_Small-VOC0712 416 53.7 1.5 0.48 2.8
YOLOv3_VGG16-VOC0712 416 74.1 122.8 0.74 35.5

Train

VOC0712

# Download dataset to `./data`
cd ./scripts
bash ./process_voc0712_dataset.sh
cd ..
# Download pretrained model weights to `./results/pretrained_models`
wget https://github.com/Lornatang/YOLOv3-PyTorch/releases/download/0.1.5/YOLOv3_Tiny-VOC0712-20231107.pth.tar -O ./resutls/pretrained_models/YOLOv3_Tiny-VOC0712-20231107.pth.tar
python3 ./tools/train.py ./configs/YOLOv3_Tiny-VOC0712.yaml

COCO2014 & COCO2017

# COCO2014
# Download dataset to `./data`
cd ./scripts
bash ./process_coco2014_dataset.sh
cd ..
# Download pretrained model weights to `./results/pretrained_models`
wget https://github.com/Lornatang/YOLOv3-PyTorch/releases/download/0.1.5/YOLOv3_Tiny-COCO2014-20231107.pth.tar -O ./resutls/pretrained_models/YOLOv3_Tiny-COCO2014-20231107.pth.tar
python3 ./tools/train.py ./configs/YOLOv3_Tiny-COCO2014.yaml

# COCO2017
# Download dataset to `./data`
cd ./scripts
bash ./process_coco2017_dataset.sh
cd ..
# Download pretrained model weights to `./results/pretrained_models`
wget https://github.com/Lornatang/YOLOv3-PyTorch/releases/download/0.1.5/YOLOv3_Tiny-COCO2017-20231107.pth.tar -O ./resutls/pretrained_models/YOLOv3_Tiny-COCO2017-20231107.pth.tar
python3 ./tools/train.py ./configs/YOLOv3_Tiny-COCO2017.yaml

Custom dataset

Details see CustomDataset.md.

Contributing

If you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.

I look forward to seeing what the community does with these models!

Credit

YOLOv3: An Incremental Improvement

Joseph Redmon, Ali Farhadi

Abstract
We present some updates to YOLO! We made a bunch of little design changes to make it better. We also trained this new network that’s pretty swell. It’s a little bigger than last time but more accurate. It’s still fast though, don’t worry. At 320 × 320 YOLOv3 runs in 22 ms at 28.2 mAP, as accurate as SSD but three times faster. When we look at the old .5 IOU mAP detection metric YOLOv3 is quite good. It achieves 57.9 AP50 in 51 ms on a Titan X, compared to 57.5 AP50 in 198 ms by RetinaNet, similar performance but 3.8× faster. As always, all the code is online at https://pjreddie.com/yolo/.

[Paper] [Project Webpage] [Authors' Implementation]

@article{yolov3,
  title={YOLOv3: An Incremental Improvement},
  author={Redmon, Joseph and Farhadi, Ali},
  journal = {arXiv},
  year={2018}
}

Metadata

Release files for yolov3-pytorch 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yolov3-pytorch 0.1.5
File Size Uploaded Provenance Actions
yolov3_pytorch-0.1.5.tar.gz 9.0 kB Without provenance Details for yolov3_pytorch-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yolov3-pytorch 0.1.5
File Interpreter ABI Platform Actions
yolov3_pytorch-0.1.5-py3-none-any.whl Python 3 none any Details for yolov3_pytorch-0.1.5-py3-none-any.whl

Total release size: 16.6 kB

Release files / yolov3_pytorch-0.1.5.tar.gz

Download URL yolov3_pytorch-0.1.5.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
09dae0fe37416a7adcfc919bfa228eed7b958d5bad7e37345f59f759ac6594d2
BLAKE2b-256 checksum
How to use checksums
ec6db8bff3be00cbbea5432203f65718f5210673c3721a4bb72cbe654c84428d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / yolov3_pytorch-0.1.5-py3-none-any.whl

Download URL yolov3_pytorch-0.1.5-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b3d1900a95cbcad9d00167fbe535ff9faab1990612ce45610e1ced035c3189
BLAKE2b-256 checksum
How to use checksums
e0a61ae8dfc9e272c0b651e5960619587369472f94c7833907fc4248c22f9c9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Security for yolov3-pytorch 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page