I am trying to run Tensorflow's Object Detection example(object_detection_tutorial.ipynb) as it is. But, at the end of the complete Jupyter notebook execution I don't see the bounding box.
I have followed instruction by running the following commands in the right paths-
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
And even the model builder test runs successfully-
python object_detection/builders/model_builder_test.py
I have verified that the model has successfully downloaded. And even the images are in the right paths.
I don't see any errors in the console as well. Please can you tell me what am I doing wrong?
The current model listed by the master branch is unstable.
This is related to tensorflow/models issue 2773 and there is a fix for it.
In the "Variables" section of models/research/object_detection/object_detection_tutorial.ipynb you have to change the model.
Just replace the model name so the it looks like this
MODEL_NAME = 'ssd_mobilenet_v1_coco_11_06_2017'
and you will happily detect dogs and people and kites in no time :)
Related
I am trying to use OpenVino python API to run MTCNN face detection, however, the performance of the converted models degraded significantly from the original model. I am wondering how I could get similar results.
I converted the mtcnn caffe models into OpenVino *.xml and *.bin files using the following commands.
python3 mo.py --input_model path/to/PNet/det1.caffemodel --model_name det1 --output_dir path/to/output_dir
python3 mo.py --input_model path/to/RNet/det2.caffemodel --model_name det2 --output_dir path/to/output_dir
python3 mo.py --input_model path/to/ONet/det3.caffemodel --model_name det3 --output_dir path/to/output_dir
And used the step_by_step mtcnn jupyter notebook to check the performance of the converted models.
But detection results using OpenVino models degraded significantly. To regenerate the results you only need to load OpenVino models instead of pytorch model in the notebook.
To regenerate my results do the following steps.
Clone https://github.com/TropComplique/mtcnn-pytorch.git
And use this jupyter notebbok
As you will see the detected boxes in the first stage after P-Net are more than the detected boxes in the original model step_by_step mtcnn jupyter notebook.
Do you have any comment on this. It seems that there is no problem in model conversion the only difference is that pytorch has a variable tensor size (FloatTensor) but for OpenVino I have to reshape the input size for each scale. This might be the reason to get different results, however I have not been able to solve this problem.
I went through all the possible mistake I might had made and check parameters to convert mtcnn models from list_topologies.yaml. This file comes with OpenVino installation and list the parameters like scale mean values and etc.
Finally, I solved the problem by using MXNET pre-trained MTCNN networks.
I hope this would help other users who might encounter this problem.
I have questions to ask about why tensorflow with poets was not able to classify the image i want. I am using Ubuntu 14.04 with tensorflow installed using docker. Here is my story:
After a successful retrained on flower category following this link here. I wish to train on my own category as well, I have 10 classes of images and they are well organized according to the tutorial. My photos were also stored in the tf_files directory and following the guide i retrain the inception model on my category.
Everything on the retraining went well. However, as I tired to classify the image I want, I was unable to do so and I have this error. I also tried to look for py file in /usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py but my dist-packages were empty! Can someone help me in this! Where can I find the py files? Thank you!
Your error indicates that it is unable to locate the file. I would suggest you to execute the following command in the directory where you have the graph and label files
python label_image.py exact_path_to_your_testimage_file.jpg
I have retrained Tensorflow's Inception V3's last layer on a flower dataset. This was done using:
bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos
The training was successful, and then I ran:
bazel build tensorflow/examples/label_image:label_image
This too ran fine and next I ran:
bazel-bin/tensorflow/examples/label_image/label_image \
--graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt \
--output_layer=final_result \
--image=$HOME/flower_photos/daisy/21652746_cc379e0eea_m.jpg
When I run this, I receive an error that says
E tensorflow/examples/label_image/main.cc:285] Not found: Failed to load compute graph at '/tmp/output_graph.pb'
Any help is greatly appreciated, thank you.
I have run this using following command instead of bazel and I found it easier.
python /path_to_file/label_image.py /path_to_image/image.jpeg
First make sure that graph is created after you run retrain.py and it is at the correct location. (default is inside /tmp/). If you want you can get the script here and you can change the file locations as per your need.
Note: If graph file is not created you may want to check this regarding running retrain.py
When I follow the tutorials of "How to Retrain Inception's Final Layer for New Categories", I need to build the retainer like this
bazel build tensorflow/examples/image_retraining:retrain
However, my tensorflow on windows does not have such directory. I am wondering why and how can I solve the problem?
Thank you in advance
In my case tensorflow version is 1.2 and corresponding retrain.py is here.
Download and extract flowers images from here.
Now run the the retrain.py file as
python retrain.py --image_dir=path\to\dir\where\flowers\images\where\extracted --output_lables=retrained_labels.txt --output_graph=retrained_graph.pb
note: the last two arguments in the above command are optional.
Now to test the retrained model:
go the master branch and download the label_image.py code as shown below
Then run python label_image.py --image=image/path/to/test/classfication --graph=retrained_graph.pb --labels=retrained_labels.txt
The result will be like
From the screenshot, it appears that you have installed the TensorFlow PIP package, whereas the instructions in the image retraining tutorial assume that you have cloned the Git repository (and can use bazel to build TensorFlow).
However, fortunately the script (retrain.py) for image retraining is a simple Python script, which you can download and run without building anything. Simply download the copy of retrain.py from the branch of the TensorFlow repository that matches your installed package (e.g. if you've installed TensorFlow 0.12, you can download this version), and you should be able to run it by typing python retrain.py at the Command Prompt.
I had the same problem on windows. My windows could not find script.retrain. I downloaded retrain.py file from tensoflow website at here. Then, copied the file in the tensorflow folder and run the retrain script using Python command.
I'm learning TensorFlow, running version r0.10 on Ubuntu 16.04. I am working on the CIFAR-10 Tutorial and have trained the CNN in the example.
Where is the image data stored for this tutorial?
The data path is defined on this line, in cifar10.py:
tf.app.flags.DEFINE_string('data_dir', '/tmp/cifar10_data',
"""Path to the CIFAR-10 data directory.""")
However I am confused as to why I cannot find this directory. I have attempted to manually search for it, and also look through all the example directories for it.
It is getting saved in a relative path for your OS, not your working directory. Take a look at my answer here and see if that helps.