- OpenCV => 4.1.0
- Operating System / Platform => Ubuntu 16.04
Hello,
I have a problem using dnn module.
I made binary classification model using Keras.
I used pre-trained mobilenet v2 (imagenet)
And this is part of my code:
conv_base = MobileNetV2(weights='imagenet', include_top=False, input_shape=(96, 96, 3))
model = models.Sequential()
model.add(conv_base) # mobilenetv2
model.add(layers.Reshape([3 * 3 * 1280])) # Flatten() -> Reshape()
model.add(layers.Dense(256, activation='relu'))
model.add(layers.Dropout(0.5))
model.add(layers.Dense(1, activation='sigmoid'))
Of course, Error is occur
OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:524: error: (-2:Unspecified error) Can't create layer "strided_slice" of type "StridedSlice" in function 'cv::dnn::dnn4_v20190122::LayerData::getLayerInstance'
I found many questions about same problem.
But, change the 'Flatten()' to 'Reshape()' is not working solution.
I changed but, same error is still occur.
I saw reshape is only working in Keras version 2.0.8
But I can't using that version because using pretrained mobilenetv2.
It is not exist in Keras version 2.0.8
Is there any other solution about this problem?
Thank you.
Hello,
I have a problem using dnn module.
I made binary classification model using Keras.
I used pre-trained mobilenet v2 (imagenet)
And this is part of my code:
Of course, Error is occur
OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\dnn\src\dnn.cpp:524: error: (-2:Unspecified error) Can't create layer "strided_slice" of type "StridedSlice" in function 'cv::dnn::dnn4_v20190122::LayerData::getLayerInstance'
I found many questions about same problem.
But, change the 'Flatten()' to 'Reshape()' is not working solution.
I changed but, same error is still occur.
I saw reshape is only working in Keras version 2.0.8
But I can't using that version because using pretrained mobilenetv2.
It is not exist in Keras version 2.0.8
Is there any other solution about this problem?
Thank you.