排除 crnn_cs.xml 檔案中額外輸出節點的快速步驟。
- 將 crnn_cs.onnx 文字辨識模型轉換為中間表示 (IR):
python mo.py --input_model crnn_cs.onnx - 在使用所產生的 IR 檔案執行 OpenCV text_detection.cpp 樣品時遇到錯誤:
(expected: 'outs.size() == (size_t)1'), where 'out.size()' is 5 must be equal to '(size_t)1' is 1 - IR 檔案包含 5 個輸出,而原始的 ONNX 模型只有一個輸出。
OpenCV text_detection.cpp樣本期望 DNN 資料庫執行輸出檢查,如果偵測到超過 1 個輸出,就會出現錯誤。
將結果替換為crnn_cs.xml檔案中的FakeResult,以取得額外的節點:
- 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"
使用 Model Optimizer 將模型轉換為 IR 時,可能會在優化期間分割特定層,而其他節點則透過OpenVINO庫識別為有效的節點。