{"id":8540,"date":"2023-01-31T21:16:29","date_gmt":"2023-01-31T21:16:29","guid":{"rendered":"https:\/\/wealthrevelation.com\/data-science\/2023\/01\/31\/identifying-the-dance-form-image-classification-with-convolutional-neural-network\/"},"modified":"2023-01-31T21:16:29","modified_gmt":"2023-01-31T21:16:29","slug":"identifying-the-dance-form-image-classification-with-convolutional-neural-network","status":"publish","type":"post","link":"https:\/\/wealthrevelation.com\/data-science\/2023\/01\/31\/identifying-the-dance-form-image-classification-with-convolutional-neural-network\/","title":{"rendered":"Identifying the Dance Form, Image Classification With Convolutional Neural Network"},"content":{"rendered":"<div id=\"tve_editor\" data-post-id=\"8823\">\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-18607c937a8\"><span class=\"tve_image_frame\"><img alt=\"Identifying the dance form with cnn\" data-id=\"8826\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Identifying the dance form with cnn\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?w=700&amp;ssl=1 700w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?resize=300%2C193&amp;ssl=1 300w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-sizes=\"(max-width: 626px) 100vw, 626px\" class=\"tve_image wp-image-8826 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?resize=626%2C402&amp;ssl=1\" class=\"tve_image wp-image-8826\" alt=\"Identifying the dance form with cnn\" data-id=\"8826\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Identifying the dance form with cnn\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-recalc-dims=\"1\"><img alt=\"Identifying the dance form with cnn\" data-id=\"8826\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Identifying the dance form with cnn\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?w=700&amp;ssl=1 700w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?resize=300%2C193&amp;ssl=1 300w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?resize=626%2C402&amp;ssl=1\" data-sizes=\"(max-width: 626px) 100vw, 626px\" class=\"tve_image wp-image-8826 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img class=\"tve_image wp-image-8826\" alt=\"Identifying the dance form with cnn\" data-id=\"8826\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Identifying the dance form with cnn\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/1.Identifying-the-dance-form-with-cnn.png?resize=626%2C402&amp;ssl=1\" data-width=\"626\" data-height=\"402\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv_wrapper thrv-inline-text wp-caption-text\" data-css=\"tve-u-18607c95b10\">Identifying the dance form with convolutional Neural Network<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\" data-css=\"tve-u-18607c7e1c4\">\n<p dir=\"ltr\">Today we are going to learn something crazy, by using <a href=\"https:\/\/dataaspirant.com\/category\/deep-learning\/\" target=\"_blank\" class=\"tve-froala fr-basic\" data-css=\"tve-u-18608cc6c22\" rel=\"noopener\">deep learning techniques<\/a>. We are going to build an Image classification model with a convolutional neural network or CNN.<\/p>\n<p dir=\"ltr\">Which can <strong>classify the given dance<\/strong> form image to the specific dance category.<\/p>\n<p dir=\"ltr\">The popularity of deep learning techniques usage increased predominantly over the years due to the significant cost reduction in storing and computing resources. <\/p>\n<p dir=\"ltr\">We can solve major chunks of problems, where <a href=\"https:\/\/dataaspirant.com\/catboost-algorithm\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>machine learning models<\/strong><\/a> are not giving promising performance results.\u00a0<\/p>\n<p dir=\"ltr\">The other reasons for deep learning usage is due to its <strong>flexibility and robustness<\/strong> in learning patterns in the data, which is hard for humans to learn or identify.\u00a0<\/p>\n<p dir=\"ltr\">With growing training data, <a href=\"https:\/\/dataaspirant.com\/optimization-algorithms-deep-learning\/\" target=\"_blank\" rel=\"noopener\"><strong>deep learning models<\/strong><\/a> learn more patterns, similarly like how the human brain learns with the amount of examples seen over the time.\u00a0<\/p>\n<p dir=\"ltr\">Today let\u2019s see one such example of how the deep learning models learn the dance form patterns to identify the dance form given the input image. <\/p>\n<p dir=\"ltr\">In a more technical term of saying <strong>Image classification with convolutional neural network<\/strong>.\u00a0<\/p>\n<blockquote class=\"\"><p>Are you excited ?<\/p><\/blockquote>\n<blockquote class=\"\"><p>We are too <img role=\"img\" alt=\"\ud83d\ude42\" data-src=\"https:\/\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif\" class=\"emoji lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img src=\"https:\/\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif\" data-lazy-src=\"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/svg\/1f642.svg\" role=\"img\" class=\"emoji\" alt=\"\ud83d\ude42\"><img role=\"img\" alt=\"\ud83d\ude42\" data-src=\"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/svg\/1f642.svg\" class=\"emoji lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img role=\"img\" class=\"emoji\" alt=\"\ud83d\ude42\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/14.0.0\/svg\/1f642.svg\"><\/p><\/blockquote>\n<p dir=\"ltr\">Before jumping straight into the use case , let\u2019s have an eagle view on the table of contents.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_tw_qs tve_clearfix\" data-url=\"https:\/\/twitter.com\/intent\/tweet\" data-via=\"\" data-use_custom_url=\"\" data-css=\"tve-u-18607c7e1c6\">\n<div class=\"thrv_tw_qs_container\">\n<div class=\"thrv_tw_quote\">\n<p class=\"\">Identifying the Dance Form, Image Classification With Convolutional Neural Network #cnn #deeplearning #imageclassification<\/p>\n<\/p><\/div>\n<p>\n\t\t\t<span><br \/>\n\t\t\t\t<i><\/i><br \/>\n\t\t\t\t<span class=\"thrv_tw_qs_button_text thrv-inline-text tve_editable\">Click to Tweet<\/span><br \/>\n\t\t\t<\/span>\n\t\t<\/p>\n<\/p><\/div>\n<\/div>\n<h2 class=\"\" id=\"t-1675167726675\">What is Image Classification<\/h2>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Today&#8217;s crazy use case will fall under the image <a href=\"https:\/\/dataaspirant.com\/classification-clustering-alogrithms\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>classification category<\/strong><\/a>. If you are not sure about classification don\u2019t worry we all were there at the beginning. So we would suggest you look at the below articles.\u00a0<\/p>\n<p dir=\"ltr\">Which helps you in solid foundation for understanding the classification concepts.\u00a0<\/p>\n<p dir=\"ltr\">For now let\u2019s understand what we mean by Image classification.\u00a0<\/p>\n<p dir=\"ltr\"><strong>Image Classification<\/strong> is most prominently used under <strong><a href=\"https:\/\/dataaspirant.com\/category\/computer-vision-2\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\">Computer Vision techniques<\/a><\/strong>. It is a <a href=\"https:\/\/dataaspirant.com\/supervised-and-unsupervised-learning\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>supervised learning algorithm<\/strong><\/a> which is able to classify the images into its respective classes or categories.\u00a0<\/p>\n<p dir=\"ltr\">To train the Image classification model we need an <strong>image dataset and its target labels<\/strong>. This is known as the <strong>training dataset<\/strong> most important or critical part in image classification model building.\u00a0<\/p>\n<p dir=\"ltr\">We can solve various real world problems using Image classification techniques. It is involved in various applications, which includes <strong><a href=\"https:\/\/dataaspirant.com\/gender-wise-face-recognition-with-opencv\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\">Face Recognition<\/a> <\/strong>, Gender Classification etc.<\/p>\n<p dir=\"ltr\">Just to understand the depth of image classification technique, let\u2019s see a few more real world examples.<\/p>\n<h2 id=\"t-1675167726676\" class=\"\">Image Classification Applications<\/h2>\n<p dir=\"ltr\">As mentioned before the Image classification has various use cases \u00a0which are widely used in various domains.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-18607cdfb58\"><span class=\"tve_image_frame\"><img alt=\"Applications of Image classification\" data-id=\"8832\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Applications of Image classification\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?w=700&amp;ssl=1 700w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?resize=300%2C193&amp;ssl=1 300w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-sizes=\"(max-width: 626px) 100vw, 626px\" class=\"tve_image wp-image-8832 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?resize=626%2C402&amp;ssl=1\" class=\"tve_image wp-image-8832\" alt=\"Applications of Image classification\" data-id=\"8832\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Applications of Image classification\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-recalc-dims=\"1\"><img alt=\"Applications of Image classification\" data-id=\"8832\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Applications of Image classification\" loading=\"lazy\" data-width=\"626\" data-height=\"402\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?w=700&amp;ssl=1 700w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?resize=300%2C193&amp;ssl=1 300w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?resize=626%2C402&amp;ssl=1\" data-sizes=\"(max-width: 626px) 100vw, 626px\" class=\"tve_image wp-image-8832 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img class=\"tve_image wp-image-8832\" alt=\"Applications of Image classification\" data-id=\"8832\" width=\"626\" data-init-width=\"700\" height=\"402\" data-init-height=\"450\" title=\"Applications of Image classification\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/3.Applications-of-Image-classification.png?resize=626%2C402&amp;ssl=1\" data-width=\"626\" data-height=\"402\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv_wrapper thrv-inline-text wp-caption-text\" data-css=\"tve-u-18607ce1299\">Applications of Image classification<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Just to give you the idea, We are presenting you the domains where the image classification is heavily used. \u00a0<\/p>\n<p dir=\"ltr\">Here you can see some of the sectors which are highly using Image Classification.<\/p>\n<h3 class=\"\" id=\"t-1675167726677\">HealthCare\u00a0<\/h3>\n<p dir=\"ltr\">Health Care is one of the finest domains we need to consider. It has different types of applications which can be solved using the image classification models. It includes<\/p>\n<ul class=\"\">\n<li>Lungs Cancer Detection.<\/li>\n<li>Brain tumor Detection,\u00a0<\/li>\n<li>Covid19 detection from x-ray scan images<\/li>\n<\/ul>\n<p dir=\"ltr\">With these kinds of use cases using image classification applications is <strong>growing exponentially<\/strong> in the healthcare sector.\u00a0<\/p>\n<p dir=\"ltr\">It is giving promenade results with <a href=\"https:\/\/dataaspirant.com\/six-popular-classification-evaluation-metrics-in-machine-learning\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>different evaluation metrics<\/strong><\/a> and providing efficient solutions for various kinds of complex medical problems.<\/p>\n<h3 class=\"\" id=\"t-1675167726678\">Education<\/h3>\n<p dir=\"ltr\">Image classification or recognition is playing a very crucial role in the education sector too. Such as \u00a0face detection. \u00a0<\/p>\n<p dir=\"ltr\"><strong><a href=\"https:\/\/dataaspirant.com\/gender-wise-face-recognition-with-opencv\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\">Face recognition applications<\/a> <\/strong>help to take attendance at one glance with no human effort.<\/p>\n<h3 id=\"t-1675167726679\" class=\"\">Driver less cars<\/h3>\n<p dir=\"ltr\">Image classification is one of the key components fueling <strong>self-driving technology<\/strong>, including the enhancement of safety features.\u00a0<\/p>\n<p dir=\"ltr\">It is implemented to identify objects on the roads, which includes <\/p>\n<ul>\n<li class=\"\">Other vehicles,\u00a0<\/li>\n<li class=\"\">Sharp turns,\u00a0<\/li>\n<li class=\"\">People,\u00a0<\/li>\n<li class=\"\">Pathways,\u00a0<\/li>\n<li class=\"\">Moving objects etc.\u00a0<\/li>\n<\/ul>\n<p dir=\"ltr\">Self-Driving cars facilitate traveling with more safety features.<\/p>\n<p dir=\"ltr\">Now let\u2019s deep dive to use of image classification technique in identifying the dance form, given the image of dance. \u00a0<\/p>\n<h2 id=\"t-1675167726680\" class=\"\">Image Classification Problem Statement<\/h2>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">You can see the different images above representing various dance forms. Anyone without dancing knowledge <strong>can\u2019t tell the difference<\/strong> between these dance forms.<\/p>\n<blockquote class=\"\"><p><strong>Tobe frank, even we can\u2019t say. <\/strong><\/p><\/blockquote>\n<p dir=\"ltr\">Probably most of the people will fail to define the actual dance form names or images from the shown images. This is\u00a0 a nutshell explanation for the image classification problem statement .<\/p>\n<p dir=\"ltr\">We have different dance forms available in the world.\u00a0 <\/p>\n<blockquote class=\"\"><p>Our main task is to <strong>Identify the dance form<\/strong> for the given image.<\/p><\/blockquote>\n<p dir=\"ltr\">Let\u2019s understand a bit about the dataset we are using to build the image classification model.<\/p>\n<h3 id=\"t-1675167726681\" class=\"\">Image Classification Model Dataset<\/h3>\n<p dir=\"ltr\">The dataset consists of <strong>364 training images<\/strong> belonging to <strong>8 categories<\/strong>, namely\u00a0<\/p>\n<ul class=\"\">\n<li>Manipuri,\u00a0<\/li>\n<li>Bharatanatyam,\u00a0<\/li>\n<li>Odissi,\u00a0<\/li>\n<li>Kathakali,\u00a0<\/li>\n<li>Kathak,\u00a0<\/li>\n<li>Sattriya,\u00a0<\/li>\n<li>Kuchipudi,\u00a0<\/li>\n<li>Mohiniyattam<\/li>\n<\/ul>\n<h4 class=\"\">Directory Structure<\/h4>\n<ul class=\"\">\n<li>train folder &#8211; consists <strong>364 training<\/strong> images<\/li>\n<li>test folder &#8211; consists <strong>154 testing<\/strong> images<\/li>\n<li>train.csv<\/li>\n<li>test.csv<\/li>\n<\/ul>\n<p dir=\"ltr\">You can download the data by using this link,<strong> Copy past the below link<\/strong>.\u00a0<\/p>\n<p dir=\"ltr\"><a href=\"\" class=\"tve-froala fr-basic\">https:\/\/drive.google.com\/drive\/folders\/1lHvKFLYnVUm4btjYfREcN2Ahaw9vAP1w?usp=sharing<\/a><\/p>\n<h2 id=\"t-1675167726682\" class=\"\">Image Classification Model Building<\/h2>\n<p dir=\"ltr\">To build the image classification model with deep learning involves different stages.<\/p>\n<ul class=\"\">\n<li>Data Preprocessing<\/li>\n<li>Analysis of the data<\/li>\n<li>Data augmentation<\/li>\n<li>Data Split<\/li>\n<li>Image classification model building<\/li>\n<li>Model specific graphs<\/li>\n<li>Image classification model evaluation<\/li>\n<\/ul>\n<h3 id=\"t-1675167726683\" class=\"\">Data Preprocessing<\/h3>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here, we are importing the <strong>necessary libraries<\/strong> to implement the model.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here, we are reading the image files , converting it into an array ,and normalizing it.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here, We are converting the image to numerical, the same way we used to convert the <strong><a href=\"https:\/\/dataaspirant.com\/word-embedding-techniques-nlp\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\">text to numerical values<\/a><\/strong> while solving the <strong><a href=\"https:\/\/dataaspirant.com\/build-email-spam-classification-model-spacy-python\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\">natural language processing problems<\/a>.<\/strong><\/p>\n<p dir=\"ltr\">The above code is simply converting the <strong>target label into one hot encoding.<\/strong><\/p>\n<h3 class=\"\" id=\"t-1675183367483\">Analysis of the data<\/h3>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here, we can see the <strong>target distribution<\/strong> of the Training data set. Seems like more over all targets having a<strong> similar kind<\/strong> of distribution.\u00a0<\/p>\n<p dir=\"ltr\">To increase the dataset, let\u2019s create multiple copies of the data with meaningful changes. Which is called <a href=\"https:\/\/dataaspirant.com\/data-augmentation-techniques-deep-learning\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>data augmentation in deep learning<\/strong><\/a>.<\/p>\n<h3 id=\"t-1675167726684\" class=\"\">Data Augmentation<\/h3>\n<p dir=\"ltr\">Data augmentation is a method that is used to <strong>increase the amount of data<\/strong> by applying various operations to the available image dataset.\u00a0<\/p>\n<p dir=\"ltr\">It can be performed by adding newly created synthetic data or images from existing data or slightly modified copies of already existing data or images. It helps to <a href=\"https:\/\/dataaspirant.com\/handle-overfitting-deep-learning-models\/\" target=\"_blank\" rel=\"noopener\"><strong>avoid overfitting <\/strong><\/a>when training a model.<\/p>\n<p dir=\"ltr\">Below is the code snippet to get this done.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here , we are augmenting the data using various techniques in order to increase the data samples.<\/p>\n<h3 class=\"\" id=\"t-1675167726685\">Data Spliting\u00a0<\/h3>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here ,we are splitting the data into training and validation data with the ratio of <strong>80% and 20%.<\/strong><\/p>\n<h3 id=\"t-1675167726686\" class=\"\">Image Classification Model Building<\/h3>\n<p dir=\"ltr\">Now let\u2019s build the image classification model.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here,<\/p>\n<ul>\n<li class=\" dir=\">First we are creating a <strong>Sequential model<\/strong> with an input layer having input_shape<strong> (224,224)<\/strong>\u00a0<\/li>\n<li class=\" dir=\">It is followed by <strong>three hidden conv2D layers<\/strong> with the sequence of 128,64 and 128 hidden neurons, respectively. <\/li>\n<li class=\" dir=\">Along with <a href=\"https:\/\/dataaspirant.com\/popular-activation-functions-neural-networks\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener\"><strong>relu activation function<\/strong><\/a>, 2*2 kernel size <strong>maxpooling2D<\/strong>, and <strong>Dropout ratio.<\/strong><\/li>\n<li class=\" dir=\">Flattening the data- (Flattening is converting the data into a 1-dimensional array for inputting it to the next layer).<\/li>\n<li class=\" dir=\">Dense layer with <strong>64 neurons and relu activation function<\/strong><\/li>\n<li class=\" dir=\">Last dense output layer with 8 neurons and softmax activation function.<\/li>\n<li class=\" dir=\">Now, we are compiling the defined model having <strong>Adam optimizer<\/strong> with categorical_crossentropy loss and accuracy metric.<\/li>\n<\/ul>\n<p dir=\"ltr\">Above all the key terms (Conv2D,MaxPooling2D and Dropout) are related to <strong>Convolutional Neural Network.<\/strong>\u00a0<\/p>\n<p dir=\"ltr\">We used different activation functions. You can refer to <a href=\"https:\/\/dataaspirant.com\/popular-activation-functions-neural-networks\/\" target=\"_blank\" rel=\"noopener\"><strong>activation functions<\/strong><\/a> for more learning.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here, we are creating both train and test data Generators to load data while training the model with having <strong>batch_size=32.<\/strong><\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here, we fit the model based on given arguments<\/p>\n<ul class=\"\">\n<li><strong>generator:<\/strong> a generator whose outcome must be a list of the form:- (inputs, targets) \u00a0<\/li>\n<li><strong>steps_per_epoch:<\/strong> it defines the complete number of steps taken from the generator as soon as one epoch is finished and the next epoch has started. It can be calculated as the <strong>total number of samples<\/strong> in your dataset divided by the batch size.<\/li>\n<li><strong>epochs: <\/strong>\u00a0epoch refers to one iteration throughout a full training dataset.\u00a0<\/li>\n<li><strong>validation_data: <\/strong>\u00a0it can be either- an inputs and targets list, a generator<\/li>\n<li><strong>validation_steps: <\/strong>It can be used only if the validation_data is a generator. It defines the complete number of steps taken from the generator previously interrupted at every iteration, and it is calculated as the total number of validation data points in your dataset divided by the validation batch size.<\/li>\n<\/ul>\n<h3 id=\"t-1675167726687\" class=\"\">Model Specific Graphs<\/h3>\n<p dir=\"ltr\">To visualize epoch wise how the loss is changing, we are going to use the below code snippet. <\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here we are plotting the <strong>train loss vs validation loss<\/strong> with respect to Epochs during training of the model.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-18608722f4d\"><span class=\"tve_image_frame\"><img alt=\"Train and validation Accuracy\" data-id=\"8855\" width=\"592\" data-init-width=\"782\" height=\"407\" data-init-height=\"538\" title=\"Train and validation Accuracy\" loading=\"lazy\" data-width=\"592\" data-height=\"407\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?w=782&amp;ssl=1 782w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=300%2C206&amp;ssl=1 300w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=768%2C528&amp;ssl=1 768w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-sizes=\"(max-width: 592px) 100vw, 592px\" class=\"tve_image wp-image-8855 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=592%2C407&amp;ssl=1\" class=\"tve_image wp-image-8855\" alt=\"Train and validation Accuracy\" data-id=\"8855\" width=\"592\" data-init-width=\"782\" height=\"407\" data-init-height=\"538\" title=\"Train and validation Accuracy\" loading=\"lazy\" data-width=\"592\" data-height=\"407\" data-recalc-dims=\"1\"><img alt=\"Train and validation Accuracy\" data-id=\"8855\" width=\"592\" data-init-width=\"782\" height=\"407\" data-init-height=\"538\" title=\"Train and validation Accuracy\" loading=\"lazy\" data-width=\"592\" data-height=\"407\" data-srcset=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?w=782&amp;ssl=1 782w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=300%2C206&amp;ssl=1 300w, https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=768%2C528&amp;ssl=1 768w\" data-recalc-dims=\"1\" data-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=592%2C407&amp;ssl=1\" data-sizes=\"(max-width: 592px) 100vw, 592px\" class=\"tve_image wp-image-8855 lazyload\" src=\"image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"><img class=\"tve_image wp-image-8855\" alt=\"Train and validation Accuracy\" data-id=\"8855\" width=\"592\" data-init-width=\"782\" height=\"407\" data-init-height=\"538\" title=\"Train and validation Accuracy\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2023\/01\/7.-Train-and-validation-Accuracy.png?resize=592%2C407&amp;ssl=1\" data-width=\"592\" data-height=\"407\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv_wrapper thrv-inline-text wp-caption-text\" data-css=\"tve-u-18608727c24\">Train and validation Accuracy<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Here, we are plotting the <strong>train accuracy vs validation accuracy<\/strong> with respect to Epochs during training of the model.<\/p>\n<h3 class=\"\" id=\"t-1675167726688\">Image Classification Model Evaluation<\/h3>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here , we are loading the test images ,converting it into array data. \u00a0<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Here , we are making predictions on the test data using a trained CNN model, inverse transforming the results into its original names and finally saving it into pandas DataFrame.<\/p>\n<p>Next we are concatenating the predictions into a test file and saving it into a csv file for submission.<\/p>\n<h2 id=\"t-1675167726689\" class=\"\">Conclusion<\/h2>\n<p dir=\"ltr\">We move to the end of this article. We learned how to build an image classification model which is able to <strong>classify the different dance forms using Convolutional Neural Networks <\/strong>in python.<\/p>\n<p dir=\"ltr\">Don&#8217;t limit yourself; use this methodology, and do some slight modifications to build models to\u00a0 solve different image classification applications.<\/p>\n<blockquote class=\"\"><p>I believe you learned something new from this article, Happy Learning!<\/p><\/blockquote>\n<\/div>\n<h4 class=\"\">Recommended Courses<\/h4>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/dataaspirant.com\/image-classification-with-convolutional-neural-network\/<\/p>\n","protected":false},"author":0,"featured_media":8541,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/8540"}],"collection":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/comments?post=8540"}],"version-history":[{"count":0,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/8540\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media\/8541"}],"wp:attachment":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media?parent=8540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/categories?post=8540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/tags?post=8540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}