AUTOMATED CLASSIFICATION OF AFRICAN EMBROIDERY PATTERNS USING CELLULAR LEARNING AUTOMATA AND SUPPORT VECTOR MACHINES

Embroidery is the art that is majorly practised in Nigeria, which requires creativity and skills. However, differentiating between two standard embroidery patterns pose challenges to wearers of the patterns. This study developed a classification system to improve the embroiderer to user relationship. The specific characteristics are used as feature sets to classify two common African embroidery patterns (handmade and tinko) are shape, brightness, thickness and colour. The system developed and simulated in MATLAB 2016a environment employed Cellular Learning Automata (CLA) and Support Vector Machine (SVM) as its classifier. The classification performance of the proposed system was evaluated using precision, recall, and accuracy. The system obtained an average precision of 0.93, average recall of 0.81, and average accuracy of 0.97 in classifying the handmade and tinko embroidery patterns considered in this study. This study also presented an experimental result of three validation models for training and testing the dataset used in this study. The model developed an improved and refined embroiderer for eliminating stress related to the manual pattern identification process.


Introduction
In today's world, the embroidery industry is gaining more attention as the production of handmade and machine embroidery is taking a new turn, and the demand is on the increase with each passing day. Although embroidery has its existence dated back to 200-500 AD (Adiji & Ojo, 2016) up till now, most African residents, especially the Yoruba and Hausa tribes in Nigeria, still accord much importance to embroidery on their clothes as this adds more vigour and pride. However, the conventional means of identifying the weave patterns (i.e., Handmade or Machine-made) on embroideries is time-consuming, confusing, and complicated when differentiating the types. Therefore, it is extremely helpful to develop an automated system for embroidery patterns recognition. The proposed system is capable of differentiating the handmade embroidery from its machine-made counterpart. This desirable feature is essential as it drives the reliability of the various embroidery works produced by fashion designers. It will also help those with limited experience in embroidery in choosing patterns or designs from the convenience of their homes without being deceived. This study examined the specific characteristics responsible for the recognition of embroidery patterns, designed a computational model for the process, implemented the model and evaluated its performance.
Handmade embroidery involves stitching embroidery designs by hand onto the fabric using hand and needles. The handmade embroidery pattern is a conventional method of fabric embellishment that promotes creativity (Jimoh et al., 2019). Machine-made embroidery, on the other hand, uses a textile machine to generate patterns on textiles. Machine-made is further classified into freemotion sewing machine (such as 20U, Tinko and Coil) and computerised or digital machine. These two types of embroidery are practised in the Western part of Nigeria. Agai (2016) affirmed that embroidery was meant originally for preserving garments' necks in Yoruba land; in comparison to the Northern part of Nigeria where the practice of embroidery is influenced by the dominant Islamic religion that prohibits representational arts such as those found in sculptures. This practice has given rise to excellent embroidery works and decorations that are linear, symmetrically oriented, and are applied to Hausa caps, calabashes, leather goods, and skull caps.
Though the art of embroidery is not indigenous to Nigeria, however, embroidery has formulated a major part of the textile culture. Research also has proven that embroidery has been a long tradition amongst the Nupe and Hausa communities with different embroidery patterns designed on their garments, from Hausa farmers' clothes to riding robes and ceremonial apparels (Adiji et al., 2016). The embroidery done on men's clothes is traditionally constructed using dark stitches to produce both asymmetrical and non-representational designs. Beautiful voluminous robes, intricately patterned are a prominence for men in Nupe and Hausa communities. Artisans create embroidery on different types of fabric such as guinea brocade, damask, and new material types to bring out the significance of thread on materials. Thus, embroidery is the art of making a pattern on textiles, leather, using threads of wool, linen, silk and needle (Ojo, 2000). Examples of patterns are fingerprint images, handwritten texts, or speech signals. However, this study developed an automated classification system to aid the process of classifying handmade embroidery and selected machine-made embroidery patterns.
Various classification techniques have been employed in the field of machine learning, especially machine vision and pattern recognition. For instance, Hafiz et al. (2020) proposed a classification system to assess the diet content of soft drinks using the Convolution Neural Networks (CNN). The study extracted the region of interest from the images using visual saliency and mean-shift techniques and evaluated the classification accuracies of four CNN methods (VGG19, InceptionV3, MobileNet and ResNet50). The CNN method, ResNet50, gave the best result. Khalil et al. (2018) evaluated the performance of three feature extraction techniques (Linear Binary Pattern, Histogram of Oriented Gradient, and grey-level co-occurrence matric) for classifying MR brain images. The obtained feature vector was used for the classification process using K-nearest neighbour. In (Sarwinda et al., 2021), ResNet-18 and ResNet-50 deep learning techniques were employed for colorectal cancer detection. The two techniques were evaluated using the testing data, and the result obtained revealed the dominance of ResNet-50 over ResNet-18 with respect to accuracy. Mammography images, specifically benchmarking the Neighbouring Support Vector Classification (NSVC) method with other ML algorithms, i.e., Support Vector Machine (SVM), K-Nearest Neighbour decision trees, Naïve Bayes. The study found that NSVC performed better. Kaur et al. (2019) also classified Mammogram breast cancer images into three classes (benign, normal, and malignant) using K-means clustering for feature extraction and multi-class SVM deep learning network as the classifier.
Xu et al. (2021) examined samples of X-ray images of lungs to predict the COVID -19 infection using a two-stage classification via CNN. The segmentation method employed the predicted mask technique to extract the regions of interest. The result obtained showed that deep learning with mask attention has a better performance. Also, Negm et al. (2019) used decision trees to identify a particular cell with acute leukaemia from microscopic images. The K-means method was adopted for segmentation and to extract morphological features. Prasad et al. (2015) carried out a comprehensive review of various techniques and performance evaluation metrics used in image classification and highlighted problems and advantages attributed to various techniques. Goyal et al. (2020) proposed a review on the classification of skin cancer diagnosis images using Artificial Intelligence (AI). The challenges facing the use of AI techniques in skin cancer detection. Khalsa et al. (2014) considered spatial correlation and semantic description of images in classifying photographic and non-photographic images. The authors identified the problems associated with the semantic description of images and used a low-level feature to classify images. Radavicience & Julience (2012) examined the effects of embroidery threads on the accuracy of embroidery patterns regularity. The effect of embroidery threads was also investigated on the buckling of fabrics in the embroidered element. Similarly, Dutta & Chatterjee (2019) developed a model to predict the subjective longitudinal stiffness of an embroidered fabric. The study employed fuzzy logic by considering the basic process parameters, i.e., thickness, angle of embroidery stitches and stiffness, to build a human perception towards the subjective stiffness of the embroidered fabric. In eliminating challenges with the dying of handmade embroidery and automating the pattern recognition process, Jimoh et al.
(2020) developed a database and employed Cellular Automata (CA) and Support Vector Machine (SVM) to classify the two types of embroidery patterns stored in the database. The evaluation result revealed that the irregular and inconsistent nature of handmade embroidery is amenable to computing in terms of recognition and classification processes.
Nevertheless, we observed that most of the studies reviewed above had focused mainly on the classification of various other patterns, and far less attention was given to embroidery patterns in the area of computer vision and patterns recognition. This observation agrees with Kuo et al. (2011). Also, to the best of our knowledge, no study has considered investigating the learning automata for analysing the computational behaviour of embroidery patterns. Hence, this study attempts to classify two of the African embroidery patterns using cellular learning automata as feature extraction techniques and SVM as its classifier.

