Search code examples
pythontensorflowobject-detectiontensorflow-slim

Error while training an object detector with my own dataset using Tensorflow's Object Detection API


I'm working on training an object detector with tensor flow's object detector API. I'm following this link to train an object detector with my own dataset. Everything seems to be fine until i started the training process (locally):

python /Users/vinayakpahalwan/models/research/object_detection/train.py --logtostderr --train_dir=/Users/vinayakpahalwan/Desktop/ObjectDetection/training/ --pipeline_config_path=/Users/vinayakpahalwan/Desktop/ObjectDetection/training/ssd_mobilenet_v1_coco.config

I'm getting the following error:

Traceback (most recent call last):
  File "builders/model_builder_test.py", line 21, in <module>
    from object_detection.builders import model_builder
  File "/Users/vinayakpahalwan/models/research/object_detection/builders/model_builder.py", line 23, in <module>
    from object_detection.builders import matcher_builder
  File "/Users/vinayakpahalwan/models/research/object_detection/builders/matcher_builder.py", line 19, in <module>
    from object_detection.matchers import bipartite_matcher
  File "/Users/vinayakpahalwan/models/research/object_detection/matchers/bipartite_matcher.py", line 20, in <module>
    from tensorflow.contrib.image.python.ops import image_ops
ImportError: No module named 'tensorflow.contrib.image'

I'm kinda stuck here as of now, any workaround for that?

I guess i have installed the object detection API correctly as per this link :

Vinayaks-MacBook-Air:object_detection vinayakpahalwan$ python builders/model_builder_test.py
...........
----------------------------------------------------------------------
Ran 11 tests in 0.070s

OK

Solution

  • The error message is saying that it cannot locate the file tensorflow/contrib/image.

    Since you are using Tensorflow version 0.12.1, looking inside tensorflow/contrib, the folder image does not exist yet. This is introduced from version 1.0 as seen here.

    Your workaround at this point is updating TS.