Spaces:
Sleeping
Sleeping
updated models. Fix colors
Browse files- app.py +8 -0
- yolo-8m-dota.pt +2 -2
- yolo-8n-dota.pt +1 -1
- yolo-8s-dota.pt +2 -2
app.py
CHANGED
@@ -2,6 +2,7 @@ import os
|
|
2 |
import gradio as gr
|
3 |
from ultralytics import YOLO
|
4 |
import numpy as np
|
|
|
5 |
|
6 |
model_options = ["yolo-8n-dota.pt", "yolo-8s-dota.pt", "yolo-8m-dota.pt"]
|
7 |
model_names = ["Nano", "Small", "Medium"]
|
@@ -18,6 +19,12 @@ def process_image(input_image, model_name, conf):
|
|
18 |
if conf is None:
|
19 |
conf = 0.6
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
model_index = model_names.index(model_name)
|
22 |
model = models[model_index]
|
23 |
|
@@ -28,6 +35,7 @@ def process_image(input_image, model_name, conf):
|
|
28 |
for r in results:
|
29 |
im_array = r.plot()
|
30 |
im_array = im_array.astype(np.uint8)
|
|
|
31 |
|
32 |
if len(r.obb.cls) == 0: # If no objects are detected
|
33 |
return None, "No objects detected."
|
|
|
2 |
import gradio as gr
|
3 |
from ultralytics import YOLO
|
4 |
import numpy as np
|
5 |
+
import cv2
|
6 |
|
7 |
model_options = ["yolo-8n-dota.pt", "yolo-8s-dota.pt", "yolo-8m-dota.pt"]
|
8 |
model_names = ["Nano", "Small", "Medium"]
|
|
|
19 |
if conf is None:
|
20 |
conf = 0.6
|
21 |
|
22 |
+
orig_height, orig_width, _ = input_image.shape
|
23 |
+
print(input_image.shape)
|
24 |
+
|
25 |
+
input_image = cv2.cvtColor(input_image, cv2.COLOR_RGB2BGR)
|
26 |
+
cv2.imwrite('./res.jpg', input_image)
|
27 |
+
|
28 |
model_index = model_names.index(model_name)
|
29 |
model = models[model_index]
|
30 |
|
|
|
35 |
for r in results:
|
36 |
im_array = r.plot()
|
37 |
im_array = im_array.astype(np.uint8)
|
38 |
+
im_array = cv2.cvtColor(im_array, cv2.COLOR_BGR2RGB)
|
39 |
|
40 |
if len(r.obb.cls) == 0: # If no objects are detected
|
41 |
return None, "No objects detected."
|
yolo-8m-dota.pt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:19906b037246aa964742ec8560fc8c3e48b479542bcd37591e7a01a108d3ac09
|
3 |
+
size 53237418
|
yolo-8n-dota.pt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 6465538
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1918f8430c5918a7f866c9be5d6099bd3d2601f1d290fa4fe08096658b75bc84
|
3 |
size 6465538
|
yolo-8s-dota.pt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:999b8ff11aaffeffbb7e9a559802ed25f9c8d24c94d407b0adead1007175347e
|
3 |
+
size 23168706
|