Reference no: EM133105642
Assignment:
Prepare one python notebook (recommended- use Google Colab) to build, train and evaluate model (TensorFlow or TensorFlow.Keras library recommended) on the two datasets given below. Read the instructions carefully.
Question: Image Captioning : Image Captioning is the process of generating textual description of an image. It uses both Natural Language Processing and Computer Vision to generate the captions. The dataset will be in the form [image → captions]. The dataset consists of input images and their corresponding output captions.
Encoder
The Convolutional Neural Network(CNN) can be thought of as an encoder. The input image is given to CNN to extract the features. The last hidden state of the CNN is connected to the Decoder.
Decoder
The Decoder is a Recurrent Neural Network(RNN) which does language modelling up to the word level. The first time step receives the encoded output from the encoder and also the <START> vector.
1. Import Libraries/Dataset
2. Import the required libraries
3. Check the GPU available (recommended- use free GPU provided by Google Colab).
2. Data Processing
1. Read the pickle file and convert the data into the correct format which could be used for ML model.
Pickle file contains the image id and the text associated with the image.
\t -> separator between Image name and Image Caption A girl in a purple shirt hold a pillow . -> Image Caption
Corresponding image wrt image name can be found in the image dataset folder.
1. Plot at least two samples and their captions (use matplotlib/seaborn/any other library).
2. Bring the train and test data in the required format.
3. Model Building
4. Use Pretrained VGG model trained on ImageNet dataset (available publicly on google) for image feature extraction.
5. Create 3 layered GRU layer model and other relevant layers for image caption generation.
6. Add L2 regularization to all the GRU layers.
7. Add one layer of dropout at the appropriate position and give reasons.
8. Choose the appropriate activation function for all the layers.
9. Print the model summary.
4. Model Compilation
5. Compile the model with the appropriate loss function.
6. Use an appropriate optimizer. Give reasons for the choice of learning rate and its value.
7. Model Training
8. Train the model for an appropriate number of epochs. Print the train and validation loss for each epoch. Use the appropriate batch size.
9. Plot the loss and accuracy history graphs for both train and validation set. Print the total time taken for training.
10. Model Evaluation
11. Take a random image from google and generate caption for that image.
Q2) Let us define a sequence parity function as a function that takes in a sequence of binary inputs and returns a sequence indicating the number of 1's in the input so far; specifically, if at time t the 1's in the input so far is odd it returns 1, and 0 if it is even. For example, given input sequence [0, 1, 0, 1, 1, 0], the
parity sequence is [0, 1, 1, 0, 1, 1].
Implement the minimal vanilla recurrent neural network to learn the parity function. Explain your rationale using a state transition diagram and parameters of the network.
Evaluation Process -
1. Task Response and Task Completion- All the models should be logically sound and have decent accuracy (models with random guessing, frozen and incorrect accuracy, exploding gradients, etc. will lead to deduction of marks. Please do a sanity check of your model and results before submission).
2. There are a lot of subparts, so answer each completely and correctly, as no partial marks will be awarded for partially correct subparts.
3. Implementation- The model layers, parameters, hyperparameters, evaluation metrics, etc. should be properly implemented.
4. Notebooks without output will not be considered for evaluation.
5. Request to upload an HTML version of the jupyter notebook as well with all the outputs and comments.
Attachment:- Convolutional Neural Network.rar