Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
YOLO11 and RF-DETR-B added to YOLO-ARENA
Browse files- README.md +4 -3
- app.py +62 -71
- requirements.txt +3 -5
README.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1 |
---
|
2 |
title: YOLO ARENA
|
3 |
emoji: ๐๏ธ
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: YOLO ARENA
|
3 |
emoji: ๐๏ธ
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: pink
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 5.22.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
+
short_description: 'compare performance of top object detectors'
|
12 |
---
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
@@ -8,61 +8,25 @@ from inference import get_model
|
|
8 |
MARKDOWN = """
|
9 |
<h1 style='text-align: center'>YOLO-ARENA ๐๏ธ</h1>
|
10 |
|
11 |
-
Welcome to YOLO-Arena! This demo showcases the performance of
|
12 |
-
|
13 |
-
|
14 |
-
- **YOLOv8**
|
15 |
-
<div style="display: flex; align-items: center;">
|
16 |
-
<a href="https://github.com/ultralytics/ultralytics" style="margin-right: 10px;">
|
17 |
-
<img src="https://badges.aleen42.com/src/github.svg">
|
18 |
-
</a>
|
19 |
-
<a href="https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov8-object-detection-on-custom-dataset.ipynb" style="margin-right: 10px;">
|
20 |
-
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
21 |
-
</a>
|
22 |
-
</div>
|
23 |
-
|
24 |
-
- **YOLOv9**
|
25 |
-
<div style="display: flex; align-items: center;">
|
26 |
-
<a href="https://github.com/WongKinYiu/yolov9" style="margin-right: 10px;">
|
27 |
-
<img src="https://badges.aleen42.com/src/github.svg">
|
28 |
-
</a>
|
29 |
-
<a href="https://arxiv.org/abs/2402.13616" style="margin-right: 10px;">
|
30 |
-
<img src="https://img.shields.io/badge/arXiv-2402.13616-b31b1b.svg">
|
31 |
-
</a>
|
32 |
-
<a href="https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov9-object-detection-on-custom-dataset.ipynb" style="margin-right: 10px;">
|
33 |
-
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
34 |
-
</a>
|
35 |
-
</div>
|
36 |
-
|
37 |
-
- **YOLOv10**
|
38 |
-
<div style="display: flex; align-items: center;">
|
39 |
-
<a href="https://github.com/THU-MIG/yolov10" style="margin-right: 10px;">
|
40 |
-
<img src="https://badges.aleen42.com/src/github.svg">
|
41 |
-
</a>
|
42 |
-
<a href="https://arxiv.org/abs/2405.14458" style="margin-right: 10px;">
|
43 |
-
<img src="https://img.shields.io/badge/arXiv-2405.14458-b31b1b.svg">
|
44 |
-
</a>
|
45 |
-
<a href="https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/train-yolov10-object-detection-on-custom-dataset.ipynb" style="margin-right: 10px;">
|
46 |
-
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
47 |
-
</a>
|
48 |
-
</div>
|
49 |
-
|
50 |
-
Powered by Roboflow [Inference](https://github.com/roboflow/inference) and
|
51 |
-
[Supervision](https://github.com/roboflow/supervision). ๐ฅ
|
52 |
"""
|
53 |
|
54 |
IMAGE_EXAMPLES = [
|
55 |
-
['https://media.roboflow.com/supervision/image-examples/people-walking.png', 0.3, 0.3, 0.1],
|
56 |
-
['https://media.roboflow.com/supervision/image-examples/vehicles.png', 0.3, 0.3, 0.1],
|
57 |
-
['https://media.roboflow.com/supervision/image-examples/basketball-1.png', 0.3, 0.3, 0.1],
|
58 |
]
|
59 |
|
60 |
YOLO_V8_MODEL = get_model(model_id="coco/8")
|
61 |
YOLO_V9_MODEL = get_model(model_id="coco/17")
|
62 |
YOLO_V10_MODEL = get_model(model_id="coco/22")
|
|
|
|
|
63 |
|
64 |
-
LABEL_ANNOTATORS = sv.LabelAnnotator(text_color=sv.Color.
|
65 |
-
BOUNDING_BOX_ANNOTATORS = sv.
|
66 |
|
67 |
|
68 |
def detect_and_annotate(
|
@@ -105,19 +69,27 @@ def process_image(
|
|
105 |
yolo_v8_confidence_threshold: float,
|
106 |
yolo_v9_confidence_threshold: float,
|
107 |
yolo_v10_confidence_threshold: float,
|
|
|
|
|
108 |
iou_threshold: float
|
109 |
-
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
|
110 |
yolo_v8_annotated_image = detect_and_annotate(
|
111 |
YOLO_V8_MODEL, input_image, yolo_v8_confidence_threshold, iou_threshold)
|
112 |
yolo_v9_annotated_image = detect_and_annotate(
|
113 |
YOLO_V9_MODEL, input_image, yolo_v9_confidence_threshold, iou_threshold)
|
114 |
yolo_10_annotated_image = detect_and_annotate(
|
115 |
YOLO_V10_MODEL, input_image, yolo_v10_confidence_threshold, iou_threshold)
|
|
|
|
|
|
|
|
|
116 |
|
117 |
return (
|
118 |
yolo_v8_annotated_image,
|
119 |
yolo_v9_annotated_image,
|
120 |
-
yolo_10_annotated_image
|
|
|
|
|
121 |
)
|
122 |
|
123 |
|
@@ -127,12 +99,7 @@ yolo_v8_confidence_threshold_component = gr.Slider(
|
|
127 |
value=0.3,
|
128 |
step=0.01,
|
129 |
label="YOLOv8 Confidence Threshold",
|
130 |
-
|
131 |
-
"The confidence threshold for the YOLO model. Lower the threshold to "
|
132 |
-
"reduce false negatives, enhancing the model's sensitivity to detect "
|
133 |
-
"sought-after objects. Conversely, increase the threshold to minimize false "
|
134 |
-
"positives, preventing the model from identifying objects it shouldn't."
|
135 |
-
))
|
136 |
|
137 |
yolo_v9_confidence_threshold_component = gr.Slider(
|
138 |
minimum=0,
|
@@ -140,12 +107,7 @@ yolo_v9_confidence_threshold_component = gr.Slider(
|
|
140 |
value=0.3,
|
141 |
step=0.01,
|
142 |
label="YOLOv9 Confidence Threshold",
|
143 |
-
|
144 |
-
"The confidence threshold for the YOLO model. Lower the threshold to "
|
145 |
-
"reduce false negatives, enhancing the model's sensitivity to detect "
|
146 |
-
"sought-after objects. Conversely, increase the threshold to minimize false "
|
147 |
-
"positives, preventing the model from identifying objects it shouldn't."
|
148 |
-
))
|
149 |
|
150 |
yolo_v10_confidence_threshold_component = gr.Slider(
|
151 |
minimum=0,
|
@@ -153,12 +115,22 @@ yolo_v10_confidence_threshold_component = gr.Slider(
|
|
153 |
value=0.3,
|
154 |
step=0.01,
|
155 |
label="YOLOv10 Confidence Threshold",
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
iou_threshold_component = gr.Slider(
|
164 |
minimum=0,
|
@@ -179,10 +151,13 @@ with gr.Blocks() as demo:
|
|
179 |
gr.Markdown(MARKDOWN)
|
180 |
with gr.Accordion("Configuration", open=False):
|
181 |
with gr.Row():
|
|
|
182 |
yolo_v8_confidence_threshold_component.render()
|
183 |
yolo_v9_confidence_threshold_component.render()
|
|
|
184 |
yolo_v10_confidence_threshold_component.render()
|
185 |
-
|
|
|
186 |
with gr.Row():
|
187 |
input_image_component = gr.Image(
|
188 |
type='pil',
|
@@ -192,15 +167,23 @@ with gr.Blocks() as demo:
|
|
192 |
type='pil',
|
193 |
label='YOLOv8'
|
194 |
)
|
195 |
-
with gr.Row():
|
196 |
yolo_v9_output_image_component = gr.Image(
|
197 |
type='pil',
|
198 |
label='YOLOv9'
|
199 |
)
|
|
|
200 |
yolo_v10_output_image_component = gr.Image(
|
201 |
type='pil',
|
202 |
label='YOLOv10'
|
203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
submit_button_component = gr.Button(
|
205 |
value='Submit',
|
206 |
scale=1,
|
@@ -214,12 +197,16 @@ with gr.Blocks() as demo:
|
|
214 |
yolo_v8_confidence_threshold_component,
|
215 |
yolo_v9_confidence_threshold_component,
|
216 |
yolo_v10_confidence_threshold_component,
|
|
|
|
|
217 |
iou_threshold_component
|
218 |
],
|
219 |
outputs=[
|
220 |
yolo_v8_output_image_component,
|
221 |
yolo_v9_output_image_component,
|
222 |
-
yolo_v10_output_image_component
|
|
|
|
|
223 |
]
|
224 |
)
|
225 |
|
@@ -230,12 +217,16 @@ with gr.Blocks() as demo:
|
|
230 |
yolo_v8_confidence_threshold_component,
|
231 |
yolo_v9_confidence_threshold_component,
|
232 |
yolo_v10_confidence_threshold_component,
|
|
|
|
|
233 |
iou_threshold_component
|
234 |
],
|
235 |
outputs=[
|
236 |
yolo_v8_output_image_component,
|
237 |
yolo_v9_output_image_component,
|
238 |
-
yolo_v10_output_image_component
|
|
|
|
|
239 |
]
|
240 |
)
|
241 |
|
|
|
8 |
MARKDOWN = """
|
9 |
<h1 style='text-align: center'>YOLO-ARENA ๐๏ธ</h1>
|
10 |
|
11 |
+
Welcome to YOLO-Arena! This demo showcases the performance of top object detection models pre-trained on the COCO dataset.
|
12 |
+
|
13 |
+
Powered by [inference](https://github.com/roboflow/inference) and [supervision](https://github.com/roboflow/supervision). ๐
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
"""
|
15 |
|
16 |
IMAGE_EXAMPLES = [
|
17 |
+
['https://media.roboflow.com/supervision/image-examples/people-walking.png', 0.3, 0.3, 0.1, 0.3, 0.3],
|
18 |
+
['https://media.roboflow.com/supervision/image-examples/vehicles.png', 0.3, 0.3, 0.1, 0.3, 0.4],
|
19 |
+
['https://media.roboflow.com/supervision/image-examples/basketball-1.png', 0.3, 0.3, 0.1, 0.3, 0.4],
|
20 |
]
|
21 |
|
22 |
YOLO_V8_MODEL = get_model(model_id="coco/8")
|
23 |
YOLO_V9_MODEL = get_model(model_id="coco/17")
|
24 |
YOLO_V10_MODEL = get_model(model_id="coco/22")
|
25 |
+
YOLO11_MODEL = get_model(model_id="coco/27")
|
26 |
+
RF_DETR_MODEL = get_model(model_id="coco/36")
|
27 |
|
28 |
+
LABEL_ANNOTATORS = sv.LabelAnnotator(text_color=sv.Color.BLACK)
|
29 |
+
BOUNDING_BOX_ANNOTATORS = sv.BoxAnnotator()
|
30 |
|
31 |
|
32 |
def detect_and_annotate(
|
|
|
69 |
yolo_v8_confidence_threshold: float,
|
70 |
yolo_v9_confidence_threshold: float,
|
71 |
yolo_v10_confidence_threshold: float,
|
72 |
+
yolo11_confidence_threshold: float,
|
73 |
+
rf_detr_confidence_threshold: float,
|
74 |
iou_threshold: float
|
75 |
+
) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
|
76 |
yolo_v8_annotated_image = detect_and_annotate(
|
77 |
YOLO_V8_MODEL, input_image, yolo_v8_confidence_threshold, iou_threshold)
|
78 |
yolo_v9_annotated_image = detect_and_annotate(
|
79 |
YOLO_V9_MODEL, input_image, yolo_v9_confidence_threshold, iou_threshold)
|
80 |
yolo_10_annotated_image = detect_and_annotate(
|
81 |
YOLO_V10_MODEL, input_image, yolo_v10_confidence_threshold, iou_threshold)
|
82 |
+
yolo11_annotated_image = detect_and_annotate(
|
83 |
+
YOLO11_MODEL, input_image, yolo11_confidence_threshold, iou_threshold)
|
84 |
+
rf_detr_annotated_image = detect_and_annotate(
|
85 |
+
RF_DETR_MODEL, input_image, rf_detr_confidence_threshold, iou_threshold)
|
86 |
|
87 |
return (
|
88 |
yolo_v8_annotated_image,
|
89 |
yolo_v9_annotated_image,
|
90 |
+
yolo_10_annotated_image,
|
91 |
+
yolo11_annotated_image,
|
92 |
+
rf_detr_annotated_image
|
93 |
)
|
94 |
|
95 |
|
|
|
99 |
value=0.3,
|
100 |
step=0.01,
|
101 |
label="YOLOv8 Confidence Threshold",
|
102 |
+
)
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
yolo_v9_confidence_threshold_component = gr.Slider(
|
105 |
minimum=0,
|
|
|
107 |
value=0.3,
|
108 |
step=0.01,
|
109 |
label="YOLOv9 Confidence Threshold",
|
110 |
+
)
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
yolo_v10_confidence_threshold_component = gr.Slider(
|
113 |
minimum=0,
|
|
|
115 |
value=0.3,
|
116 |
step=0.01,
|
117 |
label="YOLOv10 Confidence Threshold",
|
118 |
+
)
|
119 |
+
|
120 |
+
yolo11_confidence_threshold_component = gr.Slider(
|
121 |
+
minimum=0,
|
122 |
+
maximum=1.0,
|
123 |
+
value=0.3,
|
124 |
+
step=0.01,
|
125 |
+
label="YOLO11 Confidence Threshold",
|
126 |
+
)
|
127 |
+
rf_detr_confidence_threshold_component = gr.Slider(
|
128 |
+
minimum=0,
|
129 |
+
maximum=1.0,
|
130 |
+
value=0.4,
|
131 |
+
step=0.01,
|
132 |
+
label="RF-DETR Confidence Threshold",
|
133 |
+
)
|
134 |
|
135 |
iou_threshold_component = gr.Slider(
|
136 |
minimum=0,
|
|
|
151 |
gr.Markdown(MARKDOWN)
|
152 |
with gr.Accordion("Configuration", open=False):
|
153 |
with gr.Row():
|
154 |
+
iou_threshold_component.render()
|
155 |
yolo_v8_confidence_threshold_component.render()
|
156 |
yolo_v9_confidence_threshold_component.render()
|
157 |
+
with gr.Row():
|
158 |
yolo_v10_confidence_threshold_component.render()
|
159 |
+
yolo11_confidence_threshold_component.render()
|
160 |
+
rf_detr_confidence_threshold_component.render()
|
161 |
with gr.Row():
|
162 |
input_image_component = gr.Image(
|
163 |
type='pil',
|
|
|
167 |
type='pil',
|
168 |
label='YOLOv8'
|
169 |
)
|
|
|
170 |
yolo_v9_output_image_component = gr.Image(
|
171 |
type='pil',
|
172 |
label='YOLOv9'
|
173 |
)
|
174 |
+
with gr.Row():
|
175 |
yolo_v10_output_image_component = gr.Image(
|
176 |
type='pil',
|
177 |
label='YOLOv10'
|
178 |
+
)
|
179 |
+
yolo11_output_image_component = gr.Image(
|
180 |
+
type='pil',
|
181 |
+
label='YOLO11'
|
182 |
+
)
|
183 |
+
rf_detr_output_image_component = gr.Image(
|
184 |
+
type='pil',
|
185 |
+
label='RF-DETR'
|
186 |
+
)
|
187 |
submit_button_component = gr.Button(
|
188 |
value='Submit',
|
189 |
scale=1,
|
|
|
197 |
yolo_v8_confidence_threshold_component,
|
198 |
yolo_v9_confidence_threshold_component,
|
199 |
yolo_v10_confidence_threshold_component,
|
200 |
+
yolo11_confidence_threshold_component,
|
201 |
+
rf_detr_confidence_threshold_component,
|
202 |
iou_threshold_component
|
203 |
],
|
204 |
outputs=[
|
205 |
yolo_v8_output_image_component,
|
206 |
yolo_v9_output_image_component,
|
207 |
+
yolo_v10_output_image_component,
|
208 |
+
yolo11_output_image_component,
|
209 |
+
rf_detr_output_image_component
|
210 |
]
|
211 |
)
|
212 |
|
|
|
217 |
yolo_v8_confidence_threshold_component,
|
218 |
yolo_v9_confidence_threshold_component,
|
219 |
yolo_v10_confidence_threshold_component,
|
220 |
+
yolo11_confidence_threshold_component,
|
221 |
+
rf_detr_confidence_threshold_component,
|
222 |
iou_threshold_component
|
223 |
],
|
224 |
outputs=[
|
225 |
yolo_v8_output_image_component,
|
226 |
yolo_v9_output_image_component,
|
227 |
+
yolo_v10_output_image_component,
|
228 |
+
yolo11_output_image_component,
|
229 |
+
rf_detr_output_image_component
|
230 |
]
|
231 |
)
|
232 |
|
requirements.txt
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
inference==0.11.2
|
5 |
-
supervision==0.20.0
|
|
|
1 |
+
gradio
|
2 |
+
inference
|
3 |
+
supervision
|
|
|
|