Classification of Geometric Batik Motif Typical of Indonesian Using Convolutional Neural Network

Batik is a world heritage from Indonesia which is a characteristic of Indonesian culture. On October 2, 2009 batik has been awarded as a cultural heritage from UNESCO. Indonesia has 5.849 batik patterns from Aceh to Papua. The ability to recognize batik cloth patterns is certainly quite difficult and only owned by certain people who have expertise. One way to identify batik patterns is by using a pattern recognition classification method based on quantitative measurements of the main features or characteristics of an object. Deep Learning is one solution to detect batik patterns automatically. One of deep learning methods that can classify patterns of batik patterns is Convolutional Neural Network (CNN). CNN is able to group and detect objects in the image automatically by accepting input data with a size of m×n. CNN uses image input through a convolution layer and be processed according to the specified filter. Each layer produces a pattern from several parts of the image that facilitates the classification process. This study uses the CNN method and obtains the average value of 96% accuracy, 96,78% precision, 96,74% recall, and 96,74%.


INTRODUCTION
Batik is one of Indonesia's cultural icons which has received an award as a cultural heritage from UNESCO on October 2, 2009 [1]. Batik is a cultural product that has visual beauty and contains philosophy in each of its patterns [2]. Unfortunately, currently Indonesian cultural batik patterns are widely claimed by other countries as their country's wealth. For this reason, it is necessary to preserve and develop typical Indonesian batik patterns so that claims do not happen again [3]. So far, information about batik can only be obtained from books, journals, museums, and batik exhibitions. There is no official website from the government that can be accessed by people in various countries to find out information JURNAL TEKNIK INFORMATIKA Homepage :http://journal.uinjkt.ac.id/index.php/ti about batik, history, and patterns of batik in Indonesia.
According to Bandung Fe Institute and Sobat Budaya who conducted cultural data collection for the latest 9 years, it is noted that Indonesia has 5,849 batik patterns from Aceh to Papua. Each region in Indonesia has a different batik pattern. It is difficult to identify patterns of batik due to the number of patterns [4]. The process of identifying batik patterns requires experts in the field of batik, which are currently very limited in number, in addition to seeing the patterns and characteristics of batik patterns it also requires a magnifying glass, ruler, and other manual tools that require very long manual operations and a long time [5]. This requires an automatic detection system on the pattern of batik patterns with the help of a computer that can be developed to facilitate the introduction of batik patterns, especially for the general public. Automatic detection of batik patterns can be an alternative to preserving batik culture.
One of the automatic detection systems to recognize the pattern of batik patterns is to classify them. Classification is a process to identify the characteristics of an object that is categorized into different classes [6]. The method for classifying batik is done by dividing the number of batik data into certain classes according to the pattern of patterns [7]. Several studies that have carried out the classification of batik pattern patterns include: [8] classifying batik patterns into 2 classes, namely inland and coastal batik patterns. This study uses the Euclidean distance measurement method which produces accuracy, precision, and recall values, respectively, namely 44,44%, 50% and 40%. Another study by [9] used the gray level cooccurrence matrices method and the Canberra distance calculation to classify batik into 2 classes, namely inland batik and coastal batik. This study resulted in an accuracy value of 41.67%. Furthermore, another study by [10] used the Gaussian Shaped-Membership Function method by classifying Yogyakarta batik into 2 classes, namely parang kusumo batik and kawung batik. This study resulted in an accuracy value of 77%. It can be seen that in the three studies, performance is still low below 80%.
To overcome this, we need a method that can study patterns in depth in order to improve the results of the model performance obtained. One method that can be used for pattern recognition of batik patterns is Deep Learning (DL) [11].DL is part of artificial intelligence based on artificial neural networks with many hidden layers that have the ability to learn features from data automatically [12]. One of the DL-based methods that are often used in classification is Convolutional Neural Network (CNN) [13]. CNN is able to group and detect objects in the image automatically by receiving input data measuring × [14]. Several studies that use CNN in the classification process include [15] classifying brain tumors into 2 classes using the CNN-based VGG16 method. The study resulted in accuracy and f-1 scores, respectively, namely 90% and 90%. Another study by [16] classified breast cancer into 2 classes using a CNN-based modification of DenseNet. This study resulted in an accuracy value of 96%. Subsequent research by [17] classified plant seeds into 12 classes using the CNN method, where this study resulted in accuracy, recall, precision, and f-1 scores, respectively, namely 94,38%, 93,1%, 94,83%, and 93,57%.
In this study, the classification of batik patterns has 5 types, namely Ceplok, Kawung, Lereng, Nitik, and Parang. These five patterns of batik motifs are included in the type of geometric batik motif originating from the island of Java. Geometric batik motifs are batik motifs that have basic ornaments composed of geometric shapes such as squares, kites, or circles. Several previous studies have shown that the CNN model performs very well in classification by obtaining an average model performance value of above 90%. In this study, the CNN method will be applied to be able to recognize every characteristic that exists in the image data of each batik pattern. To measure CNN's performance on classification of batik types based on images of batik patterns, the values of accuracy, precision, recall, and f-1 score were used to evaluate the method proposed in this study. In addition, the purpose of this study is to make it easier for the society to recognize the motifs batik of Indonesian as a cultural heritage that must still be maintained.

