Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6427 Discussions

convert to onnx https://github.com/MaybeShewill-CV/CRNN_Tensorflow

AR92
New Contributor I
2,112 Views

hi,

i am following this link https://docs.openvinotoolkit.org/2020.1/_docs_MO_DG_prepare_model_convert_model_tf_specific_Convert_CRNN_From_Tensorflow.html 

in the third step i was getting AssertionError  

 

 

frozen = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['shadow/LSTMLayers/transpose_time_major'])

 

 

 shadow/LSTMLayers/transpose_time_major is not in graph

i changed it to below 

 

 

frozen = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['shadow_net/sequence_rnn_module/stack_bidirectional_rnn/cell_0/bidirectional_rnn/fw/fw/while/Identity_2'])

 

 

and frozen_graph is generated, i am trying to use this frozen graph with this link example https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.cpp 

and opencv throws error

 

 

[ERROR:0] global C:\jenkins\workspace\OpenCV\OpenVINO\2020.3\build\windows\opencv\modules\dnn\src\dnn.cpp (3272) cv::dnn::dnn4_v20200310::Net::Impl::getLayerShapesRecursively OPENCV/DNN: []:(_input): getMemoryShapes() throws exception. inputs=1 outputs=0/0 blobs=0
[ERROR:0] global C:\jenkins\workspace\OpenCV\OpenVINO\2020.3\build\windows\opencv\modules\dnn\src\dnn.cpp (3275) cv::dnn::dnn4_v20200310::Net::Impl::getLayerShapesRecursively input[0] = [ 1 1 32 100 ]
[ERROR:0] global C:\jenkins\workspace\OpenCV\OpenVINO\2020.3\build\windows\opencv\modules\dnn\src\dnn.cpp (3285) cv::dnn::dnn4_v20200310::Net::Impl::getLayerShapesRecursively Exception message: OpenCV(4.3.0-openvino-2020.3.0) C:\jenkins\workspace\OpenCV\OpenVINO\2020.3\build\windows\opencv\modules\dnn\src\dnn.cpp:790: error: (-215:Assertion failed) inputs.size() == requiredOutputs in function 'cv::dnn::dnn4_v20200310::DataLayer::getMemoryShapes'

OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.3.0-openvino-2020.3.0) Error: Assertion failed (inputs.size() == requiredOutputs) in cv::dnn::dnn4_v20200310::DataLayer::getMemoryShapes, file C:\jenkins\workspace\OpenCV\OpenVINO\2020.3\build\windows\opencv\modules\dnn\src\dnn.cpp, line 790

 

 

 

i have trained my model from https://github.com/MaybeShewill-CV/CRNN_Tensorflow.git

i am new to tensorflow , can anyone please have a look  

i have uploaded my model to drive https://drive.google.com/drive/folders/1wgFcC3a5jMqcRFvKmj4XFAv_b7ATt9xV?usp=sharing please have a look.

 

 

Labels (1)
0 Kudos
1 Solution
Sahira_Intel
Moderator
2,025 Views

Hi,

https://github.com/MaybeShewill-CV/CRNN_Tensorflow has not been validated for the C++ Text Detection sample.

Best Regards,

Sahira 

View solution in original post

0 Kudos
4 Replies
AR92
New Contributor I
2,072 Views

i also tried to convert it into IR, but got some error

 

Model Optimizer version:
2020-07-28 17:18:42.925656: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-07-28 17:18:42.925785: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
[ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.front.output_cut.OutputCut'>): Graph contains 0 node after executing <class 'extensions.front.output_cut.OutputCut'>. It considered as error because resulting IR will be empty which is not usual
0 Kudos
Munesh_Intel
Moderator
2,064 Views

Hi Amit,


Please provide the command given to Model Optimizer to convert your trained model to Intermediate Representation (IR), and environment details (versions of OS, TensorFlow, Python, CMake, etc.).


Regards,

Munesh


0 Kudos
AR92
New Contributor I
2,059 Views

hi ,

command i tried is 

 

python mo_tf.py --input_model E:\CRNN_Tensorflow-case\frozen_graph_test.pb --reverse_input_channels   --data_type FP32 --input_shape="[1,32,100,3]"  --output_dir IR

 

 

 i trained this model in ubuntu 18.04, tensoflow-gpu 1.15, python 3.7

and to convert the frozen_graph i used

windows 10 x64bit machine,

tensorflow-cpu 1.15,

python 3.7

cmake 3.14.5

i have also converted a tensorflow ssd object detection model to IR and that is working fine.

 

 

0 Kudos
Sahira_Intel
Moderator
2,026 Views

Hi,

https://github.com/MaybeShewill-CV/CRNN_Tensorflow has not been validated for the C++ Text Detection sample.

Best Regards,

Sahira 

0 Kudos
Reply