parent
251aeafcb1
commit
91547edec1
|
@ -5,7 +5,6 @@ from pathlib import Path
|
|||
import cv2
|
||||
import torch
|
||||
import torch.backends.cudnn as cudnn
|
||||
from numpy import random
|
||||
|
||||
from models.experimental import attempt_load
|
||||
from utils.datasets import LoadStreams, LoadImages
|
||||
|
@ -79,7 +78,7 @@ def detect(opt):
|
|||
# Process detections
|
||||
for i, det in enumerate(pred): # detections per image
|
||||
if webcam: # batch_size >= 1
|
||||
p, s, im0, frame = path[i], '%g: ' % i, im0s[i].copy(), dataset.count
|
||||
p, s, im0, frame = path[i], f'{i}: ', im0s[i].copy(), dataset.count
|
||||
else:
|
||||
p, s, im0, frame = path, '', im0s.copy(), getattr(dataset, 'frame', 0)
|
||||
|
||||
|
@ -108,7 +107,6 @@ def detect(opt):
|
|||
if save_img or opt.save_crop or view_img: # Add bbox to image
|
||||
c = int(cls) # integer class
|
||||
label = None if opt.hide_labels else (names[c] if opt.hide_conf else f'{names[c]} {conf:.2f}')
|
||||
|
||||
plot_one_box(xyxy, im0, label=label, color=colors(c, True), line_thickness=opt.line_thickness)
|
||||
if opt.save_crop:
|
||||
save_one_box(xyxy, im0s, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)
|
||||
|
|
Loading…
Reference in New Issue