II. METHODOLOGY
In this study, the method used to classify the types of batik motifs is the Convolutional Neural Network (CNN) method. The steps taken in this study were the first to collect data using the Batik dataset. Then, this dataset will be improved image quality (preprocessing data). The preprocessing carried out in this research is resizing the data, augmenting the data, and splitting the data. After that, the results of the data preprocessing will be implemented into the CNN method by extracting its features.
Feature extraction carried out are Convolutional Layer, Max Pooling, and ReLU activation function. The next step is the testing process to measure the performance evaluation of the model obtained. The following is the workflow in this research which can be seen in Figure 1.

Data Collection
The data used in this research is the batik dataset which is secondary data sourced from the github.com database with the https://github.com/yohanesgultom/deeplearning-batik-classification/ page. The Batik dataset consists of 1,067 images of batik motifs which are divided into 143 ceplok motifs, 563 kawung motifs, 62 slope motifs, 120 nitik motifs, and 179 machete motifs. Examples of Batik datasets for the five batik motifs are shown in Table 1.

Preprocessing Data
At this stage, the image data used will be preprocessed using resize on the batik image. Image resizing is a technique to enlarge or reduce the size of an image. After resizing, the image will be augmented to increase the quantity of images from the dataset. Furthermore, the image will be split or divided into training data and testing data.

Implementation of convolutional Neural Network (CNN)
CNN is one of the methods in machine learning which is a combination of artificial neural networks and deep learning. At this stage, a model will be formed that will be used in training data in recognizing an object. The input from the inner layer on CNN is arranged in 3 dimensions, namely height, width, and depth or measuring × × [18].

Convolutional Layer
The convolutional layer is often referred to as the convolutional layer which is the core block of CNN which consists of a collection of convolutional filters or kernels and the final result of the process is a feature map (Alzubaidi et al., 2021). The image input that is entered into the model will be carried out by a feature extraction process. The input image will be partitioned into several parts of each pixel according to the predetermined parameters. From this covolution process, the output image can be smaller or it can be the same size, but the depth of the image will change. The process of calculating the output matrix of the convolution process can be seen in Equation (1) [12]: where is the input matrix, , is the convolution filter matrix, dan are the kernel, and is the bias value of the filter.
As an illustration in Figure 2, given a 5x5 input matrix with a 3x3 kernel, convolution is carried out using the same padding and stride 1. The final result of the convolution produces a 5x5 matrix.

