Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
Model | Test Size | AP50test | batch 1 fps | batch 32 average time |
---|---|---|---|---|
YOLOv7-Tiny | 640 | 98.7% | 417 fps | 2.4 ms |
Docker environment (recommended)
Expand
# create the docker container, you can change the share memory size if you have more.
nvidia-docker run --name yolov7 -it -v your_coco_path/:/coco/ -v your_code_path/:/yolov7 --shm-size=64g nvcr.io/nvidia/pytorch:21.08-py3
# apt install required packages
apt update
apt install -y zip htop screen libgl1-mesa-glx
# pip install required packages
pip install seaborn thop
# go to code folder
cd /yolov7
python test.py --data data/builder.yaml --img 640 --batch 32 --conf 0.001 --iou 0.5 --device 0 --weights yolov7-tiny-builder.pt --name yolov7_tiny_builder_val
You will get the results:
Class Images Labels P R [email protected] [email protected]:.95
all 200 1376 0.985 0.969 0.987 0.679
vest 200 486 0.98 0.986 0.997 0.707
helmet 200 404 0.992 0.928 0.968 0.573
person 200 486 0.984 0.994 0.997 0.757
On image:
python detect.py --weights yolov7-tiny-builder.pt --conf 0.25 --img-size 640 --source inference/images/builder/1779.jpg
PR curve:
Losses and mAP:
Confusion matrix:
Data preparation
bash scripts/get_dataset.sh
- Download dataset and pretrained yolov7-tiny.pt
Single GPU training
# train tiny model
python train.py --epochs 100 --workers 4 --device 0 --batch-size 32 --data data/builder.yaml --img 640 640 --cfg cfg/training/yolov7-tiny-builder.yaml --weights 'yolov7-tiny.pt' --name yolov7_tiny_builder --hyp data/hyp.scratch.tiny.yaml
@article{wang2022yolov7,
title={{YOLOv7}: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors},
author={Wang, Chien-Yao and Bochkovskiy, Alexey and Liao, Hong-Yuan Mark},
journal={arXiv preprint arXiv:2207.02696},
year={2022}
}
Expand
- https://github.com/AlexeyAB/darknet
- https://github.com/WongKinYiu/yolor
- https://github.com/WongKinYiu/PyTorch_YOLOv4
- https://github.com/WongKinYiu/ScaledYOLOv4
- https://github.com/Megvii-BaseDetection/YOLOX
- https://github.com/ultralytics/yolov3
- https://github.com/ultralytics/yolov5
- https://github.com/DingXiaoH/RepVGG
- https://github.com/JUGGHM/OREPA_CVPR2022
- https://github.com/TexasInstruments/edgeai-yolov5/tree/yolo-pose