models icon indicating copy to clipboard operation
models copied to clipboard

Object Detection Train Error - ImportError: cannot import name 'dataset_builder'

Open alensaqe opened this issue 8 years ago • 11 comments

I recently updated to tf 1.5 and while trying to invoke train.py under research/object_detection i hit an error saying

ImportError: cannot import name 'dataset_builder'

For more info:

Traceback (most recent call last):
  File "train.py", line 50, in <module>
    from object_detection.builders import dataset_builder
ImportError: cannot import name 'dataset_builder'

Is there any circular dependency or is it just me that gets this error? Or on your end everything is working?

Details:

  1. OS: Widows 10
  2. TensorFlow verion: 1.5
  3. CUDA 9.0 Cudnn 7
  4. Python ver: 3.6.2
  5. GPU: Nvidia 930MX - 2Gb Ram
  6. Tf installed from pip3

Command py train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config

alensaqe avatar Feb 15 '18 03:02 alensaqe

Please provide details about what platform you are using (operating system, architecture). Also include your TensorFlow version. Also, did you compile from source or install a binary? Make sure you also include the exact command if possible to produce the output included in your test case. If you are unclear what to include see the issue template displayed in the Github new issue template.

We ask for this in the issue submission template, because it is really difficult to help without that information. Thanks!

cy89 avatar Feb 16 '18 18:02 cy89

Sorry about that. I gave all the required details above in a post edit. If you need further details let me know. Meanwhile i will keep trying to make it work and post updates here if i make it work.

alensaqe avatar Feb 19 '18 16:02 alensaqe

You may need to execute from one directory up... py object_detection/train.py --logtostderr --train_dir=object_detection/training/ --pipeline_config_path=object_detection/training/ssd_inception_v2_coco.config

The builders folder is in /object_detection folder.

darraghdog avatar Feb 27 '18 22:02 darraghdog

@darraghdog No difference. Still the same error. I will get the latest clone of the repo in a few days and try again with it.

alensaqe avatar Feb 28 '18 23:02 alensaqe

@alensaqe I got the same problem, Had you solve the problem?

liu09114 avatar Mar 14 '18 07:03 liu09114

@liu09114 not yet. I have not worked on it a lot lately. If i go around the issue i will make sure to update the thread!

alensaqe avatar Mar 16 '18 19:03 alensaqe

Hi everyone, I get the same error too and I'm executing the command from one directory up as @darraghdog suggested. Inference works without problem.

szm-R avatar Mar 22 '18 03:03 szm-R

Well, I solved this and thought to share it with others. The point is to move the train.py code to one directory up and then execute it!!! (I was doing this before: python3 object_detection/train.py blah blah, which is pointless!). I don't why such a thing isn't considered in the code in the first place!

szm-R avatar Mar 22 '18 15:03 szm-R

Thank you for sharing! I might close this issue then and i will test it again. I might move all my training to the cloud anyway!

alensaqe avatar Mar 22 '18 19:03 alensaqe

I meet the problem when i run Google object detection model. Maybe the solution is useful for you. You need put the slim to PYTHONPATH. The specific method is to execute this: export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim . you can have a try.

clovking avatar May 08 '18 11:05 clovking

I have the same problem. I've tried what's written here, but the problem continues.

Traceback (most recent call last): File "object_detection/train.py", line 49, in from object_detection.builders import dataset_builder File "C:\tensorflow1\models\research\object_detection\builders\dataset_builder.py", line 27, in from object_detection.data_decoders import tf_example_decoder File "C:\tensorflow1\models\research\object_detection\data_decoders\tf_example_decoder.py", line 24, in from object_detection.protos import input_reader_pb2 ImportError: cannot import name 'input_reader_pb2'

smalgan avatar Mar 17 '19 16:03 smalgan