0

usage: OpenCV 4.5.3-dev

I followed this example: https://github.com/opencv/opencv/blob/master/samples/dnn/scene_text_spotting.cpp It is use:

  • for the detection model: DB_TD500_resnet50.onnx
  • for the recognition model : crnn_cs.onnx
  • for the vocabulary: alphabet_94.txt
  • the decode type is set to: "CTC-prefix-beam-search"

These settings received the following error:

OpenCV(4.5.3-dev) C:\DevTools\opencv\modules\dnn\src\model.cpp:745: error: (-2:Unspecified error)     in function 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cv::dnn::TextRecognitionModel_Impl::ctcPrefixBeamSearchDecode(const class cv::Mat &)'
>  (expected: 'prediction.size[2] == (int)vocabulary.size() + 1'), where
>     'prediction.size[2]' is 96
> must be equal to
>     '(int)vocabulary.size() + 1' is 95
Albi
  • 41
  • 3

1 Answers1

0

Add one empty line at the end of the vocabulary or push_back one more item in the vocabulary vector. I don't know if is only a workaround or a real solution...