CASP Tutorial-11 Project
This tutorial project demonstrates how to do machine learning with CASP. It uses MNIST fashion database to train a Feed Forward Neural Network (FFNN) and a Convolution Neural Network (CNN).
Pre-Requisites
· Tutorial-2 should be completed.
· User should be well versed with basic machine learning concepts, especially FFNNs and CNNs.
Model
· FFNN model is implemented in file ff_mnist.wsp and CNN model is implemented in file cnn_mnist.wsp. In these models, neural network control block (ds_ctrl) is used for generating required control signals to the data source block (ds_source) and neural net blocks during the simulation. Confusion matrix block is used to calculate accuracy, precision, sensitivity and F-score. The data source block outputs 28 x 28 images sequentially at its first output port and the label data at its second output port (L).
· In the FFNN model, FFNN blocks ffnn0 and ffnn1 are connected in cascaded fashion. The ffnn0 block takes the images from the data source block. It consists of one input layer of 784 neurons and one hidden layer of 64 neurons. The output of the hidden layer is passed on to the next FFNN block (ffnn1). The ffnn1 block consists of one hidden layer of 64 neurons and one output layer of 10 neurons. The resultant network consists of one input layer, two hidden layers and one output layer.
· In the CNN model, CNN block cnn0 takes the images from the data source block via image padding and channel splitter blocks. It consists of one input channel (29x29) and one output channel (27x27). The output channel is connected to the pooling block which is further connected to the FFNN block (ffnn0). The ffnn0 block consists of one input layer of 81 neurons, one hidden layer of 81 neurons and one output layer of 8 neurons.
· Please refer to these two models for details of other settings.
· FFNN model is shown in below figure
Step 1: Open Project
· Open the project and enable blocks in the required model. User has to enable blocks in only one model at a time.
· Go through the various block parameters. User may change the configuration as per his/her requirement.
· User can also enable any one of the acceleration methods (if hardware supports) for the FFNN and CNN blocks from respective block parameters.
Step 2: Setup Simulation Parameters
· Go through the simulation settings. User can increase the Limit model compute threads and Limit block compute threads values to increase the CPU computational performance during the learning process.
Step 3: Run Simulation
· Press Build/Run button from Home->Simulation menu item. CASP builds and compiles the model and opens separate simulation panel window. In the simulation panel window press ‘Run Simulation’ button to run simulation.
· A screen short of FFNN model simulation panel window is shown below