Identification of Indian dance form using TenforFlow2.0 and Keras

Original article was published on Deep Learning on Medium

Identification of Indian dance form using TenforFlow2.0 and Keras

In this article I am going to walk you through Basic Image classification problem using Indian dance form data. I am going to use CNN (Convolution Neural Network) in TensorFlow2.0 and Keras with Transfer Learning to classify images into multiple classes. In this file we are using Transfer Learning concept to classify Indian dance form. Transfer Learning used when we have very less training data. In image processing, training with less data does not give good results. So we are using Transfer Learning to get weights. This notebook use TensorFlow VGG16 and the purpose of this article to show how to use Transfer Learning for image classification.You can download the data from here.

The datasets consists of 364 images belonging to 8 categories, namely manipuri, bharatanatyam, odissi, kathakali, kathak, sattriya, kuchipudi, and mohiniyattam. It is one of the basic building blocks of Machine Learning and Deep Learning We challenge you to build a model that auto-tags images and classifies them into various categories of Indian classical dance forms.

The data folder consists of two folders and two .csv files. The details are as follows: train: Contains 364 images for 8 classes

  • manipuri,
  • bharatanatyam
  • odissi
  • kathakali
  • kathak
  • sattriya
  • kuchipudi
  • mohiniyattam

First we need to load all libraries before proceeding further

Now we load data set which contains image name and labels for training data set and image name for test data

Lets plot the dance form using histogram to check image distribution

We can see image class are almost equally distributed minimum image for manipuri is 36 and maximum image for mohiniyattam is 50

It’s time for creating base and working directory for image processing for loading actual image data from dist into memory. I am using kaggle plate from you can use your own location.

After assigning path where our actual data exist we need two helper function to read image data and convert into numeric format. I am using OpenCV to read and convert images into numeric format.

Now we have loaded images into memory an numeric format lets visualize first 25 images.

Our target variable is in string format, for model building we need to convert sting into object variable. We are using sklearn LebelEncoder to convert from string to object format

Now it’ time to build the model. Before building Deep Learning model we need to divide our data into training and validation set.

One more final step before model building is augmentation for rescale of numeric data by dividing all values by 255, so that all values will be between 0 to 1 as well as creating multiple new data to prevent over fitting of model.

Now our data is ready for training. In this article I am using Transfer Learning to train our model. We use weights of already trained model VGG16 for this purpose.

We use already trained model output and build two sequential dense layer with dropout =0.25 to prevent over fitting.

After 30 epoch we reached training accuracy 0.8642 and validation accuracy 0.7273. Lets plot accuracy and loss graph for training and validation for each epoch.

From above graph we can see training and validation accuracy increases fast for first few epoch but after it is going to constant and same case applicable for loss.

I hope this article give you some insights about classifying Indian dance form using Tensorflow and keras with help of Transfer Learning.