sunsmarterjieleaf commited on
Commit
54b0173
·
verified ·
1 Parent(s): d70ba99

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -134
README.md CHANGED
@@ -1,136 +1,12 @@
 
 
 
 
 
 
 
 
 
 
1
 
2
 
3
- <div align="center">
4
- <h1>YOLOv12</h1>
5
- <h3>YOLOv12: Attention-Centric Real-Time Object Detectors</h3>
6
-
7
- [Yunjie Tian](https://sunsmarterjie.github.io/)<sup>1</sup>, [Qixiang Ye](https://people.ucas.ac.cn/~qxye?language=en)<sup>2</sup>, [David Doermann](https://cse.buffalo.edu/~doermann/)<sup>1</sup>
8
-
9
- <sup>1</sup> University at Buffalo, SUNY, <sup>2</sup> University of Chinese Academy of Sciences.
10
-
11
-
12
- <p align="center">
13
- <img src="assets/tradeoff.svg" width=90%> <br>
14
- Comparison with popular methods in terms of latency-accuracy (left) and FLOPs-accuracy (right) trade-offs
15
- </p>
16
-
17
- </div>
18
-
19
- [![arXiv](https://img.shields.io/badge/arXiv-2502.12524-b31b1b.svg)](https://arxiv.org/abs/2502.12524)
20
-
21
- ## Updates
22
- - 2025/02/19: [arXiv version](https://arxiv.org/abs/2502.12524) is public.
23
-
24
-
25
- <details>
26
- <summary>
27
- <font size="+1">Abstract</font>
28
- </summary>
29
- Enhancing the network architecture of the YOLO framework has been crucial for a long time but has focused on CNN-based improvements despite the proven superiority of attention mechanisms in modeling capabilities. This is because attention-based models cannot match the speed of CNN-based models. This paper proposes an attention-centric YOLO framework, namely YOLOv12, that matches the speed of previous CNN-based ones while harnessing the performance benefits of attention mechanisms.
30
-
31
- YOLOv12 surpasses all popular real-time object detectors in accuracy with competitive speed. For example, YOLOv12-N achieves 40.6% mAP with an inference latency of 1.64 ms on a T4 GPU, outperforming advanced YOLOv10-N / YOLOv11-N by 2.1%/1.2% mAP with a comparable speed. This advantage extends to other model scales. YOLOv12 also surpasses end-to-end real-time detectors that improve DETR, such as RT-DETR / RT-DETRv2: YOLOv12-S beats RT-DETR-R18 / RT-DETRv2-R18 while running 42% faster, using only 36% of the computation and 45% of the parameters.
32
- </details>
33
-
34
-
35
- ## Main Results
36
- COCO
37
-
38
- | Model | size<br><sup>(pixels) | mAP<sup>val<br>50-95 | Speed<br><sup>T4 TensorRT10<br> | params<br><sup>(M) | FLOPs<br><sup>(G) |
39
- | :----------------------------------------------------------------------------------- | :-------------------: | :-------------------:| :------------------------------:| :-----------------:| :---------------:|
40
- | [YOLO12n](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12n.pt) | 640 | 40.6 | 1.64 | 2.6 | 6.5 |
41
- | [YOLO12s](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12s.pt) | 640 | 48.0 | 2.61 | 9.3 | 21.4 |
42
- | [YOLO12m](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12m.pt) | 640 | 52.5 | 4.86 | 20.2 | 67.5 |
43
- | [YOLO12l](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12l.pt) | 640 | 53.7 | 6.77 | 26.4 | 88.9 |
44
- | [YOLO12x](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12x.pt) | 640 | 55.2 | 11.79 | 59.1 | 199.0 |
45
-
46
- ## Installation
47
- ```
48
- wget https://github.com/Dao-AILab/flash-attention/releases/download/v2.7.3/flash_attn-2.7.3+cu11torch2.2cxx11abiFALSE-cp311-cp311-linux_x86_64.whl
49
- conda create -n yolov12 python=3.11
50
- conda activate yolov12
51
- pip install -r requirements.txt
52
- pip install -e .
53
- ```
54
-
55
- ## Validation
56
- [`yolov12n`](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12n.pt)
57
- [`yolov12s`](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12s.pt)
58
- [`yolov12m`](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12m.pt)
59
- [`yolov12l`](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12l.pt)
60
- [`yolov12x`](https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12x.pt)
61
-
62
- ```python
63
- from ultralytics import YOLO
64
-
65
- model = YOLO('yolov12{n/s/m/l/x}.pt')
66
- model.val(data='coco.yaml', save_json=True)
67
- ```
68
-
69
- ## Training
70
- ```python
71
- from ultralytics import YOLO
72
-
73
- model = YOLO('yolov12n.yaml')
74
-
75
- # Train the model
76
- results = model.train(
77
- data='coco.yaml',
78
- epochs=600,
79
- batch=256,
80
- imgsz=640,
81
- scale=0.5, # S:0.9; M:0.9; L:0.9; X:0.9
82
- mosaic=1.0,
83
- mixup=0.0, # S:0.05; M:0.15; L:0.15; X:0.2
84
- copy_paste=0.1, # S:0.15; M:0.4; L:0.5; X:0.6
85
- device="0,1,2,3",
86
- )
87
-
88
- # Evaluate model performance on the validation set
89
- metrics = model.val()
90
-
91
- # Perform object detection on an image
92
- results = model("path/to/image.jpg")
93
- results[0].show()
94
-
95
- ```
96
-
97
- ## Prediction
98
- ```python
99
- from ultralytics import YOLO
100
-
101
- model = YOLO('yolov12{n/s/m/l/x}.pt')
102
- model.predict()
103
- ```
104
-
105
- ## Export
106
- ```python
107
- from ultralytics import YOLO
108
-
109
- model = YOLO('yolov12{n/s/m/l/x}.pt')
110
- model.export(format="engine", half=True) # or format="onnx"
111
- ```
112
-
113
-
114
- ## Demo
115
-
116
- ```
117
- python app.py
118
- # Please visit http://127.0.0.1:7860
119
- ```
120
-
121
-
122
- ## Acknowledgement
123
-
124
- The code is based on [ultralytics](https://github.com/ultralytics/ultralytics). Thanks for their excellent work!
125
-
126
- ## Citation
127
-
128
- ```BibTeX
129
- @article{tian2025yolov12,
130
- title={YOLOv12: Attention-Centric Real-Time Object Detectors},
131
- author={Tian, Yunjie and Ye, Qixiang and Doermann, David},
132
- journal={arXiv preprint arXiv:2502.12524},
133
- year={2025}
134
- }
135
- ```
136
-
 
1
+ ---
2
+ title: YOLOv12 Demo
3
+ emoji: 🚀
4
+ colorFrom: indigo
5
+ colorTo: blue
6
+ sdk: gradio # 或者 streamlit
7
+ sdk_version: "4.44.1" # 这里可以指定 Gradio/Streamlit 版本
8
+ app_file: app.py # 确保这个文件是你的 Gradio/Streamlit 入口文件
9
+ pinned: false
10
+ ---
11
 
12