airctic / icevision

An Agnostic Computer Vision Framework - Pluggable to any Training Library: Fastai, Pytorch-Lightning with more to come
https://airctic.github.io/icevision/
Apache License 2.0
845 stars 149 forks source link

Error when loading icevision in colab #1160

Open misza222 opened 1 year ago

misza222 commented 1 year ago

🐛 Bug

Hi there, when I import icevision in colab I get an error: ModuleNotFoundError: No module named 'sahi.model'

To Reproduce Steps to reproduce the behavior: !pip install icevision[all] from icevision.all import *

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-5-2dc2b878494d>](https://localhost:8080/#) in <module>
----> 1 from icevision.all import *

2 frames
[/usr/local/lib/python3.7/dist-packages/icevision/__init__.py](https://localhost:8080/#) in <module>
      5 from icevision.data import *
      6 from icevision import backbones
----> 7 from icevision import models
      8 from icevision.metrics import *
      9 from icevision.visualize import *

[/usr/local/lib/python3.7/dist-packages/icevision/models/__init__.py](https://localhost:8080/#) in <module>
     30 
     31 if SoftDependencies.sahi:
---> 32     from icevision.models import inference_sahi

[/usr/local/lib/python3.7/dist-packages/icevision/models/inference_sahi.py](https://localhost:8080/#) in <module>
     12 
     13 
---> 14 from sahi.model import DetectionModel
     15 from sahi.prediction import ObjectPrediction
     16 from sahi.predict import get_sliced_prediction as sahi_get_sliced_prediction

ModuleNotFoundError: No module named 'sahi.model'

Screenshots

Screenshot 2022-11-24 at 15 06 49

Where it happens:

misza222 commented 1 year ago

The problem is with sahi library - they have changed the interface between version 0.10 and 0.11 and icevision 0.12 (most recent version on pip) relies on things that are only present in <= sahi 0.10.*

shravankumar147 commented 1 year ago

Hi,

I Encounter the same issue,

The Issue occurred when I tried to import --> from icevision.all import *

[/usr/local/lib/python3.8/dist-packages/icevision/models/inference_sahi.py](https://localhost:8080/#) in <module>

---> 14 from sahi.model import DetectionModel
     15 from sahi.prediction import ObjectPrediction
     16 from sahi.predict import get_sliced_prediction as sahi_get_sliced_prediction

ModuleNotFoundError: No module named 'sahi.model'

My Installation followed :

# # Torch - Torchvision - IceVision - IceData - MMDetection - YOLOv5 - EfficientDet Installation
!wget https://raw.githubusercontent.com/airctic/icevision/master/icevision_install.sh

# # Choose your installation target: cuda11 or cuda10 or cpu
!bash icevision_install.sh cuda11

then installed sahi

!pip install sahi -U then I checked the versions of Icevision and sahi.

icedata 0.5.1 icevision 0.12.0 sahi 0.11.6

As the error is pointing to the icevision/models/inference_sahi.py file, I looked into it and modified as below:

from sahi import DetectionModel instead from sahi.model import DetectionModel

This solved the issue.