Testing
Browse files- app.py +70 -39
- requirements.txt +1 -1
app.py
CHANGED
@@ -6,11 +6,42 @@ import supervision as sv
|
|
6 |
from inference import get_model
|
7 |
|
8 |
MARKDOWN = """
|
9 |
-
<h1 style='text-align: center'>
|
10 |
-
Welcome to
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
Powered by Roboflow [Inference](https://github.com/roboflow/inference) and
|
15 |
[Supervision](https://github.com/roboflow/supervision). 🔥
|
16 |
"""
|
@@ -21,9 +52,9 @@ IMAGE_EXAMPLES = [
|
|
21 |
['https://media.roboflow.com/supervision/image-examples/basketball-1.png', 0.3, 0.3, 0.1],
|
22 |
]
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
LABEL_ANNOTATORS = sv.LabelAnnotator(text_color=sv.Color.black())
|
29 |
BOUNDING_BOX_ANNOTATORS = sv.BoundingBoxAnnotator()
|
@@ -72,11 +103,11 @@ def process_image(
|
|
72 |
iou_threshold: float
|
73 |
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
|
74 |
yolo_v8_annotated_image = detect_and_annotate(
|
75 |
-
|
76 |
yolo_v9_annotated_image = detect_and_annotate(
|
77 |
-
|
78 |
yolo_10_annotated_image = detect_and_annotate(
|
79 |
-
|
80 |
|
81 |
return (
|
82 |
yolo_v8_annotated_image,
|
@@ -85,12 +116,12 @@ def process_image(
|
|
85 |
)
|
86 |
|
87 |
|
88 |
-
|
89 |
minimum=0,
|
90 |
maximum=1.0,
|
91 |
value=0.3,
|
92 |
step=0.01,
|
93 |
-
label="
|
94 |
info=(
|
95 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
96 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
@@ -98,12 +129,12 @@ yolo_v8N_confidence_threshold_component = gr.Slider(
|
|
98 |
"positives, preventing the model from identifying objects it shouldn't."
|
99 |
))
|
100 |
|
101 |
-
|
102 |
minimum=0,
|
103 |
maximum=1.0,
|
104 |
value=0.3,
|
105 |
step=0.01,
|
106 |
-
label="
|
107 |
info=(
|
108 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
109 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
@@ -111,12 +142,12 @@ yolo_v8S_confidence_threshold_component = gr.Slider(
|
|
111 |
"positives, preventing the model from identifying objects it shouldn't."
|
112 |
))
|
113 |
|
114 |
-
|
115 |
minimum=0,
|
116 |
maximum=1.0,
|
117 |
value=0.3,
|
118 |
step=0.01,
|
119 |
-
label="
|
120 |
info=(
|
121 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
122 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
@@ -143,27 +174,27 @@ with gr.Blocks() as demo:
|
|
143 |
gr.Markdown(MARKDOWN)
|
144 |
with gr.Accordion("Configuration", open=False):
|
145 |
with gr.Row():
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
iou_threshold_component.render()
|
150 |
with gr.Row():
|
151 |
input_image_component = gr.Image(
|
152 |
type='pil',
|
153 |
label='Input'
|
154 |
)
|
155 |
-
|
156 |
type='pil',
|
157 |
-
label='
|
158 |
)
|
159 |
with gr.Row():
|
160 |
-
|
161 |
type='pil',
|
162 |
-
label='
|
163 |
)
|
164 |
-
|
165 |
type='pil',
|
166 |
-
label='
|
167 |
)
|
168 |
submit_button_component = gr.Button(
|
169 |
value='Submit',
|
@@ -175,15 +206,15 @@ with gr.Blocks() as demo:
|
|
175 |
examples=IMAGE_EXAMPLES,
|
176 |
inputs=[
|
177 |
input_image_component,
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
iou_threshold_component
|
182 |
],
|
183 |
outputs=[
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
]
|
188 |
)
|
189 |
|
@@ -191,16 +222,16 @@ with gr.Blocks() as demo:
|
|
191 |
fn=process_image,
|
192 |
inputs=[
|
193 |
input_image_component,
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
iou_threshold_component
|
198 |
],
|
199 |
outputs=[
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
]
|
204 |
)
|
205 |
|
206 |
-
demo.launch(debug=False, show_error=True, max_threads=1)
|
|
|
6 |
from inference import get_model
|
7 |
|
8 |
MARKDOWN = """
|
9 |
+
<h1 style='text-align: center'>YOLO-ARENA 🏟️</h1>
|
10 |
+
Welcome to YOLO-Arena! This demo showcases the performance of various YOLO models
|
11 |
+
pre-trained on the COCO dataset.
|
12 |
+
- **YOLOv8**
|
13 |
+
<div style="display: flex; align-items: center;">
|
14 |
+
<a href="https://github.com/ultralytics/ultralytics" style="margin-right: 10px;">
|
15 |
+
<img src="https://badges.aleen42.com/src/github.svg">
|
16 |
+
</a>
|
17 |
+
<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;">
|
18 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
19 |
+
</a>
|
20 |
+
</div>
|
21 |
+
- **YOLOv9**
|
22 |
+
<div style="display: flex; align-items: center;">
|
23 |
+
<a href="https://github.com/WongKinYiu/yolov9" style="margin-right: 10px;">
|
24 |
+
<img src="https://badges.aleen42.com/src/github.svg">
|
25 |
+
</a>
|
26 |
+
<a href="https://arxiv.org/abs/2402.13616" style="margin-right: 10px;">
|
27 |
+
<img src="https://img.shields.io/badge/arXiv-2402.13616-b31b1b.svg">
|
28 |
+
</a>
|
29 |
+
<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;">
|
30 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
31 |
+
</a>
|
32 |
+
</div>
|
33 |
+
- **YOLOv10**
|
34 |
+
<div style="display: flex; align-items: center;">
|
35 |
+
<a href="https://github.com/THU-MIG/yolov10" style="margin-right: 10px;">
|
36 |
+
<img src="https://badges.aleen42.com/src/github.svg">
|
37 |
+
</a>
|
38 |
+
<a href="https://arxiv.org/abs/2405.14458" style="margin-right: 10px;">
|
39 |
+
<img src="https://img.shields.io/badge/arXiv-2405.14458-b31b1b.svg">
|
40 |
+
</a>
|
41 |
+
<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;">
|
42 |
+
<img src="https://colab.research.google.com/assets/colab-badge.svg">
|
43 |
+
</a>
|
44 |
+
</div>
|
45 |
Powered by Roboflow [Inference](https://github.com/roboflow/inference) and
|
46 |
[Supervision](https://github.com/roboflow/supervision). 🔥
|
47 |
"""
|
|
|
52 |
['https://media.roboflow.com/supervision/image-examples/basketball-1.png', 0.3, 0.3, 0.1],
|
53 |
]
|
54 |
|
55 |
+
YOLO_V8_MODEL = get_model(model_id="coco/8")
|
56 |
+
YOLO_V9_MODEL = get_model(model_id="coco/17")
|
57 |
+
YOLO_V10_MODEL = get_model(model_id="coco/22")
|
58 |
|
59 |
LABEL_ANNOTATORS = sv.LabelAnnotator(text_color=sv.Color.black())
|
60 |
BOUNDING_BOX_ANNOTATORS = sv.BoundingBoxAnnotator()
|
|
|
103 |
iou_threshold: float
|
104 |
) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
|
105 |
yolo_v8_annotated_image = detect_and_annotate(
|
106 |
+
YOLO_V8_MODEL, input_image, yolo_v8_confidence_threshold, iou_threshold)
|
107 |
yolo_v9_annotated_image = detect_and_annotate(
|
108 |
+
YOLO_V9_MODEL, input_image, yolo_v9_confidence_threshold, iou_threshold)
|
109 |
yolo_10_annotated_image = detect_and_annotate(
|
110 |
+
YOLO_V10_MODEL, input_image, yolo_v10_confidence_threshold, iou_threshold)
|
111 |
|
112 |
return (
|
113 |
yolo_v8_annotated_image,
|
|
|
116 |
)
|
117 |
|
118 |
|
119 |
+
yolo_v8_confidence_threshold_component = gr.Slider(
|
120 |
minimum=0,
|
121 |
maximum=1.0,
|
122 |
value=0.3,
|
123 |
step=0.01,
|
124 |
+
label="YOLOv8 Confidence Threshold",
|
125 |
info=(
|
126 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
127 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
|
|
129 |
"positives, preventing the model from identifying objects it shouldn't."
|
130 |
))
|
131 |
|
132 |
+
yolo_v9_confidence_threshold_component = gr.Slider(
|
133 |
minimum=0,
|
134 |
maximum=1.0,
|
135 |
value=0.3,
|
136 |
step=0.01,
|
137 |
+
label="YOLOv9 Confidence Threshold",
|
138 |
info=(
|
139 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
140 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
|
|
142 |
"positives, preventing the model from identifying objects it shouldn't."
|
143 |
))
|
144 |
|
145 |
+
yolo_v10_confidence_threshold_component = gr.Slider(
|
146 |
minimum=0,
|
147 |
maximum=1.0,
|
148 |
value=0.3,
|
149 |
step=0.01,
|
150 |
+
label="YOLOv10 Confidence Threshold",
|
151 |
info=(
|
152 |
"The confidence threshold for the YOLO model. Lower the threshold to "
|
153 |
"reduce false negatives, enhancing the model's sensitivity to detect "
|
|
|
174 |
gr.Markdown(MARKDOWN)
|
175 |
with gr.Accordion("Configuration", open=False):
|
176 |
with gr.Row():
|
177 |
+
yolo_v8_confidence_threshold_component.render()
|
178 |
+
yolo_v9_confidence_threshold_component.render()
|
179 |
+
yolo_v10_confidence_threshold_component.render()
|
180 |
iou_threshold_component.render()
|
181 |
with gr.Row():
|
182 |
input_image_component = gr.Image(
|
183 |
type='pil',
|
184 |
label='Input'
|
185 |
)
|
186 |
+
yolo_v8_output_image_component = gr.Image(
|
187 |
type='pil',
|
188 |
+
label='YOLOv8'
|
189 |
)
|
190 |
with gr.Row():
|
191 |
+
yolo_v9_output_image_component = gr.Image(
|
192 |
type='pil',
|
193 |
+
label='YOLOv9'
|
194 |
)
|
195 |
+
yolo_v10_output_image_component = gr.Image(
|
196 |
type='pil',
|
197 |
+
label='YOLOv10'
|
198 |
)
|
199 |
submit_button_component = gr.Button(
|
200 |
value='Submit',
|
|
|
206 |
examples=IMAGE_EXAMPLES,
|
207 |
inputs=[
|
208 |
input_image_component,
|
209 |
+
yolo_v8_confidence_threshold_component,
|
210 |
+
yolo_v9_confidence_threshold_component,
|
211 |
+
yolo_v10_confidence_threshold_component,
|
212 |
iou_threshold_component
|
213 |
],
|
214 |
outputs=[
|
215 |
+
yolo_v8_output_image_component,
|
216 |
+
yolo_v9_output_image_component,
|
217 |
+
yolo_v10_output_image_component
|
218 |
]
|
219 |
)
|
220 |
|
|
|
222 |
fn=process_image,
|
223 |
inputs=[
|
224 |
input_image_component,
|
225 |
+
yolo_v8_confidence_threshold_component,
|
226 |
+
yolo_v9_confidence_threshold_component,
|
227 |
+
yolo_v10_confidence_threshold_component,
|
228 |
iou_threshold_component
|
229 |
],
|
230 |
outputs=[
|
231 |
+
yolo_v8_output_image_component,
|
232 |
+
yolo_v9_output_image_component,
|
233 |
+
yolo_v10_output_image_component
|
234 |
]
|
235 |
)
|
236 |
|
237 |
+
demo.launch(debug=False, show_error=True, max_threads=1)
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
setuptools<70.0.0
|
2 |
awscli==1.29.54
|
3 |
gradio==4.19.2
|
4 |
-
inference==0.
|
5 |
supervision==0.20.0
|
|
|
1 |
setuptools<70.0.0
|
2 |
awscli==1.29.54
|
3 |
gradio==4.19.2
|
4 |
+
inference==0.13.0
|
5 |
supervision==0.20.0
|