The project presents several algorithm variants that use different statistical classifiers to classify photovoltaic panels into one of two classes, clean or dirty, based on observation (feature vector). For the classification, it decided to use the characteristic feature of dirt. The image saturation decreases in the place where they occur, the image saturation decreases, and its luminance increases. Due to the two classes and two features, binary classifiers have been selected to classify observations with two parts. The algorithm consists of two stages: classifier training and classification. The photo material was divided into two sets: a training set composed of 32 photos of clean panels and 32 photos of dirty panels. A test set consisted of 12 pictures of clean panels and 12 photos of dirty panels. Before classification, the image is pre-processed to remove unwanted background and leave only the PV module in the picture.
3.2. Observation
By visually comparing a clean and dirty panel, you can see that the surface of the dirty panel looks dull and lacks color intensity. This is because the dominant color of the dust is gray, and the shades of gray are not saturated. In addition, the surface of the pure solar panel is dark as the cell material absorbs incident light. Therefore, the amount of light reflected by the panel is limited. For a dirty PV module, its surface looks brighter because less light is absorbed by the cell, and therefore more light is reflected from the surface and scattered by the deposits [
26].
Table 1 shows the average values of color saturation and luminance for the same panel in two cases, when clean and dirty.
Figure 6 shows a visual comparison of this panel. These panels differ mainly in appearance. No structure is visible, no light reflection, surface heterogeneity. In turn,
Figure 7 presents all the results of observations in a graphical form. These values confirm the hypothesis that for dirty panels, the image saturation decreases, and the luminance increases.
Image luminance is a value representing the image’s brightness, calculated by ITU BT.601 [
27]. For each pixel, calculate its luminance value and then calculate the arithmetic mean of these values.
To calculate the saturation value of the image, you can use the fact that the saturation is one of the components of the HSV model. So you can convert the image from RGB to HSV, extract the component corresponding to the saturation for each pixel, and then calculate the arithmetic mean of these values.
3.3. The Classifier of the k Nearest Neighbors
The classifier of the
k nearest neighbors (kNN) classification method assigns a classified object to the class that is most frequently represented among the
k closest neighbors from the training set [
28]. In order to find the
k nearest neighbors of the test object, the Euclidean distance between the test object and all training objects is calculated [
29]. In this case, the classifier consists of two features, so it is two-dimensional, which means that can lace of the things be placed on the Euclidean plane in the form of a point with Cartesian coordinates. Then, the Euclidean distance between two points is expressed by the formula:
where:
p—first point;
q—second point;
—Euclidean distance between points p and q;
—coordinate X of point p;
—coordinate Y of point p;
—coordinate X of point q;
—coordinate Y of point q.
As shown in
Table 1, the values of saturation and contrast differ significantly in terms of magnitude, so the difference would dominate the calculated Euclidean distance because it affects the distance value much more. For this reason, it is necessary to normalize the value so that all dimensions for which the distance is calculated are equally relevant. Normalization consists of making the variable’s values belong to the interval [0, 1]. The formula that expresses it:
where:
i—next vector index;
j—index of feature;
—the maximum value of the variable j;
—the minimal value of the variable j.
Test data also needs to be normalized. When normalizing the test set, one should use the maximum and minimum values determined on the training set.
Figure 8 shows the decision surface for the kNN classifier for
k = 7.
3.4. Naive Bayesian Classifier
The naive Bayes classifier is a simple probabilistic classifier that assumes that all features are mutually independent, hence the so-called “naivety” of this classifier. It uses Bayes’ theorem, and the classification result is based on a conditional probability comparison. The class for which the posterior probability value is the highest is selected [
30].
where:
Y—vector of classes;
—class;
X—vector of features of classified object;
—feature;
—probability a priori;
—probability of occurrence;
—probability a posteriori;
—probability of occurrence of set of features.
Using the assumption of the classifier’s naivety:
where:
—probability of occurrence;
—conditional probability of occurrence of a given feature provided that a given class occurs.
The values of the features are continuous, so we assume that for each part
the distribution
is a normal distribution:
where:
—indicator function;
—variance;
—average value.
In the case under consideration, we have 2 features and 2 classes:
therefore:
To compare
and
, it is not necessary to calculate
P(
X) because this value is constant and only serves as a scaling function. This approach reduces the computational effort of the classifier. The classifier’s decision rule is as follows:
Figure 9 shows the decision surface of the naive Bayes classifier.
3.5. Fisher’s Linear Discriminator
The Fisher Linear Discriminator (FLD) is used for supervised classification and produces a linear discriminant rule. The task of discriminant analysis for two classes can be defined as [
31]:
find the direction a, hat best separates the learning subgroups, and as a measure of class separation along a given direction a take the square of the distance between the arithmetic means of the subgroups along this direction, taking into account the variability of the intra-group observation.
The direction of
a best separating the classes is the direction that maximizes the expression (
13):
W—intragroup covariance matrix;
a—direction vector of the searched line;
—group mean of observations included in the class clean;
—group mean of observations included in the class dirty;
—number of observations included in the class clean;
—number of observations included in the class dirty.
The observations can be divided into a subgroup of observations classified as class
clean and into a subgroup of observations classified as class
dirty:
Then, we can write the group averages as:
In order to assess the intragroup variability of the covariance matrix, it is necessary to assume that both subgroups have the same covariance matrix, then:
where:
—sample covariance matrix of subgroup k;
—vector transposition x.
Having the designated direction
a, both means of classes
i and the new observation
x, we can define the classification rule:
where:
x—new observation;
X—the class assigned to the new observation.
What after qualifying the boundary case to class
clean comes down to the following decision rule:
Figure 10 shows the discriminant line. It is a straight line perpendicular to the line
a and passing through the middle of the line connecting points
and
. The discriminant line equation is as follows:
where:
—value of saturation;
—value of luminance.
Figure 11 shows the designated decision areas.