Ace_Code

A.Q: Last week you did an exercise where you manually applied a 3x3 array as a filter to an image of two people ascending an outdoor staircase. Modify the existing filter and if needed the associated weight in order to apply your new filters to the image 3 times.
Plot each result, upload them to your response, and describe how each filter transformed the existing image as it convolved through the original array and reduced the object size. What are you functionally accomplishing as you apply the filter to your original array (see the following snippet for reference)? Why is the application of a convolving filter to an image useful for computer vision? Stretch goal: instead of using the misc.ascent() image from scipy, can you apply three filters and weights to your own selected image? Again describe the results.

##Blur:

A.A: In The first run, the image (see below) is black and white and the horizontal lines are not as clear as the vertical lines. This is because the first filter was a blurred line filter. So, the filter takes A convolution, which is a filter that passes over an image, processing it, and extracting features that show a commonality in the image to put emphasis blurring the lines. In this case it reduced te objects size but did not lose any features.

Pic_1 Pic_Blur

In the next run, the same process was applied and only this time we can see that the reduced image has not lost any features, but now there is an emphasis on the Horizontal lines. This is important because this means we could classify an image based on its features, which is what CNNs are supposed to do. So, convolutions will learn the sets of features that will match the labels using filters through randomization and optimizers. Look at the images below to see how the Different filters changed the image.

##Horizantal Filter:

Pic_Horiz

##Virt:

Pic_Virt

##Pooling B.Q: Another useful method is pooling. Apply a 2x2 filter to one of your convolved images, and plot the result. In ffect what have you accomplished by applying this filter? Can you determine from the code which type of pooling filter is applied, and the method for selecting a pixel value (see the following snippet)? Did the result increase in size or decrease? Why would this method be method? Stretch goal: again, instead of using misc.ascent(), apply the pooling filter to one of your transformed images.

B.A.: After running the Pooling Code I have created a new image that is half the size of the original and the image has an emphasis on a vertical line but has maintained all the features of the original image. Bellow are the photos and their differences.

Pic_1 Pic_Pool3

##C.Q: C. The lecture for today (Coding with Convolutional Neural Network) compared the application of our previously specified deep neural network with a newly specified convolutional neural network. Instead of using the fashion_MNIST dataset, use the mnist dataset (the hand written letters) to train and compare your DNN and CNN output.
Were you able to improve your model by adding the Conv2D and MaxPooling2D layers to your neural network? Plot the convolutions graphically, include them in your response and describe them. Edit the convolutions be changing the 32s to either 16 or 64 and describe what impact this had on accuracy and training time. What happens if you add more convolution layers?

C.A.:I was able to improve the model. When adding the Conv2D and Max Pooling2d the amount of information being processed was reduced and made the image smaller while keeping the features I wanted intact. For example, the max-pooling 2d turned 4 pixels in to one. Adding more CNN layers will normally improve accuracy for large data sets as more layers with less stride factor will extract more features from your input data. In this case that is exactly what happened. When we added more filters, the image got better and so did the accuracy.

16: Loss: 0.559 Acc: .9854

32: Loss: .0626 Acc: .9860

64: Loss: .0539 Acc: .9870

See the images bellow:

16

Pic_Pool16

32

Pic_32

64

Pic_Poo64