Skip to content

A repository to generate synthetic text image sentences/words pairs for OCR

Notifications You must be signed in to change notification settings

prathameshza/TextToImageGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text to Image Generator

A synthetic text image pair generator for OCR

Installation

install the required dependencies first

pip install -r requirements.txt

Launch the web app interface

streamlit run tig.py

It will automatically launch the instance on the browser, if not click on the local URL in terminal

local_url

Below interface will pop up!

tig_interface

How to use

Upload the Text/CSV/Excel file containing sentences or words, Below is a sample of text file containing words

SampleWords

Set the image width, image height (in pixels) and the number of image to be generated

The generated images will be stored in the output_images directory and a data.csv file containing the image name, text, font size, font file and word count as shown Below

datacsv

Generated Samples

words:

1 2

sentences:

4 3

Language support

All languages are supported 🥳 just use the proper font files.

Customization

The app will choose the fonts randomly, if you want to use only a single specific font then download and paste it into the font_files directory

supported font formats include: ttf, otf, woff, woff2, eot and pfb

Note: Changing the font also changes the images created per second

Below is the tested font and their speeds for Hindi image generation

Font Speed
Lohit-Devanagari 15-16 it/s
Gargi 17-18 it/s
Sura unicode 11-12 it/s
akshra unicode 4-5 it/s
Kurti dev 010 50-55 it/s
aakar regular 50-55 it/s
freesansbold 9-10 it/s
Nakula 8-9 it/s

About

A repository to generate synthetic text image sentences/words pairs for OCR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages