Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

DNN - own tensorflow model and issues with dropout

Hey guys, does anyone have an experience with training own TF model (nothing fancy, just Conv, Dropout, FC layers...). I am struggling with converting model so I can load it using OpenCV.DNN module. I've followed this approach. The problem is, that in the end there are still dropout layers.

dropout/random_uniform/max
dropout/random_uniform/min
dropout/random_uniform/sub
dropout/div
dropout/Shape
dropout/random_uniform/RandomUniform
dropout/random_uniform/mul
dropout/random_uniform
dropout/add
dropout/Floor
dropout/mul

And when I load the model (cv2.dnn.readNetFromTensorflow('deploy.pb')) I get an error (which make sense):

OpenCV(3.4.1) Error: Unspecified error (Unknown layer type Shape in op dropout/Shape) in populateNet, file /tmp/opencv-20180307-60086-ryy1b3/opencv-3.4.1/modules/dnn/src/tensorflow/tf_importer.cpp, line 1582 Traceback (most recent call last):
  File "run_tensorflow.py", line 24, in <module>
    net = cv2.dnn.readNetFromTensorflow('optimized_model.pb')
cv2.error: OpenCV(3.4.1) /tmp/opencv-20180307-60086-ryy1b3/opencv-3.4.1/modules/dnn/src/tensorflow/tf_importer.cpp:1582: error: (-2) Unknown layer type Shape in op dropout/Shape in function populateNet

Am I missing something?

Thanks in advance!