models icon indicating copy to clipboard operation
models copied to clipboard

ImportError: cannot import name 'graph_rewriter_builder' when running train.py

Open fdkssdks opened this issue 8 years ago • 4 comments

I followed the guide to generate and place all the files required for training in the proper models/research/object_detection directory structure.

I found out the train.py file is in legacy folder so I run:

python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config

I get this error:

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

I checked the file is present in the directory.

I copied train.py out of legacy directory ran it and same error again.

I also passed the path export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim and no success.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04 LTS
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.9.0
  • Bazel version (if compiling from source):
  • CUDA/cuDNN version: 9.0 / 7.1
  • GPU model and memory: GTX960M 4GB
  • Exact command to reproduce: python legacy/train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config

Link to Tensorflow tutorial

fdkssdks avatar Jul 25 '18 18:07 fdkssdks

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code

tensorflowbutler avatar Jul 26 '18 07:07 tensorflowbutler

Thanks for the reply. The issue was solved when I restarted the terminal not sure what happened. But now everytime I start training it just gets killed not matter what batch_size I put. I've tensorflow-gpu installed and I've total 120 pictures.

fdkssdks avatar Jul 26 '18 07:07 fdkssdks

It happened with me as well. I had two versions of tensorflow installed, 1.5 and 1.9. First I set the pythonpath to the old installation. Then I switched to te new version and set the pythonpath to the new one. I belive the error occured, because the new installation tried to access the old installations files.

martinbacsi avatar Nov 11 '18 16:11 martinbacsi

Hi There, We are checking to see if you still need help on this, as this seems to be considerably old issue. Please update this issue with the latest information, code snippet to reproduce your issue and error you are seeing. If we don't hear from you in the next 7 days, this issue will be closed automatically. If you don't need help on this issue any more, please consider closing this.

tensorflowbutler avatar Jan 29 '20 23:01 tensorflowbutler