Share your work here ✅

Was inspired by the lesson 2 image download, I re-adapted the code to use it to download high quality images from EyeEm (which is used by pro photographers).
I got a nice curve for the learning rate
eyeem_learning_rate
And some good results when looking at the confusion matrix:
eyeem_confusion_matrix
Here is a blog post summarizing the steps for creating a dataset of images using this service - link.
Here is the complete jupyter notebook - link.

Tried to build a web app for serving an emotion classifier using same service used to win science hack day mentioned in lesson 2. The classifier didn’t had great results, but nevertheless was able to see that Samuel Jackson is angry:

> train_ds._get_x(10)

samuel

> learner.predict(train_ds._get_x(10))
('Angry',
 tensor(0),
 tensor([7.7620, 0.6239, 2.4098, 0.4851, 1.5716, 0.1141, 0.7207]))

Then hit this error on deployment of the app;

> Upload [====================] 100% 0.0s (83.34MB) [3 files]> Error! Upload failed
> Error! An unexpected error occurred!
  Error: File size limit exceeded (5 MB) (400)
    at responseError (/snapshot/repo/dist/now.js:2700:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7) Error: File size limit exceeded (5 MB) (400)
    at responseError (/snapshot/repo/dist/now.js:2700:15)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

It seems need to upgrade paid. I think Bardem next movie should be no country for poor men :joy:
Any way, I think the world can wait few more days until I find a free service :laughing:

Jokes a side:

2 Likes

FYI in python stuff starting with ‘_’ is generally meant for internal use. You should simply say train_ds[10].

3 Likes

Hi fellow practitioners,

No web-app but sharing it anyway :slight_smile:

I automatically downloaded 99 images for three kinds op medical packaging. Paracetamol 125MG, 500MG and 1000MG. Resulting pictures are of good quality, below some examples:

(For downloading I used google image download:)

PATH = "/home/jupyter/med_packages/train"
keywords = "Paracetamol 500MG,Paracetamol 125MG,Paracetamol 1000MG"
response = google_images_download.googleimagesdownload()
arguments = {"keywords":keywords,
         "limit":99,
         "print_urls":False,
         "output_directory":f'{PATH}',
         "chromedriver":"/usr/local/bin/chromedriver"}
paths = response.download(arguments)

I expected it to learn quite fast because imagenet is capable of segmenting/filtering text inside an image. So I would expect it learned to associate the numbers in the image with the corresponding class.

But even training with Resnet50 it is wrong on 1 out of 4 images, while the images are correctly classified, eg:
29
42

Probably the model sees other patterns. Any suggestions for debugging or improving? Of course more data would improve the model.
Can I somehow/force hint the model it should look for text? I’m thinking of generating some data myself with only text in different fonts/colours/sizes/angles.

Thanks for thinking along!

1 Like

I’ve made story about classifying fruits dataset with fastai. I am aware that the code display method should be consistent (some is written in markdown, some is screenshotted), but I got lazy tbh.

1 Like

For those willing to try their first Kaggle competition, or those with little experience like me, what @radek created on Kaggle and GitHub for this Quick_Draw competition is pure gold:
He takes you through the initial steps of downloading the right data,
how to process/transform it to fit into FastaiV1,
how/where to modify the tuning (image_size, full or partial dataset_size, number of epochs),
and even include the code to optimize it (TTA) then generate a submission :heart_eyes:

It’s truly an amazing package for an on-going competition.

Of course, his starter pack “as it is” won’t get you a medal.
But if you dive in and figure out how to play with FastaiV1 options/parameters, you have a unique chance to compete and see your Public Leaderboard score move as you explore (remember: only 5 submissions per day).

Plus he and others share more tips about finetuning to get a better score, in the Kaggle thread he created so it’s legit.

BTW, if you check his profile on Kaggle, he went from Novice (Rank 1) to Master (Rank 4) in the last 3 months, focusing on three Computer Vision competitions (1 solo gold, 2 silver) so he obviously knows a bit about it :rofl:

cc @jeremy

PS: this relates to the first post in this thread.

21 Likes

I classified 149 different composers based on spectrograms of their compositions. I wanted to see whether an image classifier could rival an expert music buff’s ability to spot a composer by listening to a piece. Data was a large MIDI file dump found on a DJ subreddit.

The model turned out only so-so (82% accuracy) and, really, it only works well for the best-represented composers in the dataset (it rocked at classifying Bach). But it was a fun proof of concept and intro to the fastai workflow!


code: https://github.com/zcaceres/deep-learning-composer-prediction

19 Likes

That sounds really high for recognizing that many classes!

2 Likes

Wow, cool! 82% is amazing, almost unbelievable accuracy with so many classes!

You might also want to try with a melspectogram. It was better for environmental sounds, not sure if that holds for music though.

1 Like

Is this that beautiful spectro form provided by librosa??

Yes, one of them:
https://librosa.github.io/librosa/generated/librosa.feature.melspectrogram.html

Librosa is really great, and you can generate several types of spectrograms all with a lot of options. To be honest I was just pretty much blindly experimenting because I’m not an expert in audio. I think selecting the optimal one with the optimal configuration requires some insight into the specific use case.

5 Likes

That’s useful notebook, will check out

I’m trying to build a classification model for various aircraft models (Airbus A380, Boeing 747, Boeing 777 etc.) - the problem I’m facing is that my lateral ends of the image get cropped off due to square-cropping, and this impacts my training because in most cases the nose and tail of the airplane, which are important features that distinguish the model get cropped off. How do I overcome this?

You can add these arguments to the ImageDataBunch function: do_crop=False, padding_mode=‘zeros’

See https://docs.fast.ai/vision.transform.html for alternative padding_modes and more info on this.

3 Likes

I took the nice animation of SGD from lesson 2 and tried to take it a step further, plotting the loss function and the path followed by SGD.

Some visualizations at different learning rates:





It was a nice learning experience and an opportunity to learn a little bit more on matplotlib as well :slight_smile:

144 Likes

If you read here https://www.fast.ai/2018/08/10/fastai-diu-imagenet/ there is a discussion on rectangles. I did not have time to check if this thing has been already implemented in fastai v1

very cool :+1:

Link is broken.

Link is OK for me.

Grate job!

1 Like

I tried classifying all the 81 fruits on the same dataset. Almost 100% accuracy on validation set, even without training the lower layers. Maybe the fruit shapes are very basic, and so such deep NN is not required.

1 Like