tensorflow / models

Models and examples built with TensorFlow
Other
77.25k stars 45.75k forks source link

ModuleNotFoundError: No module named 'object_detection' #10113

Closed JakeMalis closed 3 years ago

JakeMalis commented 3 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/colab_tutorials/object_detection_tutorial.ipynb

2. Describe the bug

ModuleNotFoundError: No module named 'object_detection' error is thrown due to an error in the installation of the object detection api.

3. Steps to reproduce

Just run the file in Google Colab.

4. Expected behavior

The object detection api should be installed which would allow the rest of the code to work properly.

5. Additional context

Include any logs that would be helpful to diagnose the problem.

6. System information

Google Colab GPU

v1.12.1-59375-ga5317d67e6c 2.6.0-rc0

007rohitSaini commented 3 years ago

pip install tensorflow-object-detection-api

JakeMalis commented 3 years ago

pip install tensorflow-object-detection-api

Thanks for the tip, but the tutorial says that it should install as the code is shown in the repository, which it doesn't. I know I could install it with pip but it would be easier for newbies to learn if the provided code wasn't broken.

saikumarchalla commented 3 years ago

@JakeMalis Please update the cells with the below code and it will work. Thanks!

%%bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python -m pip install .
JakeMalis commented 3 years ago

I did in the attached Pull Request

saikumarchalla commented 3 years ago

@JakeMalis If the issue is resolved for you Please go ahead and close the issue . We can track the bug in PR seperately.Thanks!

utkarsh125 commented 2 years ago

If you are on Anaconda notebook just install the setup.py file after follow the steps mentioned by @saikumarchalla upto where you use protobuf and then manually copy the setup.py file from object_detection/tf2/ and paste it under models/research

now all you have to do it run it using python -m pip install .

mahi01agarwal commented 1 year ago

It still doesn't work , I already have setup.py file in models/research but i get the error "ModuleNotFoundError: No module named 'object_detection'" .

utkarsh125 commented 1 year ago

Make sure you use the exact versions of the required toolkits and frameworks as mentioned in the tutorial as TensorFlow GPU is not longer used since December 2022...

mahi01agarwal commented 1 year ago

When I try training the model using following command :

The error faced by me is :

Kushal3603 commented 3 months ago

Did you find a solution to it? I'm facing the same issue.