open-mmlab / mmdetection

OpenMMLab Detection Toolbox and Benchmark
https://mmdetection.readthedocs.io
Apache License 2.0
29.21k stars 9.4k forks source link

Why can I not find model in mmdetection-main/mmdet? #11806

Open deardost opened 3 months ago

deardost commented 3 months ago

I am very new to this repository, and in-fact to machine learning. So I highly appreciate your time and help. I am following the link called Introduction to SAHI which is given by https://medium.com/codable/sahi-a-vision-library-for-performing-sliced-inference-on-large-images-small-objects-c8b086af3b80 What I did was just copy the code snippets given and paste them in my Spyder environment. The final code I have is the following: `from sahi import AutoDetectionModel from sahi.predict import get_sliced_prediction from sahi.utils.cv import read_image_as_pil from pathlib import Path from IPython.display import Image, display

detection_model = AutoDetectionModel.from_pretrained( model_type='mmdet', model_path="C:/Users/abdul/AppData/Roaming/Python/Python311/site-packages/mmdetection-main/mmdet", config_path="C:/Users/abdul/AppData/Roaming/Python/Python311/site-packages/mmdetection-main/mmdet", confidence_threshold=0.4, device="cuda:0" )

print(Path.cwd()) #It shows the current working directory

image = read_image_as_pil("cars_on_road.png")

result = get_sliced_prediction( image, detection_model, slice_height = 256, slice_width = 256, overlap_height_ratio = 0.2, overlap_width_ratio = 0.2 )

result.export_visuals(export_dir="result/")

result_image_path = "result/prediction_visual.png" display(Image(result_image_path))`

After running it, I am getting the following error:

ValueError: Cannot find model: c:/users/abdul/appdata/roaming/python/python311/site-packages/mmdetection-main/mmdet in mmdet

The things I have done:

  1. I have run the code pip install mmdet mmcv-full
  2. I have downloaded the mmdetection repository from the link https://github.com/open-mmlab/mmdetection

In the error above, the mmdetection-main is the repository of mmdetection.

Note: All the pip are apparently installed in site-packages given in the above directory. So I downloaded and copied the mmdetection repository also in the same directory.

In case it's relevant, the system I am using is the following: OS: Windows 11 Processor: Core i5 Graphics Card: Radeon 2GB (I don't have Nvidia) RAM: 8GB Environment: Anaconda Spyder