# Automatic System for the Detection of Defects on Olive Fruits in an Oil Mill
## 3 Results and Discussion
### Results of the Image Processing Algorithm  
As mentioned previously, the validity of the image processing algorithm was tested through ground-truth image comparison. The values of the measures proposed to evaluate the algorithm performance are included in Table 1.  
The first data column of the above table shows the harvesting date. An example of three days within the assessed period (from 11 to 26 January 2021) have been chosen for the discussion of the results obtained. In addition, data from the whole period is also presented. The second column classifies images, according the number of olives or set of olives extracted from the background, into the three following levels: low, medium and high. Images containing a number of regions below 30 are labelled as low, whereas the number of regions is between 30 and 100 are considered as medium; finally, if the number of regions included in an image is more than 100, this image is labelled as high. The last two columns give the detection rate (TPR) and the olives wrongly classified (FPR). In all cases, TPR and FPR rates are the average of the set of images analysed by the expert in the corresponding harvest date (5 images per day). As expected, the quantity of fruits on the conveyor belt has an influence on the algorithm performance. Detection rate is always higher for images labelled as low, while there is no significant difference between images designated as medium or high. The TPR is more reliable if olives are not overlapped, as the whole fruit can be analysed. Olives can also be wrongly classified if several of them are included in the same region and disturbances, such as the olive edge or part of the background visible among them, appear. This issue increases the number of FP, i.e., olives labelled as non-defective but classified as defective, which has a direct correlation with the FPR. Images labelled as medium or high are more likely to suffer this effect, but it can also occur in images labelled as low. An example of this is shown in Table 1. In both harvesting dates, 15 and 26 of January, the FPR for images considered as low is slightly higher than those labelled as high. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Harvesting Date** & **Number of Olives or Set of Olives** & **TPR (\%)** & **FPR (\%)** \\ \hline \multirow{4}{*}{11/01/2021} & low & 85.71 & 6.67 \\ \cline{2-4}  & medium & 79.55 & 11.39 \\ \cline{2-4}  & high & 88 & 14.38 \\ \cline{2-4}  & low & 93.33 & 10.81 \\ \cline{2-4}  & medium & 87.5 & 13.46 \\ \cline{2-4}  & high & 76.47 & 9.46 \\ \hline \multirow{4}{*}{26/01/2021} & low & 88.89 & 10.34 \\ \cline{2-4}  & medium & 73.08 & 16.24 \\ \cline{2-4}  & high & 72.73 & 9.83 \\ \cline{2-4}  & low & 90.32 & 9.88 \\ \cline{2-4}  & medium & 79.07 & 16.24 \\ \cline{2-4}  & high & 79.69 & 9.83 \\ \hline \multirow{2}{*}{11/01/2021–26/01/2021} & global & 81.22 & 11.51 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Performance of the image processing algorithm calculated by comparison between the automated and manual inspections (ground-truth). Results are expressed in terms of True Positive Rate (TPR) and False Positive Rate (FPR). The conveyor belt can also be a source of mistakes, and images considered as low are prone to this type of error. Figure 11 shows an example of these two types of false positive sources: the conveyor belt and the overlap among several olives, both labelled as defects. The final assessment of the image processing algorithm was done analysing a total of 80 images. As shown in the last row of the Table 1, the TPR was 81.22% and the FPR was 11.51%. The detection rate is expected to be higher than what is achieved in a manual inspection, since the current inspection process is performed by sampling a subset of olives of each batch, with the frequency of inspection and the number of olives to be inspected based on the oil-mill expert indications. The capacity to analyse the whole batch of incoming olives is already a substantial improvement on the current practice.