Devanagari and Gurmukhi Handwritten Character Generation Using Generative Adversarial Networks
Total Page:16
File Type:pdf, Size:1020Kb
Devanagari and Gurmukhi Handwritten Character Generation using Generative Adversarial Networks Thesis submitted in partial fulfillment of the requirements for the award of degree of Master of Engineering in Computer Science and Engineering Submitted By Simerpreet Kaur (Roll No. 801632048) Under the supervision of: Dr. Karun Verma Assistant Professor, CSE Department COMPUTER SCIENCE AND ENGINEERING DEPARTMENT THAPAR INSTITUTE OF ENGINEERING AND TECHNOLOGY PATIALA – 147004 June 2018 i ACKNOWLEDGEMENT I would like to express my grateful thanks to my supervisor Dr. Karun Verma. This work would not have been possible without his encouragement and guidance. I thank my supervisor for his time, patience, discussion and valuable comments. His enthusiasm and optimism made this experience both rewarding and enjoyable. I am equally grateful to Dr. Maninder Singh, Professor and Head of Computer Science and Engineering Department, an excellent teacher and a well-credited researcher, who always encouraged us to keep going with the work. I will be failing in my duty if I don’t express my gratitude to Dr. S.S. Bhatia, Senior Professor and Dean of Academic Affairs, Thapar Institute of Engineering and Technology, for making all the provisions of infrastructure such as library facilities, computer labs equipped with net facilities, immensely useful for learners to equip themselves with latest in the field. I am also thankful to entire faculty and staff members of Computer Science and Engineering Department for their direct-indirect help and cooperation, which made my stay at Thapar Institute of Engineering and Technology memorable. Date: June, 2018 (Simerpreet Kaur) Place: Thapar Institute of Engineering and Technology ii ABSTRACT Today, computers have influenced the life of human beings to a great extent. The theory that computers can learn without being programmed to perform a specific task, have attracted the researchers to see if computers could learn from data. As deep learning became popular, the need for huge amounts of data has risen. The major problem faced in the area of deep learning is the data availability. In this dissertation, a generative technique is used to generate the handwritten Gurmukhi and Devanagari characters. This dissertation describes the implementation of handwritten Gurmukhi and Devanagari characters using deep learning technique named as Generative Adversarial Networks. Gurmukhi and Devanagari script is chosen for this research work as it is used directly or indirectly by more than 500 million people in the Indian subcontinent and less work is done on Devanagari and Gurmukhi script as compared to work done on other scripts such as English and Chinese. GANs are chosen for the implementation as it is proven to be the very powerful generative method. Here, we use 3-layer CNN having stride value of 2 for the feature extraction of handwritten character. The characters generated look like the character in the original dataset. Also by increasing the number of epochs the images are more recognizable and clear as well as the loss starts decreasing. iii TABLE OF CONTENTS CERTIFICATE .............................................................................................................. i ACKNOWLDEGEMENT............................................................................................ ii ABSTRACT .................................................................................................................. iii LIST OF FIGURES .................................................................................................... vii LIST OF TABLES ..................................................................................................... viii ABBREVIATIONS ...................................................................................................... ix Chapter 1: Introduction ............................................................................................... 1 1.1. Artificial Neural Networks ....................................................................... 3 1.1.1. Back Propagation ........................................................................... 4 1.2. Convolutional Neural Network ................................................................ 5 1.2.1. Convolutional Layer ..................................................................... 5 1.2.2. Pooling Layer ............................................................................... 6 1.2.3. Fully-Connected Layer ................................................................. 7 1.2.4. Activation Layer. .......................................................................... 7 1.2.5. Dropout Layer ............................................................................. 10 1.2.6. Batch Normalization ................................................................... 10 1.2.7. Loss Function ............................................................................. 11 1.3. Generative modeling ............................................................................... 11 1.3.1. Generative model working ......................................................... 12 1.4. Generative adversarial network .............................................................. 13 1.4.1. Adversarial loss .......................................................................... 13 1.5. Deep Convolutional Generative Adversarial Network ........................... 14 1.5.1 Architecture of DCGAN ............................................................. 14 1.6. Dissertation Outline ................................................................................ 15 Chapter 2: Literature Review .................................................................................... 16 Chapter 3: Problem Statement .................................................................................. 23 3.1 Problem Formulation ............................................................................... 23 3.2 Research Gap ........................................................................................... 24 3.3 Research Objectives ................................................................................. 24 iv Chapter 4: Gurmukhi and Devanagari Script Overview..……………………………...25 4.1. Gurmukhi Script ...................................................................................... 25 4.1.1. Overview ...................................................................................... 25 4.1.2. Gurmukhi consonants identifiers ................................................. 26 4.2. Devanagari Script ................................................................................... 26 4.2.1. Overview ...................................................................................... 26 4.2.2. Devanagari consonants and digits identifiers .............................. 27 Chapter 5: Implementation ................................................................................................ 28 5.1. Data Collection ........................................................................................ 28 5.2. Preprocessing ........................................................................................... 29 5.3. GANs Network Building ......................................................................... 30 5.3.1. Generator Network....................................................................... 31 5.3.2. Discriminator Network ................................................................ 32 5.3.3. Loss Calculation........................................................................... 33 5.3.4. Optimizer ..................................................................................... 34 5.3.5. Running Training Session ............................................................ 34 5.4. Output Generation .................................................................................... 34 Chapter 6: Results and Discussion .................................................................................... 35 6.1. Experiment 1 ............................................................................................ 35 6.2. Experiment 2 ............................................................................................ 42 Chapter 7: Conclusion and Future Scope ......................................................................... 50 7.1. Conclusion ................................................................................................ 50 7.3. Future Scope ............................................................................................ 50 Publications. ........................................................................................................................ 52 References ............................................................................................................................ 53 v LIST OF FIGURES Figure No. Title of Figure Page No. Figure 1.1 A simple neural network 3 Figure 1.2 Multilayer perceptron neural network 4 Figure 1.3 Convolutional network architecture 5 Figure 1.4 Convolutional layer example 6 Figure 1.5 Example of max pooling layer having 2 × 2 kernel size 7 Figure 1.6 Sigmoid (left), Tanh (right) 8 Figure 1.7 ReLU (left), Leaky ReLU (right) 9 Figure 1.8 The GANs architecture 13 Figure 1.9 The Generator network 14 Figure 1.10 The Discriminator network 15 Figure 4.1 Different zones and headline of Gurmukhi script 25 Figure 4.2 Consonants used in Gurmukhi script 26 Figure 4.3 Consonants,