Skip to main content

YOLOv3 in PyTorch.

Project description

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}
}

Project details


Download files

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

Source Distribution

yolov3_pytorch-0.1.5.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

yolov3_pytorch-0.1.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file yolov3_pytorch-0.1.5.tar.gz.

File metadata

  • Download URL: yolov3_pytorch-0.1.5.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for yolov3_pytorch-0.1.5.tar.gz
Algorithm Hash digest
SHA256 09dae0fe37416a7adcfc919bfa228eed7b958d5bad7e37345f59f759ac6594d2
MD5 593026ae80eef8fa7a423b02d27a480e
BLAKE2b-256 ec6db8bff3be00cbbea5432203f65718f5210673c3721a4bb72cbe654c84428d

See more details on using hashes here.

File details

Details for the file yolov3_pytorch-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for yolov3_pytorch-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b2b3d1900a95cbcad9d00167fbe535ff9faab1990612ce45610e1ced035c3189
MD5 9cb608e23c6a0d3f8c79957884c8fd70
BLAKE2b-256 e0a61ae8dfc9e272c0b651e5960619587369472f94c7833907fc4248c22f9c9a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page