ModuleNotFoundError: No module named 'utils'
Question:
I’m trying to run the object_detection API in Tensorflow using my webcam as an input.
The error says: “from utils import label_map_util ModuleNotFoundError: No module named ‘utils'”
Which relates to the lines:
from utils import label_map_util
from utils import visualization_utils as vis_util
I’ve tried “pip install util” appears to work but doesn’t solve the problem. I have also reinstalled multiple versions of protobuf as other questions online appear to have this as the solution. I don’t get any errors when I install protoc so I don’t think this is the issue.
I’m using python 3.6 on windows 10 with tensorflow-gpu.
Answers:
What folder are you running your python script from?
To be able to access the ‘utils’ module directly, you need to be running the script inside the <models-master>researchobject_detection
folder.
-
Instead of running script inside object detection folder append the
path of tensorflow object detection in your script by writing
import sys
sys.path.append('PATH_TO_TENSORFLOW_OBJECT_DETECTION_FOLDER')
-
e.g ‘PATH_TO_TENSORFLOW_OBJECT_DETECTION_FOLDER’ in my ubuntu system is
/home/dc-335/Documents/Softwares/tensorflow/models/research/object_detection
-
Cheers, You done it !!
add object_detection to the front of utils:
# from utils import label_map_util
# from utils import visualization_utils as vis_util
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
I used a quicker method to fix it.
I copied the utils folder from modelsresearchobject_detection and pasted it within the same directory as the python file which required utils
the installation didn’t go through, you will notice no module called model_utils in your project folder.
uninstall it pip uninstall django-model-utils
then install it again pip install django-model-utils
a new app called model_utils in your project folder.
I used to quick method
!pip install utils
it workes properlly
faced similar issue
download utils.py file and copy it in your project folder
I’m trying to run the object_detection API in Tensorflow using my webcam as an input.
The error says: “from utils import label_map_util ModuleNotFoundError: No module named ‘utils'”
Which relates to the lines:
from utils import label_map_util
from utils import visualization_utils as vis_util
I’ve tried “pip install util” appears to work but doesn’t solve the problem. I have also reinstalled multiple versions of protobuf as other questions online appear to have this as the solution. I don’t get any errors when I install protoc so I don’t think this is the issue.
I’m using python 3.6 on windows 10 with tensorflow-gpu.
What folder are you running your python script from?
To be able to access the ‘utils’ module directly, you need to be running the script inside the <models-master>researchobject_detection
folder.
-
Instead of running script inside object detection folder append the
path of tensorflow object detection in your script by writingimport sys sys.path.append('PATH_TO_TENSORFLOW_OBJECT_DETECTION_FOLDER')
-
e.g ‘PATH_TO_TENSORFLOW_OBJECT_DETECTION_FOLDER’ in my ubuntu system is
/home/dc-335/Documents/Softwares/tensorflow/models/research/object_detection
-
Cheers, You done it !!
add object_detection to the front of utils:
# from utils import label_map_util
# from utils import visualization_utils as vis_util
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
I used a quicker method to fix it.
I copied the utils folder from modelsresearchobject_detection and pasted it within the same directory as the python file which required utils
the installation didn’t go through, you will notice no module called model_utils in your project folder.
uninstall it pip uninstall django-model-utils
then install it again pip install django-model-utils
a new app called model_utils in your project folder.
I used to quick method
!pip install utils
it workes properlly
faced similar issue
download utils.py file and copy it in your project folder