Skip to content

Commit

Permalink
Update detect.py (ultralytics#3087)
Browse files Browse the repository at this point in the history
* Update detect.py

* Update detect.py
  • Loading branch information
glenn-jocher authored May 9, 2021
1 parent 251aeaf commit 91547ed
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 91547ed

Please sign in to comment.