Hand and tinko embroidery
The two types of embroidery considered in this study are shown in Figure 1. Hand embroidery patterns exploit the use of motifs and stitches in various forms using needles and threads to make designs on fabrics. Hand embroidery involves in the stitching of embroidery patterns using hand onto the fabric using hand needles and a special thread commonly referred to as affrayon. The tinko embroidery is a type of embroidered designs created using the basic zig-zag sewing machine used typically for tailoring. This machine lacks the automated features of a specialized machine. Thus, creating a free-motion machine embroidery involves operating the machine and cleverly moving the closely hooped fabric beneath a needle to create designs, with machine teeth lowered or covered by the embroiderer when moving the fabric manually. During this process of manually developing embroidery, the embroiderer uses the machine's settings to run stitches and more elegant built-in stitches to form an image on a piece of fabric as depicted in Fig. 1(a). the handmade embroidery is shown in Fig. 1(b).
The rest of this work is arranged as follows. The related work is described in Section 2. Materials and methods are discussed in Sections 3. The Result and discussion were discussed in Sections 4 and Section 5 concludes the work.

Experimental
The materials and methods used in this study are discussed in the following subsections:

Classification Model
In this study, the classification of embroidery patterns using the specific characteristics responsible for recognising embroidery patterns is considered. The specific characteristics used for the classification purpose are the shape, texture, colour, and thickness of the embroidery stitches. The classification methods employed are the Cellular Learning Automata (CLA) for feature extraction and Support Vector Machine (SVM) for patterns classification. The acquired images are input into the model, and the cellular automata are set up based on the image data matrix. If the image is in monochrome form, the number of pixel neighbours is counted; otherwise, the image data is transformed first into grayscale before counting the number of pixels in its neighbourhood. CLA is applied to each cell of the cellular automata to optimise the process before applying the edge detection rules to extract the image. Afterwards, the SVM classifier is used to obtain the embroidery type. These two primary modules are presented in the following subsections. Fig. 2 depicts the proposed CLA-SVM architecture for embroidery patterns recognition.

