## 4 Result and Discussion
### Performance of the Developed Model Based on the Online Prototype System  
The binary classification results of the detected moving seeds on the conveyer belt were transferred to an Arduino system, used for switching ejector solenoids on and off according to the transferred signal received from the classification results. Initially, the ejector was trained so that seeds detected from the apricot kernels would send a \"yes\" signal to Arduino to open the ejector valves and suck the seeds out using pressure, while a \"no\" signal would close the valve. Figure 10 presents the graphical user interface (GUI) used for visualizing the online classification process and optimizing the parameters. Firstly, the threshold cut-off point was determined based on the intensity value reflected from the surface of the seeds on the conveyor belt in the seven-line valley space, according to Figure 11. Secondly, the loaded beta coefficient resulted from raw preprocessing observed for visualizing the seeds perfectly in each line and assigning the background cut-off ratio. Figure 10 shows the moving seeds on the conveyor belt with a 0.5 threshold, which is the optimized discrimination threshold value used to distinguish almonds from apricot kernels and was adjusted according to PLS-DA model classification.  
Figure 11 shows the optimized threshold discrimination between almonds and apricot kernel varieties on the conveyor belt according to the reflected light intensity. The optimized threshold shows a good discrimination of seeds with the assigned value of the threshold cut-off point against the  
Figure 9: Discrimination mapped images of the PLS-DA model, easily visualizing the chemical composition of adulterated seeds of both seed varieties.  
valley space position of the conveyor belt. However, the L7 almond sample shows a misclassification, displaying a slightly higher intensity compared to the other lines of almonds, which might be due to light variations and camera sensitivity.  
Figure 10 shows the optimized threshold point for the classification of apricot kernels from almonds, which is 0.5, while it was running using the raw preprocessing with 17 smoothing points and a discrimination threshold of 0.2 to remove the background. Once the system was optimized based on the small number of seeds, we then randomly selected 50 samples from each variety of both groups. The total numbers of samples used for the online application assessments were 100 almonds and 100 apricot seeds, which were mixed. The systems classified 90/100 of the almonds with a 90% accuracy and 80/100 of the apricot seeds with an 80% accuracy. The overall accuracy in both groups was 85% for  
Figure 11: The determination of the threshold point for seed discrimination in lines.  
Figure 10: The moving seeds on the conveyor belt after the optimized threshold (0.5) was used to distinguish between the almonds and apricot kernels.  
the discrimination of seeds. The online application shows a slightly lower accuracy, which might be due to lighting optimization and movement on the conveyor belt with higher speeds. Based on the obtained result, the online application of NIR-HSI shows high potential for the industrial application of high-quantity seed discrimination.