Spaces:
Running
on
Zero
Running
on
Zero
thai thong
commited on
Commit
•
0d2d193
1
Parent(s):
e7b0d30
Fix video ouput not display
Browse files
detect.py
CHANGED
@@ -43,7 +43,7 @@ def run(
|
|
43 |
project=ROOT / 'runs/detect', # save results to project/name
|
44 |
name='exp', # save results to project/name
|
45 |
exist_ok=False, # existing project/name ok, do not increment
|
46 |
-
line_thickness=
|
47 |
hide_labels=False, # hide labels
|
48 |
hide_conf=False, # hide confidences
|
49 |
half=False, # use FP16 half-precision inference
|
@@ -100,9 +100,9 @@ def run(
|
|
100 |
|
101 |
# NMS
|
102 |
with dt[2]:
|
103 |
-
pred = pred[0][
|
104 |
pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
|
105 |
-
|
106 |
|
107 |
# Second-stage classifier (optional)
|
108 |
# pred = utils.general.apply_classifier(pred, classifier_model, im, im0s)
|
@@ -173,7 +173,7 @@ def run(
|
|
173 |
else: # stream
|
174 |
fps, w, h = 30, im0.shape[1], im0.shape[0]
|
175 |
save_path = str(Path(save_path).with_suffix('.mp4')) # force *.mp4 suffix on results videos
|
176 |
-
vid_writer[i] = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(
|
177 |
vid_writer[i].write(im0)
|
178 |
|
179 |
# Print time (inference-only)
|
|
|
43 |
project=ROOT / 'runs/detect', # save results to project/name
|
44 |
name='exp', # save results to project/name
|
45 |
exist_ok=False, # existing project/name ok, do not increment
|
46 |
+
line_thickness=2, # bounding box thickness (pixels)
|
47 |
hide_labels=False, # hide labels
|
48 |
hide_conf=False, # hide confidences
|
49 |
half=False, # use FP16 half-precision inference
|
|
|
100 |
|
101 |
# NMS
|
102 |
with dt[2]:
|
103 |
+
pred = pred[0][1] if isinstance(pred[0], list) else pred[0] # single model or ensemble
|
104 |
pred = non_max_suppression(pred, conf_thres, iou_thres, classes, agnostic_nms, max_det=max_det)
|
105 |
+
|
106 |
|
107 |
# Second-stage classifier (optional)
|
108 |
# pred = utils.general.apply_classifier(pred, classifier_model, im, im0s)
|
|
|
173 |
else: # stream
|
174 |
fps, w, h = 30, im0.shape[1], im0.shape[0]
|
175 |
save_path = str(Path(save_path).with_suffix('.mp4')) # force *.mp4 suffix on results videos
|
176 |
+
vid_writer[i] = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc('m','p','4','v'), fps, (w, h))
|
177 |
vid_writer[i].write(im0)
|
178 |
|
179 |
# Print time (inference-only)
|