Coder Social home page Coder Social logo

qutrino / synthtext_kr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youngkyung/synthtext_kr

0.0 0.0 0.0 43.19 MB

[KOREAN] Code for generating synthetic text images as described in "Synthetic Data for Text Localisation in Natural Images", Ankush Gupta, Andrea Vedaldi, Andrew Zisserman, CVPR 2016.

Python 96.28% MATLAB 3.72%

synthtext_kr's Introduction

SynthText_kr

This is KOREAN version code of original SynthText scene-text image generator. (You can find the English, original version in here: https://github.com/ankush-me/SynthText)

Code for generating synthetic text images as described in "Synthetic Data for Text Localisation in Natural Images", Ankush Gupta, Andrea Vedaldi, Andrew Zisserman, CVPR 2016.

Korean Synthetic Scene-Text Image Samples Synthetic Scene-Text Samples

The main dependencies are:

pygame, opencv (cv2), PIL (Image), numpy, matplotlib, h5py, scipy

Pre-processed Background Images

The 8,000 background images used in the paper, along with their segmentation and depth masks, have been uploaded here: http://zeus.robots.ox.ac.uk/textspot/static/db/<filename>, where, <filename> can be:

  • imnames.cp [180K]: names of filtered files, i.e., those files which do not contain text
  • bg_img.tar.gz [8.9G]: compressed image files (more than 8000, so only use the filtered ones in imnames.cp)
  • depth.h5 [15G]: depth maps
  • seg.h5 [6.9G]: segmentation maps

Note: I do not own the copyright to these images.

Generating scene-text images with background

The background image files are saved in bg_img directory. The following files are used to generate the images.

  • data/fonts: several sample fonts (add more fonts to this folder and then update fonts/fontlist.txt with their paths). You must put Korean fonts, otherwise you cannot print out the letters in the picture properly.
  • data/newsgroup: Text-source (from the News Group dataset). This can be subsituted with any text file. Look inside text_utils.py to see how the text inside this file is used by the renderer.
  • data/models/colors_new.cp: Color-model (foreground/background text color model), learnt from the IIIT-5K word dataset.
  • data/models: Other cPickle files (char_freq.cp: frequency of each character in the text dataset; font_px2pt.cp: conversion from pt to px for various fonts: If you add a new font, make sure that the corresponding model is present in this file, if not you can add it by adapting invert_font_size.py).
python make_h5.py

This will generate random scene-text image files with background images and store them in an h5 file in dset_kr.h5. When it generates the image, it also creates the following files.

  • word_text.txt: words that are generated from scene-text.
  • char_text.txt: characters that are splited from words.
python visualize_results.py

This will generate the followings from stored images in dset_kr.h5. There are 3 types of dataset that you can generate.

  • ~/images: Scene-text image files
  • ~/words: Word image files from ~/images
  • ~/characters: Character image files from ~/images

Also, you can get the coordinate files of characters and words each

  • ch_coords.txt: Characters' each coordinate in scene-text image files
  • wd_coords.txt: Words' each coordinate in scene-text image files

Adding New Images

Segmentation and depth-maps are required to use new images as background. Sample scripts for obtaining these are available here.

  • predict_depth.m MATLAB script to regress a depth mask for a given RGB image; uses the network of Liu etal. However, more recent works (e.g., this) might give better results.
  • run_ucm.m and floodFill.py for getting segmentation masks using gPb-UCM.

For an explanation of the fields in dset.h5 (e.g.: seg,area,label), please check this comment.

Further Information

Please refer to the paper for more information, or contact the author (email address in the paper). If you find errors for koreans, don't hesitate to give me an email: [email protected]

synthtext_kr's People

Contributors

youngkyung 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.