# Towards Automatic License Plate Recognition in Challenging Conditions
## 4 Simulation Results
### Training Data Preparations and Model Training  
Before our developed method is executed, we initially prepare the data and make some assumptions to train the model. Algorithm 4 shows the arrangements for preparing the training data. To extract the LP digits from the input image, basic data processing (DP) operations are performed from lines 2-13 of Algorithm 4. Most of these DP operations include desaturating the image through a Gaussian low-pass filter and binarizing the image. Moreover, the erosion and dilation operations described above are also performed. Meanwhile, the LP image is converted to 28 \(\times\) 28 pixel image on which random spatial transformations are applied that ultimately result in a 28 \(\times\) 28 dataset with prominent characters and their classes. Since then, we have also performed experiments on the CCPD dataset, which has substantial license plate variations, such as tilted or blurred plates. For the tilted plates, spatial transformations are applied to the 28 \(\times\) 28 pixels converted image. This operation essentially corrects the appearance of the license plate and ultimately makes the algorithm easier to process. Similarly, for poor image quality in which characters are not fully visible, characters touch each other due to blur or similar phenomena. In such conditions, mathematical morphological image processing techniques, such as erosion and dilation as described in Equations (4) and (5), respectively, become handy. All the operations listed in Algorithm 4 essentially prepare and result in well-managed, systematic data that is nicely processed by our developed algorithm during the recognition task. After LP character data is obtained, in the next step, training of the LP recognition model is performed as shown in Algorithm 5, which takes the 28 \(\times\) 28 LP character image and yields the recognition model with weights. During the first part of the LP training, a 13-layer CNN is used to build a DNN. This DNN is then applied to a 3 \(\times\) 3 Conv2D layer along with a 2 \(\times\) 2 MaxPool layer. As shown in Algorithm 5, the next stages also apply a dense layer to perform the 50% dropout to obtain the appropriate model. During the model training, the LP characters are checked and predicted for a small batch of images. Meanwhile, to obtain good accuracy, weights are adjusted at regular intervals after each execution epoch. Once the training data and LP recognition model training are set, in the next section, we demonstrate our detailed observations and findings. Our LP recognition analysis and discussion are based on the PKU, AOLP, and CCPD datasets, which are well-known and widely used in research these days. ```
1. Input: Dataset of 28 \(\times\) 28 Images with character classes
2. begin LPR Training
3. begin Model Design
4. Apply the DNN with 13 Layers of the CNN
5. for\(i=1\):3
6. Conv2D 3 \(\times\) 3
7. MaxPool 2 \(\times\) 2
8. end for
9. Flatten the LP with a dropout of 50%
10. for\(i=1\):3
11. Use a dense Layer with a dropout of 50%
12. end for
13. end Model Design
14. begin Training
15. for\(epoch=1\):\(n\), get batch of images (\(i\))
16. for\(i=1\):\(n\)
17. Provide image to the model and check predicted characters adjust weights
18. end for
19. end for
20. end LPR Training
21. Output: Model with set weights
```  
**Algorithm 5** The LPR model training. After LP character data is obtained, in the next step, training of the LP recognition model is performed as shown in Algorithm 5, which takes the 28 \(\times\) 28 LP character image and yields the recognition model with weights. During the first part of the LP training, a 13-layer CNN is used to build a DNN. This DNN is then applied to a 3 \(\times\) 3 Conv2D layer along with a 2 \(\times\) 2 MaxPool layer. As shown in Algorithm 5, the next stages also apply a dense layer to perform the 50% dropout to obtain the appropriate model. During the model training, the LP characters are checked and predicted for a small batch of images.