Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'object_detection'

Tags:

i try to train.py in object_detection in under git url

https://github.com/tensorflow/models/tree/master/research/object_detection

However, the following error occurs.

ModuleNotFoundError: No module named 'object_detection'

So I tried to solve the problem by writing the following code.

import sys  sys.path.append('/home/user/Documents/imgmlreport/inception/models/research/object_detection') from object_detection.builders import dataset_builder 

This problem has not been solved yet.

The directory structure is shown below.

~/object_detection/train.py  ~/object_detection/builders/dataset_bulider.py 

and here is full error massage

/home/user/anaconda3/lib/python3.6/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated.

In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters

Traceback (most recent call last):

File "train.py", line 52, in import trainer

File"/home/user/Documents/imgmlreport/inception/models/research/object_detection/trainer.py", line 26, in from object_detection.builders import optimizer_builder

ModuleNotFoundError: No module named 'object_detection'

how can i import modules?

like image 851
송준석 Avatar asked May 01 '18 08:05

송준석


2 Answers

Try install Tensorflow Object Detection Library Packaged

pip install tensorflow-object-detection-api 
like image 190
bedna Avatar answered Oct 25 '22 18:10

bedna


Cause of this error is installing object_detection library, So one of the solution which can work is running the below command inside models/research

      sudo python setup.py install  

If such solution does not work, please execute the below command one by one in the directory models/research

      export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim     sudo python setup.py install  

I hope this will work. I also faced the same problem while creating model from export_inference_graph.py. It worked for me.

like image 37
Vijay Avatar answered Oct 25 '22 18:10

Vijay