Spaces:
Runtime error
Runtime error
Commit
·
23abd94
1
Parent(s):
4eff630
Initial commit
Browse files
app.py
CHANGED
@@ -11,6 +11,7 @@ from utils.plots import plot_one_box
|
|
11 |
from utils.torch_utils import time_synchronized
|
12 |
import time
|
13 |
from ultralytics import YOLO
|
|
|
14 |
|
15 |
def letterbox(im, new_shape=(640, 640), color=(114, 114, 114), auto=True, scaleup=True, stride=32):
|
16 |
# Resize and pad image while meeting stride-multiple constraints
|
@@ -174,6 +175,9 @@ def inference2(video,model_link,iou_threshold,confidence_threshold):
|
|
174 |
return 'output.mp4',np.mean(fps_video)
|
175 |
|
176 |
|
|
|
|
|
|
|
177 |
|
178 |
examples_images = ['data/images/1.jpg',
|
179 |
'data/images/2.jpg',
|
@@ -218,8 +222,7 @@ with gr.Blocks() as demo:
|
|
218 |
video_button_detect.click(inference2, inputs=[video_input,video_drop,
|
219 |
video_iou_threshold,video_conf_threshold],
|
220 |
outputs=[video_output,fps_video])
|
221 |
-
video_button_track.click(
|
222 |
-
|
223 |
-
outputs=[video_output,fps_video])
|
224 |
|
225 |
demo.launch(debug=True,enable_queue=True)
|
|
|
11 |
from utils.torch_utils import time_synchronized
|
12 |
import time
|
13 |
from ultralytics import YOLO
|
14 |
+
import track.py
|
15 |
|
16 |
def letterbox(im, new_shape=(640, 640), color=(114, 114, 114), auto=True, scaleup=True, stride=32):
|
17 |
# Resize and pad image while meeting stride-multiple constraints
|
|
|
175 |
return 'output.mp4',np.mean(fps_video)
|
176 |
|
177 |
|
178 |
+
def MODT():
|
179 |
+
return track.MOT()
|
180 |
+
|
181 |
|
182 |
examples_images = ['data/images/1.jpg',
|
183 |
'data/images/2.jpg',
|
|
|
222 |
video_button_detect.click(inference2, inputs=[video_input,video_drop,
|
223 |
video_iou_threshold,video_conf_threshold],
|
224 |
outputs=[video_output,fps_video])
|
225 |
+
video_button_track.click(MODT,inputs=[],
|
226 |
+
outputs=[video_output])
|
|
|
227 |
|
228 |
demo.launch(debug=True,enable_queue=True)
|
track.py
CHANGED
@@ -370,7 +370,12 @@ def MOT():
|
|
370 |
save_dir = increment_path('runs/track/exp', exist_ok=False)
|
371 |
input = os.path.join(save_dir,'out.mp4')
|
372 |
tracking_method='strongsort'
|
373 |
-
outpath = 'output/' + tracking_method + '_output.mp4'
|
|
|
|
|
|
|
|
|
374 |
#!ffmpeg -i $input -vf fps=30 -vcodec libx264 $outpath tbd
|
|
|
375 |
|
376 |
|
|
|
370 |
save_dir = increment_path('runs/track/exp', exist_ok=False)
|
371 |
input = os.path.join(save_dir,'out.mp4')
|
372 |
tracking_method='strongsort'
|
373 |
+
#outpath = 'output/' + tracking_method + '_output.mp4'
|
374 |
+
outpath = 'output/'+ 'output.mp4'
|
375 |
+
command = f"ffmpeg -i {input} -vf fps=30 -vcodec libx264 {outpath}"
|
376 |
+
print(command)
|
377 |
+
os.system(command)
|
378 |
#!ffmpeg -i $input -vf fps=30 -vcodec libx264 $outpath tbd
|
379 |
+
return outpath
|
380 |
|
381 |
|