Git Product home page Git Product logo

hccg-cyclegan's Introduction

HCCG-CycleGAN

Generating Handwritten Chinese Characters using CycleGAN
Bo Chang*, Qiong Zhang*, Shenyi Pan, Lili Meng
WACV 2018.

Abstract

Handwriting of Chinese has long been an important skill in East Asia. However, automatic generation of handwritten Chinese characters poses a great challenge due to the large number of characters. Various machine learning techniques have been used to recognize Chinese characters, but few works have studied the handwritten Chinese character generation problem, especially with unpaired training data. In this work, we formulate the Chinese handwritten character generation as a problem that learns a mapping from an existing printed font to a personalized handwritten style. We further propose DenseNet CycleGAN to generate Chinese handwritten characters. Our method is applied not only to commonly used Chinese characters but also to calligraphy work with aesthetic values. Furthermore, we propose content accuracy and style discrepancy as the evaluation metrics to assess the quality of the handwritten characters generated. We then use our proposed metrics to evaluate the generated characters from CASIA dataset as well as our newly introduced Lanting calligraphy dataset.

Requirement

Python 2.7

Preprocess handwritting database

The gnt files in CASIA HWDB1.1 database can be downloaded here.

python preprocess/preprocess_hw.py fonts/1252-c.gnt fonts/simhei.ttf 0.1 0.1 

Both the gnt file for the handwritten data and the ttf/otf file for the source font need to be under the fonts folder. The last two number represents for the split ratio of the training and test data.

DenseCycleGAN

Usage

  • Training
cd DenseCycleGAN
DATA_ROOT=./datasets/1252-c-0.1-0.1 name=1252-c-dense5 which_model_netG=densenet_5blocks th train.lua
  • Testing
DATA_ROOT=./datasets/1252-c-0.1-0.1 name=1252-c-dense5 phase=test th test.lua

Supported which_model_netG in training

  • resnet_6blocks
  • resnet_9blocks
  • densenet_5blocks
  • densenet_6blocks
  • densenet_7blocks
  • densenet_8blocks

BibTeX

@inproceedings{chang2018generating, 
  title={Generating Handwritten Chinese Characters Using CycleGAN}, 
  author={Chang, Bo and Zhang, Qiong and Pan, Shenyi and Meng, Lili}, 
  booktitle={IEEE Winter Conference on Applications of Computer Vision}, 
  year={2018} 
}

hccg-cyclegan's People

Contributors

changebo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hccg-cyclegan's Issues

bitmap = bitmaplist[arr[x]]

HCCG-CycleGAN$ python preprocess/preprocess_hw.py fonts/1252-c.gnt fonts/simhei.ttf 0.1 0.1
File "preprocess/preprocess_hw.py", line 97
bitmap = bitmaplist[arr[x]]
^
TabError: inconsistent use of tabs and spaces in indentation

Any suggestions please?

Error when running testing

torch/install/share/lua/5.1/threads/threads.lua:183: [thread 1 callback] ...ai/tk/HCCG-CycleGAN/DenseCycleGAN/data/donkey_folder.lua:28: Did not find directory: /home/oitai/tk/HCCG-CycleGAN/DenseCycleGAN/datasets/1252-c-0.1-0.1/testA
stack traceback:
[C]: in function 'error'
...ai/tk/HCCG-CycleGAN/DenseCycleGAN/data/donkey_folder.lua:28: in main chunk
[C]: in function 'dofile'
/home/oitai/tk/HCCG-CycleGAN/DenseCycleGAN/data/data.lua:39: in function </home/oitai/tk/HCCG-CycleGAN/DenseCycleGAN/data/data.lua:29>
[C]: in function 'xpcall'
/home/oitai/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback'
/home/oitai/torch/install/share/lua/5.1/threads/queue.lua:65: in function </home/oitai/torch/install/share/lua/5.1/threads/queue.lua:41>
[C]: in function 'pcall'
/home/oitai/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob'
[string " local Queue = require 'threads.queue'..."]:13: in main chunk
stack traceback:
[C]: in function 'error'
/home/oitai/torch/install/share/lua/5.1/threads/threads.lua:183: in function 'dojob'
/home/oitai/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize'
/home/oitai/torch/install/share/lua/5.1/threads/threads.lua:142: in function 'specific'
/home/oitai/torch/install/share/lua/5.1/threads/threads.lua:125: in function 'Threads'
/home/oitai/tk/HCCG-CycleGAN/DenseCycleGAN/data/data.lua:27: in function 'new'
.../oitai/tk/HCCG-CycleGAN/DenseCycleGAN/data/data_util.lua:17: in function 'load_dataset'
./data/unaligned_data_loader.lua:24: in function 'Initialize'
test.lua:47: in main chunk
[C]: in function 'dofile'
...itai/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
[C]: at 0x00405d50

Any suggestions please?

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.