Python code that can generate a large number of specified character images, which can be used in fields such as character recognition, to quickly expand the training dataset.
This python code is used to draw chars on background images to generate corresponding synthetic images, while simultaneously creating annotation files in YOLO format. It can be widely applied in fields such as character recognition, can automatically generate any number of training images and their corresponding annotation files, quickly expanding the train dataset.
If you find it useful, please give me a star. Thank you!
-
freely specify the list of characters to be generated, the length of the characters, the number of characters, and the number of images to be generated, based on actual requirements.
-
freely specify the list of fonts based on actual requirements.
-
freely specify the directory of background images based on actual requirements.
-
freely specify the color of the generated characters based on actual requirements.
pip install -r requirements.txt
python generate_chars_images.py
and then, generated images will be saved in generated_files/images, generated labels will be saved in generated_files/labels.
just enjoy!