Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Importing Bidirectional LSTM model via onnx shows an error

$
0
0
Hi, I'm trying to export model from [easyOCR](https://github.com/JaidedAI/EasyOCR) to ONNX and import it through openCV. I successfully exported it to ONNX, checked that it runs well, but failed to import the model through openCV using readNetFromONNX. Below is my model export code and the error: batch_size=1 x = torch.rand(batch_size,1,64,256).float().cpu() torch.onnx.export(model, (x,''), "ocr0807_0.onnx") net = cv2.dnn.readNetFromONNX('ocr0807_0.onnx') <- where error occurs error: (-215:Assertion failed) (int)_numAxes == inputs[0].size() in function 'getMemoryShapes' The error occurs at Bidirectional LSTM layer of the model even though I'm using openCV 4.4.0 and python 3.7. Below is the part of model code from easyOCR, which include Bidirectional LSTM: """ Sequence modeling""" self.SequenceModeling = nn.Sequential( BidirectionalLSTM(self.FeatureExtraction_output, hidden_size, hidden_size), BidirectionalLSTM(hidden_size, hidden_size, hidden_size)) self.SequenceModeling_output = hidden_size Would you please help me with this problem? Thank you.

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>