Skip to content

Commit

Permalink
新增yolov3说明
Browse files Browse the repository at this point in the history
  • Loading branch information
bobo0810 committed Sep 9, 2018
0 parents commit b1721f1
Show file tree
Hide file tree
Showing 30 changed files with 2,216 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

.DS_Store
build
.git
*.egg-info
dist
output
data/coco
backup
weights/*.weights
__pycache__
checkpoints
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# PyTorch-YOLOv3
Minimal implementation of YOLOv3 in PyTorch.

## Table of Contents
- [PyTorch-YOLOv3](#pytorch-yolov3)
* [Table of Contents](#table-of-contents)
* [Paper](#paper)
* [Installation](#installation)
* [Inference](#inference)
* [Test](#test)
* [Train](#train)
* [Credit](#credit)

## Paper
### YOLOv3: An Incremental Improvement
_Joseph Redmon, Ali Farhadi_ <br>

**Abstract** <br>
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]](https://pjreddie.com/media/files/papers/YOLOv3.pdf) [[Original Implementation]](https://github.com/pjreddie/darknet)

## Installation
$ git clone https://github.com/eriklindernoren/PyTorch-YOLOv3
$ cd PyTorch-YOLOv3/
$ sudo pip3 install -r requirements.txt

##### Download pretrained weights
$ cd weights/
$ bash download_weights.sh

##### Download COCO
$ cd data/
$ bash get_coco_dataset.sh

## Inference
Uses pretrained weights to make predictions on images. Below table displays the inference times when using as inputs images scaled to 256x256. The ResNet backbone measurements are taken from the YOLOv3 paper. The Darknet-53 measurement marked shows the inference time of this implementation on my 1080ti card.

| Backbone | GPU | FPS |
| ----------------------- |:--------:|:--------:|
| ResNet-101 | Titan X | 53 |
| ResNet-152 | Titan X | 37 |
| Darknet-53 (paper) | Titan X | 76 |
| Darknet-53 (this impl.) | 1080ti | 74 |

$ python3 detect.py --image_folder /data/samples

<p align="center"><img src="assets/giraffe.png" width="480"\></p>
<p align="center"><img src="assets/dog.png" width="480"\></p>
<p align="center"><img src="assets/traffic.png" width="480"\></p>
<p align="center"><img src="assets/messi.png" width="480"\></p>

## Test
Evaluates the model on COCO test.

$ python3 test.py --weights_path weights/yolov3.weights

| Model | mAP (min. 50 IoU) |
| ----------------------- |:----------------:|
| YOLOv3 (paper) | 57.9 |
| YOLOv3 (this impl.) | 58.2 |

## Train
Model does not converge yet during training. Data augmentation as well as additional training tricks remains to be implemented. PRs are welcomed!
```
train.py [-h] [--epochs EPOCHS] [--image_folder IMAGE_FOLDER]
[--batch_size BATCH_SIZE]
[--model_config_path MODEL_CONFIG_PATH]
[--data_config_path DATA_CONFIG_PATH]
[--weights_path WEIGHTS_PATH] [--class_path CLASS_PATH]
[--conf_thres CONF_THRES] [--nms_thres NMS_THRES]
[--n_cpu N_CPU] [--img_size IMG_SIZE]
[--checkpoint_interval CHECKPOINT_INTERVAL]
[--checkpoint_dir CHECKPOINT_DIR]
```

## Credit
```
@article{yolov3,
title={YOLOv3: An Incremental Improvement},
author={Redmon, Joseph and Farhadi, Ali},
journal = {arXiv},
year={2018}
}
```
Binary file added assets/dog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/giraffe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/messi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/traffic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions config/coco.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
classes= 80
train=data/coco/trainvalno5k.txt
valid=data/coco/5k.txt
names=data/coco.names
backup=backup/
eval=coco
Loading

0 comments on commit b1721f1

Please sign in to comment.