Hi
from this issue and many similar, I know that OpenCV can not import BidirectionalLSTM when my model is written in Keras and converted to ONNX. but when I write my model in PyTorch and convert it to ONNX OpenCV CAN import BidirectionalLSTM. I just wonder why this is happening. any help would be highly appreciated
which opencv is it ?
(issue is a year old)
My OpenCV version is 4.5.3. and if you notice OpenCV has just fixed this issue in this commit. but my question is why this is happening because this is definitely not related to which framework I use
and the exact errors are ?
did you find out, what the differences between the models are ?
The error is:
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (310) getLayerParams DNN/ONNX/Attribute[activations]: âStringsâ (6) are not supported
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(0) = âSigmoidâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(1) = âTanhâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(2) = âTanhâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(3) = âSigmoidâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(4) = âTanhâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (313) getLayerParams Attribute[activations].string(5) = âTanhâ
[ERROR:0] global /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp (2125) handleNode DNN/ONNX: ERROR during processing node with 8 inputs and 3 outputs: [LSTM]:(bidirectional_4_Y)
terminate called after throwing an instance of âcv::Exceptionâ
what(): OpenCV(4.5.3) /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp:2146: error: (-2:Unspecified error) in function âhandleNodeâ
Node [LSTM]:(bidirectional_4_Y) parse error: OpenCV(4.5.3) /build/opencv/src/opencv-4.5.3/modules/dnn/src/onnx/onnx_importer.cpp:315: error: (-213:The function/feature is not implemented) DNN/ONNX/Attribute[activations]: âStringsâ (6) are not supported in function âgetLayerParamsâ
so, 4.5.3 release does not have the fix.
what about updating to latest master ?
it shouldnt be so, but it is, unfortunately
No, I can not use the non-stable version.
this is the point I can not understand. because the ONNX specification should be the same ( for a specific opset) regardless of the framework I use. I mean there should be no differences when you convert BidirectionalLSTM written in Keras and when you convert it in Pytorch
hey, yea. unfortunately, opencv devs there dont âimplement an onnx opsetâ, just the most needed parts to support the âmodel zooâ
and the pytorch workflow is simply better tested, than keras or such
That was the answer i was looking for. thank you so much for your answer and your time :))