Issue in tensorflow 2 google colab tutorial - google-colaboratory

I'm trying to follow the steps as dictated through this blog post https://medium.com/swlh/tensorflow-2-object-detection-api-with-google-colab-b2af171e81cc. I have edited the pipeline.config file as mentioned on step 13. After which I tried to run it on colab. While executing the following line of code I get the error as
#Step 15- Train the model.
#run the cell to start model training
!python model_main_tf2.py --model_dir=models/my_ssd_resnet50_v1_fpn --pipeline_config_path=models/my_ssd_resnet50_v1_fpn/pipeline.config
ValueError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on pre-trained-models/ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint/ckpt-0: Not found: pre-trained-models/ssd_resnet50_v1_fpn_640x640_coco17_tpu-8/checkpoint; No such file or directory
Any idea where I'm going wrong?

Related

PermissionError with spacy train on Windows

This question is same as asked in this GitHub discussion.
I am using the latest version (3.3.0).
This has also been discussed before: this previous discussion.
While training, I am facing errors like PermissionError: [WinError 5] Access is denied: 'output\\model-best\\ner'.
I am using the following line as mentioned in the earlier discussion (link above)
python -m spacy init config config.cfg --lang en --pipeline ner --force
(python -m spacy init fill-config base_config.cfg config.cfg also doesn't work)
Then I am converting some CoNLL 2003 data to spacy format (using spacy convert ... -c ner).
Then trying to train using
python -m spacy train ./config.cfg --output ./output --paths.train <path to train.spacy> --paths.dev <path to valid.spacy>
I am getting the following error:
...lots of lines...
File "C:\Users\username\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 620, in _rmtree_unsafe
os.rmdir(path)
PermissionError: [WinError 5] Access is denied: 'output\\model-best\\ner'
As mentioned in the earlier discussion, I have already tried running
import spacy, shutil
nlp = spacy.blank("en")
print("saving model")
nlp.to_disk("check-serialize")
print("deleting model")
shutil.rmtree("check-serialize")
print("delete finished")
and this works fine.
Using Windows Terminal in admin mode gives similar errors.
The config file can be found at the 1st link above.

Converting a saved tensorflow model to IR using openvino model optimizer

I trained a custom CNN model using keras and tensorflow 2.2.0 as background. After that, I saved the model as .ckpt file having assets, variables, .pb file as subfolders init. After that to convert it into IR in openvino documentation it is given that we have use the following command:
**To convert such TensorFlow model:
Go to the <INSTALL_DIR>/deployment_tools/model_optimizer directory
Run the mo_tf.py script with a path to the SavedModel directory to convert a model:
python3 mo_tf.py --saved_model_dir <SAVED_MODEL_DIRECTORY>**
so, I went to the following directory as mentioned and tired the following command:
python3 mo_tf.py --saved_model_dir C:\Users\vyas\Desktop\saved_model\cp.ckpt
There is no output or anything. There is no error also.
Also, I tried the following command:
python3 mo_tf.py --saved_model_dir C:\Users\vyas\Desktop\saved_model\cp.ckpt --output_dir C:\Users\vyas\Desktop\out
Still there is no output.
Can someone please help.
I am using tensorflow 2.2.0
Can someone please help me with this
--saved_model_dir must provide a path to the SavedModel directory.
Modify your command as follows:
python3 mo_tf.py --saved_model_dir C:\Users\vyas\Desktop\saved_model

SSDmobilenet pets config -> Faced error when tried to created tflite pb file from customize checkpoint created from transfer training

Faced error when tried to created tflite pb file from customize checkpoint created from transfer training
System information :
ubuntu - 18.0
tf.VERSION = 1.14.1-dev20190517
tf.GIT_VERSION = v1.12.1-2154-g3df6d99f3f
tf.COMPILER_VERSION = v1.12.1-2154-g3df6d99f3f
env : LD_LIBRARY_PATH /usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64
Tensorflow command:
python /object_detection/export_tflite_ssd_graph.py
--pipeline_config_path models/ssd_mobilenet_v1_pets.config
--trained_checkpoint_prefix model.ckpt-23595
--output_directory /tflite/
--add_postprocessing_op=true
Error log :
TypeError: export_tflite_graph() takes 6 positional arguments but 7 were given
Any help appreciated !
This is a bug with the script. We will fix it shortly.
Thanks for flagging!

"Import error:No module named Cython.Build" while training on Google Cloud ML Engine

I am trying to train a model on Google Cloud ML Engine with this command. I installed tensorflow with Anaconda.But while I training model , this error appears:
-Import error:No module named Cython.Build
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-0eA9cj/pycocotools/
I also added this line on setup.py :
"REQUIRED_PACKAGES = ['Pillow>=1.0', 'Matplotlib>=2.1', 'Cython>=0.28', 'pycocotools>=2.0.0'
But the problem is not solved,is there any idea to solve this problem?
Thanks in advance...
Same error for me, This is what worked for me, I added an extra --packages to my gcloud command, the packages i've downloaded from pip web repository as zip files and added as the below flag
--packages your-folder/Cython-0.28.1.tar.gz,your-folder/pycocotools-2.0.0.tar.gz --packages <your other object-detection and slim packages here>

Tensorflow unable to run strip_unused.pb (has no attribute '__path__')

Following the tutorial on TensorFlow for Poets (Android) (https://codelabs.developers.google.com/codelabs/tensorflow-for-poets-2/#0)
Attempting to use Inception model instead of Mobilenet
Trying to strip DecodeJpeg Op from the retrained model using strip_unused.py, but encountered the following error.
Error:
/home/user/tensorflow/bin/python: Error while finding spec for 'tensorflow.python.tools.strip_unused.py' (AttributeError: module 'tensorflow.python.tools.strip_unused' has no attribute '__path__')
Command line:
python -m tensorflow.python.tools.strip_unused.py --input_graph=tf_files/retrained_graph.pb --output_graph=tf_files/stripped_graph.pb --input_node_names="Mul" --output_node_names="final_result" --input_binary=true
Machine:
Ubuntu 16.04 LTS
Python 3.5.2
TensorFlow 1.4.1
Any assistance is greatly appreciated. Thanks!
Might be due to the typo mistake as file extension .py was specified. This seemed to work:
python -m tensorflow.python.tools.strip_unused --input_graph=tf_files/retrained_graph.pb --output_graph=tf_files/stripped_graph.pb --input_node_names="Mul" --output_node_names="final_result" --input_binary=true
Result: 997 ops in the final graph.