ImportError: cannot import name 'preprocessor_pb2' in the training part after installation was successful - tensorflow

I installed the object detection API correctly using this https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md and I checked by running model_builder_test.py
This gave me a OK result.
Then I moved on to running the train.py on my dataset using the following command
python train.py --logtostderr --pipeline_config_path=pipeline.config --train_dir=train_file
And I am getting the error ImportError: cannot import name 'preprocessor_pb2'
This particular preprocessor_pb2.py exists in the path it is looking for i.e
C:\Users\SP-TestMc\Anaconda3\envs\tensorflow\models-master\models-master\research\object_detection\protos
What could be the reason for this error then?

See https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md#protobuf-compilation. Sounds like you need to compile the protos before using the Python scripts.

Related

ImportError: cannot import name 'IEX_CLOUD_API_TOKEN' from 'secrets'

I'm facing the above error when I try to execute the following code:
from secrets import IEX_CLOUD_API_TOKEN
I tried using '.secrets' instead of 'secrets' but that gives the ModuleNotFoundError.
It's not a problem with the secrets library or anything of such kind.
It's just that after uploading secrets.py to the working directory, restart the kernel in your jupyter notebook.
Code shall run !!

NameError: name 'python' is not defined when importing part of tensorflow's deeplab module

Thanks to this github issue, I realise that I shouldn't try to reload tensorflow, because I get this error:
del python
NameError: name 'python' is not defined
when I do
import tensorflow
from deeplab import common
In case it's relevant, import deeplab works fine.
I saw elsewhere that it's probably the IPython session in spyder that is keeping a tensorflow session open. So I closed spyder - but launching python in the shell gave me the same issue. ps -ef | grep -E 'py|tensorflow|tensorboard|tf' came up empty. What could still be hanging around and causing tensorflow to try a reload, rather than a fresh load?
I understand that the issue around reloading tensorflow will not be resolved. How do I make sure that I have cleared everything from my previous runs so that it will be a fresh load rather than a reload?
Edit: even after restarting the computer I get the same error. Even if the first thing I do is open a python console and type from deeplab import common. That means the original title to my question is probably wrong, so I have changed it.

OpenAI Gym error running demo from intro page

I installed OpenAI Gym and attempted to run the getting-started cart-pole demo (https://gym.openai.com/docs/). (I'm running in a Colab notebook.)
import gym
env = gym.make('CartPole-v0')
env.reset()
for _ in range(1000):
env.render()
env.step(env.action_space.sample()) # take a random action
This doesn't learn, but it should display the cart and pole.
When I run it I get a warning and an error.
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype.
The error is triggered by env.render(). At the bottom of the Traceback is
Error occured while running `from pyglet.gl import *`
The original exception was:
ImportError: Library "GL" not found.
I had installed pyOpenGL with the following.
!pip install PyOpenGL PyOpenGL_accelerate
I'd appreciate help with both the warning and the error. Is there another GL library I should install?
Thanks.
Google Colab is run in the cloud. It can't send the graphic display back to your monitor.
You can try running it with local runtime.
https://research.google.com/colaboratory/local-runtimes.html
Do you get this window?
If yes then try to add this import:
import time
and this line of Code within the for-loop:
time.sleep(0.3)
Thing is that the pole runs out of view rather quick, so it seems like
the Environment did not run at all.

unittest in tensorflow, python session_test.py, got a exception

I'm trying to run session_test.py from https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/client/session_test.py, So in my anaconda, tensorflow virtual env, I went to the corresponding directory in tensorflow like ../master/tensorflow/python/client/.. and run
python session_test.py
I got exception info like this:
Traceback (most recent call last):
File "session_test.py", line 32, in
from tensorflow.core.protobuf import cluster_pb2
ImportError: cannot import name 'cluster_pb2'
What package I should install or related documents that I could read about it. Is there anyone trying to do the same thing, run those unit test coming along with each module in tensorflow repo?
Please help me, thanks!
That line was added just a couple of weeks ago (see commit), and relates to a new feature being implemented in TensorFlow. Unless you have compiled and installed a very bleeding-edge version of TensorFlow you won't be able to run it. Instead, try to run the script corresponding to the version of TensorFlow that you have installed (for example, this is for version 1.1.0, the latest stable release at the time of writing).

ImportError: No module named inception

Im using imagenet train script (https://github.com/tensorflow/models/blob/master/inception/inception/imagenet_train.py) to train my own image data set to classify in tensorflow (in Oracle VM Virtual box) and im getting an error as below
shri#shri-VirtualBox:~/Desktop/Test/inception_test/models/inception/inception$ python imagenet_train.py
Traceback (most recent call last):
File "imagenet_train.py", line 25, in
from inception import inception_train
ImportError: No module named inception
Could someone please help understand the problem and how do i fix it?
Regards,
Shri
This sounds like a Python module search path issue. The import statements in the particular script imagenet_train.py and other scripts in that directory assume that they can find the other scripts in a submodule called inception, but when you run the script from the same directory, Python can't find that submodule.
The easiest way to fix this is to change to the parent directory (cd ~/Desktop/Test/inception_test/models/inception) and run the script as follows:
$ python inception/inception_train.py