Original Source Here
Guitar classifier using fast.ai library
This is a starter project I created for fast-ai part 1 course. The classifier is able to learn to distinguish fender and gibson guitars with ~90% accuracy using only 200 example images. This project illustrates the power of out of box tools available in fast-ai library, and is a great way to get started with deep learning.
Extract Guitar images
Fast ai library makes this step incredibly easy. Open a google images tab, and search for the keyword of interest, for our case we can simply search for “fender guitar” and “gibson guitar”.
Once we get all the image URL’s, fast-ai library makes it straightforward to download images using the api call.
Load and preprocess the data
In this step we use fast-ai vision library function ImageDataLoaders::from_folder which loads the images and splits them into the train/test/validation set and batches the data. It also provides the option of doing transformations on the image data before loading the image.
Verify that the data looks reasonable by previewing a batch.
Check the training and test data — in our case we have 216 training examples and 53 validation set.
Train the model using cnn-style resnet architecture. Use cnn_learner fast-ai function for instantiating the learner.
Start training the model by using one cycle scheduler. Note the reduction in error rate through subsequent epochs, the model converges to 11% error rate after 7 epochs(1 epoch = one sweep through the training data).
Check the result by plotting the confusion matrix. As can be seen from the matrix, model error rate = (5+1)/(5+1+18+29) = 11.3%
Github repo code/data available at:
Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot