Skip to content

Adversarial Generation of Handwritten Text Images

License

Notifications You must be signed in to change notification settings

anno-ai/scrabble-gan

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScrabbleGAN (TensorFlow 2/ Python3)

Implementation of ScrabbleGAN for adversarial generation of handwritten text images in TensorFlow 2.1.

More details can be found here

Implementational notes

  • the BigGAN-part/ structure of ScrabbleGAN is based on google/compare_gan rewritten in TF2
  • all dependencies (batch size, epochs etc.) are handled using google gin-config

Setup

  1. Download and extract IAM-Handwriting DB and random word list as described in src/dinterface/dinterface.py

    wget --user <user-id> --password <pw> http://www.fki.inf.unibe.ch/DBs/iamDB/data/words/words.tgz 
    wget --user <user-id> --password <pw> http://www.fki.inf.unibe.ch/DBs/iamDB/data/ascii/words.txt
    wget -O random_words.txt https://www.dropbox.com/s/o60ubzh3m163j0x/random_words.txt?dl=0
    tar zxvf words.tgz
    rm -rf words.tgz       
    
  2. Move folders into correct position (see File Structure); update file paths in scrabble_gan.gin + main.py

  3. Install dependencies (e.g. AWS P3)

Usage

Train model

python3 main.py

File Structure

 doc
     ├── installation_aws_p3.txt                    # how to install dependencies on AWS P3 instance
     ├── ...                                        # addtional README resources
 res                               
     ├── data/                                      # various word datasets (e.g. RIMES, IAM, ...)
         ├── iamDB/                                              
             ├── words/                                          
             ├── words-Reading/ 
             ├── words.txt                                            
         ├── random_words.txt/                                  
     ├── out/                                       # location where to store generated output files   
         ├── big_ac_gan/                            # output of ScrabbleGAN (here denoted as big_ac_gan)
             ├── images/                            
             ├── model/                             
             ├── training_checkpoints/              
         ├── ...                                    # potentially output of more models   
 src
     ├── bigacgan/                                  # ScrabbleGAN implementation
         ├── ...                                           
     ├── dinterface/                                # purpose: bring various datasets into equal format
         ├── ...                                         
     ├── main.py                                    # core of this repo - train ScrabbleGAN
     ├── scrabble_gan.gin                           # all dependencies are handled here (gin config file)

License

License

About

Adversarial Generation of Handwritten Text Images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%