Starting from:

$30

CS69012-Assignment 10 Cloth Classification using RNN and CNN Solved

Task 1 
You will create a recurrent neural network with a tensorflow.compat.v1.nn.rnn_cell.RNNCell as a basic component. Use tensorflow.compat.v1.nn.static_rnn to create the RNN. Train it end to end.

RNN specifics:

1.     Hidden state size: 100

2.     Timesteps for unfolding the RNN: 28

3.     Non-linear activation: tanh

4.     Loss function: categorical softmax cross entropy with logits

5.     Regularization: Use dropout with retention probability of 0.8

6.     Optimizer: Adam

Save the weights corresponding to the best validation accuracy in a folder ‘logs_rnn/’ and report the results on the validation and test set.

Task 2
You will create a 2D convolutional neural network using tensorflow.compat.v1.layers.conv2d as a basic component. Train it end to end.

CNN specifics:

1.     1st convolutional layer: 32 filters of dimension 5x5 followed by batch normalization, relu activation and max pooling (with 2x2 subsampling).

2.     2nd convolutional layer: 64 filters of dimension 5x5 followed by batch normalization, relu activation and max pooling (with 2x2 subsampling).

3.     Flatten above layer and feed it to a densely connected layer with 1024 hidden units

4.     Add an output dense layer with 10 logits followed by batch normalization and softmax activation.

5.     Loss function: categorical softmax cross entropy with logits

6.     Regularization: Use dropout with retention probability of 0.6

7.     Optimizer: Adam

Save the weights corresponding to the best validation accuracy in a folder ‘logs_cnn/’ and report the results on the validation and test set.

Submit a brief report on what inferences you could draw from the experiments (in pdf only). The report should contain information on model hyperparameters and the training, validation and test accuracies.

Constraints and Considerations:

1.     You must NOT use tensorflow.keras functions other than for loading the dataset. Define the RNN using the functions in tensorflow.compat.v1.nn only. Similarly use only the functions in tensorflow.compat.v1.layers for the CNN.

2.     Apart from the above restriction you have the freedom to choose the details of your architecture e.g. learning rate, variable initializers, strides, zero padding etc.

3.     You should create a train-validation split on the training set and train and test on appropriate data only. You must train properly with a proper stopping criterion. All decisions you take for model parameters must be logical.

4.     Do NOT hardcode any paths.

5.     Include all training and testing codes. Two files named  ‘rnn.py’ and ‘cnn.py’  must be present. They will take some command line arguments. ‘python rnn.py  --train’ should train the RNN model, ‘python rnn.py --test’ should load all model weights, test the model and report the accuracy on the test data. Similarly for the file ‘cnn.py’.

6.     Name the ZIP file as well the folder that you compressed to get the zip as

“Assignment10_<Roll No..zip” and “Assignment10_<Roll No.” respectively. Upload the zip file to moodle. Note that the zip file should contain your python files, model weights (i.e. the ‘logs_rnn/’ and the ‘logs_cnn/’ folders), and a pdf file explaining your model hyperparameters and results/inferences. Please note that all explanations should be short (1-3 sentences).

7.     Small differences in your method's accuracy would not be penalized (larger may be; remember to set a fixed random seed for reproducing your result). Your experimentation technique should be sound (like, do not test on training data or train on validation data).

More products