YOLOv3 in PyTorch.
Project description
YOLOv3-PyTorch
Contents
- Introduction
- Getting Started
- Download weights
- Download datasets
- How Test and Train
- Result
- Contributing
- Credit
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
python3 setup.py install
Inference (TODO)
# Download YOLOv3-tiny model weights to `./results/pretrained_models`
wget .
python3 ./tools/detect.py
All pretrained model weights
How Test and Train
Both training and testing only need to modify the train_config.py
or test_config.py
file.
Test yolov3_tiny_voc model
Modify the test_config.py
file.
- line 18:
model_arch_name
change toyolov3_tiny_voc
. - line 34:
test_dataset_config_path
change to./data/voc.data
. - line 38:
model_weights_path
change to./results/pretrained_models/YOLOv3_tiny-COCO.weights
.
python3 test.py
Train yolov3_tiny_voc model
Modify the train_config.py
file.
- line 18:
model_arch_name
change toyolov3_tiny_voc
. - line 58:
upscale_factor
change to./data/voc.data
.
python3 train.py
Resume train yolov3_tiny_voc model
Modify the train_config.py
file.
- line 18:
model_arch_name
change toyolov3_tiny_voc
. - line 58:
upscale_factor
change to./data/voc.data
. - line 74:
resume_model_weights_path
change tof"./samples/YOLOv3_tiny-VOC0712/epoch_xxx.pth.tar"
.
python3 train.py
Result
Source of original paper results: https://arxiv.org/pdf/1804.02767v1.pdf
In the following table, the mAP value in ()
indicates the result of the project, and -
indicates no test.
Model | Train dataset | Test dataset | Size | mAP |
---|---|---|---|---|
yolov3_tiny_prn_voc | VOC07+12 trainval | VOC07 test | 416 | -(56.4) |
yolov3_tiny_voc | VOC07+12 trainval | VOC07 test | 416 | -(58.8) |
yolov3_voc | VOC07+12 trainval | VOC07 test | 416 | -(79.0) |
yolov3_spp_voc | VOC07+12 trainval | VOC07 test | 416 | -(75.3) |
mobilenetv1_voc | VOC07+12 trainval | VOC07 test | 416 | -(66.0) |
mobilenetv2_voc | VOC07+12 trainval | VOC07 test | 416 | -(69.3) |
mobilenetv3_small_voc | VOC07+12 trainval | VOC07 test | 416 | -(53.8) |
mobilenetv3_large_voc | VOC07+12 trainval | VOC07 test | 416 | -(71.1) |
alexnet_voc | VOC07+12 trainval | VOC07 test | 416 | -(56.4) |
vgg16_voc | VOC07+12 trainval | VOC07 test | 416 | -(74.5) |
# Download `YOLOv3_tiny-VOC0712-d24f2c25.pth.tar` weights to `./results/pretrained_models`
# More detail see `README.md<Download weights>`
python3 ./detect.py
Output1:
Output2:
Loaded `` pretrained model weights successfully.
image 1/2 data/examples/dog.jpg: 480x608 1 bicycle, 1 car, 1 dog,
image 2/2 data/examples/person.jpg: 416x608 1 dog, 1 person, 1 sheep,
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yolov3_pytorch-0.1.1.tar.gz
.
File metadata
- Download URL: yolov3_pytorch-0.1.1.tar.gz
- Upload date:
- Size: 43.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e37f14af45e01516b13075978ab873e2f39af1509483784443779f3d0ae00f8 |
|
MD5 | 5f1474823cab98ecfedc4d81702450c6 |
|
BLAKE2b-256 | a2501def97c3f0e38f6d9f7b50852b031bdce2a781eb2918c3aa76cb4aa77a89 |
File details
Details for the file yolov3_pytorch-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: yolov3_pytorch-0.1.1-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae0d8d674075977a43677cb27932e6e52364a7bb8e50c56dfeeb77f03314238d |
|
MD5 | eaa7747fbf05cddad3e32d6f7e9a8286 |
|
BLAKE2b-256 | 12b8fc3af89eb20212c9c6d915a47b19a583cd44987488944b0afef9290ce07f |