I have trained segmentation and classification network in python using Tensorflow 2.1. The Model is saved using SavedModel (.pb). Now, I want to test the model, I need this to be done in C++.
I saw many information about C++ API for Tensorflow 1.x, except TF 2.x.
The official tensorflow site says "Note: There is no libtensorflow support for TensorFlow 2 yet. It is expected in a future release.".
Does anyone know of a possible way?
It will be great help to me.
Thanks.
Related
I did transferlearning by using MaskRCNN for multiple-object detection in an environment with:
python=3.6.12
tensorflow==1.15.3
keras==2.2.4
mrcnn==2.1
And the model works.
Now I would like to implement mrcnn real-time with my laptop camera and OpenCV.
Firstly, I would apply face detection with res10_300x300_ssd_iter_140000.caffemodel because my mrcnn model works better if it is run on a face. I chose res10 because I have aleady used it in another project and it worked well!
Unfortunatly, I notice that MaskRCNN doesn't work with the latest version of tensorflow. Moreover, res10_300x300_ssd_iter_140000.caffemodel doesn't work with old versions of tensorflow and I get this error: "ValueError: Unknown layer: Functional".
I would like to know if it is possible to use res10_300x300_ssd_iter_140000.caffemodel
with previous versions of tensorflow, isn't it?
Is there a way to do a porting of MaskRCNN to a more recent version of tensorflow?
Or, is there a way to use res10 with old versions of tensorflow?
A different model for face detection in opencv with a good accuracy?
A different model rather than mrcnn tha is compatible with res10?
Any advice is welcome!
Thanks!
My Resources:
https://github.com/opencv/opencv/wiki/Deep-Learning-in-OpenCV
https://machinelearningmastery.com/how-to-train-an-object-detection-model-with-keras/
https://www.pyimagesearch.com/2020/05/04/covid-19-face-mask-detector-with-opencv-keras-tensorflow-and-deep-learning/
Basically I have been trying to train a custom object detection model with ssd_mobilenet_v1_coco and ssd_inception_v2_coco on google colab tensorflow 1.15.2 using tensorflow object detection api. As soon as I start training it throws error for both the models respectively.
I also ran the python object_detection/builders/model_builder_tf1_test.py and it passed all the test without any errors or warnings.
ValueError: ssd_inception_v2 is not supported. See model_builder.py for features extractors compatible with different versions of Tensorflow.
ValueError: ssd_mobilenet_v1_coco is not supported. See model_builder.py for features extractors compatible with different versions of Tensorflow.
I have successfully changed the tensorflow to 1.15.2 by using below command this is my first step before installing any of the dependencies.
%tensorflow_version 1.x
import tensorflow
print(tensorflow.__version__)
When I checked the model_builder.py I can see that they still have support for ssd_mobilenet_v1 and ssd_inception_v2. I want to deploy my custom trained model ssd_mobilenet_v1 or ssd_inception_v2 on jetson tx2 by converting them into trt-tf models
. In these 2 documents https://www.elinux.org/Jetson_Zoo and https://github.com/NVIDIA-AI-IOT/tf_trt_models#od_models we can see object detection models which can be converted to tf-trt models. So my question is how can I train these models as they are supported on google colab on tensorflow 1.15.2 and deploy on jetson txt for converting them to tf-trt models? Can anyone guide me through it would be really helpful to conitue my learning and learn something interesting thanks
i think you downloaded both of the models from tensorflow v2 repository and tensorflow 1.15 will obviously not support them.
download models from here : https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md
and try again.good luck
I am using https://github.com/fizyr/keras-retinanet this implementation of retinanet which is implemented with tensorflow and keras. So I want to use produced model in c++ for inference. But when I search for it, I can't find anything to try for tensorflow version>=2.0 . There is a good documentation for this operation for pytorch https://pytorch.org/tutorials/advanced/cpp_export.html . I am looking for tensorflow version of it. Thanks.
I'm working on an object detection project. I followed the instruction from Github.
But I used a different model.
I run this command
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config
The error is
ValueError: ssd_inception_v2 is not supported. See `model_builder.py` for features extractors compatible with different versions of Tensorflow
I don't know why. I tried to change the model version but still error.
Please guide me. How to solve it?
I already knew how to solve it. I used model which is support Tensorflow 1., but I build my program with Tensorflow 2.. So, I changed the to use a model which support tensorflow 2.*
For those asking where to find v2 version of ssd_mobilenet_v1_coco trained models please visit and download appropriate model:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf2_detection_zoo.md
Apple's new CoreML can work with models trained on popular framework. At least they say so at 18" in the WWDC video. But in the docs it seems that concerning neural nets they only support Caffe and Keras 1.2.2 (see code), while Keras it on it 2.0 version and Tensorflow and Theano are quite popular in their own rights.
To get the conversion running with Keras 2, is there a better way than implementing the conversion myself? The Keras conversion code in the coremltools package is ~2000 lines longs and I don't have a deep knowledge of all Keras model representation so I really don't want to go that route.
I've tried converting a model saved with Keras 2 directly, but that doesn't work and fails with
TypeError: ('Keyword argument not understood:', u'gamma_initializer')
from site-packages/keras/engine/topology.py", line 326
They also don't have a github for coremltools so it's hard to discuss this package in more details. I've uploaded a copy of the package: https://github.com/gsabran/coremltools
Keras 2.0 support is already there (released yesterday), with coremltools v.0.4.0
Also, refer to newest comments on Apple Developer Forums