This brief guideline is designed to simplify the use of the Python script developed for generating license plate imagery data, essential for training machine learning-based ALPR algorithms.
A target folder shall be created as the central location for all files related to the project. All relevant files, residing in their respective subfolders, should be transferred to the target folder. The content of the various directories is as illustrated below and detailed in Table 1 below.
Directory Tree:
Table 1: List Of Relevant Files
| File | Description |
|---|---|
| EuroPlate.ttf | Font file as used by the Python script in order to write the license plate number onto the image. |
| LicensePlateGenerator.py | Python script to generate the synthetic data. |
| eu_patch.png | Image file for the EU patch applied onto the license plate images by the script. |
| german_police_registration.jpg | Image file for the German police registration patch applied onto the license plate images by the script. |
The following modules shall be installed and made available to the environment.
Table 2: List Of Dependencies For Data Generator
| Package Name | Version Number |
|---|---|
| Pillow | 9.5.0 |
| matplotlib | 3.7.1 |
| numpy | 1.23.5 |
| openpyxl | 3.1.2 |
| pandas | 1.4.4 |
The following parameters shall be defined and set before execution of the script.
Table 3: List And Meaning Of Configuration Parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
number_of_plates_to_generate |
Int | 1000 | The total number of license plates to be generated. |
number_of_images_per_plate |
Int | 183 | The number of images to generate for each plate, based on the likelihood of appearance specified by the next parameter. |
likelihood_to_appear |
Float | 0.25 | The probability that an image of a particular license plate number will be generated for a given cycle and plate. |
show_inline |
Bool | False | Determines whether images should be displayed inline during generation, which may impact performance. |
max_rotation_angle |
Int | 2 | The maximum degree to which an image should be rotated. |
max_gaussianblur_radius |
Int | 2 | The maximum radius for the Gaussian blur filter applied to the images. |
grains_to_add |
Bool | True | Specifies whether grains (noise) should be added to the images. |
different_lighting |
Bool | True | Indicates whether to create images with varying lighting conditions. |
dest_folder |
Str | 'data' | The destination folder where the generated images will be saved. |
After configuring the script accordingly, it can be executed as follows. Note, that the script will generate the target folder, should it not exist. If the script is to be executed using an IDE rather than the command line, it is important to ensure that the console's working directory is set to the location where the script is located.
python LicensePlateGenerator.py
Table 2: Output Generated By The Script
| Output Type | Description |
|---|---|
| Imagery Data | A set of JPG-Files with UUIDs as their filenames. These UUIDs are unique and cannot be associated with the license plate number or cycle they belong to. |
| Mapping File | An Excel file containing a matrix matching filenames with license plate numbers and cycles. Filename syntax: 0_LPN_Data_%Y-%m-%d_%H-%M.xlsx. Includes tables with statistical information describing the data generated. |
| Statistical Descriptions | A set of PNG-Files created to graphically illustrate the statistical data mentioned above. |