In this article couple of problems are going to be described. Both the problems appeared as assignments in the Coursera course Convolution Neural Network (a part of deeplearning specialization) by the Stanford Prof. Andrew Ng.

( The problem descriptions are taken from the course itself.

Details of the “Happy” dataset: Images are of shape (64,64,3)
Training: 600 pictures
Test: 150 pictures It is now time to solve the “Happy” Challenge. We need to start by loading the following required packages.

import numpy as np
from keras import layers
from keras.layers import Input, Dense, Activation, ZeroPadding2D, BatchNormalization, Flatten, Conv2D
from keras.layers import AveragePooling2D, MaxPooling2D, Dropout, GlobalMaxPooling2D, GlobalAveragePooling2D
from keras.models import Model
from keras.preprocessing import image
from keras.utils import layer_utils
from keras.utils.data_utils import get_file
from keras.applications.imagenet_utils import preprocess_input
from keras.utils.vis_utils import model_to_dot
from keras.utils import plot_model
import keras.backend as K
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow Then let’s normalize and load the dataset. X_train_orig, Y_train_orig, X_test_orig, Y_test_orig, classes = load_dataset() ​# Normalize image vectors
X_train = X_train_orig/255.

X_test = X_test_orig/255. # Reshape
Y_train = Y_train_orig.T
Y_test = Y_test_orig.T print (“number of training examples = ” + str(X_train.shape[0]))
print (“number of test examples = ” + str(X_test.shape[0]))
print (“X_train shape: ” + str(X_train.shape))
print (“Y_train shape: ” + str(Y_train.shape))
print (“X_test shape: ” + str(X_test.shape))
print (“Y_test shape: ” + str(Y_test.shape)) number of training examples = 600
number of test examples = 150
X_train shape: (600, 64, 64, 3)
Y_train shape: (600, 1)
X_test shape: (150, 64, 64, 3)
Y_test shape: (150, 1) Now let’s find the number of labeled happy and unhappy faces in the training dataset. Read more from…

thumbnail courtesy of