This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62A7: Does TI AM68A/AM62A have support for paddleocr (OCR model )?

Part Number: AM62A7
Other Parts Discussed in Thread: AM68A

Hi Teams,
I am currently debugging PaddleOCR on the AM62A and AM68A platforms
. I found that most of the layers doesnot been supported by TIDL(And can not get correct result  when inference via TIDL .).

Could you please advise on how to properly configure the edgeai-tidl-tools to build this model? . Alternatively, do you have any other OCR models that you have successfully debugged and verified that you could recommend. Thanks.

log:

| Conv        | p2o.Conv.29        | Stride must be the same along both horizontal and vertical dimensions          |
| AveragePool | p2o.AveragePool.0  | Kernel size (3x2) with stride (3x2) not supported                              |
| ReduceMean  | p2o.ReduceMean.0   | Layer 273 - op type ReduceMean, Unknown input dimension, not supported by TIDL |
| Sub         | p2o.Sub.0          | Layer 274 - op type Sub, Unknown input dimension, not supported by TIDL        |
| Transpose   | Transpose_token_0  | Layer 275 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| ReduceMean  | p2o.ReduceMean.2   | Layer type not supported by TIDL                                               |
| Slice       | p2o.Slice.6        | Layer 286 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Slice       | p2o.Slice.4        | Layer 289 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Slice       | p2o.Slice.8        | Layer 295 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Squeeze     | p2o.Squeeze.1      | Layer 287 - op type Squeeze, Unknown input dimension, not supported by TIDL    |
| Transpose   | Transpose_token_4  | Layer 290 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| Transpose   | Transpose_token_6  | Layer 296 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| Transpose   | p2o.Transpose.2    | Layer 288 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| Slice       | p2o.Slice.15       | Layer 333 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Slice       | p2o.Slice.13       | Layer 336 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Slice       | p2o.Slice.17       | Layer 342 - op type Slice, Unknown input dimension, not supported by TIDL      |
| Squeeze     | p2o.Squeeze.4      | Layer 334 - op type Squeeze, Unknown input dimension, not supported by TIDL    |
| Transpose   | Transpose_token_11 | Layer 337 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| Transpose   | Transpose_token_13 | Layer 343 - op type Transpose, Unknown input dimension, not supported by TIDL  |
| Transpose   | p2o.Transpose.5    | Layer 335 - op type Transpose, Unknown input dimension, not supported by TIDL  |
---------------------------------------------------------------------------------------------------------------------

  • Hi Yongbing,

    I took a look at the model supplied by a member of our field team.

    The layers within the model look to all be supported (though may not run optimally -- HardSwish is natively supported in 11.01 SDK, but I see this was decomposed within your model into individual operations in your model). 

    | Transpose   | p2o.Transpose.5    | Layer 335 - op type Transpose, Unknown input dimension, not supported by TIDL  |

    What this means is that your model has not undergone "shape inference". This is where the models input dimensions are used to trace the model and determine intermediate tensor dimensions. We need this to allocate memory upfront and plan how to optimally use that memory (this is a standard practice called 'memory planning'). The same error is shown where there are 'dynamic' shapes in the model, which are ordinarily represented as variables like 'image_height' or 'num_classes'. Dynamic shapes are not supported. 

    You will need to run shape inference for your ONNX model. To run shape inference, you only need the input tensor shape to be defined before running the appropriate function -- see ONNX documentation for details [1]. 

    There is also a tool called 'onnxsim ' aka onnx-simplify [2] that does a good job of combining operators and eliminating unnecessary ones (including some that are produced during model export to handle shape-specific layers). We often run this prior to TIDL-import. 

    Note that there are situations where shape-inference and onnxsim cannot determine tensor shapes. These models will be challenging to accelerate with TIDL, and alternate structures/architectures should be explored -- otherwise, many layers may run on the CPU at significantly reduced performance. 

    [1] https://onnx.ai/onnx/api/shape_inference.html 

    [2] https://pypi.org/project/onnxsim 

  • Hi Reese, I failed to compile the PPOCR via onnxsim and tidl,could you please try on your side for me? thanks.

  • Hi Yongbing,

    Can you provide any error log, beyond what is already shown? We do have the model already. You generally need to set dynamic shapes as static first, then run shape inference so the model (visualized generated with netron.app) shows tensor dimensions. 

    BR,
    Reese