Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
a6436e2
1
Parent(s):
850b849
Update app
Browse files
preprocess/inference_preprocess.py
CHANGED
@@ -166,11 +166,13 @@ def inference_video(opt, padding=0):
|
|
166 |
videofile = os.path.join(opt.avi_dir, 'video.avi')
|
167 |
vidObj = cv2.VideoCapture(videofile)
|
168 |
yolo_model = YOLO("yolov9t.pt")
|
169 |
-
|
170 |
dets = []
|
171 |
fidx = 0
|
|
|
|
|
172 |
print("Detecting people in the video using YOLO (slowest step in the pipeline)...")
|
173 |
def generate_detections():
|
|
|
174 |
while True:
|
175 |
success, image = vidObj.read()
|
176 |
if not success:
|
@@ -197,6 +199,8 @@ def inference_video(opt, padding=0):
|
|
197 |
fidx += 1
|
198 |
yield
|
199 |
|
|
|
|
|
200 |
for _ in tqdm(generate_detections()):
|
201 |
pass
|
202 |
|
|
|
166 |
videofile = os.path.join(opt.avi_dir, 'video.avi')
|
167 |
vidObj = cv2.VideoCapture(videofile)
|
168 |
yolo_model = YOLO("yolov9t.pt")
|
|
|
169 |
dets = []
|
170 |
fidx = 0
|
171 |
+
global dets, fidx
|
172 |
+
|
173 |
print("Detecting people in the video using YOLO (slowest step in the pipeline)...")
|
174 |
def generate_detections():
|
175 |
+
global dets, fidx
|
176 |
while True:
|
177 |
success, image = vidObj.read()
|
178 |
if not success:
|
|
|
199 |
fidx += 1
|
200 |
yield
|
201 |
|
202 |
+
return dets
|
203 |
+
|
204 |
for _ in tqdm(generate_detections()):
|
205 |
pass
|
206 |
|