Figure 2. Convolutional Layer Process
Based on Figure 2, the input matrix is first carried out with the same padding process, where around the input matrix is filled with a value of 0 so that the matrix becomes 7x7 in size. The result of the padding addition process is then carried out a convolution process with a 3x3 kernel, where the value in the kernel is generated randomly by the computer. The convolution process is carried out with the dot product operation between the matrix resulting from the addition of padding and the kernel using Equation (1). The multiplication results are then added up and stored into a new matrix called feature maps. This process is repeated until the kernel is at the end of the lower right corner by shifting the kernel by 1 step horizontally and then vertically.

Max Pooling
Max Pooling is an operation that extracts patches from the feature map resulting from the convolution process of the input matrix and produces the maximum value from the patch. Max pooling is used to reduce the size of the image dimensions so as to simplify the next process on CNN. Max pooling is usually used after the convolutional layer process. The convolution and max pooling processes are carried out several times to get a feature map of the desired size. This feature map will be the input to the Fully Connected Layer process which has been converted into a onedimensional array for classification [19].

Rectified Linear Unit (ReLU) Activation Function
The activation function is a nonlinear transformation that is used to convert the input signal into an output signal. The ReLU activation function is one of the activation functions that can increase the speed of the training process. This activation function makes all negative pixel values in the image 0. If h is an input matrix entry, then the ReLU activation function denoted as (ℎ) can be defined in Equation (2) [20]:

Flatten
Flatten is the process of reshaping the output (reshape feature map) into vectors that can be used as inputs in the fully-connected layer process [21]. Flatten is important in classifying. If the flattening process is not carried out, the results from the convolution process cannot be processed by the fully connected layer [19].

Fully-Connected Layer (Dense Layer)
In the fully connected layer all nodes are connected to the previous layer. The nodes that make up the fully-connected layer are often referred to as dense layers. Every activity that occurs in the previous layer must be made into an array or one-dimensional data array [22].

Softmax Activation Function
Softmax activation function is a function used to get multiclass classification results. This activation function produces a probability value that has not been normalized for each class [23]. The equation for the softmax activation function can be seen in Equation (3) below [24]: for = 1, … , where is the number of classes.

Loss Function (Cross Entropy Loss)
Loss Function Cross entropy is a function that is used to calculate the performance of a model by calculating the error or error rate generated from the model. The function of Cross Entropy Loss is shown in Equation (4) [25]:

Testing
The testing process is the last process of the entire research system. The testing process is carried out to test the accuracy of the classification by assessing the index generated by the CNN model that has been trained.

Confusion Matrix
Confusion Matrix is used as an evaluation in calculating the model's performance criteria in predictions consisting of True Positive (TP), True Negative (TN), False Positive (FP), and False Negative (FN). Each value of these parameters is obtained from the calculation of the confusion matrix as shown in Table 2. There are performance evaluation measures used in the classification of the values in the confusion matrix, namely accuracy, precision, recall and f1-Score. The calculation formula for the confusion matrix performance can be seen in Equations (5), (6), (7), and (8) [26]: In Table 2 it can be seen that the true positive value is defined as a positive class that is classified correctly by the model. Second, true negative is a negative class that is classified correctly by the model. Third, for false positives, it is a negative class which is classified as a positive class by the model. Finally, for false negatives, positive classes are classified as negative classes by the classification model.

