# Fabric Weave Pattern and Yarn Color Recognition and Classification Using a Deep ELM Network
## 2 Method
### Biologically-Inspired Deep ELM-Based Pattern Recognition Network Design (D-ELM)
The original training set images, Y, like the supervised training of an extreme learning machine has been conducted elsewhere [23; 28; 37], we find the solution of the following set of NM linear equations in NM unknown variables comprised from the elements of W\({}_{\text{O1}}\):  
\[\text{YA}^{\text{T}}=\text{W}_{\text{O1}}(\text{AA}^{\text{T}}+\text{cl}), \tag{3}\]  
where c is the regularization parameter that can be optimized as a hyperparameter, and I is an identity matrix of order (M). An input instance X is converted into a new vector \(\widehat{X_{1}}\) using this trained weight matrix W\({}_{\text{O1}}\) as follows:  
\[\widehat{X_{1}}=\text{W}_{\text{O1}}\text{f}[\text{H}_{1}] \tag{4}\]  
which is the auto-encoded form of the input data. The weight matrix W\({}_{\text{p2}}\in\mathbb{R}^{\text{Q}\times\text{N}}\) is used to construct the next module of the proposed network, the second hidden layer input is with input H\({}_{\text{2}}\in\mathbb{R}^{\text{Q}\times 1}\) is connected to X, where Q may not be the same as the size of the first hidden layer, M. Then the fashion in which the output weight vectors of the first module were trained, is repeated again to train the output weights of the second module to produce a new auto-encoded response:  
\[\widehat{X_{2}}=\text{W}_{\text{O2}}\text{f}[\text{H}_{\text{2}}]. \tag{5}\]  
A D-module deep ELM network can be formed by repeating the process explained above, several times. The sequential steps involved in the training procedure is explained above. After completing the training process, the two weight matrices W\({}_{\text{O1}}\), W\({}_{\text{O2}}\) are combined to form one single weight matrix W\({}_{\text{h12}}\in\mathbb{R}^{\text{Q}\times\text{M}}\), that connects the first two hidden layers:  
\[\text{W}_{\text{h12}}=\text{W}_{\text{O2}}\text{W}_{\text{O1}}, \tag{6}\]  
Similarly the entire process explained above can be repeated for the subsequent modules because the input layers and the output layers of an ELM module are linear. We used an approach for the classification of the dataset images by embedding the class labels as integers in the first column of the image vector for training, where each row represents the class label for that respective feature vectors (to which it belongs). The addition of label pixels is shown in Table 1, where each image contains \"N\" unique features are represented as attribute 1, attribute 2 through attribute N. Furthermore, the corresponding class category of the particular image can be represented as the \"target\" class in Figure 2.0 The first column in the Table 1 represents the class to which the features of that row (particular input image) belong. Each row represents several features from an image, attribute1 through attributeN are the several features for an input image. The resulting training vector dataset is used as the target vector matrix, Y, to train every auto-encoding ELM module. The first module receives the image only as input. Hence, the labeled training image sets are contained in matrix Y, but the network's first module's input, X, are only the images. In the classification step, the elements of the prediction vector corresponds to the class labels. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Target** & **Input Attribute 1** & **Input Attribute 2** &... & **Input Attribute N \(\mathbf{-1}\)** & **Input Attribute N** \\ \hline
3 & \(-\)0.3846 & \(-\)0.3454 &... & \(-\)0.5937 & \(-\)0.2812 \\
1 & 0.6307 & 0.5454 &... & \(-\)0.0468 & 0.75 \\
2 & \(-\)0.1384 & \(-\)0.1272 &... & \(-\)0.1562 & 0.2187 \\
3 & 0.3538 & 0.2363 &... & \(-\)0.1562 & 0.3437 \\
1 & 0.2615 & 0.0545 &... & \(-\)0.3281 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Training labels embedded in the first column of the training vector. The deep extreme learning machine (ELM) algorithm proposed in our study improves the training time of the network relative to a single ELM using a similar size of hidden layers and can also improve the classification accuracy relative to the other single-module ELM methods.