Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:npu:ksnn:demo:ppocr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
products:sbc:vim4:npu:ksnn:demo:ppocr [2025/01/08 22:34]
louis
products:sbc:vim4:npu:ksnn:demo:ppocr [2025/05/12 21:43] (current)
louis
Line 121: Line 121:
  
 ==== Picture input demo ==== ==== Picture input demo ====
 +
 +<WRAP important>
 +The demo use cn rec model. If you want to use other rec model, you need to modify the rec model output and character index dictionary.
 +
 +```python ppocr-picture.py
 +# model input and output
 +det_input_size = (736, 736) # (model height, model width)
 +rec_input_size = ( 48, 320) # (model height, model width)
 +rec_output_size = (40, 97) # rec output
 +```
 +
 +```python postprocess.py
 +character_str = ["blank"]
 +with open("./data/ppocr_keys_v1.txt", "rb") as fin: # the path for character index dictionary
 +    lines = fin.readlines()
 +    for line in lines:
 +        line = line.decode("utf-8").strip("\n").strip("\r\n")
 +        character_str.append(line)
 +character_str.append(" ")
 +ignored_token = [0]
 +```
 +
 +You can find the dictionary txt file in ''PaddleOCR/ppocr/utils''
 +</WRAP>
  
 ```shell ```shell
Last modified: 2025/05/12 21:43 by louis