--- license: agpl-3.0 language: - en pipeline_tag: object-detection tags: - Axera - License Plate Recognition - NPU - OCR - Object Detection --- # plate-axera This version of **plate-axera** has been converted to run on the Axera NPU using **w8a16** quantization. There are two models included: 1. **pld_650_npu3.axmodel**: This model is trained to detect the license plate with label 'plate'. 2. **plr_650_npu3.axmodel**: This model is trained to recognize the characters of detected license plates, and also shows the color of the license plate. ## Supported Classes Detection model supports the following classes: 1. **plate** ## Supported characters Recognition model supports the following characters: ``` {"皖沪津渝冀晋蒙辽吉黑苏浙京闽赣鲁豫鄂湘粤桂琼川贵云藏陕甘青宁新警学港澳台使领挂OABCDEFGHJKLMNPQRSTUVWXYZ0123456789"} ``` ## Supported colors Recognition model supports the following colors: ``` ['blue', 'green', 'yellow', 'white', 'black'] ``` Compatible with Pulsar2 version: 5.2. ## Convert tools links: For those who are interested in model conversion, you can try to export axmodel through: - [The repo of AXera Platform](https://github.com/AXERA-TECH/ax-samples), where you can get the detailed guide. - [Pulsar2 Link, How to Convert ONNX to axmodel](https://pulsar2-docs.readthedocs.io/en/latest/pulsar2/introduction.html) ## Support Platform https://docs.m5stack.com/zh_CN/ai_hardware/AI_Pyramid-Pro - **AX650N/AX8850** - [M4N-Dock(爱芯派Pro)](https://wiki.sipeed.com/hardware/zh/maixIV/m4ndock/m4ndock.html) - [AI Pyramid](https://docs.m5stack.com/zh_CN/ai_hardware/AI_Pyramid-Pro) - [M.2 Accelerator card](https://docs.m5stack.com/en/ai_hardware/LLM-8850_Card) ## How to use Download all files from this repository to the device. ### python env requirement #### pyaxengine https://github.com/AXERA-TECH/pyaxengine ```bash wget https://github.com/AXERA-TECH/pyaxengine/releases/download/0.1.3.rc2/axengine-0.1.3-py3-none-any.whl pip install axengine-0.1.3-py3-none-any.whl ``` ### Inference with AX650 Host, such as M4N-Dock(爱芯派Pro) #### Plate Detection Input image: ![](test.jpg) run ```bash python3 axmodel_infer_pld.py ``` ```bash root@ax650:~/plate-axera# python3 axmodel_infer_pld.py [INFO] Available providers: ['AxEngineExecutionProvider', 'AXCLRTExecutionProvider'] [INFO] Using provider: AxEngineExecutionProvider [INFO] Chip type: ChipType.MC50 [INFO] VNPU type: VNPUType.DISABLED [INFO] Engine version: 2.12.0s [INFO] Model type: 2 (triple core) [INFO] Compiler version: 5.2 eccb31f5 class: plate left:597 top:417 right:759 bottom:475 conf: 88% ``` Output image: ![](det_res.jpg) #### Plate Recognition Input image: ![](苏A8A68Y.jpg) run ```bash python3 axmodel_infer_plr.py ``` ```bash root@ax650:~/plate-axera# python3 axmodel_infer_plr.py [INFO] Available providers: ['AxEngineExecutionProvider', 'AXCLRTExecutionProvider'] [INFO] Using provider: AxEngineExecutionProvider [INFO] Chip type: ChipType.MC50 [INFO] VNPU type: VNPUType.DISABLED [INFO] Engine version: 2.12.0s [INFO] Model type: 2 (triple core) [INFO] Compiler version: 5.2 eccb31f5 Plate: [苏A8A68Y], score: 0.9997, color: [blue], score:1.0000 ``` #### Plate det & Rec End2End Input image: ![](test.jpg) run ```bash python3 axmodel_infer_plate_end2end.py ``` ```bash root@ax650:~/plate-axera# python3 axmodel_infer_plate_end2end.py [INFO] Available providers: ['AxEngineExecutionProvider', 'AXCLRTExecutionProvider'] [INFO] Using provider: AxEngineExecutionProvider [INFO] Chip type: ChipType.MC50 [INFO] VNPU type: VNPUType.DISABLED [INFO] Engine version: 2.12.0s [INFO] Model type: 2 (triple core) [INFO] Compiler version: 5.2 eccb31f5 [INFO] Using provider: AxEngineExecutionProvider [INFO] Model type: 2 (triple core) [INFO] Compiler version: 5.2 eccb31f5 Det---class:[plate], bbox:[597,417,759,475], conf:0.88 Rec---Plate:[川A2E7V7], score:0.9991, color:[blue], score:1.0000 Result saved to: ./plate_end2end_res.jpg ``` Output image: ![](plate_end2end_res.jpg)