Week 2, course1, A tree is a "cat", a sun is a "cat"!

The model misclassified my first two test images: a “tree” and the " sun"! In both cases: “y = 1.0, your algorithm predicts a “cat” picture”.
Any explanation.

Hi Ayoub, welcome to the community and thanks for your question! Can you give some context to your question, which exercise and which week, and where exactly in the exercises are your checking on the classification? That way I might be able to give you advise on this,
regards, Stephanus

Sorry I didn’t specify. It’s the logistic regression classifier we build in week 2 in course 1 to recognize cats. After I got all the assignment correct, I tried the model on a tree picture and on the sun. The classifier classifies them as cats.

Hi Ayoub,
Just run the test myself with some pictures. You got a good point! My sun picture also predicts a cat, although my tree picture predicts a non-cat. Apparently, there is some bias in the predictive model in that round shapes are predicted as cats.

It is a perfect example to show that logic regression is not entirely accurate when predicting images. Basically logistic regression is a neural network with one layer. It’s reasonably accurate, but it can be more accurate if you use a neural network with more layers. You will see in the exercises in the following weeks that you can build a much more accurate model.

Hope this helps!

1 Like

I agree. Just to say, the image of the tree I used was a “drawn tree” not a real one :).
There is a question that’s just crossed my mind, even with the most powerful algorithms that classify images, are they capable of classifying counterparts of real world objects from the world of drawings (only by training them with real world objects) ? For instance, suppose we have a powerful classifier that “perfectly” classify cats from non-cats, will it be able to “correctly” classify drawings of cats from drawings of non-cats?

Hi Ayoub,
that’s a great question. Neural networks are basically black boxes so if you test them with real cat pictures, you do not know “how” the neural network identifies a cat from a non-cat. It could for example be color, the contours, whether it has claws, 4 feet, etc. I haven’t seen any situation in which a model trained on real data actually also can identify “sketches”, and we probably do not even no how humans identify sketches from real pictures.

But you can try it our yourself. I uploaded some sketches of cats.

These were the sketches identified as cat:
cats yes

These were the sketches identified as non-cat:
cats no

So still quite accurate, but it is difficult to say what “criteria” are being used by the model. When you add non-cat pictures and non-cat sketches, the same will apply as well.

The text book answer of course is to include sketches of cats and sketches on non-cats in your training set as well. But for art, once drawings get really abstract there is even disagreement among people whether abstract art will represent something in real live, like a cat, or a person, or anything else… So I can’t give you a straight and definitive answer.

Hope this clarifies a bit!
Regards Stephanus


Hi Stephanus.
Actually, the answer in fantastic. It explains to me lots of things I always had questions about. Thanks.

You’re welcome. Good luck with the rest of the course!

1 Like

Hi @sjfischer. I’ve just finished course 4 and I tested the 4-layer NN (the deep one) on the same tree and sun images I tested before with the logistic regression model. As a reminder, this latter gave that these images are cats. However, the 4-Layer has better predictions. Indeed, a tree still a cat :scream_cat: , but the sun is now not a cat (Fortunately :smiley_cat:).

1 Like

Hi @Ayoub that’s great to hear! So the 4-layer is better, but not perfect yet! Fortunately some human judgement is still required :grinning:

1 Like

Indeed it does, otherwise… :grinning_face_with_smiling_eyes:
I’ve just tested with other images, and the difference between the two models is obvious.
@sjfischer, as the courses go on, will we build a perfect classifier in the future?

Hi @Ayoub, the courses go on to explore some other topics (hyperparameter tuning, convolutional neural networks, sequence models), so no cats anymore… But definitely something to revisit once and a while!

1 Like