Article ID: 000087877 Content Type: Error Messages Last Reviewed: 05/20/2022

Unable to Run OpenCV* text_detection.cpp Sample with CRNN_CS Model Using OpenVINO™ Toolkit

BUILT IN - ARTICLE INTRO SECOND COMPONENT
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.

Related Products

This article applies to 2 products