# Diagnosis by SAM Linked to Machine Vision Systems in Olive Fitting Machines
## 2 Materials and Methods  
### Olive Varieties and Treatment  
For this study, two olive varieties were selected due to their representative size ranges in current industrial processes: Gordal (_Olea europaea regalis_), a large-sized variety with calibers ranging from 60 to 140 olives/kg, and Hojiblanca (_Olea europaea arolensis_), which encompasses medium to small calibers (100 to 420 olives/kg). The Gordal variety exhibits a metallic black color, resulting from an oxidation treatment known as the _California style_, whereas Hojiblanca olives are pickled green, following the _Seville style_. Both treatments eliminate bitterness through the chemical hydrolysis of the glycoside eleuropein, with the key distinction being the presence or absence of oxygen during processing [28; 29; 30; 31].  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Expected Accuracy** & **Computational Cost** & **Training Effort** & **Real Time Suitability** \\ \hline U Net [12] & High (semantic) & Moderate & Low–moderate & Achievable with lightweight variants \\ Mask R CNN [10] & Very high (instances) & High & High (dense masks) & Limited (GPU required) \\ DeepLab v3 [21] & Very high (pixel wise) & High & Moderate (large datasets) & Moderate (mobile backbones) \\ SAM [16] & High (zero shot) & Very high & None for new tasks & Low (unless specialised HW) \\ MobileSAM [22] & High (\(\sim\) SAM) & Low–moderate & None for new tasks & High (\(\sim\)10 ms img\({}^{-1}\)) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Comparative overview of standalone deep learning segmentation models for industrial and agri-food applications.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Hybrid Pipeline** & **Typical Accuracy** & **Computational Cost** & **Training Effort** & **Real Time Suitability** & **Study** \\ \hline YOLO v8 \(\rightarrow\) SAM & High FI; pixel accurate & YOLO \(\approx\) 5 ms + SAM & & \\  & & ROI \(\approx\) 15 ms & Train YOLO only & \(\geq\)30 FPS GPU & [23] \\ Grounding DINO \(\rightarrow\) SAM & Very high AP, & Higher (transformer) & Class names only & 12–18 FPS & [24] \\ Objectives CNN \(\rightarrow\) & Mod–high IoU, & CNN \(\approx\) 3 ms + & CNN on binary labels & Real time SoC & [25] \\ MobileSAM & edge friendly & MobileSAM \(\rightarrow\) 10 ms & & & \\ Global SAM \(\rightarrow\) Tiny & High precision after filter & SAM heavy; & Few dozen masks & \(\sim\)5 FPS overall & [27] \\ CNN filter & & CNN negligible & FastSAM \(<\) 10 ms; & Fine tune proposal net & \(>\)60 FPS & [26] \\ Proposal net \(\rightarrow\) FastSAM & & 40–50\(\times\) faster & proposal \(<\) 5 ms & & \\ \hline \hline \end{tabular}
\end{table}
Table 2: Performance profile of hybrid detector–prompt based segmentation pipelines for high speed industrial/agri-food inspection.  
Specifically, Gordal olives undergo 2 to 5 baths in sodium hydroxide (NaOH) at a concentration of 1-4% (\(w/v\)), with an olive-to-solution ratio of 1:1, for 1 to 4 h, where intermediate washings are performed to remove excess alkali, completing the process within 24 h. In this treatment, oxygenation plays a crucial role in gradually darkening the olives, a process that becomes irreversible upon the addition of iron salts [29; 30].  
Conversely, Hojiblanca olives retain their early green color by avoiding oxidation. They are processed in an initial bath with a higher NaOH concentration (2-5%), followed by several washings that prepare them for a second treatment in sodium chloride (NaCl, 10-12%), with a final step that enhances their organoleptic and textural properties through lactic fermentation [28; 29; 30].  
After undergoing these treatments, the olives are sorted by caliber before being introduced into a DRR machine, where they can be pitted, sliced, or stuffed. However, in this study, only the pitting process is performed.