Summary
Quick step to exclude extra output nodes in crnn_cs.xml file.
Description
- Converted crnn_cs.onnx text recognition model to Intermediate Representation (IR):
python mo.py --input_model crnn_cs.onnx - Encountered error when running OpenCV text_detection.cpp sample with the generated IR files:
(expected: 'outs.size() == (size_t)1'), where 'out.size()' is 5 must be equal to '(size_t)1' is 1 - The IR files contain 5 outputs, while the original ONNX model has only one output.
Resolution
OpenCV text_detection.cpp sample expects DNN library to perform an output check and will prompt an error if more than 1 output is detected.
Replace Result to FakeResult in crnn_cs.xml file for extra nodes:
- name="LSTM_183/FinalConcat/CellState/sink_port_0" type="Result"
- name="LSTM_183/FinalConcat/HiddenState/sink_port_0" type="Result"
- name="LSTM_201/FinalConcat/CellState/sink_port_0" type="Result"
- name="LSTM_201/FinalConcat/HiddenState/sink_port_0" type="Result"
- name="LSTM_183/FinalConcat/CellState/sink_port_0" type="FakeResult"
- name="LSTM_183/FinalConcat/HiddenState/sink_port_0" type="FakeResult"
- name="LSTM_201/FinalConcat/CellState/sink_port_0" type="FakeResult"
- name="LSTM_201/FinalConcat/HiddenState/sink_port_0" type="FakeResult"
Additional information
When converting models to IR using Model Optimizer, it is possible that certain layers are split during optimization, and the additional nodes are recognized as valid nodes by OpenVINO library.