models icon indicating copy to clipboard operation
models copied to clipboard

ImportError: cannot import name 'preprocessor_pb2'

Open LaurentBerder opened this issue 8 years ago • 5 comments


System information

  • What is the top-level directory of the model you are using: Models/research/object_detection
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.5.0
  • Bazel version (if compiling from source): n/a
  • CUDA/cuDNN version: n/a
  • GPU model and memory: n/a
  • Exact command to reproduce: python train.py --h

Describe the problem

Hi,

I'm trying out the Object_detection model, but can't launch train.py. I get error:

research\object_detection\builders\preprocessor_builder.py", line 24, in <module>
    from protos import preprocessor_pb2
ImportError: cannot import name 'preprocessor_pb2'

Indeed, there is no file called preprocessor_pb2 in the folder "protos"

Source code / logs

Traceback (most recent call last):
  File "Models\research\object_detection\train.py", line 49, in <module>
    import trainer
  File "G:\My Drive\CMA-CGM\Reconnaissance_Container\Scripts\Models\research\object_detection\trainer.py", line 27, in <module>
    from builders import preprocessor_builder
  File "G:\My Drive\CMA-CGM\Reconnaissance_Container\Scripts\Models\research\object_detection\builders\preprocessor_builder.py", line 24, in <module>
    from protos import preprocessor_pb2
ImportError: cannot import name 'preprocessor_pb2'

LaurentBerder avatar Feb 09 '18 11:02 LaurentBerder

Did you follow the "Protobuf Compliation" installation steps before running train? What about adding the PYTHONPATH variables?

derekjchow avatar Feb 12 '18 17:02 derekjchow

Yeah, I realized after a while I needed to do this.

I tried, but it is very tricky installing and compiling Protobuf under a Windows environment.

LaurentBerder avatar Feb 14 '18 16:02 LaurentBerder

It maybe the problem of protobuf. I meet the question when i update google object detection. i see it can't work when input the command, protobuf Compilation protoc object_detection/protos/*.proto --python_out=. , before trainning. when i update protobuf2 to protobuf3, it work. you can have a see https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

clovking avatar May 09 '18 11:05 clovking

hi, it must be the problem of protobuf,when l upgrade protobuf from 2.6.1 to 3.6.0, l solved the problem.

mrainezty avatar Jun 21 '18 09:06 mrainezty

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