zjykzj / YOLOv4

YOLOv4: Optimal Speed and Accuracy of Object Detection

Home Page:https://arxiv.org/abs/2004.10934

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language: 🇺🇸 🇨🇳

«YOLOv4» reimplemented the paper "YOLOv4: Optimal Speed and Accuracy of Object Detection"

dataset COCO AP[IoU=0.50:0.95], inference COCO AP[IoU=0.50], inference Input Size Conf Thre NMS Thre
DarkNet (YOLOv4 paper) coco val2017 0.471 0.710 416x416 / /
Pytorch (TianXiaomo) coco val2017 0.466 0.704 416x416 / /
Pytorch (This) coco val2017 0.35925 0.59468 608x608 0.0001 0.4

Table of Contents

Background

The purpose of creating this warehouse is to better understand the YOLO series object detection network. Note: The realization of the project depends heavily on the implementation of Tianxiaomo/pytorch-YOLOv4 and zjykzj/YOLOv3

Installation

Development environment (Use nvidia docker container)

docker run --gpus all -it --rm -v </path/to/YOLOv4>:/app/YOLOv4 -v </path/to/COCO>:/app/YOLOv4/COCO nvcr.io/nvidia/pytorch:22.08-py3

Usage

Train

  • One GPU
CUDA_VISIBLE_DEVICES=0 python main_amp.py -c config/yolov4_default.cfg --opt-level=O0 COCO
  • Multi GPU
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port "32111" main_amp.py -c config/yolov4_Tianxiaomo.cfg --opt-level=O0 COCO

Test

python val.py --cfg config/yolov4_Tianxiaomo.cfg --checkpoint outputs/yolov4_Tianxiaomo/model_best.pth.tar --conf-thre 0.0001 COCO
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.35925
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.59468
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.37727
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.20224
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.41769
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.46202
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.29350
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.48046
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.52313
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.40198
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.58462
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.62250

Detect

python detect.py --cfg=config/yolov4_Tianxiaomo.cfg --ckpt=outputs/yolov4_Tianxiaomo_v2/model_best.pth.tar --source=./data/images/ --conf-thre=0.2 --nms-thre=0.5

Maintainers

  • zhujian - Initial work - zjykzj

Thanks

Contributing

Anyone's participation is welcome! Open an issue or submit PRs.

Small note:

License

Apache License 2.0 © 2023 zjykzj

About

YOLOv4: Optimal Speed and Accuracy of Object Detection

https://arxiv.org/abs/2004.10934

License:Apache License 2.0


Languages

Language:Python 100.0%