Week 4: Identity cat / non-cat pictures

Hello again, I’m on the last assignment for this course, I’m glad that we re-visit the “cat / non-cat” classification problem that we had from the Week 2 assignment. Let’s say that our algorithms are good enough, be it logistic regression or neural network, one thing still bothers me whenever I take a step back and look at this cat problem from a holistic view. Perhaps, I’m missing something! I like the algorithms we use, I love the math involved, and a good number of training examples. Still, I don’t think that’s enough for the algorithms to be able to classify a photo as a cat photo or not. Is it the “pixel intensity” from the inputs that help make this classification ? And if that’s the case, what is it about the cat pixels that make them different from the non-cat pixels ? I have re-watched the videos from the earlier weeks but still don’t get it. I definitely missed something important !

It is not the individual pixel values, but their relationships, right? The algorithm can learn the geometric relationships, like edges and curves and then putting those together to recognize higher level features: e.g. two edges that meet at a certain angle are probably a cat’s ear.

Another way to see the point I’m making above is to consider what would happen if you took the images and just subtracted 5 from all the pixel values. The shapes would still be the same, right? A cat still looks like a cat if you slightly change all the colors in the image. In fact the idea of randomly perturbing the pixel values is a legitimate technique for “data augmentation” to use when you have limited training data. Speaking of which …

The sample datasets here are incredibly small for the complexity of this task. It turns out the datasets are very carefully curated so that it even works as well as it does. But you’ll notice that if you try the model on your own imported images, the performance is not that great. Here’s a thread that shows some experiments with rearranging the training and test sets.

Another interesting aspect of this to consider is that we need to “flatten” the images into vectors in order for the algorithm to handle them. So you might think that doing that obscures the geometric relationships between the pixels, but the algorithm is still able to figure them out. In fact there are more ways than one to do that flattening operation, but as long as you consistently handle all the data the same way the algorithm can still learn. Here’s a thread which discusses the flattening operations in more detail. Make sure to read all the posts to see the discussion of the “F” versus “C” unrolling order.

Thanks Paul!

The last assignment has two exercises. I got “All tests passed” for Exercise I. I expected to get the same thing (“All test passed”) for Exercise II as well. However, when I ran Exercise II, something wasn’t right. All the previous inputs were not taken in, shown as “In [ * ]” and no message was displayed. Is it a problem with the Autograder I had read earlier. I have not submitted the assignment yet.

There is no problem with the autograder for that assignment. At least not any that would cause your issue. It sounds like you are not handling the print flag correctly (hard-coding it to False maybe), but that should not cause the tests to fail. I suggest you free your mind from the thought that this must be someone else’s fault and have another hard look at both the instructions and your code.

And note that just passing the two_layer_model case is no proof of anything. The L layer case is a bit more complex and there are more things that can go wrong.

I jut got “All tests passed” for Exercise II as well. But now I’m having a problem submitting this assignment. I will see if it’s the internet issue. Thanks Paul !

I completed this course and I’m moving on to the next course in this Deep Learning Specialization. Thanks for everything!

Congratulations! There’s tons of fun and interesting material still to come. See you in Course 2!