17. License Plate Recognition

17. License Plate Recognition17.1. Experimental Objectives17.2. Preparation before the experiment17.3, Experimental process17.4, Experimental results17.5, Experimental summary

17.1. Experimental Objectives

This lesson mainly studies the license plate recognition function of K210.

The reference code path for this experiment is: K210 Developer Kit Data\10.MicroPython Version\Source Code\car_licenseplate_recog_cn.py

17.2. Preparation before the experiment

! Note! : Since the model and weight files used in this case are large, the lite version firmware must be flashed before running, otherwise it will freeze.

Please follow the steps below to run the license plate recognition example:

  1. Save the license plate recognition code to the SD card and name it main.py
  2. Use the K-Flash tool to burn the canmv-dev-kit-lite-V2.0.6 firmware
  3. Unplug the data cable and power it on again, the license plate recognition example will be automatically executed
  4. After the operation is completed, please burn back to the original firmware (canmv-dev-kit-V2.0.6.bin), otherwise you will not be able to connect to the IDE

image-20241017163721299

Please confirm whether the SD card model, font library and weight file are imported successfully:

  1. /sd/KPU/car_licenseplate_recog/lp_detect.kmodel
  2. /sd/KPU/car_licenseplate_recog/lp_recog.kmodel
  3. /sd/0xA00000.Dzk
  4. /sd/KPU/car_licenseplate_recog/lp_weight.bin

17.3, Experimental process

The factory firmware of the module has integrated the AI ​​visual algorithm module. If you have downloaded other firmware, please burn it back to the factory firmware before conducting the experiment.

  1. Initialize the font library and the parameters required for the model
  1. Loading model file
  1. Define the function for drawing the license plate border
  1. Main program: frame the license plate and recognize the license plate text

17.4, Experimental results

Connect the K210 module to the computer via a microUSB data cable, click the connection button in CanMV IDE, and click the run button after the connection is completed to run the example code. You can also download the code as main.py to the K210 module and run it.

After waiting for the system to initialize, the LCD displays the camera image, and the license plate on the screen will be framed by a green frame and the license plate information will be recognized.

image-20241017164836723

17.5, Experimental summary

Hand recognition requires a memory card to load the model file, so you need to import the model file into the memory card in advance, and then insert the memory card into the memory card slot of the K210 module. If the model file in the memory card cannot be read, an error will be reported. The model and weight files used in this case are large, and the lite version firmware needs to be flashed before running, otherwise it will freeze. In this experiment, we learned how to implement the license plate recognition function based on yolo on the K210 platform. Due to the limitation of model size, the recognition accuracy may be affected. You can train a better model by yourself.