yolov5只检测单一类别或者特定的类
作者:互联网
在detect.py中
170行
if save_img or save_crop or view_img: # Add bbox to image
c = int(cls) # integer class
# FIXME:
if names[int(cls)] == "name_sign":
label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}')
annotator.box_label(xyxy, label, color=colors(c, True),counta = counta)
if save_crop:
save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)
标签:yolov5,int,crop,label,names,conf,类别,save,单一 来源: https://blog.csdn.net/BruceBorgia/article/details/123103804