Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,16 @@ import os
|
|
2 |
os.system("pip3 install cython_bbox gdown 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'")
|
3 |
from torchyolo import YoloHub
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
"""
|
7 |
Paper Implementation
|
8 |
#"kadirnar/OcSort"
|
9 |
#"kadirnar/SORT"
|
10 |
#"kadirnar/ByteTracker"
|
|
|
|
|
|
|
11 |
"""
|
12 |
|
13 |
def object_tracker(
|
@@ -16,6 +20,7 @@ def object_tracker(
|
|
16 |
model_path: str,
|
17 |
tracker_type: str,
|
18 |
tracker_config_path: str,
|
|
|
19 |
):
|
20 |
model = YoloHub(
|
21 |
config_path="default_config.yaml",
|
@@ -23,11 +28,16 @@ def object_tracker(
|
|
23 |
model_path=model_path,
|
24 |
)
|
25 |
|
|
|
|
|
|
|
26 |
model.predict(
|
27 |
source=source,
|
28 |
tracker_type=tracker_type,
|
|
|
29 |
tracker_config_path=tracker_config_path,
|
30 |
)
|
|
|
31 |
return 'output.mp4'
|
32 |
|
33 |
|
@@ -63,6 +73,15 @@ inputs = [
|
|
63 |
],
|
64 |
default="tracker/norfair_track.yaml",
|
65 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
]
|
67 |
examples = [
|
68 |
[
|
|
|
2 |
os.system("pip3 install cython_bbox gdown 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'")
|
3 |
from torchyolo import YoloHub
|
4 |
import gradio as gr
|
5 |
+
from utils import attempt_download_from_hub
|
6 |
|
7 |
"""
|
8 |
Paper Implementation
|
9 |
#"kadirnar/OcSort"
|
10 |
#"kadirnar/SORT"
|
11 |
#"kadirnar/ByteTracker"
|
12 |
+
#"kadirnar/strongsort"
|
13 |
+
|
14 |
+
|
15 |
"""
|
16 |
|
17 |
def object_tracker(
|
|
|
20 |
model_path: str,
|
21 |
tracker_type: str,
|
22 |
tracker_config_path: str,
|
23 |
+
StrongSort_OsNet_Path: str = None,
|
24 |
):
|
25 |
model = YoloHub(
|
26 |
config_path="default_config.yaml",
|
|
|
28 |
model_path=model_path,
|
29 |
)
|
30 |
|
31 |
+
if tracker_type == "STRONGSORT":
|
32 |
+
StrongSort_OsNet_Path = attempt_download_from_hub(StrongSort_OsNet_Path)
|
33 |
+
|
34 |
model.predict(
|
35 |
source=source,
|
36 |
tracker_type=tracker_type,
|
37 |
+
tracker_weight_path=StrongSort_OsNet_Path,
|
38 |
tracker_config_path=tracker_config_path,
|
39 |
)
|
40 |
+
|
41 |
return 'output.mp4'
|
42 |
|
43 |
|
|
|
73 |
],
|
74 |
default="tracker/norfair_track.yaml",
|
75 |
),
|
76 |
+
gr.inputs.Dropdown(
|
77 |
+
label="Tracker Weight Path",
|
78 |
+
choices=[
|
79 |
+
"kadirnar/osnet_x0_5_imagenet",
|
80 |
+
"kadirnar/osnet_x1_0_imagenet",
|
81 |
+
"kadirnar/osnet_x0_25_imagenet"
|
82 |
+
],
|
83 |
+
default="kadirnar/osnet_x0_5_imagenet",
|
84 |
+
),
|
85 |
]
|
86 |
examples = [
|
87 |
[
|