Skip to content

Convert 'labelme' project's output data to a dataset for OCR model training.

Notifications You must be signed in to change notification settings

DaveLogs/labelme-to-datasets-for-OCR-model-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

labelme-to-datasets-for-OCR-model-training

Convert 'labelme' project's output data to a dataset for OCR model training.

References

  1. 'labelme' project: https://github.com/wkentaro/labelme

Procedures

  1. Read 'label' and 'bbox' from json file.
  2. Crop the image using 'bbox' and save it.
  3. Write a label for each cropped image to the label file.

Usage example:

python3 convert.py \
        --input_path ./input \
        --output_path ./output

Input data structure:

/input
├── image00001.png
├── image00001.json
├── image00002.png
├── image00002.json
└── ...

Output data structure:

/output
└── /images
    #   [filename]_[idx].[ext]
    ├── image00001_00001.png
    ├── image00001_00002.png
    ├── image00002_00001.png
    ├── image00002_00002.png
    ├── ...
    └── labels.txt
  • Label file structure:

    {filename}\t{label}\n

    image00001_00001.png	abcd
    image00001_00002.png	efgh
    image00002_00001.png	ijkl
    image00002_00002.png	mnop
    ...
    

About

Convert 'labelme' project's output data to a dataset for OCR model training.

Resources

Stars

Watchers

Forks

Languages