Generates training data with JSON annotations for training Tesseract OCR on custom text characters/codes and is fully compatible with Supervisely.
- GUI app to generate/edit box and tiff files for Tesseract 4.0.0 training
- One-click training as well at some point.
Generates the outputdir directory with the following tree structure:
├── outputdir
│ ├── train
│ │ ├── img
│ │ ├── ann
│ ├── test
│ │ ├── img
│ │ ├── ann
│ ├── meta.jsonWith images stored in their respective train (or test) /img folder and annotations in the train (or test) /ann folder. The meta.json file contains data for Supervisely. The annotations Json contains the text in the image, and the Top Left and Bottom Right co-ordinates of the bounding box. The text can be accessed by json['objects'][0]['description'] and the points can be accessed by json['objects'][0]['points']['exterior'].
- Clone the repo with
git clone https://github.com/rafayk7/tesseractDataGenerator.git - Download requirements with
pip install requirements.txt - Run run.py with
python3 run.py
- trainingAmt - Number of total images to be generated (default 1000)
- trainTestSplit - Split between number of training and testing images in range [0,1] (default 0.7)
- codesfile - path to the file with codes/chars to generate training images from (default codesKOR.txt)
- outputdir - directory to store all generated data (default /data)
- getTextImgForTraining
- minAngle - lower bound angle for skew generation
- maxAngle - upper bound angle for skew generation
- (W, H) - size of text image (not final training image - see getTrainingImage)
- fontSize - size of font of text - change with getTrainingImage
- getImgJson
- format of JSON annotations file - currently in compatibility with Supervisely
- width, height - width and height of training image, change with (Wimg, Himg) in getTrainingImage
- getTrainingImg
- fontSize - size of font of text - change with getTextImgForTraining
- (Wimg, Himg) - size of final training image
- backgroundImgPath - path to background image for training images

