icevision icon indicating copy to clipboard operation
icevision copied to clipboard

Error: cannot import name 'intersect_dicts' from 'yolov5.utils.torch_utils when using icevision==0.12.0 with yolov5==6.2.3

Open rafaelvp-db opened this issue 3 years ago • 1 comments

🐛 Bug

Describe the bug

When trying to use yolov5==6.2.3 with icevision==0.12.0 I get the following error:

8 from yolov5.models.yolo import Model
      9 from yolov5.utils.downloads import attempt_download
---> 10 from yolov5.utils.torch_utils import intersect_dicts
     11 from yolov5.utils.general import check_img_size
     12 from icevision.models.ultralytics.yolov5.utils import *

ImportError: cannot import name 'intersect_dicts' from 'yolov5.utils.torch_utils' (/databricks/python/lib/python3.8/site-packages/yolov5/utils/torch_utils.py)

To Reproduce Steps to reproduce the behavior:

  1. Install icevision==0.12.0 and yolov5==6.2.3
  2. Try to instantiate icevision.parsers.COCOBBoxParser

Expected behavior COCOBBoxParser is instantiated correctly

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • ubuntu 18.04

Additional context I'm trying to replicate the exact same architecture available from ultralytics.yolov5 for inference (mainly because I want to run inference on raw images, without having to declare a Dataset or DataLoader. The reason for this is to deploy an object detection as a REST API endpoint.

rafaelvp-db avatar Nov 08 '22 12:11 rafaelvp-db

It's in utils.general in the latest versions: https://github.com/ultralytics/yolov5/blob/fde77584687041aa62795bb2c27e895cf73686bf/utils/general.py#L242

But icevision should be used with yolov5-icevision package I believe: https://github.com/airctic/icevision/blob/b6b70ad5fe5fa168d4d44d122b433ad1aaf1959c/setup.cfg#L38

fcakyon avatar Nov 13 '22 19:11 fcakyon