Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#20413 YOLOE: Fix visual prompt training

Merged
Ghost merged 1 commits into Ultralytics:main from ultralytics:yoloe-vp-fix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
  1. // Ultralytics ๐Ÿš€ AGPL-3.0 License - https://ultralytics.com/license
  2. // YOLO models chart ---------------------------------------------------------------------------------------------------
  3. const data = {
  4. // YOLO12: {
  5. // n: { speed: 1.64, mAP: 40.6 },
  6. // s: { speed: 2.61, mAP: 48.0 },
  7. // m: { speed: 4.86, mAP: 52.5 },
  8. // l: { speed: 6.77, mAP: 53.7 },
  9. // x: { speed: 11.79, mAP: 55.2 },
  10. // },
  11. YOLO11: {
  12. n: { speed: 1.5, mAP: 39.5 },
  13. s: { speed: 2.5, mAP: 47.0 },
  14. m: { speed: 4.7, mAP: 51.5 },
  15. l: { speed: 6.2, mAP: 53.4 },
  16. x: { speed: 11.3, mAP: 54.7 },
  17. },
  18. YOLOv10: {
  19. n: { speed: 1.56, mAP: 39.5 },
  20. s: { speed: 2.66, mAP: 46.7 },
  21. m: { speed: 5.48, mAP: 51.3 },
  22. b: { speed: 6.54, mAP: 52.7 },
  23. l: { speed: 8.33, mAP: 53.3 },
  24. x: { speed: 12.2, mAP: 54.4 },
  25. },
  26. YOLOv9: {
  27. t: { speed: 2.3, mAP: 38.3 },
  28. s: { speed: 3.54, mAP: 46.8 },
  29. m: { speed: 6.43, mAP: 51.4 },
  30. c: { speed: 7.16, mAP: 53.0 },
  31. e: { speed: 16.77, mAP: 55.6 },
  32. },
  33. YOLOv8: {
  34. n: { speed: 1.47, mAP: 37.3 },
  35. s: { speed: 2.66, mAP: 44.9 },
  36. m: { speed: 5.86, mAP: 50.2 },
  37. l: { speed: 9.06, mAP: 52.9 },
  38. x: { speed: 14.37, mAP: 53.9 },
  39. },
  40. YOLOv7: { l: { speed: 6.84, mAP: 51.4 }, x: { speed: 11.57, mAP: 53.1 } },
  41. "YOLOv6-3.0": {
  42. n: { speed: 1.17, mAP: 37.5 },
  43. s: { speed: 2.66, mAP: 45.0 },
  44. m: { speed: 5.28, mAP: 50.0 },
  45. l: { speed: 8.95, mAP: 52.8 },
  46. },
  47. YOLOv5: {
  48. n: { speed: 1.12, mAP: 28.0 },
  49. s: { speed: 1.92, mAP: 37.4 },
  50. m: { speed: 4.03, mAP: 45.4 },
  51. l: { speed: 6.61, mAP: 49.0 },
  52. x: { speed: 11.89, mAP: 50.7 },
  53. },
  54. "PP-YOLOE+": {
  55. t: { speed: 2.84, mAP: 39.9 },
  56. s: { speed: 2.62, mAP: 43.7 },
  57. m: { speed: 5.56, mAP: 49.8 },
  58. l: { speed: 8.36, mAP: 52.9 },
  59. x: { speed: 14.3, mAP: 54.7 },
  60. },
  61. "DAMO-YOLO": {
  62. t: { speed: 2.32, mAP: 42.0 },
  63. s: { speed: 3.45, mAP: 46.0 },
  64. m: { speed: 5.09, mAP: 49.2 },
  65. l: { speed: 7.18, mAP: 50.8 },
  66. },
  67. YOLOX: {
  68. s: { speed: 2.56, mAP: 40.5 },
  69. m: { speed: 5.43, mAP: 46.9 },
  70. l: { speed: 9.04, mAP: 49.7 },
  71. x: { speed: 16.1, mAP: 51.1 },
  72. },
  73. RTDETRv2: {
  74. s: { speed: 5.03, mAP: 48.1 },
  75. m: { speed: 7.51, mAP: 51.9 },
  76. l: { speed: 9.76, mAP: 53.4 },
  77. x: { speed: 15.03, mAP: 54.3 },
  78. },
  79. EfficientDet: {
  80. d0: { speed: 3.92, mAP: 34.6 },
  81. d1: { speed: 7.31, mAP: 40.5 },
  82. d2: { speed: 10.92, mAP: 43.0 },
  83. d3: { speed: 19.59, mAP: 47.5 },
  84. // d4: { speed: 33.55, mAP: 49.4 },
  85. // d5: { speed: 67.86, mAP: 50.7 },
  86. // d6: { speed: 89.29, mAP: 51.7 },
  87. // d7: { speed: 128.07, mAP: 53.7 },
  88. // d8: { speed: 157.57, mAP: 55.1 }
  89. },
  90. };
  91. let modelComparisonChart = null; // chart variable will hold the reference to the current chart instance.
  92. // Function to lighten a hex color by a specified amount.
  93. function lightenHexColor(color, amount = 0.5) {
  94. const r = parseInt(color.slice(1, 3), 16);
  95. const g = parseInt(color.slice(3, 5), 16);
  96. const b = parseInt(color.slice(5, 7), 16);
  97. const newR = Math.min(255, Math.round(r + (255 - r) * amount));
  98. const newG = Math.min(255, Math.round(g + (255 - g) * amount));
  99. const newB = Math.min(255, Math.round(b + (255 - b) * amount));
  100. return `#${newR.toString(16).padStart(2, "0")}${newG.toString(16).padStart(2, "0")}${newB.toString(16).padStart(2, "0")}`;
  101. }
  102. // Function to update the benchmarks chart.
  103. function updateChart(initialDatasets = []) {
  104. if (modelComparisonChart) {
  105. modelComparisonChart.destroy();
  106. } // If a chart instance already exists, destroy it.
  107. // Define a specific color map for models.
  108. const colorMap = {
  109. YOLO11: "#0b23a9",
  110. YOLOv10: "#ff7f0e",
  111. YOLOv9: "#2ca02c",
  112. YOLOv8: "#d62728",
  113. YOLOv7: "#9467bd",
  114. "YOLOv6-3.0": "#8c564b",
  115. YOLOv5: "#e377c2",
  116. "PP-YOLOE+": "#7f7f7f",
  117. "DAMO-YOLO": "#bcbd22",
  118. YOLOX: "#17becf",
  119. RTDETRv2: "#eccd22",
  120. EfficientDet: "#000000",
  121. };
  122. // Always include all models in the dataset creation
  123. const datasets = Object.keys(data).map((algorithm, i) => {
  124. const baseColor =
  125. colorMap[algorithm] || `hsl(${Math.random() * 360}, 70%, 50%)`;
  126. const lineColor =
  127. Object.keys(data).indexOf(algorithm) === 0
  128. ? baseColor
  129. : lightenHexColor(baseColor, 0.6);
  130. return {
  131. label: algorithm,
  132. data: Object.entries(data[algorithm]).map(([version, point]) => ({
  133. x: point.speed,
  134. y: point.mAP,
  135. version: version.toUpperCase(),
  136. })),
  137. fill: false,
  138. borderColor: lineColor,
  139. tension: 0.2,
  140. pointRadius: Object.keys(data).indexOf(algorithm) === 0 ? 7 : 4,
  141. pointHoverRadius: Object.keys(data).indexOf(algorithm) === 0 ? 9 : 6,
  142. pointBackgroundColor: lineColor,
  143. pointBorderColor: "#ffffff",
  144. borderWidth: i === 0 ? 3 : 1.5,
  145. hidden:
  146. initialDatasets.length > 0 && !initialDatasets.includes(algorithm),
  147. };
  148. });
  149. // Create a new chart instance.
  150. modelComparisonChart = new Chart(
  151. document.getElementById("modelComparisonChart").getContext("2d"),
  152. {
  153. type: "line",
  154. data: { datasets },
  155. options: {
  156. //aspectRatio: 2.5, // higher is wider
  157. plugins: {
  158. legend: {
  159. display: true,
  160. position: "right",
  161. align: "start", // start, end, center
  162. labels: { color: "#808080" },
  163. onClick: (e, legendItem, legend) => {
  164. const index = legendItem.datasetIndex;
  165. const ci = legend.chart;
  166. const meta = ci.getDatasetMeta(index);
  167. meta.hidden =
  168. meta.hidden === null ? !ci.data.datasets[index].hidden : null;
  169. ci.update();
  170. },
  171. }, // Configure the legend.
  172. tooltip: {
  173. callbacks: {
  174. label: (tooltipItem) => {
  175. const { dataset, dataIndex } = tooltipItem;
  176. const point = dataset.data[dataIndex];
  177. return `${dataset.label}${point.version.toLowerCase()}: Speed = ${point.x}ms/img, mAP50-95 = ${point.y}`; // Custom tooltip label.
  178. },
  179. },
  180. mode: "nearest",
  181. intersect: false,
  182. }, // Configure the tooltip.
  183. },
  184. interaction: { mode: "nearest", axis: "x", intersect: false }, // Configure the interaction mode.
  185. scales: {
  186. x: {
  187. type: "linear",
  188. position: "bottom",
  189. title: {
  190. display: true,
  191. text: "Latency T4 TensorRT10 FP16 (ms/img)",
  192. color: "#808080",
  193. },
  194. grid: { color: "#e0e0e0" },
  195. ticks: { color: "#808080" },
  196. min: 0,
  197. max: 18,
  198. },
  199. y: {
  200. title: { display: true, text: "COCO mAP 50-95", color: "#808080" },
  201. grid: { color: "#e0e0e0" },
  202. ticks: { color: "#808080" },
  203. min: 36,
  204. max: 56,
  205. },
  206. },
  207. },
  208. },
  209. );
  210. }
  211. function initChart(activeModels) {
  212. updateChart(activeModels);
  213. }
  214. document$.subscribe(function () {
  215. (function initializeApp() {
  216. if (typeof Chart !== "undefined") {
  217. // Get active models from page config or use default
  218. // e.g. <canvas id="modelComparisonChart" width="1024" height="400" active-models='["YOLOv5", "YOLOv8"]'></canvas>
  219. const pageConfig = document
  220. .getElementById("modelComparisonChart")
  221. .getAttribute("active-models");
  222. const activeModels = pageConfig ? JSON.parse(pageConfig) : [];
  223. initChart(activeModels);
  224. } else {
  225. setTimeout(initializeApp, 50); // Retry every 50 ms
  226. }
  227. })();
  228. });
Discard
Tip!

Press p or to see the previous file or, n or to see the next file