Spaces:
Runtime error
Runtime error
Commit
·
64b1104
1
Parent(s):
1a54db0
updated app.py for tracking
Browse files
app.py
CHANGED
@@ -138,7 +138,7 @@ def inference(img,model_link,iou_threshold,confidence_threshold):
|
|
138 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
139 |
# Load model
|
140 |
model_path = 'weights/'+str(model_link)+'.pt'
|
141 |
-
if model_link== '
|
142 |
model = YOLO(model_path)
|
143 |
return detectv8(img,model,device,iou_threshold,confidence_threshold)
|
144 |
else:
|
@@ -175,8 +175,9 @@ def inference2(video,model_link,iou_threshold,confidence_threshold):
|
|
175 |
return 'output.mp4',np.mean(fps_video)
|
176 |
|
177 |
|
178 |
-
def MODT():
|
179 |
-
|
|
|
180 |
|
181 |
|
182 |
examples_images = ['data/images/1.jpg',
|
@@ -222,7 +223,7 @@ with gr.Blocks() as demo:
|
|
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)
|
|
|
138 |
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
139 |
# Load model
|
140 |
model_path = 'weights/'+str(model_link)+'.pt'
|
141 |
+
if model_link== '.':
|
142 |
model = YOLO(model_path)
|
143 |
return detectv8(img,model,device,iou_threshold,confidence_threshold)
|
144 |
else:
|
|
|
175 |
return 'output.mp4',np.mean(fps_video)
|
176 |
|
177 |
|
178 |
+
def MODT(sourceVideo, model_link, trackingmethod):
|
179 |
+
model_path = 'weights/'+str(model_link)+'.pt'
|
180 |
+
return track.MOT(model_path, trackingmethod, sourceVideo)
|
181 |
|
182 |
|
183 |
examples_images = ['data/images/1.jpg',
|
|
|
223 |
video_button_detect.click(inference2, inputs=[video_input,video_drop,
|
224 |
video_iou_threshold,video_conf_threshold],
|
225 |
outputs=[video_output,fps_video])
|
226 |
+
video_button_track.click(MODT,inputs=[video_input,video_drop, 'strongsort'],
|
227 |
+
outputs=[video_output, fps_video])
|
228 |
+
,
|
229 |
demo.launch(debug=True,enable_queue=True)
|