Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pjh5672/YOLOv2
YOLOv2 implementation using PyTorch
https://github.com/pjh5672/YOLOv2
object-detection pytorch yolo yolov2 yolov2-pytorch
Last synced: 3 months ago
JSON representation
YOLOv2 implementation using PyTorch
- Host: GitHub
- URL: https://github.com/pjh5672/YOLOv2
- Owner: pjh5672
- License: gpl-3.0
- Created: 2022-11-11T13:30:40.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-01T12:35:06.000Z (almost 2 years ago)
- Last Synced: 2024-08-03T01:23:05.851Z (6 months ago)
- Topics: object-detection, pytorch, yolo, yolov2, yolov2-pytorch
- Language: Python
- Homepage:
- Size: 5.44 MB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-yolo-object-detection - pjh5672/YOLOv2
- awesome-yolo-object-detection - pjh5672/YOLOv2
README
#
Object Detection: YOLOv2---
## [Content]
1. [Description](#description)
2. [Usage](#usage)
2-1. [K-medoids Anchor Clustering](#k-medoids-anchor-clustering)
2-2. [Model Training](#model-training)
2-3. [Detection Evaluation](#detection-evaluation)
2-4. [Result Analysis](#result-analysis)
3. [Contact](#contact)---
## [Description]
This is a repository for PyTorch implementation of YOLOv2 following the original paper (https://arxiv.org/abs/1612.08242).
- **Performance Table**
| Model | Dataset | Train | Valid | Size
(pixel) | mAP
(@0.5:0.95) | mAP
(@0.5) | Params
(M) | FLOPs
(B) |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| YOLOv2
(Paper:page_with_curl:) | PASCAL-VOC | trainval2007+2012 | test2007 | 416 | *not reported* | 76.8 | *not reported* | 34.90 |
| YOLOv2
(Our:star:) | PASCAL-VOC | trainval2007+2012 | test2007 | 416 | 35.6 | 73.2 | 50.66 | 29.49 |
| YOLOv2
(Our:star:) | COCO | train2017 | val2017 | 416 | 20.0 | 45.6 | 50.96 | 29.49 |- **Pretrained Model Weights Download**
- [Darknet19 backbone](https://drive.google.com/file/d/1qjOfb-KESJFZoJRlwZ_2FbT4-9PkgdjZ/view?usp=share_link)
- [YOLOv2 trained on VOC](https://drive.google.com/file/d/16q3Hkhz8S8_Sn3IUju9U5z9y2hb-3UKP/view?usp=share_link)
- [YOLOv2 trained on COCO](https://drive.google.com/file/d/13opYZb9aXTviEuUC5Wb1POkO-2a2GuIJ/view?usp=share_link)![result](./asset/result.jpg)
## [Usage]
#### K-medoids Anchor Clustering
- You extract anchor box priors from all instances' boxes at first.```python
python kmedoids_anchor.py --exp my_test --data voc.yaml
``````log
2022-11-16 13:43:54 | Avg IOU: 62.01%
2022-11-16 13:43:54 | Boxes:
[[0.068 0.11711711]
[0.16 0.26666668]
[0.278 0.60982656]
[0.776 0.82133335]
[0.494 0.40533334]]
2022-11-16 13:43:54 | Ratios: [0.46, 0.58, 0.6, 0.94, 1.22]
```#### Model Training
- You can train your own YOLOv2 model using Darknet19 with anchor box from above step. If you wanna train YOLOv2 on your dataset from the scratch, add "--scratch" in training command like below.```python
python train.py --exp my_test --data voc.yaml --multiscale(optional) --scratch(optional)
```#### Detection Evaluation
- You can compute detection metric via mean Average Precision(mAP) with IoU of 0.5, 0.75, 0.5:0.95. I follow the evaluation code with the reference on https://github.com/rafaelpadilla/Object-Detection-Metrics.```python
python val.py --exp my_test --data voc.yaml --ckpt-name best.pt
```#### Result Analysis
- After training is done, you will get the results shown below.```log
2022-11-24 00:05:50 | YOLOv2 Architecture Info - Params(M): 50.67, FLOPS(B): 29.49
2022-11-24 00:11:46 | [Train-Epoch:001] multipart: 47.5865 obj: 0.3412 noobj: 39.8344 txty: 0.3336 twth: 1.3665 cls: 4.3459
2022-11-24 00:16:35 | [Train-Epoch:002] multipart: 5.2848 obj: 0.4527 noobj: 0.4779 txty: 0.2533 twth: 0.5172 cls: 1.7730
2022-11-24 00:21:20 | [Train-Epoch:003] multipart: 4.7149 obj: 0.4151 noobj: 0.6242 txty: 0.2230 twth: 0.3704 cls: 1.4219
2022-11-24 00:25:57 | [Train-Epoch:004] multipart: 4.4068 obj: 0.3878 noobj: 0.6716 txty: 0.2124 twth: 0.3370 cls: 1.2465
2022-11-24 00:30:33 | [Train-Epoch:005] multipart: 4.2239 obj: 0.3716 noobj: 0.6863 txty: 0.2042 twth: 0.3206 cls: 1.1549
2022-11-24 00:35:08 | [Train-Epoch:006] multipart: 4.0749 obj: 0.3551 noobj: 0.6898 txty: 0.1996 twth: 0.3054 cls: 1.1047
2022-11-24 00:39:49 | [Train-Epoch:007] multipart: 3.9681 obj: 0.3493 noobj: 0.6986 txty: 0.1950 twth: 0.2917 cls: 1.0364
2022-11-24 00:44:25 | [Train-Epoch:008] multipart: 3.9203 obj: 0.3470 noobj: 0.7098 txty: 0.1907 twth: 0.2743 cls: 1.0106
2022-11-24 00:49:01 | [Train-Epoch:009] multipart: 3.7825 obj: 0.3335 noobj: 0.7053 txty: 0.1868 twth: 0.2739 cls: 0.9491
2022-11-24 00:53:37 | [Train-Epoch:010] multipart: 3.7485 obj: 0.3315 noobj: 0.7096 txty: 0.1834 twth: 0.2738 cls: 0.9241
2022-11-24 00:54:57 |
- Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.298
- Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.589
- Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.250
- Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.009
- Average Precision (AP) @[ IoU=0.50 | area= small | maxDets=100 ] = 0.042
- Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.114
- Average Precision (AP) @[ IoU=0.50 | area=medium | maxDets=100 ] = 0.279
- Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.361
- Average Precision (AP) @[ IoU=0.50 | area= large | maxDets=100 ] = 0.681...
2022-11-24 16:37:12 | [Train-Epoch:199] multipart: 1.8789 obj: 0.1728 noobj: 0.5847 txty: 0.1090 twth: 0.1221 cls: 0.1992
2022-11-24 16:37:13 | [Best mAP at 190]- Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.481
- Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.753
- Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.501
- Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.061
- Average Precision (AP) @[ IoU=0.50 | area= small | maxDets=100 ] = 0.174
- Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.230
- Average Precision (AP) @[ IoU=0.50 | area=medium | maxDets=100 ] = 0.460
- Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.552
- Average Precision (AP) @[ IoU=0.50 | area= large | maxDets=100 ] = 0.807
```---
## [Contact]
- Author: Jiho Park
- Email: [email protected]