# Transfer Learning - Week 1
## ANNs vs. CNNs
### Test 1.
**1. If we give an input matrix of size (30x30x64) to the flattened layer, what will be its size?**
- 900
- 57600 **Ans:** You Selected
- 1920
- 576
Why?:
The size of the flattened layer will be 30*30*64 = 57600
**2. Which of the following is not true for Convolutional Neural Networks?**
A. CNNs are translation invariant.
B. CNNs increase the number of trainable parameters, making the training procedure more complex.
- Only A
- Only B **Ans**
- A and B both
- Neither A nor B
Why?:
Convolutional filters require less trainable parameters which gives CNNs a computational advantage.
**3. Find the number of trainable parameters of a convolution layer if our input shape is (224,224,3) and we are using 10 filters of (3x3) filter size.**
- 280 **You Selected**
- 270
- 180
- 300
Number of Trainable Parameters
= (filter size x No. of channels + bias) x No. of filters
= (3 x 3 x 3 + 1) x 10
= 280
## CNN Architecture.
### Test 2.
**1. Which of the following options is correct for Convolutional Neural Networks?**
* Input Layer -> Convolution Layer -> Pooling -> Prediction -> Fully Connected Layer -> Flatten
* Input Layer -> Convolution Layer -> Pooling -> Fully Connected Layer -> Flatten
* Flatten -> Input Layer -> Convolution Layer -> Pooling -> Fully Connected Layer
* Input Layer -> Convolution Layer -> Pooling -> Flatten-> Fully Connected Layer **(Ans)**
Why?:
The correct flow of the layers in a CNN is:
* Input Layer -> Convolution Layer -> Pooling -> Flatten-> Fully Connected Layer
**Input Layer:** Collects input images
**Convolution Layer + Pooling:** Build feature maps and extract important features from input images
**Flatten:** Creates a 1-D array of the output of its previous layer
**Fully Connected Layer:** Classifies/Predicts the output.
**2. State whether the following statement is True or False.**
*We do not lose any information in the pooling* layer.
**Ans:** False
Why?: We do lose information at the pooling layer, but it is only irrelevant information.
**3. Which of the following tasks does not take place in the Fully Connected Layer?**
* Prediction
* Weight modification
* Feature Extraction **(Ans)**
* Firing up the neurons
Why?: In the fully-connected neural network, we use flattened outputs from the pooling layer to get the final predictions. Since this is nothing but a dense neural network, operations like weight modification and firing up neurons using activation functions occur. **The FC layer does not have the capability of feature extraction.**
## CNN Sequential Model Hands-on
### Test 3.
**1. Which of the following is the correct technique for normalization in CNN?**
* Reshaping the input images to have a single channel.
* Dividing all the pixel values by 255 so that the images have pixel values between 0 to 1. **(Ans)**
* Encoding the Y values.
**2. Consider the below code:**
`model.add(Conv2D(64, (3, 3), activation='relu', padding="same", input_shape=(x, y, z)))`
Which of the following is correct for the above code?
* This code is adding 3 convolution layers with 64 filters and kernel size 3 ; padding = 'same' provides the output size same as the input size and input_shape denotes the final image dimension for the flattened layer.
* This code is adding first convolution layer with 64 filters and kernel size 3x3 , padding = 'same' provides the output size same as the kernel size and input_shape denotes input image dimension of the data set.
* This code is adding first convolution layer with 64 filters and kernel size 3x3 , padding = 'same' provides the output size same as the input size and input_shape denotes input image dimension of the data set. **(Ans)**
Why?
* model.add(Conv2D()) is creating the first convolutional layer.
* 64, (3, 3) is the number of filters and kernel size respectively
* padding = 'same' provides the output size same as the input size
input_shape denotes input image dimension of the data set. So if the data set has images of dimension 720x720 and have 3 channels, then x = 720 , y = 720 and z = 3
**3. How many trainable parameters do we have in the pooling layers of a CNN?**
* 0 **(ans)**
* 9
* Same as convolution layers.
Why?:
Pooling Layer has no trainable parameters, so the number of parameters is 0.
### Quiz - Week 1