GithubHelp home page GithubHelp logo

git-manager / srnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from youdao-ai/srnet

0.0 1.0 0.0 71.86 MB

A tensorflow reproducing of paper “Editing Text in the wild”

License: GNU General Public License v3.0

Python 100.00%

srnet's Introduction

SRNet - Editing Text in the Wild

 

Introduction

This is a reproducing of paper Editing Text in the wild by tensorflow, which aims to replace or modify a word in the source image with another one while maintaining its realistic look.

Original paper: Editing Text in the wild by Liang Wu, Chengquan Zhang, Jiaming Liu, Junyu Han, Jingtuo Liu, Errui Ding and Xiang Bai.

The model in this project is a result of my experiment and debugging of the details described in the paper.

A pre-trained vgg19 model is used in this SRNet, which is downloaded from https://github.com/fchollet/deep-learning-models/releases/tag/v0.1 and converted to pb format

image

 

Prepare data

Data is completely prepared as described in the paper.

You can refer to and improve Synthtext project to render styled texts on background images. Also need to save some intermediate results as labels while rendering.

According to this paper, you need to prepare 2 input images(i_s, i_t) and 4 label images(t_sk, t_t, t_b, t_f)

  • i_s: standard text b rendering on gray background

  • i_t: styled text a rendering on background image

  • t_sk: skeletonization of styled text b.

  • t_t: styled text b rendering on gray background

  • t_b: background image

  • t_f: styled text b rendering on background image

In my experiment, I found it easier to train with one more label data(mask_t).

  • mask_t: the binary mask of styled text b

image

From left to right, from top to bottom are examples of i_s, i_t, t_sk, t_t, t_b, t_f, mask_t

 

Train your own dataset

First clone this project

$ git clone https://github.com/youdao-ai/SRNet.git

Once the data is ready, put the images in different directories with the same name.

You can modify the data directories and training parameters in cfg.py as you want.

Then run python3 train.py to start training.

 

Predict

You can predict your own data with

$ python3 predict.py --i_s xxx --i_t xxx --save_dir xxx --checkpoint xxx

If you want to predict a directory of data, just make sure your data i_s and i_t have the same prefix and splited by '_', for example, image1_i_s.png and image1_i_t.png, put them into one directory and

$ python3 predict.py --input_dir xxx --save_dir xxx --checkpoint xxx

Or you can set these path information in cfg.py and just python3 predict.py

 

Requirements

  • Python 3.6

  • numpy

  • opencv-python

  • tensorflow 1.14.0

 

Reference

srnet's People

Contributors

ursaminor0401 avatar

Watchers

 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.