Skip to content

PyTorch Hub cv2 .save() .show() bug #2830

@glenn-jocher

Description

@glenn-jocher

🐛 Bug

.show() and .save() methods do not show bounding boxes for cv2-loaded images in the PyTorch Hub tutorial detailed example:

YOLOv5 🚀 2021-4-15 torch 1.8.1 CPU
Downloading zidane.jpg...
100%|██████████| 165k/165k [00:00<00:00, 7.90MB/s]
Downloading bus.jpg...
100%|██████████| 476k/476k [00:00<00:00, 12.2MB/s]
image 1/2: 720x1280 2 persons, 2 ties
image 2/2: 1080x810 4 persons, 1 bus
Speed: 11.3ms pre-process, 269.3ms inference, 1.4ms NMS per image at shape (2, 3, 640, 640)
Saved zidane.jpg,Traceback (most recent call last):
  File "<input>", line 21, in <module>
  File "/Users/glennjocher/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 348, in save
    self.display(save=True, save_dir=save_dir)  # save results
  File "/Users/glennjocher/.cache/torch/hub/ultralytics_yolov5_master/models/common.py", line 325, in display
    plot_one_box(box, img, label=label, color=colors[int(cls) % 10])
  File "/Users/glennjocher/.cache/torch/hub/ultralytics_yolov5_master/utils/plots.py", line 62, in plot_one_box
    cv2.rectangle(img, c1, c2, color, thickness=tl, lineType=cv2.LINE_AA)
TypeError: argument for rectangle() given by name ('thickness') and position (4)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions