Open Thesis.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
THE PENNSYLVANIA STATE UNIVERSITY SCHREYER HONORS COLLEGE DEPARTMENT OF ENGINEERING TENSORSHOW: A GRAPHICAL USER INTERFACE FOR ASSEMBLING, TRAINING AND EVALUATING CONVOLUTIONAL NEURAL NETWORKS ANDREW WARNER SPRING 2020 A thesis submitted in partial fulfillment of the requirements for a baccalaureate degree in Computer Science with honors in Electrical Engineering Reviewed and approved* by the following: Vishal Monga Professor of Electrical Engineering Thesis Supervisor Vijaykrishnan Narayanan Distinguished Professor Computer Engineering Honors Adviser * Electronic approvals are on file. i ABSTRACT Machine learning applications have developed as quickly as the technologies that drive them in recent years. The need for developing quick machine learning architectures for solving ubiquitous problem has not been met by current programming libraries that facilitate the computations required for training and deploying models. TensorShow utilizes the powerful machine learning library and toolset, TensorFlow, to provide users with a graphical interface for developing and analyzing machine learning architectures. TensorShow specifically builds Convolutional Neural Network (CNN) architectures by abstracting the construction of convolutional, pooling, and fully connected layers in a clean Graphical User Interface (GUI). Users can quickly build CNNs for classification tasks on numerous datasets, as well as assemble models that can be ported into Keras and TensorFlow for further development. The task of solving data-driven problems with Machine Learning is made easier with TensorShow’s easy to use user-interface. ii TABLE OF CONTENTS LIST OF FIGURES ................................................................................................ iii LIST OF TABLES ................................................................................................... iv ACKNOWLEDGEMENTS ..................................................................................... v Chapter 1 Project Overview ..................................................................................... 1 Chapter 2 Background and Overview of Technology ............................................... 3 Convolutional Neural Networks .................................................................................. 3 TensorFlow and Python............................................................................................... 5 React and JavaScript ................................................................................................... 7 Socket.IO and Transmission Control Protocol ............................................................. 8 Chapter 3 Product Usage .......................................................................................... 9 Building a Network ..................................................................................................... 9 Setting and Updating Parameters ................................................................................. 11 Training a Network ..................................................................................................... 14 Chapter 4 Conclusion ............................................................................................... 17 BIBLIOGRAPHY .................................................................................................... 18 iii LIST OF FIGURES Figure 1. Starting a CNN in TensorShow ............................................................................ 9 Figure 2. Branching Layers in TensorShow......................................................................... 10 Figure 3. Completing a Model in TensorShow .................................................................... 11 Figure 4. Setting Convolution Parameters in TensorShow ................................................... 12 Figure 5. Setting Pooling Parameters in TensorShow .......................................................... 13 Figure 6. Setting Fully Connected Parameters in TensorShow ............................................. 14 Figure 7. Choosing a Dataset in TensorShow ...................................................................... 15 Figure 8. Setting Training Parameters in TensorShow ......................................................... 16 iv LIST OF TABLES Table 1. Example CNN Architecture ................................................................................... 4 v ACKNOWLEDGEMENTS Thank you to the friends I made during my years at school that helped foster my education and maintain my academic rigor. Thank you to my family for their continued support and to my girlfriend for enduring the completion of this project and the declaration of this thesis. Thank you to the open source community for providing me with the tools to make this project possible. Thank you to Professor Vishal Monga and Professor Vijay Narayanan for their guidance in building this application and writing this dissertation. 1 Chapter 1 Project Overview TensorShow provides a graphical user interface (GUI) for designing, training and evaluating Convolutional Neural Networks (CNNs). CNNs are a useful network design for machine learning tasks such as image classification. CNNs are able to process images by feeding them forward through a deep architecture of computationally intensive layers. Such layers include convolutional layers, pooling layers, and fully connected layers. Convolutional layers filter a kernel over an image in order to extract features by computing the inner product between the kernel and the window of the image. The weight values in the kernels are learned as the network is fed more images. Pooling layers filter a window over an image and return a single value depending on the type of pooling operation specified. Such pooling operations include maximum pooling, where the maximum value in the window of the image is returned, or average pooling, where the average value in the window of the image is returned. Fully connected layers flatten the image into a vector and pass it forward through a Deep Neural Network (DNN). Classification is achieved after passing the output of the last fully connected layer into the SoftMax function where a probability distribution over the class labels is returned. Users are able to easily construct multiple CNNs by branching the different compatible CNN layers. This allows users to try different combinations of hyperparameters (kernel window size, pooling window size, fully connected output units, etc.) and different permutations of CNN layer types. Moreover, users can deploy models to a TensorFlow backend for quick training and receive useful training insights such as loss values and accuracy values of the network on training sets. 2 Users can choose from four different datasets to train and compare the different CNN networks constructed: CIFAR10, CIFAR100, MNIST Digits, and MNIST Fashion. Each dataset provides tens of thousands of training and test images that are easily fed through CNNs. Users can test their accuracy and loss scores against benchmarks available for these commonly used datasets. Information about each of the datasets is provided to the user so they can understand the different shapes of the images and know how large the training and testing sets are. TensorShow was built using the React framework for the JavaScript frontend and TensorFlow for the machine learning infrastructure in the backend. The two components are connected using socket level TCP transfer for live inference of training models. Altogether, the components are connected to deliver a full stack application. 3 Chapter 2 Background and Overview of Technology TensorShow harnesses cutting edge mathematical and technological advances in machine learning and application development to provide a seamless user experience. Convolutional Neural Networks can be difficult to visualize during construction. TensorShow allows users to understand the flow of their networks as they are constructed. Moreover, in order to train the networks efficiently, TensorFlow is used in the backend for the most computationally expensive operations. The application is developed using the React JavaScript framework because it provides easy to use mechanisms for maintaining the state of the application. Moreover, React allows real time Document Object Model (DOM) manipulation and rendering which reduces overhead. The user-interface is designed using Google’s Material-UI Kit because of the simplicity and functionality of the components. Lastly, Socket.IO is used to provide an interface to the TCP level transmission of data from the TensorFlow backend to the React frontend. Convolutional Neural Networks Convolutional Neural Networks (CNNs) are the most common architecture used in image classification, image regression and object recognition tasks. CNNs are useful for extracting features from images and reducing unnecessary information through pooling, making them computational efficient for real-time deployment. CNNs are not different from regular neural networks such as Deep Neural Networks (DNNs) because they still have learned weights and biases. The weights that are learned in the CNNs are the values in the kernels that are filtered over the image and the parameters in fully connected layers at the end of the network that are 4 used for classification. However, CNNs are more efficient than normal DNNs for image classification because DNNs do not scale well to image classification. For example, if an image that is 32 x 32 x 3 is used for classification,