# Evaluation of Artificial Intelligence-Based Models for Classifying Defective Photovoltaic Cells
## 2 Materials and Methods
### Methods  
In this section, the methodology followed for defective cell classification is presented. Firstly, the pretreatment of the \(EL\) images was explained. Secondly, Self-Organizing Maps (\(SOM\)) were used to observe the similarities detected between cells and groups. Thirdly, different variables were proposed, and applying the method combining \(KN\) and \(SVM\), the variables with the best performance were selected. Finally, four classifiers were developed and tested using those variables: \(KNN\), \(SVM\), \(RF\), and \(MLP\). Besides, a fifth independent classifier, using \(CNN\), was proposed. More explicit information about the well-known models used (\(KNN\), \(SVM\), \(RF\), \(MLP\), and \(CNN\)) can be found in the following outstanding references [24; 25; 26; 27; 28]. According to the pretreatment of \(EL\) images for feeding the classifiers, since the \(EL\) image was taken from the entire module, as showed in Figure 2, the first thing was to cut out the cells for individual assessment. For this, a 115 \(\times\) 115-pixel cropping window was established, which offered the best adjustment by superimposing it on each cell. It was necessary to zoom to the maximum to adjust the window optimally, thus ensuring that all the cropped images were aligned and thus avoiding including the black margins that separate (due to the natural structure of the panel) the cells. After that, with the objective of improving the edges, the images were loaded into Python, reducing each side by 1 pixel, finally resulting in 60 images of size 113 \(\times\) 113. Given the classification method proposed in this work, in which the cells were grouped according to the power measured individually in each one (groups 1, 2, or 3, as previously detailed), it was not possible to appreciate visible features (see Figure 2) that characterized the elements of the different groups, except for the black spots in group 3. To demonstrate the correctness of this classification, the authors proposed using \(SOM\) to be able to observe the similarities detected between cells. \(SOM\) is a type of unsupervised neural network, and its purpose is to reduce the dimensionality of the data preserving the topological properties of it [29]. It is made up of only 2 layers, the input and the output layers. The input layer has a number \(N\) of neurons equivalent to the dimension of the data. The output layer represents a two-dimensional array of neurons, each with an assigned \(N\)-dimension weight. Each time the \(SOM\) map algorithm is executed, the weights are randomly initialized (once initialized, they are organized and distributed on the map based on their proximity), and they compete with each other each time data is entered into the input layer. The neuron whose weight most closely resembles the input information is the winner, which causes an update in the value of its weight, as well as that of its neighbors. Therefore, the algorithm consists of iterating enough times and each time choosing random data in the training sample to progressively update the map until it is molded to the structure of the starting information. In this study, a \(SOM\) network of 20 rows and 20 columns was proposed, using Euclidean distance as the standard distance, and the results are shown in the results section. Therefore, it was necessary to decide which variables were the representative ones of the 60 members. Each image (in grayscale) was a matrix of 113 rows by 113 columns, where each coordinate or pixel had values from 0 (black) to 255 (white). Since each matrix had 12,769 coordinates or pixels that take 256 possible values, then every image could also be seen as a flattened matrix, that is, a vector \(C_{i}=(p_{i,0},\ldots,p_{i,12768})\in\mathbb{R}^{12769},0\leq i\leq 59\), where \(p_{i,0},\ \ldots,\ p_{i,112}\) are the values of the pixels that correspond to the first row of the ith matrix, \(p_{i,i113},\ \ldots,\ p_{i,226}\) are the pixels correspond to the second row of the ith matrix, and so on.