Does dnn opencv c++ support layer:DepthwiseConv2dNative

asked 2020-09-03 03:50:39 -0600

rajaajar gravatar image

i have a TensorFlow model(.pb)for semantic segmentation, that contains a layer: DepthwiseConv2dNative . i can read the model using net.forward() in python, and the result are accurate.But, with net.forward() in c++, all results are Black. After some investigations, the results after DepthwiseConv2dNative are all the same with different inputs. does dnn opencv C++ support this layer: DepthwiseConv2dNative ? code in c++ used too read the model:

   Mat img = imread("Path to image");
   img.convertTo(img, CV_32F);
   String model = ("Path to model");
   Net net = readNetFromTensorflow(model);
   Scalar mean = (-1.0, -1.0, -1.0); float scale = 0.007843137718737125; 
   Mat blob = blobFromImage(img, scale, Size(250, 250), mean, false, false, CV_32F);  
   net.setInput(blob);
   Mat seg = net.forward();

Unfortunately i can't share the model.

edit retag flag offensive close merge delete

Comments

opencv version ?

(there is support for depthwise 2d convolution)

Unfortunately i can't share the model.

at least you could show us the resp. tf code, that built this model

berak gravatar imageberak ( 2020-09-03 04:35:37 -0600 )edit

-Opencv version: Opencv(4.4.0) Steps : 1-Export the model, i used this : https://github.com/tensorflow/models/...

2-For optimizing the model i used this Transformation: --in_graph="path to model" \ --out_graph="path" --inputs='ImageTensor' --outputs='SemanticPredictions' --transforms=' remove_nodes(op=Identity) fold_constants() fold_batch_norms fold_old_batch_norms sort_by_execution_order'

rajaajar gravatar imagerajaajar ( 2020-09-03 06:34:03 -0600 )edit

sorry, but that's all quite useless. needed would be the code that builds your model, not the code, that exports it.

is it this ?

also, what's the error msg ?

berak gravatar imageberak ( 2020-09-03 07:33:15 -0600 )edit