some errors with tensorflow 'object_detection' and preprocessor_pb2

Problem solved
Problem: ERROR: No module named 'object_detection'


  1. go to your tensorflow folder (..\Python\Python36\Lib\site-packages\tensorflow\)
  2. if there is not a folder call models or models-master download it from https://github.com/tensorflow/models and put the folder in tensorflow folder
  3. open cmd
  4. cd ..\Python\Python36\Lib\site-packages\tensorflow\models-master (or models)
  5. python setup.py install
  6. DONE
Problem: ERROR: ImportError: cannot import name preprocessor_pb2

  1. download protoc-3.5.0-win32.zip from https://github.com/google/protobuf/releases
  2. unzip and copy the protoc.exe in bin folder to your tensorflow\models\research folder (in my case is ..\Python\Python36\Lib\site-packages\tensorflow\models-master\research\)
  3. open cmd
  4. cd  ..\Python\Python36\Lib\site-packages\tensorflow\models\research\ (in my case is ..\Python\Python36\Lib\site-packages\tensorflow\models-master\research\)
  5. in normal case you can just run "protoc object_detection\protos\*.proto --python_out=." However, in windows10, it cannot recognize wildcase'*'. You can use specific name to run it one by one. Or  use for loop to do it. just run "for %i in (object_detection\protos\*.proto) DO protoc %i --python_out=."
  6. right click on "This PC" -> properties ->Advanced system settings -> Environment variables -> system variable -> New... 
  7. variable name: "PYTHONPATH", variable value: "...\tensorflow\models-master\research\; ...\tensorflow\models-master\research\slim"
  8. DONE
note: don't use "export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim" or "set PYTHONPATH=$PYTHONPATH:pwd:pwd/slim" in cmd, it is not working!

Comments

Popular posts from this blog

Insatll python 2.7.14 with opencv 3.3.0