0

I installed tensorflow today, followed the setup tutorial found on github. Installation was fine with protobuff 3.4. The setup is complete and the object_detection.ipynb example code runs just fine.

But the problem is when i try to use live object detection. i followed (https://pythonprogramming.net/video-tensorflow-object-detection-api-tutorial/) this tutorial. My third cell seems to have a problem. Should i move the mscoco_label_map.pbtxt (it is present in data of the object detection folder) somewhere? Also why is there an OS error. Isn't it built into python.

Thanks for your help guys

# What model to download.
MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'
MODEL_FILE = MODEL_NAME + '.tar.gz'
DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'

# Path to frozen detection graph. This is the actual model that is used 
for 
the object detection.
PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'

# List of the strings that is used to add correct label for each box.
PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')

NUM_CLASSES = 90



MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'
MODEL_FILE = MODEL_NAME + '.tar.gz'
DOWNLOAD_BASE = 'http://download.tensorflow.org/models/object_detection/'

# Path to frozen detection graph. This is the actual model that is used for the object detection.
PATH_TO_CKPT = MODEL_NAME + '/frozen_inference_graph.pb'

# List of the strings that is used to add correct label for each box.
PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')

NUM_CLASSES = 90


# ## Download ModelTraceback (most recent call last):

  File "<ipython-input-2-08073e128cca>", line 9, in <module>
    PATH_TO_LABELS = os.path.join('data', 'mscoco_label_map.pbtxt')

NameError: name 'os' is not defined
  • you're missing the `import os` statement – wiomoc Jun 10 '19 at 15:07
  • i tried pip install os-win, i get {Command "python setup.py egg_info" failed with error code 1} – peanut.butter Jun 10 '19 at 15:15
  • `import os # What model to download. MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017' ...` – wiomoc Jun 10 '19 at 15:16
  • Possible duplicate of [Python name 'os' is not defined](https://stackoverflow.com/questions/23048129/python-name-os-is-not-defined) – wiomoc Jun 10 '19 at 15:26
  • that worked. when running the full code i get- NotFoundError: NewRandomAccessFile failed to Create/Open: data\mscoco_label_map.pbtxt : The system cannot find the path specified. ; No such process – peanut.butter Jun 10 '19 at 15:35
  • should i move the mscoco_label_map.pbtxt file somewhere that i'm missing? and i just added the path to python environment – peanut.butter Jun 10 '19 at 15:36
  • Where you able to use the model? I managed to successfully train and use my trained model with tensorflow with similar code. Make sure NUM_CLASSES is equal to the amount of objects your trying to detect. – sirshakir Jun 24 '19 at 20:53
  • Yepp finally got it working, ps: i scratched my head for 2 weeks to get it to work lol – peanut.butter Jun 24 '19 at 23:54
  • Does the tensorflow object detection run slow for you? – sirshakir Jun 25 '19 at 13:35
  • The system doesn't seem to struggle detecting objects, but it gave a 93% probability that i was a dog – peanut.butter Jun 26 '19 at 13:34

0 Answers0