RESULTS AND DISCUSSION
Batik is very related to motifs. Motifs on a batik characterize the type and origin of the area of the batik. So that in the process of introducing batik motifs, computer assistance is needed to facilitate the process of introducing the motif. This study used CNN to determine 5 batik classes namely Ceplok, Kawung, Lereng, Nitik, and Parang.
The first step in this study is the preprocessing process, where the batik dataset is resized to a size of 250 × 250. Resize data is done to equalize the size of the image. After that, augmentation data was performed using rotation (rotating the image randomly) and flipping (rotating the image based on the horizontal axis). An example of the results of the image augmentation process can be seen in Figure 3. In Figure 3 it can be seen that there are 5 examples of images that have been carried out by the data augmentation process. With augmentation, the image data increased to 10.688 image data. The next step is to split the data, where the 10.688 data are divided into 80% training data and 20% test data. So that the training data used were 8.551 training data, and 2.137 test data. The training data obtained then carried out the training process using the Convolutional Neural Network (CNN) method, as shown in Figure 4. In Figure 4 it can be seen that the architecture of the built model consists of several layers. In the input layer, the image used is the image from the training data. Next, the image input is processed in the first convolution layer using the ReLU activation function and max pooling. The output in the first convolution layer is used as input for the second convolution process. This convolution process continues until the third convolution. Then the results of the convolution process are flattened so that the shape changes to a 1-dimensional tensor or array. The results of this flatten are collected at the fully connected layer. In this layer, features that are correlated with certain classes are determined so that the end result of this process is features classified into five classes.
In the data training process, in the data training process using the CNN method, parameters such as the number of epochs are 50, and the batch size is 8. After that, the optimizer is performed first, then the loss function is used to estimate the loss, compare and measure the results of good or bad predictions. When modeling the trained data, the interconnection weights of the neurons will gradually be adjusted until a good prediction is obtained. The results of the training data process produce accuracy and loss values in training data, as well as accuracy and loss values in validation data. Accuracy and loss graphs obtained in the training data process can be seen in Figure 5 and Figure 6. In Figures 5 and 6, both figures show the prediction accuracy and loss function of the proposed model for the training data set and the validation data. In this figure, an epoch shows one cycle through the full training image dataset to update the weights. While the loss function shows the sum of the errors made for each image in the training process to find the best weights as model parameters. From the plot of Figure 5, it can be seen that the accuracy increased significantly from the first epoch onwards and it can be concluded that the training process experienced a sharp gradient change but was still able to achieve convergence to a fairly acceptable value, with a local maximum approaching 94% accuracy for training data. . In Figure 6, the loss function curve experiences cases of overfitting on the training data and its validation, but the training process can be said to be going well. Furthermore, the evaluation of model performance in the form of accuracy, precision, recall, and f1-score for each class of batik motifs is also calculated as shown in Table  2.Next, calculate the performance evaluation of the existing model, namely the calculated accuracy, precision, recall, and f1-score for each class of batik pattern patterns shown in Table 3. In Table 3, to assess the performance of the model, it is predicted that the overall accuracy of the data on the type of batik motif pattern is predicted. Precision describes the accuracy between the requested data and the prediction results provided by the model. Recall defines the success of the model in finding information. F1-Score is used to compare the average precision and recall weights, we can also use it as a reference to determine accuracy. It can be seen in Table 3 that the average accuracy obtained is 96.74% for 5 classes, so the CNN model used can be said to be very good in classifying the types of batik motifs.
After the evaluation stage, it is continued with the analysis and interpretation stage of the results. At this stage, we compare the results of the evaluation of the classification of batik motifs using the proposed CNN architecture with the results of the evaluation of the classification of batik motifs in other studies.
The comparison of the results of the performance evaluation can be seen in Table 4. Based on Table 4, the evaluation results for the proposed method obtained an accuracy of 96.74%, a precision of 96.78%, a recall of 96.74%, and an f1-Score of 96.74%. The method proposed in this case has the ability to classify the types of batik motifs in the case of mixed class sizes in the data set. In this case the model obtained from the classification results can be used to detect the types of batik motifs that correspond well to the dataset used.
In addition, the results of the classification using the CNN method can facilitate the society in the process of introducing typical Indonesian batik motifs.

IV. CONCLUSION
The results of the study were found to be very good at classifying patterns of batik patterns. This can be seen from the high average accuracy, precision, recall, and F1-Score. The ability of the proposed model to classify patterns of batik patterns is very good seen from the precision of 96.78% and also the accuracy of 96.74%% for each class or batik pattern.
This study uses CNN to classify the types of batik patterns. It is hoped that for future research the classification of types of batik patterns can be done with a semantic network to train nodes because it is very useful, especially in exploring image categorization so as to produce better predictions in the future.