$30
2 Task Description
The task of the assignment is known as (binary) gender recognition from face images. There are several papers focusing on this topic in the literature [1–4]. You will be using facial images from two Kaggle datasets as described in Section 2.1. After downloading and preparing the datasets, your assignment is to:
• Create a virtual environment and install tensorflow, SciPy, matplotlib, keras, seaborn libraries. These are the libraries we recommend but you can also install the ones of your choice.
• Implement the baseline CNN algorithm that is shown in Fig. 1. It is a network consisting of: a convolutional layer with 16 filters of size 3×3 with ReLU activations followed by a max pooling layer of size 2 × 2; another convolutional layer identical to the first followed by a max pooling layer; a fully connected layer of size 64 and ReLU activation function; and finally, an output layer of size 1 with a sigmoid activation function. The pooling layers have a stride of 1.
• Analyze the performance of the baseline by plotting: (i) the training and validation losses and accuracies on the training and test set, (ii) the Receiver Operator Characteristic (ROC) curve with the Area under the Curve (AUC) score and a confusion matrix for the validation and test set. Examples of accuracy and loss plots are shown in in Fig. 2, an example of a ROC curve and confusion matrix is shown in Fig. 3, respectively. Report performance measures (accuracy, sensitivity, specificity and F1-score). • Once you have a baseline model, adapt/fine-tune the network to improve its performance by: (i) changing the hyper-parameters (e.g. add more layers) and/or (ii) applying data augmentation techniques. Illustrate the improvements of your new network over the baseline by: (a) plotting the ROC curve with AUC score and (b) reporting performance measures. Compare and explain the differences between the two models as well as potential reasons behind the increase in performance .
• Next, train a new model using transfer learning. Utilize VGG16 architecture for feature extraction. Freeze the layers until the fully connected layer such that these layers will not be updated through training. Add your fully connected layers (as many as you like) and present the results that you obtained on the test set (ROC curve with AUC score, performance measures and confusion matrix). Comment on the performance with respect to the baseline and the network that you designed in the previous step.
Figure 1: Baseline CNN Algorithm
2.1 Data set
The training and test data are available on Kaggle. The training data can be downloaded using the following link:
https://www.kaggle.com/rashikrahmanpritom/gender-recognition-dataset
The dataset is provided in train, validation and test folders. Although there is a separate validation folder, the files inside that folder do not have labels. Hence, you should use the images in the test folder as your validation set. The traning folder contains 11135 RGB images of size 100 × 100 and the test folder contains 1279 RGB images of the same size – you will use those for validation.
It is important to have a test set that is from a different dataset. Test set can be downloaded from:
https://www.kaggle.com/maciejgronczynski/biggest-genderface-recognition-dataset
The test set contains 27167 RGB images of varying size.
• You should resize your images to 100 × 100 while loading the images.
(a) Training and validation accuracy (b) Training and validation loss
Figure 2: Examples of accuracy and loss plots
• You should have the same labels as your training and validation sets. In training and validation sets, the label names are ‘Female’ and ‘Male’, so modify the test set folders accordingly.