1
from utils import label_map_util

ImportError: No module named utils

I tried to fix this problem but I can't, this similar my case Case 1 and Case 2

please help me if Ubuntu 14.04 with python 2.7 fix it

thanks in advance!!

ivcubr
  • 1,988
  • 9
  • 20
  • 28
Algabri
  • 185
  • 1
  • 2
  • 12
  • did you try 'pip install utils' ? – jman Jan 02 '19 at 02:00
  • See this:https://pypi.org/project/python-utils/ and this:https://stackoverflow.com/questions/46494160/from-utils-import-label-map-util-import-error-no-module-named-utils – I_Al-thamary Jan 02 '19 at 05:11
  • the output:Requirement already satisfied: python-utils in /usr/local/lib/python3.4/dist-packages (2.3.0) Requirement already satisfied: six in /usr/local/lib/python3.4/dist-packages (from python-utils) (1.12.0) – Algabri Jan 03 '19 at 12:07
  • path python 3 not python 2.7!!! how I can solve it???please – Algabri Jan 03 '19 at 12:08

1 Answers1

0

First, clone this:https://github.com/tensorflow/models and include the path to your code the folder is in the research folder research/object_detection:

import sys

sys.path

sys.path.insert(0, 'path/to/your/object_detection')

Or this way

import( os )
os.chdir( 'path/to/your/object_detection' )

and change your import to be:

from object_detection.utils import label_map_util
I_Al-thamary
  • 3,385
  • 2
  • 24
  • 37
  • run `sudo pip install object_detection` if you face a problem see this https://github.com/tensorflow/models/issues/2577 – I_Al-thamary Jan 07 '19 at 03:39
  • thank you again, my problem in paths, it worked now 1. MODEL_NAME = '/inference_graph/placeholder.txt' , 2. CWD_PATH = os.getcwd(), 3.PATH_TO_CKPT = CWD_PATH + '/frozen_inference_graph.pb' , 4. PATH_TO_LABELS = os.path.join(CWD_PATH,'training','/home/redhwan/models/research/object_detection/data/mscoco_label_map.pbtxt') – Algabri Jan 07 '19 at 07:00
  • Could not find a version that satisfies the requirement object_detection (from versions: ) No matching distribution found for object_detection – Algabri Jan 07 '19 at 07:07
  • thank you again, I used this link:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md, after this I change in paths (in code), finally, it worked – Algabri Jan 07 '19 at 07:11
  • I am very sorry, I deleted it this comment inadvertently because of lack of experience: from object_detection.protos import string_int_label_map_pb2 ImportError: No module named object_detection.protos – Algabri Jan 07 '19 at 07:17
  • No problem. Good luck. – I_Al-thamary Jan 07 '19 at 11:32