Image processing
The images are captured using the Fujifilm 16 Megapixel 8 optical zoom digital camera from the embroiderer shops from four cities, each from the states of Oyo and Osun in Western Nigeria. After the data capturing, the next step is the pre-processing stage, where the data are rescaled and normalized to reduce redundancy. The purpose of doing this is to improve the recognition performance. The pre-processing operations (image size reduction, image enhancement, and segmentation) were carried out on the acquired images to extract the necessary features. The contrast and brightness of these images are changed to enhance their appearance using image processing techniques. The coloured images' components (red, green and blue (RGB)) are then converted to grayscales to extract the discriminatory information and then compressed to reduce the storage requirements. The compressed images (900 X 1900 pixels), saved in the Tagged Image File Format (TIFF), are binarized using the Otsu method available in MATLAB.

Cellular Automata Model
Cellular Learning Automata (CLA) combines cellular automata (CA) and learning automata (LA). The CA is a discrete dynamic system that changes its state according to its current state, the state of its neighbour based on a simple update rule. CA has an n-dimensional cellular space and consists of a regular grid of cells. The neighbourhood of a cell consists of the surrounding adjacent cells, including the cell itself. For one-dimensional CAs, a cell, for instance, is connected to r local neighbours on each side, including itself, where r is the radius and given S as an integer, CA consists of a 4-tuple defined using Equation 1. Two neighbourhood types available are 9-cells Moore and 5-cells Von Neumann. Moore neighbourhood has nine cells (squarelike) with a central cell, and Von Neumann neighbourhood is a five-cells (plus-like) neighbourhood type.
where a set of finite states for a grayscale image with 256 intensity levels,

or
, a set of finite states for a binary image with 2 intensity levels.
is the available neighbourhood type for CA. F -Local rule of CA The CA 9-cells of Moore neighbourhood is considered for the study and is given in Equation 2.

Learning Automata Model
Learning Automaton is a machine that performs a finite set of actions based on a probability vector. The probability vector in this context represents the probability distribution of a set of actions in a given environment. In selecting a typical action, LA is examined and judged based on a probability vector of the environment, and the evaluation response, which is applied to the learning automaton. This evaluation response carries positive and negative reinforcement signals. Therefore, CLA is a CA for which the learning automaton is assigned to all its cells

