Week #4 — Identification of Artists by Their Paintings with Machine Learning

Mert Şahin
BBM406 Spring 2021 Projects
3 min readMay 10, 2021

This week, we discussed how we can improve the accuracy of our algorithm that we have implemented. After our meeting with T.A, we focused on specific methods. These are Fine-tuning a pre-trained model and attention.

Attention

In the context of neural networks, attention is a technique that mimics cognitive attention. The effect enhances the important parts of the input data and fades out the rest — the thought being that the network should devote more computing power on that small but important part of the data. Which part of the data is more important than others depends on the context and is learned through training data by gradient descent.

Prediction/Actual/Loss/Prob

The image above is one of our misclassifications. When we looked at the painting, we thought that the border areas of the painting don’t have the signature of the artist. Therefore, we think that running our algorithm using certain parts of the picture with using attention, can increase accuracy. We are planning to implement this issue in our algorithm next week.

Fine-tuning

Fine-tuning, in general, means making small adjustments to a process to achieve the desired output or performance. Fine-tuning deep learning involves using weights of a previous deep learning algorithm for programming another similar deep learning process.

We did small adjustments on the model ResNet152.

Firstly, we froze top level layers and trained only the output layer.

artist_identification.freeze()
artist_identification.fit_one_cycle(4)

Then the accuracy increased from %87 to %88.3.

Secondly, we unfreeze all layers of the CNN and we find the optimal learning rate, and plot a visual.

artist_identification.unfreeze()artist_identification.lr_find()

Then we choose optimal learning rate interval.

artist_identification.fit_one_cycle(2, max_lr=slice(1e-6,1e-5))

We trained all layers again with the value epoch = 2.

We reached %90 accuracy on our model with fine-tuning!

Confusion matrices before & after fine tuning

With fine-tuning we got better results especially for Pablo Picasso.

In the next weeks we will still work on how can predict better with our algorithm. Stay tuned!

References

--

--