# An Enhanced Deep Convolutional Neural Network for Classifying Indian Classical Dance Forms
## 3 Proposed Methodology
### Data Pre-Processing  
The accuracy of an image classification model is highly dependent on the data the neural network it is trained with. Image recognition algorithms rely on the dataset's quality, and image pre-processing allows us to focus on the features we want the neural network to learn by removing all the noise and disturbance in the input image. Indian classical dance forms have a steep range of color intensities due to vibrant costumes and stage drama; hence thresholding and scaling images into range \(-1\) to 1 sample-wise proves beneficial in learning. Algorithm 1 ([[https://github.com/VibhutiBansal-11](https://github.com/VibhutiBansal-11)]([https://github.com/VibhutiBansal-11](https://github.com/VibhutiBansal-11)), accessed on 4 September 2020) lists out the entire implementation workflow of the proposed approach. ```
The algorithm takes the images as input
1:for each image in Dataset:
2:function Preprocess (image, x_dim = 224, y_dim, threshold = 127, scale)
3: Return ProcessedImage
4:end function
5:Append(image) to array(X)
6:end for
7:read labels csv in array(Y)
8: categorical_labels = encode(Y)
9:Shuffle (X, categorical_labels)
10:X_train, Y_train, X_test, Y_test = train_test_split(X, categorical_labels)
11:function Create model
12:Initialize base_model = ResNet50
13:for layers in resnet.layer[:-14]:
14:Layers.trainable = false
15:end for
16:Add_layers (GlobalAveragePooling2D (), Dropout (0.5), Dense (256), Dropout (0.5), SoftmaxLayer)
17:Return model
18:Model.Compile (loss = Categorical_crossentropy, optimizer = Adam, metric = Accuracy)
19:function Create_Callbacks (monitor, patience, cooldown, min_lr)
20:return callbacks
21:function Train_Model (train_data, num_epochs = 15, val_frequency, callbacks)
22:return model
```  
**Algorithm 1**Workflow of the approach. Step 1: This involves resizing all the images to 224 \(\times\) 224 using Interarea interpolation, as shown in Figure 3c. Figure 3: (**a**) Original image, (**b**) RGB to BGR, (**c**) resized image, (**d**) threshold image (**e**) sampled image. Step 2: The simplest thresholding methods, as mentioned in [19], replace every pixel in the image with user-defined values, which can then be used to create binary black and white images or reduce the range of intensity in the image pixels. Thresholding is the simplest method of segmenting images in which we use truncate thresholding on images. The value of the threshold used is 127, all values above the threshold (127) are set to 127, and all values less than or equal to 127 are unchanged, as depicted in Figure 3a-d.  
\[dest\;(x,\;y)=\{thresh\;,\quad if\;src\;(x,\;y)>threshsrc\;(x,\;y)\;,\quad otherwise\} \tag{1}\]  
In Equation (1), \(\text{src}(x,y)\) gives the intensity values of the source image. In contrast, thresh shows the maximum intensity value for the pixels, and intensity values for the destination image are given by \(\text{dest}(x,y)\). The graph for the intensity of image pixels can be seen in Figure 4.  
Step 3: After thresholding, a sample-wise scaling of pixels to a range of \(-1\) to \(1\) is performed as shown in Figure 3e. Step 4: Later, the dataset is shuffled to ensure that each data point creates a distinct, independent change on the model without being biased by the same points and thus preventing the model from overfitting on the input data. The shuffled images are divided into training (70%), testing (15%), and validation (15%) splits. Following the above stated four steps that are resizing, thresholding, scaling, and shuffling, the dataset is now ready for training the image classification model as inferred from Figure 5.  
We designed our DCNN on top of ResNet50 architecture [20]. The pre-trained model, initially trained for 1000 categories, is used for feature extraction using Transfer Learning. The head of the pre-trained ResNet50 model is removed and replaced with our own set of layers. The last 14 layers of ResNet50 were un-frozen and made trainable. The following sections describe the architecture of the proposed deep convolution neural network (DCNN) [21].