Repository: opencv
Issue: text detection sample program occurs error, because VGG_CTC.onnx requires float16 input data
Labels: feature,category: dnn

<!--
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
<!-- Example
- OpenCV => 4.2
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
-->

- OpenCV => 4.5.3
- Operating System / Platform => Windows 64 Bit

##### Detailed description

<!-- your description -->
I’m trying this tutorial about OCR.  
https://docs.opencv.org/master/d9/d1e/tutorial_dnn_OCR.html  

I followed steps and download some sample pre-trained models from this google drive.  
https://drive.google.com/drive/folders/1cTbQ3nuZG-EKWak6emD_s8_hHXWz7lAr?usp=sharing  

Then, I tried some pre-trained models with sample programs.  
https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.py

Most of them work correctly, except for models that requests input float16 data.  
I also know that OpenCV's DNN module does not work with models that require float16 input.  
Therefore, It is correct that CRNN_VGG_BiLSTM_CTC_float16.onnx will not work. It is OK.

Just one thing, VGG_CTC.onnx did not work.  
I check that model on netron.app, it is requires float16 input data.  
![VGG_CTC onnx](https://user-images.githubusercontent.com/816705/134638820-eba3fc9e-fe01-45e7-95ae-0f84f92648fb.png)

However, that's strange. In the Google Drive, VGG_CTC_float16.onnx exists separately from VGG_CTC.onnx.  
Therefore, I thought that VGG_CTC.onnx should be a model that requires float32 input data.  
![pre-trained_models](https://user-images.githubusercontent.com/816705/134639100-9c10739d-d0a2-4597-9463-e4c2bc4ff454.png)

I think you upload the wrong file.  
If so, Please re-upload VGG_CTC.onnx that requires float32 input data.  
That model is important because it is [recommended](https://github.com/opencv/opencv/blob/master/doc/tutorials/dnn/dnn_OCR/dnn_OCR.markdown#model-selection-suggestion) in the tutorial.
![recommend](https://user-images.githubusercontent.com/816705/134640835-cc8e1584-4436-4d8a-9603-91704acbf53b.png)

Thanks,

##### Steps to reproduce

<!-- to add code example fence it with triple backticks and optional file extension
    ```.cpp
    // C++ code example
    ```
 or attach as .txt or .zip file
-->

1. install opencv-python
    ```
    pip install opencv-python
    ```

2. download models
    * text detection model (frozen_east_text_detection.pb) :  https://www.dropbox.com/s/r2ingd0l3zt8hxs/frozen_east_text_detection.tar.gz?dl=1
    * text recognition model (VGG_CTC.onnx) : https://drive.google.com/drive/folders/1cTbQ3nuZG-EKWak6emD_s8_hHXWz7lAr?usp=sharing

3. run sample program with fix https://github.com/opencv/opencv/pull/20742
    * https://github.com/opencv/opencv/blob/master/samples/dnn/text_detection.py
    ```
    python text_detection.py --model=./frozen_east_text_detection.pb --ocr=./VGG_CTC.onnx
    ```

4. error occurs
    ```
    Traceback (most recent call last):
    File "text_detection.py", line 242, in <module>
      main()
    File "text_detection.py", line 153, in main
      recognizer = cv.dnn.readNet(modelRecognition)
    cv2.error: OpenCV(4.5.3) C:\Users\runneradmin\AppData\Local\Temp\pip-req-build-q3d_8t8e\opencv\modules\dnn\src\onnx\onnx_graph_simplifier.cpp:651: error: (-210:Unsupported format or combination of formats) Unsupported data type: FLOAT16 in function 'cv::dnn::dnn4_v20210608::getMatFromTensor'
    ```

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with forum.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://forum.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [x] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->