Week 5 — Image Transformation According to Art Style

Oktay UĞURLU
BBM406 Spring 2021 Projects
3 min readMay 17, 2021

Hi! Last time, we talked about clustering and artist’s arts from the dataset to generate more styled images.

The K-means is an unsupervised learning algorithm that is a clustering algorithm. The K-means first randomly choose k points for the k cluster. After, the algorithm tries to fit these points centre of each cluster as centroid points until the repositioning is stopped. Finally, the points are assigned to the clusters according to their position.

The number of clusters can be evaluated by the Elbow method. According to the Elbow method, the sum of squares are calculated for each number of cluster. The squares of the difference between the centroid and each point belong to the centroid of the clusters are summed. When this summation is changed distinctively, the best cluster number is chosen which seems on this change.

We have run the K-means algorithm on directly extracted features from Monet’s arts. But the results didn’t get as expected. Because style based clustering is more complicated than a basic clustering process, we needed to extract some more features from each image.

K-means on pure features

When we applied the Elbow method to see an optimum cluster, the elbow seems on the 2 clusters, so it means that the algorithm only clusters 2 styles optimally. Therefore, when we look at the number of images for each cluster, we saw that the images are almost clustered randomly. The numbers are equal and the centre points are closed to each other. So, we decided to increase features using some feature extracting technics.

We have used VGG16 with ImageNET to preprocess images. The VGG16 model is a CNN based deep learning model which is used pre-trained weights on the ImageNet dataset. The processes in between the input layer and max-pooling layer take the role of feature extracting. After feature extraction, we got more fine clustered images whose styles looks the same as each other.

Elbow method for VGG16 feature extraction

According to the Elbow method, the optimum clustering seems as 4 clusters. After applying the K-means with 4 clusters, the number of images distributes more meaningful. You can see some clustered images for the same cluster below:

Same clustered images after K-means

Today, we have talked about how did we use K-means on the art dataset for clustering styles. Our aim for next week is to improve the accuracy of our image style transformation algorithm by using the accurate algorithm that we have implemented. In order to implement this algorithm, we have used K-means and the VGG16 model. We will also use this algorithm to cluster same looking styled arts.

Contributors:

--

--