zjykzj / YOLOv5

A Tiny Version of the Original ultralytics/yolov5

Home Page:https://docs.ultralytics.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language: 🇺🇸 🇨🇳

«YOLOv5» implements a tiny version of the original ultralytics/yolov5

Table of Contents

Background

ultralytics/yolov5 provides a perfect object detection implementation, including the advanced yolov5 model and loss function, as well as perfect logging and debugging functions. For beginners, training, testing, and deployment of object detection tasks can be completed through documentation, and even ultralytics/yolov5 provides SOP for classification and segmentation tasks.

This repository aims to implement a simplified version of YOLOv5, simplifying the internal implementation of the original YOLOv5 repository as much as possible, and removing features and code that I currently do not need. For example, I will remove the implementation code for video files and cache files in the data module, and only retain the onnxruntime/opencv implementation in the deployment module, and so on.

Note1: The implementation of yolov5 for this warehouse is referenced from v7.0 - YOLOv5 SOTA Realtime Instance Segmentation.

Note2: The configuration of this warehouse is completely based on the original implementation of YOLOv5, divided into configs/data/*.yaml, configs/hyps/*.yaml, configs/models/*.yaml.

Usage

Train

  • Detect
python -m torch.distributed.run --nproc_per_node 4 --master_port 53122 train.py --data coco.yaml --weights "" --cfg yolov5s.yaml --img 640 --device 0,1,2,3
  • Classify
python -m torch.distributed.run --nproc_per_node 4 --master_port 25123 classify/train.py --model yolov5s-cls.pt --data imagenet --img 224 --epochs 90 --device 0,1,2,3

Eval

  • Detect
python val.py --weights yolov5s.pt --data coco.yaml --img 640
python val.py --weights yolov5s_voc.pt --data VOC.yaml --img 640
Model size
(pixels)
dataset
mAPval
50-95
mAPval
50
Speed
PyTorch RTX3090
(ms)
params
(M)
FLOPs
@640 (B)
YOLOv5x 640 COCO 48.1 66.7 19.7 86.71 205.5
YOLOv5l 640 COCO 46.2 65.2 11.7 46.53 109.0
YOLOv5m 640 COCO 42.9 62.1 5.0 21.17 48.9
YOLOv5s 640 COCO 34.7 53.8 3.6 7.23 16.4
YOLOv5n 640 COCO 24.4 41.3 3.5 1.87 4.5
YOLOv3 640 COCO 43.6 63.7 8.0 61.92 155.9
YOLOv5s 640 VOC 46.8 73.8 2.3 7.06 15.9
YOLOv3 640 VOC 56.9 81.9 7.1 61.60 154.9
YOLOv3-Tiny 640 VOC 25.3 54.2 1.9 8.71 13.0
  • Classify
python classify/val.py --weights yolov5s-cls.pt --data ../datasets/imagenet --img 224
Model size
(pixels)
acc
top1
acc
top5
Training
90 epochs
4xRTX3090 (hours)
Speed
PyTorch RTX3090
(ms)
params
(M)
FLOPs
@224 (B)
YOLOv5s-cls 224 64.9 86.0 38.831 0.3 6.45 11.4
YOLOv3-cls 224 68.3 88.2 56.517 1.0 16.81 98.6
ResNet50 224 69.3 88.2 94.422 0.4 25.6 8.5
EfficientNet_b0 224 71.0 90.2 77.515 0.5 5.3 1.0

Predict

python detect.py --weights yolov5n.pt --source assets/coco/

python classify/predict.py --weights yolov5s-cls.pt --source assets/imagenet-val/ --imgsz 224

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

A Tiny Version of the Original ultralytics/yolov5

https://docs.ultralytics.com

License:Apache License 2.0


Languages

Language:Python 98.9%Language:Shell 0.7%Language:Dockerfile 0.4%