Spaces:
Runtime error
Runtime error
Update detect_deepsort.py
Browse files- detect_deepsort.py +6 -6
detect_deepsort.py
CHANGED
@@ -216,14 +216,14 @@ def run_deepsort(
|
|
216 |
seen += 1
|
217 |
if webcam: # batch_size >= 1
|
218 |
p, im0, frame = path[i], im0s[i].copy(), dataset.count
|
219 |
-
s += f'{i}: '
|
220 |
else:
|
221 |
p, im0, frame = path, im0s.copy(), getattr(dataset, 'frame', 0)
|
222 |
|
223 |
p = Path(p) # to Path
|
224 |
save_path = str(save_dir / p.name) # im.jpg
|
225 |
txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}') # im.txt
|
226 |
-
s += '%gx%g ' % im.shape[2:] # print string
|
227 |
gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh
|
228 |
ims = im0.copy()
|
229 |
if len(det):
|
@@ -231,9 +231,9 @@ def run_deepsort(
|
|
231 |
det[:, :4] = scale_boxes(im.shape[2:], det[:, :4], im0.shape).round()
|
232 |
|
233 |
# Print results
|
234 |
-
for c in det[:,
|
235 |
-
n = (det[:,
|
236 |
-
s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
|
237 |
xywh_bboxs = []
|
238 |
confs = []
|
239 |
oids = []
|
@@ -287,7 +287,7 @@ def run_deepsort(
|
|
287 |
vid_writer[i].write(ims)
|
288 |
|
289 |
# Print time (inference-only)
|
290 |
-
LOGGER.info(f"{s}{'' if len(det) else '(no detections), '}{dt[1].dt * 1E3:.1f}ms")
|
291 |
if update:
|
292 |
strip_optimizer(weights[0]) # update model (to fix SourceChangeWarning)
|
293 |
return save_path
|
|
|
216 |
seen += 1
|
217 |
if webcam: # batch_size >= 1
|
218 |
p, im0, frame = path[i], im0s[i].copy(), dataset.count
|
219 |
+
#s += f'{i}: '
|
220 |
else:
|
221 |
p, im0, frame = path, im0s.copy(), getattr(dataset, 'frame', 0)
|
222 |
|
223 |
p = Path(p) # to Path
|
224 |
save_path = str(save_dir / p.name) # im.jpg
|
225 |
txt_path = str(save_dir / 'labels' / p.stem) + ('' if dataset.mode == 'image' else f'_{frame}') # im.txt
|
226 |
+
#s += '%gx%g ' % im.shape[2:] # print string
|
227 |
gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh
|
228 |
ims = im0.copy()
|
229 |
if len(det):
|
|
|
231 |
det[:, :4] = scale_boxes(im.shape[2:], det[:, :4], im0.shape).round()
|
232 |
|
233 |
# Print results
|
234 |
+
for c in det[:, 5].unique():
|
235 |
+
n = (det[:, 5] == c).sum() # detections per class
|
236 |
+
#s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
|
237 |
xywh_bboxs = []
|
238 |
confs = []
|
239 |
oids = []
|
|
|
287 |
vid_writer[i].write(ims)
|
288 |
|
289 |
# Print time (inference-only)
|
290 |
+
#LOGGER.info(f"{s}{'' if len(det) else '(no detections), '}{dt[1].dt * 1E3:.1f}ms")
|
291 |
if update:
|
292 |
strip_optimizer(weights[0]) # update model (to fix SourceChangeWarning)
|
293 |
return save_path
|