diff --git a/requirements.txt b/requirements.txt index d8bcf54f..48cae7f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,9 +4,8 @@ Cython matplotlib>=3.2.2 numpy>=1.18.5 -opencv-python>=4.1.2 Pillow -PyYAML>=5.3.1 +PyYAML scipy>=1.4.1 tensorboard>=1.5 torch==1.7.0 diff --git a/utils/plots.py b/utils/plots.py index c90a96b8..4a8f3836 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -160,7 +160,11 @@ def plot_images(images, targets, paths=None, fname='images.jpg', names=None, max for j, box in enumerate(boxes.T): cls = int(classes[j]) color = colors[cls % len(colors)] - cls = names[cls] if names else cls + if names: + if len(names) == 1: # when training 1 class detector, error occurs in here + cls = names[0] + else: + cls = names[cls] if labels or conf[j] > 0.25: # 0.25 conf thresh label = '%s' % cls if labels else '%s %.1f' % (cls, conf[j]) plot_one_box(box, mosaic, label=label, color=color, line_thickness=tl)