This is cool. How big is your dataset?
I am talking about RAM.
Have you succeeded to train 1 cycle with all images?
Row size variety
I did it on fast.ai v2 first time by modifying same lesson dog breeds
and achieved then 95% max
Your actual achieved accuracy with v3 in your notebook with resnet50 is 98.05 % ! You forgot to remove learn.load(‘stage-1-50’) at step.
Correct it was V3 with accuracy 98%. Indeed thanks for noticing it:)
I created a text classifier, which is able to detect language of handwritten document based on images. Dataset contains handwritten text in four languages: Bangla , Kannada, Oriya, Persian.
Here is sample dataset:
I used the lesson 1 notebook. With resnet50, accuracy of classification is ~97%.
Here is the prediction top losses:
and this is confusion matrix:
I used dataset provided by authors of this paper.
Next step would be to include other Indian languages and improve the classifier.
I also did a bit of PCA and applied some clustering models on the raw predictions (final output) of the model but not sure how to get the output from other layers. I didn’t know how to use the hook function in fastai neither then I came across your post. Thanks for sharing!
By memory do you mean RAM or the disk? In the code I shared we only use ~1% of the 50 million examples available, I don’t recall now but at resolution 128x128 that is only a couple of GB.
All these files never get loaded into RAM. They are written one by one to disk. And during training they are loaded and transformed on a per batch basis.
v1 exposes many nice ways to work with image files on disk - those are the class methods of
vision/data.py starting around line 271.
In v2 of the course I remember Jeremy saying: ‘if you have an option to change the data into a format supported by the tool of your choice, go ahead and do it, it will save you a lot of hassle vs writing your own way of interfacing with the data directly’. There is a way to use all 50 million examples by generating them on the fly without storing anything to disk, but I heeded Jeremy’s advice and took the easy way out
As a side note, I do wonder if even with a big, well tuned model it makes a difference if you train on 50 million examples vs say 2 million with data augmentation Realistically, there must be a lot of redundancy in 50_000_000 / 340 drawings of snowman!
Even in 0.7 that wasn’t true - it used bcolz to store it on disk. It only looked like an in-memory array - it wasn’t really one.
This text will be hidden
When I try to untar the data I get this error - ReadError: not a gzip file.
My code to untar the data is same as yours. Did you encounter that error?
I am very excited about the v3 course and the shared work here! A lot of creative approaches!
I also played around with the STONEFLY9 Image Database consisting of 3826 images of 9 taxa of Stoneflies for training a ResNet34 and ResNet50.
This is how the data looks like:
I was able to get the accuracy up to 0.99+ and the single misclassified image is one where the insect is only shown incompletely:
These results also beat the older papers as far as I have found comparable values.
You can find my notebook here: https://github.com/MicPie/fastai_course_v3/blob/master/L1-stonefly.ipynb
Questions, comments, and suggestions are highly appreciated!
I will now look deeper into results with the methods posted by others in this thread (PCA, activations, etc.).
Edit: Added a post about visualizing the activations including a notebook.
I always have to manually clean up my Whatsapp downloaded images folder because Memes and other images sit in same folder along with camera pics shared by my contatcs.
Hence i trained 34 model with 2000 images without unfreezing, 1000 manually classified images from my own Whatsapp and another 1000 sourced from google search.
I think google photos have similar model built in to remove clutter but it does not detect memes.
I am planning to have bigger dataset and testing set and see how it goes.
Playing with the Birds dataset from Caltech. It seems going to be challenging, there is 200 bird classes each a dozen pictures. With the simple 4 cycles training of ResNet-34, I got very bad results:
Total time: 12:08 epoch train_loss valid_loss error_rate 1 3.650673 2.174252 0.521866 (03:07) 2 1.836933 1.261172 0.349438 (03:08) 3 1.250030 1.025832 0.284881 (02:55) 4 0.989510 0.987043 0.269888 (02:57)
Here is the top losses:
The confusion matrix is not even readable with all the 200 categories:
This is going to be challenging but love it, thanks so much @jeremy for this wonderful journey!
be careful with the CUB dataset, as it says on their website:
Warning: Images in this dataset overlap with images in ImageNet. Exercise caution when using networks pretrained with ImageNet (or any network pretrained with images from Flickr) as the test set of CUB may overlap with the training set of the original network.
Potentially you are using images for your valid/test set which were previously in the ImageNet train dataset used for training the weights of the pretrained ResNet.
Nevertheless, I was also playing around with this dataset before and got similar results to the one posted by you.
I guess in this case it would be best(practice) to remove the ImageNet images from the birds dataset or pretrain with other images (and not ImageNet)?
Hey everyone! I played around with Kaggle’s Facial Expression Recognition dataset to create a emotion classifier.
This is what the data looks like:
And the top losses:
The classifier gets an accuracy of 84%! Surprising since even I was confused (a lot) while manually inspecting the images.
P.S - Since all the images in this dataset are 48x48 does anyone know what happens when we use
size=299 while creating ImageDataBunch?
@MicPie I didn’t fully understand the warning when looking at the training cycles results I see big losses. Isn’t this strange? should be almost perfect results if the same pictures were used to train the model.
The thing if we train without ImageNet pretrained NN it will take a long time, but will give it a try.
It just means it will run unnecessarily slowly. Use size=48 instead.
I have been currently working on this Happy whale dataset. I have used resnet34 model for classifying more than 3000+ whale species. The classifier that I build didn’t perform very well with only 10% accuracy. From this dataset I understand that there might be some more to it to increase it’s accuracy like applying certain specific transformation, choosing different etc. Since this is the problem of multi-class predictions I hope this will be taught later in this course on how to build multi-class prediction model in fastai which is so much easier as compared to building this notebook completely from scratch using pytorch. Below is my gist for happy whale dataset classification: