ModuleNotFoundError: No module named 'sahi.model'

80 Views Asked by At
import cv2
from sahi.predict import predict
from sahi.model import Yolov5DetectionModel
from sahi.utils.cv import read_image

sahi.predict and sahi.utils works fine but sahi.model gives me error:

  • ModuleNotFoundError: No module named 'sahi.model'

Installed

  • pip install torch torchvision torchaudio
  • pip install sahi
  • pip install yolov5

Versions

  • Pip version : pip 23.1.2
  • Python version : Python 3.11.4

I tried to downgrade sahi to 0.10.8 by using pip install sahi==0.10.8 it didn`t work aswell

1

There are 1 best solutions below

0
CognitiveRobot On

There is no module called 'model' in sahi. It's called 'models'. So, to import 'Yolov5DetectionModel' you have to import as below.

from sahi.models.yolov5 import Yolov5DetectionModel

You don't need to downgrade. You can check all available models here https://github.com/obss/sahi/tree/main/sahi/models