Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError with Object Detection #791

Open
LOActualControl opened this issue Jan 16, 2023 · 0 comments
Open

ModuleNotFoundError with Object Detection #791

LOActualControl opened this issue Jan 16, 2023 · 0 comments

Comments

@LOActualControl
Copy link

Good evening,

When attempting to perform Object Detection using a pre-trained YoloV3 model, I am getting a ModuleNotFoundError. I'm attempting to detect a single class ("boat") from the 80 pre-trained classes available. My code is below (taken from the ImageAI documentation):

`from imageai.Detection import ObjectDetection

detector = ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath("/content/gdrive/MyDrive/shipspotting_revision/yolov3.pt")
detector.loadModel()
custom = detector.CustomObjects(boat=True)
detections = detector.detectCustomObjectsFromImage(custom_objects=custom, input_image="/content/gdrive/MyDrive/shipspotting_revision/rostock/output/live_test/test_[1463].jpg", output_image_path="/content/gdrive/MyDrive/shipspotting_revision/rostock/output/live_test/test_new.jpg")

for eachObject in detections:
print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
`

The traceback for the error I'm getting is below:

ModuleNotFoundError Traceback (most recent call last)
in
4 detector.setModelTypeAsYOLOv3()
5 detector.setModelPath("/content/gdrive/MyDrive/shipspotting_revision/yolov3.pt")
----> 6 detector.loadModel()
7 custom = detector.CustomObjects(boat=True)
8 detections = detector.detectCustomObjectsFromImage(custom_objects=custom, input_image="/content/gdrive/MyDrive/shipspotting_revision/rostock/output/live_test/test_[1463].jpg", output_image_path="/content/gdrive/MyDrive/shipspotting_revision/rostock/output/live_test/test_new.jpg")

3 frames
/usr/local/lib/python3.8/dist-packages/torch/serialization.py in find_class(self, mod_name, name)
1122 pass
1123 mod_name = load_module_mapping.get(mod_name, mod_name)
-> 1124 return super().find_class(mod_name, name)
1125
1126 # Load the data (which may in turn use persistent_load to load tensors)

ModuleNotFoundError: No module named 'models'

All other imports were successful and I'm scratching my head as to what might be wrong. I'm working in a Colab notebook. Thanks for any help you can provide!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant