Coder Social home page Coder Social logo

text_renderer-1's Introduction

Text Renderer

Generate text images for training deep learning OCR model (e.g. CRNN). example

  • Modular design. You can easily add Corpus, Effect, Layout.
  • Support generate lmdb dataset which compatible with PaddleOCR, see Dataset
  • Support render multi corpus on image with different font, font size or font color. Layout is responsible for the layout between multiple corpora
  • Generate vertical text
  • Corpus sampler: helpful to perform character balance

Quick Start

To use text_renderer, you should prepare:

  • Font file: .ttf or...
  • Background image
  • Text: Optional. Depends on the corpus you use.
  • Character set: Optional. Depends on the corpus you use.

Run following command to generate image using example data:

git clone https://github.com/oh-my-ocr/text_renderer
cd text_renderer
python3 setup.py develop
pip3 install -r docker/requirements.txt
python3 main.py \
    --config example_data/example.py \
    --dataset img \
    --num_processes 2 \
    --log_period 10

The data is generated in the example_data/output directory.

main.py script only has 4 arguments:

  • config:Python config file path
  • dataset: Dataset format img/lmdb
  • num_processes: Number of processes used
  • log_period: Period of log printing. (0, 100)

All parameters related to the example image generation process are all configured in example.py

Learn more at documentation

Run in Docker

Build image

docker build -f docker/Dockerfile -t text_renderer .

Config file is provided by CONFIG environment. In example.py file, data is generated in example_data/output directory, so we map this directory to the host.

docker run --rm \
-v `pwd`/example_data/docker_output/:/app/example_data/output \
--env CONFIG=/app/example_data/example.py \
--env DATASET=img \
--env NUM_PROCESSES=2 \
--env LOG_PERIOD=10 \
text_renderer

Build docs

cd docs
make html

Open _build/html/index.html

text_renderer-1's People

Contributors

ohmyocr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.