Result and discussion
In total, 240 image samples from embroiderer shops from four cities each from Oyo and Osun states, Nigeria, consisting of different embroidery patterns, were collected. This sample data consisted of Handmade (50%) and Tinko (50%), respectively. In developing the classification model, the dataset is split into two sets, 60% for training and 40% for testing and validating the model. The classification model was developed and simulated in MATLAB R2016a environment on an Intel 3.66Ghz processor with a 4GB RAM capacity. Samples of embroidery patterns from the testing set are then randomly selected and presented to the model as inputs during the validation stage, which tests the performance of the model in classifying new, previously "unseen" images. We performed the test on two classes of images-binary and grayscale. The classification efficiency of the model was determined using performance metrics (Recall, Precision, and Accuracy) defined in Equations 6, 7 and 8. Recall gives the true positive or the probability of detection, a measure of correctly identified images. Precision is the true negative rate or a measure of the proportion of negatives correctly identified, while accuracy is the percentage of correctly classified image.
for enhanced learning ability. The LA learns the state of each CA cell based on the status of the cells. The interaction of the learning automaton and the probabilistic environment is given in Figs. 3 and 4 respectively. In Fig. 4, the learning automaton is attached to each cell of CA to learn its environment and based on the selected action, the probability vector of the LA is updated using Equations 3 and 4, respectively, where a and b are the probability coefficients. We used Equation 3 to compute the probability of getting a reward and Equation 4 to estimate the probability of penalizing a cell.

Reward Action
Penalty Action Where T N is the total number of embroideries sampled, TP is the true positive detection of a specific embroidery type, F P is the false positive detection of a particular embroidery type, T N is the true negative detection of a given embroidery type and fn is the false negative detection of a given embroidery type. Two sets of classification results are presented in Figures 4 and 5, respectively. Figs. 4(a) and (b) are the correctly classified images, while Figure 5 (a and b) shows incorrectly classified embroidery patterns. In Fig. 5 (a), the pattern is handmade, and the model classified it as Tinko. Likewise, in Fig. 5(b), the pattern is Tinko and was classified as Handmade. The two classes of the result generated are depicted in Figures 4 and 5 that show an embroidery type handmade was correctly classified as handmade (Fig. 4a), and likewise in Fig. 4(b), the pattern was correctly classified as type 'Tinko'. Fig. 5(a) depicts a scenario where an embroidery type 'handmade' was wrongly classified as 'Tinko', while Fig. 5(b) depicts an embroidery type 'Tinko' wrongly classified as 'handmade'. The classification results obtained for the two images (grayscale and binary) are represented using bar charts shown in the Figs. 6 and 7.
This study provides an experimental result of three validation models for training and testing the dataset shown in Tables 1 and 2. In the first model, 60% of data were used for training and 40% for testing. For the second model, the training set had 70% of the data while the testing set had 30%. The third model used 80% of the dataset for training and 20% for testing the models. This validation process was done for the two classes of image considered in this study. In Table 1, the validated result in terms of accuracy, recall and precision for grayscale images revealed that model 3 had the highest accuracy result of 98%, model 1 had a closer accuracy value of 97%, and model 2 had the least accuracy value. Model 3 recorded the highest precision value of 93.5%, and model 1 had the highest recall value of 81%. In Table  2, it was revealed that model 3 also obtained the highest accuracy value of 88%, followed by model 1 with 87% accuracy. Model 1 had the highest precision of 86% and the highest recall of 72%. Thus, the model classification results for the grayscale images moderately outperformed that of the binary images.

Conclusion
The system developed in this study employed the Cellular Learning Automata (CLA) and Support Vector Machine to automate the manual process of identifying embroidery types on clothes. The use of CLA is an alternative option to other intelligent extraction techniques such as edge detection and Principal Component Analysis. The classes of African embroidery types (Handmade and Tinko) are considered for building the classification model in this study. The model developed established an improved and refined embroiderer for eliminating the stress related to the manual patterns' identification process. Thus, the model can be used by users to verify the types of embroidery designs on clothes. Consequently, assisting them in optimal decision making for the choice of patterns on their clothes. Future work will involve developing a database of multiple and many embroideries pattern types to improve classification accuracy and where users can select and communicate the choice of patterns to the embroiderer.