First CNN. Whoohooo!

Jeremy requested reports of first tries. We created an image set of one_apple, some_apples (<5) and many_apples (>=5) and No_apples (soccer balls and strawberries and stuff) to see if we could train a CNN to count one, some or many apples. It was a terrible result because we only fed in 5 examples of each 'classification.

But…WE WENT THROUGH THE WHOLE PROCESS from Lesson 1. ‘We’ is me (67, MSc Comp Sci 1979, and my son, 19, first year Bsc Comp Sci). We are so stoked we can barely breath.



The lesson 1 is cat vs dog breed classifier right?
How did you use that to create a model that counts the number of items in an image?

@AjayStark we created our own image set by downloading and relabelling images from google images. A bunch of images of one apple, less than 4 apples, more than 4 apples and then some random non apples.Just like the dog and cat breeds, we labelled the images one_apple, some_apples, many_apples and no_apples. Then we had to upload the images to Google Collab. Then we had trouble with pathname (more on this if you are interested), but were finally in a position to train. But, alas, our image set was too small. Nevertheless, the point was to go through the entire process of training a CNN. It was quite a rush. BTW - we tried to improve the results by adding epochs, but the image set was simply too small, and the task a little ambitious for such a small set.


‘Counting’ images is a bit of an exaggeration. We just wanted to distinguish between one, some and many

1 Like

Ohh, good :slight_smile:

1 Like

can someone elaborate more on ImageDataBunch object ?

Hi Bhavesh, I think you may want to open a new topic, rather than have it under my comment - many more people with read it. Also maybe a bit more specific? My beginner’s take on the object is that it needs to take, at minimum, an image data set, a set of labels (or ‘classes’) and an architecture (like resnet34), which is a predefined learning architecture (and which works well with a lot of problems). There are many other parameters and options which Jeremy gets into later. BTW - if you don’t have validation (unlabelled) dataset, it will make one for you from a small percentage of your image dataset - there are many other options for that too . There are also multiple ways of attaching labels to images - the first example has them embedded in file name.