Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Prepare one python notebook (recommended- use Google Colab) to build, train and evaluate model (TensorFlow or TensorFlow

Prepare one python notebook (recommended- use Google Colab) to build, train and evaluate model (TensorFlow or TensorFlow

Computer Science

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.

 

(10 marks) 

  1. Import Libraries/Dataset (0 mark) 
  2. Import the required libraries
  3. Check the GPU available (recommended- use free GPU provided by Google Colab). 

 

  1. Data Processing(1  mark) 

 

  1. Read the pickle file (https://drive.google.com/file/d/1d_TOIMx1XcapamexS6ujYuiIuaLXuANk/view?usp=sharing) (Links to an external site.) 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.

Eg: '319847657_2c40e14113.jpg#0\tA girl in a purple shirt hold a pillow .

Each image can have multiple captions.

319847657_2c40e14113.jpg -> image name

#0 -> Caption ID

\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.

 

Image dataset Folder : https://drive.google.com/file/d/1-mPKMpphaKqtT26ZzbR5hCHGedkNyAf1/view?usp=sharing

 

  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. 

 

  1. Model Building (4 mark) 
  2. Use Pretrained VGG model trained on ImageNet dataset (available publicly on google) for image feature extraction.
  3. Create 3 layered GRU layer model and other relevant layers for image caption generation.
  4. Add L2 regularization to all the GRU layers. 
  5. Add one layer of dropout at the appropriate position and give reasons. 
  6. Choose the appropriate activation function for all the layers. 
  7. Print the model summary. 

 

  1. Model Compilation (0.5  mark) 
  2. Compile the model with the appropriate loss function. 
  3. Use an appropriate optimizer. Give reasons for the choice of learning rate and its value. 
  4. Model Training (1 mark) 
  5. Train the model for an appropriate number of epochs. Print the train and validation loss for each epoch. Use the appropriate batch size. 
  6. Plot the loss and accuracy history graphs for both train and validation set. Print the total time taken for training. 
  7. Model Evaluation (1 mark) 
  8. Take a random image from google and generate caption for that image.

 

Q2) 2.5 Marks

 

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.

Additional Tips -

  1. Code organization- Please organize your code with correct line spacing and indentation, and add comments to make your code more readable.
  2. Try to give explanations or cite references wherever required.
  3. Use other combinations of hyperparameters to improve model accuracy.

 

Option 1

Low Cost Option
Download this past answer in few clicks

28.99 USD

PURCHASE SOLUTION

Already member?


Option 2

Custom new solution created by our subject matter experts

GET A QUOTE