DNN - Load segmentation model with variable input shape

asked 2019-09-10 08:35:22 -0500

agorka gravatar image

Hello! I have a UNET segmentation model I trained with Keras and would like to load to OpenCV DNN. I converted it to PB with various algorithms but it fails to load with errors like this:

error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\dnn\src\tensorflow\tf_importer.cpp:582: error: (-2:Unspecified error) Input [bn_data/ones_like] for node [bn_data/FusedBatchNorm_1] not found in function 'cv::dnn::dnn4_v20190621::`anonymous-namespace'::TFImporter::getConstBlob'

I can not use .pbtxt converters as I don't have any of .config files they require.

I tried to convert the model to some other model format with mmdnn but getting errors like:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

It seems to be caused by the input shape of the model, which is (None, None, 3)

What could be done to make it work with OpenCV? Does it support (None, None) input shape at all?

Thank you in advance!

edit retag flag offensive close merge delete