# Physical Contamination Detection in Food Industry Using Microwave and Machine Learning

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Measurements Setup

## 3. Dataset Construction

## 4. ML Tools

#### 4.1. SVM

#### 4.2. MLP

## 5. Optimization Using Grey Wolf Optimizer (GWO)

**${C}^{*}$**and

**${\gamma}^{*}$**), while we used it with MLP to estimate the optimal number of neuron (${N}^{*}$) in the hidden layer. The values of all these parameters obtained from the optimization process will be presented in the results section with the validation results.

## 6. Results

#### 6.1. Results for Magnitude Only Dataset

#### 6.2. Results for the Complex Dataset

## 7. Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## Abbreviations

MW | Microwave |

SVM | Support vector Machine |

MLP | Multilayer perceptron |

VNA | Vector Network Analyzer |

EM | Electromagnetic |

ML | Machine learning |

mmW | millimeter wave |

SVD | Singular value decomposition |

GWO | Grey Wolf Optimizer |

PCA | Principal Component Analysis |

RBF | Radial Basis Function |

Relu | Rectified linear Activation Unit |

Lbfgs | limited-memory Royden-Fletcher-Goldfarb-Shanno |

PTFE | Polytetrafluoroethylene |

TN | True negative |

TP | True Positive |

FN | False negative |

FP | False positive |

## References

- Lau, O.W.; Wong, S.K. Contamination in food from packaging material. J. Chromatogr. A
**2000**, 882, 255–270. [Google Scholar] [CrossRef] - Haff, R.P.; Toyofuku, N. X-ray detection of defects and contaminants in the food industry. Sens. Instrum. Food Qual. Saf.
**2008**, 2, 262–273. [Google Scholar] [CrossRef] - Guyer, D.; Yang, X. Use of genetic artificial neural networks and spectral imaging for defect detection on cherries. Comput. Electron. Agric.
**2000**, 29, 179–197. [Google Scholar] [CrossRef] - Oliveri, G.; Rocca, P.; Massa, A. Svm for electromagnetics: Stateof- art, potentialities, and trends. In Proceedings of the 2012 IEEE International Symposium on Antennas and Propagation, Chicago, IL, USA, 8–14 July 2012. [Google Scholar]
- Zidane, F.; Lanteri, J.; Brochier, L.; Joachimowicz, N.; Roussel, H.; Migliaccio, C. Damaged Apple Sorting with mmWave Imaging and Non-Linear Support Vector Machine. IEEE Trans. Antennas Propag.
**2020**, 68, 8062–8071. [Google Scholar] [CrossRef] - Kim, Y.; Ha, S.; Kwon, J. Human Detection Using Doppler Radar Based on Physical Characteristics of Targets. IEEE Geosci. Remote. Sens. Lett.
**2015**, 12, 289–293. [Google Scholar] - Zidane, F.; Coli, V.L.; Lanteri, J.; Binder, D.; Marot, J.; Migliaccio, C. Artificial Intelligence-Based Low-Terahertz Imaging for Archaeological Shards’ Classification. IEEE Trans. Antennas Propag.
**2022**, 70, 6300–6312. [Google Scholar] [CrossRef] - Milovanović, B.; Marković, V.; Marinković, Z.; Stanković, Z. Some Applications of Neural Networks in Microwave Modeling. J. Autom. Control.
**2003**, 13, 39–46. [Google Scholar] [CrossRef] - Ricci, M.; Štitić, B.; Urbinati, L.; Guglielmo, G.D.; Vasquez, J.A.T.; Carloni, L.P.; Vipiana, F.; Casu, M.R. Machine-Learning-Based Microwave Sensing: A Case Study for the Food Industry. IEEE J. Emerg. Sel. Top. Circuits Syst.
**2021**, 11, 503–514. [Google Scholar] [CrossRef] - Zidane, F.; Lanteri, J.; Brochier, L.; Marot, J.; Migliaccio, C. Fruit Sorting with Amplitude-only Measurements. In Proceedings of the 18th European Radar Conference (EuRAD), London, UK, 10–15 October 2021. [Google Scholar]
- Ricci, M.; Vasquez, J.A.T.; Scapaticci, R.; Crocco, L.; Vipiana, F. Multi-Antenna System for In-Line Food Imaging at Microwave Frequencies. IEEE Trans. Antennas Propag.
**2022**, 70, 7094–7105. [Google Scholar] [CrossRef] - Scapaticci, R.; Tobon, J.; Bellizzi, G.; Vipiana, F.; Crocco, L. Design and numerical characterization of a low-complexity microwave device for brain stroke monitoring. IEEE Trans. Antennas Propag.
**2018**, 66, 7328–7338. [Google Scholar] [CrossRef] - Vasquez, A.J.T.; Scapaticci, R.; Turvani, G.; Bellizzi, G.; Joachimowicz, N.; Duchêne, B.; Tedeschi, E.; Casu, M.R.; Crocco, L.; Vipiana, F. Design and experimental assessment of a 2D microwave imaging system for brain stroke monitoring. Int. J. Antennas Propag.
**2019**, 2019, 8065036. [Google Scholar] - Vasquez, J.A.T.; Scapaticci, R.; Turvani, G.; Ricci, M.; Farina, L.; Litman, A.; Casu, M.R.; Crocco, L.; Vipiana, F. Noninvasive inline food inspection via microwave imaging technology: An application example in the food industry. IEEE Antennas Propag.
**2020**, 62, 18–32. [Google Scholar] [CrossRef] - Jolliffe, I. Principal component analysis. Encycl. Stat. Behav. Sci.
**2005**. [Google Scholar] [CrossRef] - Zidane, F.; Lanteri, J.; Migliaccio, C.; Marot, J. System measurement optimized for damages detection in fruit. In Proceedings of the IEEE Conference on Antenna Measurements & Applications (CAMA), Antibes Juan-les-Pins, France, 15–17 November 2021. [Google Scholar]
- Scholkopf, B.; Smola, A.J. Learning with Kernels: Support Vector Machines, Regularization, Optimization, and Beyond; MIT Press: Cambridge, MA, USA, 2001. [Google Scholar]
- Amari, S.i.; Wu, S. Improving support vector machine classifiers by modifying kernel functions. Neural Netw.
**1999**, 12, 783–789. [Google Scholar] [CrossRef] - Gardner, M.W.; Dorling, S.R. Artificial Neural Networks (The Multilayer Perceptron)—A Review of Applications in the Atmospheric Sciences. Atmos. Environ.
**1998**, 32, 2627–2636. [Google Scholar] [CrossRef] - Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw.
**2014**, 69, 46–61. [Google Scholar] [CrossRef] [Green Version]

**Figure 2.**Uncontaminated jar sample filled up with oil. The image includes different types of contaminants, numbered from 1 to 6, and the circles drawn on the jar (a, b, c, and d) refer to the most probable positions of the contaminants materials inside the jars.

**Figure 4.**Plotting of the amplitude of the retrieved S-parameters from two samples under test. (

**a**) The uncontaminated jar sample; (

**b**) the contaminated jar sample.

**Figure 5.**Data distribution on the 3 most significant eigenvectors. (

**a**) Complex nature dataset. (

**b**) Amplitude only dataset.

**Figure 7.**Confusion matrices obtained by the non-linear SVM classifier trained on Magnitude only dataset. Curve (

**a**) shows the plot of the well-classified terms TP and TN, while curve (

**b**) is the plot of the misclassified terms FP and FN.

**Figure 8.**Confusion matrices obtained by the MLP classifier trained on Magnitude only dataset. Curve (

**a**) shows the plot of the well classified terms TP and TN, while curve (

**b**) is the plot of the misclassified terms FP and FN.

**Figure 9.**The plot of the misclassified terms FP and FN of the confusion matrices for each contaminated class alone. The results obtained by the non-linear SVM algorithm trained on the Magnitude only dataset.

**Figure 10.**The plot of the misclassified terms FP and FN of the confusion matrices for each contaminated class alone. The results obtained by the MLP algorithm trained on the Magnitude only dataset.

**Figure 11.**Confusion matrices obtained by the non-linear SVM classifier trained on the Complex nature dataset. Curve (

**a**) shows the plot of the well-classified terms TP and TN, while curve (

**b**) is the plot of the misclassified terms FP and FN.

**Figure 12.**The plot of the misclassified terms FP and FN of the confusion matrices for each contaminated class alone. The results obtained by the non-linear SVM algorithm trained on the Complex nature dataset.

**Figure 13.**Confusion matrices obtained by the MLP classifier trained on the Complex nature dataset. Curve (

**a**) shows the plot of the well-classified terms TP and TN, while curve (

**b**) is the plot of the misclassified terms FP and FN.

**Figure 14.**The plot of the misclassified terms FP and FN of the confusion matrices for each contaminated class alone. The results were obtained by the MLP algorithm trained on the Complex nature dataset.

Classes | Number of Samples Used for Training | Number of Samples Used for Test |
---|---|---|

Uncontaminated | 360 | 240 |

Contaminated with small splinter of Glass | 60 | 60 |

Contaminated with Metal | 60 | 40 |

Contaminated with small splinter of Plastic | 60 | 60 |

Contaminated with PTFE sample sphere | 60 | 40 |

Contaminated with soda–lime glass sample sphere | 60 | 40 |

Contaminated with fragment of wood | 60 | 40 |

N | P | |
---|---|---|

N | TN | FP |

P | FN | TP |

**Table 3.**The optimum pair (C*, $\gamma $*) for non-Linear SVM and the optimal number of neurons (N*) for MLP. Training time, confusion matrices and accuracy obtained on the validation set for the two different ML algorithms trained with Magnitude only dataset.

Used Algorithm | Optimal Parameters | Training Time (s) | Confusion Matrix Val Set | Accuracy on Val Set (%) |
---|---|---|---|---|

Non-linear SVM | (2,056,177,868, 2× 10${}^{-4}$) | 0.01 | $\left(\begin{array}{cc}38& 0\\ 0& 34\end{array}\right)$ | 100 |

MLP | 11 | 0.2 | $\left(\begin{array}{cc}37& 1\\ 0& 34\end{array}\right)$ | 98.6 |

Classes | Average Accuracy with SVM (%) | Average Accuracy with MLP (%) |
---|---|---|

Uncontaminated | 99.3 | 95.2 |

Contaminated with small splinter of glass | 99 | 96.5 |

Contaminated with metal | 99.3 | 94 |

Contaminated with small splinter of plastic | 99.3 | 98.5 |

Contaminated with PTFE sample sphere | 98.2 | 92.8 |

Contaminated with soda–lime glass sample sphere | 98.9 | 95.9 |

Contaminated with fragment of wood | 99.5 | 96 |

**Table 5.**The optimum pair (C*,$\gamma $*) for non-linear SVM and the optimal number of neurons (${N}^{*}$) for MLP. Training time, confusion matrices, and accuracy obtained on the validation set for the two different ML algorithms trained with the Complex nature dataset.

Used Algorithm | Optimal Parameters | Training Time (s) | Confusion Matrix Val Set | Accuracy on Val Set (%) |
---|---|---|---|---|

Non-linear SVM | (3,400,529,630, 3× 10${}^{-2}$) | 0.01 | $\left(\begin{array}{cc}41& 0\\ 0& 31\end{array}\right)$ | 100 |

MLP | 11 | 0.4 | $\left(\begin{array}{cc}40& 0\\ 0& 32\end{array}\right)$ | 100 |

Classes | Average Accuracy with SVM (%) | Average Accuracy with MLP (%) |
---|---|---|

Uncontaminated | 99.9 | 99.3 |

Contaminated with small splinter of glass | 99.9 | 99.8 |

Contaminated with metal | 100 | 99.9 |

Contaminated with small splinter of plastic | 100 | 99.5 |

Contaminated with PTFE sample sphere | 99.7 | 98 |

Contaminated with soda–lime glass sample sphere | 99.3 | 99.6 |

Contaminated with fragment of wood | 99.8 | 98.6 |

**Table 7.**The table summarizes the conditions under which we obtained the results in our paper compared to what was followed in [9].

Conditions | [9] | This Paper | This Paper |
---|---|---|---|

Used classifier | MLP | MLP | Non-linear SVM |

Dataset nature | Complex (Real-Imag) | Complex (Real-Imag) | Complex (Real-Imag) |

Dataset split (Training set–Test set) | 70–30% (868–372 samples) | 58–42% (720–520 samples) | 58–42% (720-520 samples) |

Optimization method | None - | GWO | GWO |

Average performance accuracy | 99.35% | 99.3% | 99.8% |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Darwish, A.; Ricci, M.; Zidane, F.; Vasquez, J.A.T.; Casu, M.R.; Lanteri, J.; Migliaccio, C.; Vipiana, F.
Physical Contamination Detection in Food Industry Using Microwave and Machine Learning. *Electronics* **2022**, *11*, 3115.
https://doi.org/10.3390/electronics11193115

**AMA Style**

Darwish A, Ricci M, Zidane F, Vasquez JAT, Casu MR, Lanteri J, Migliaccio C, Vipiana F.
Physical Contamination Detection in Food Industry Using Microwave and Machine Learning. *Electronics*. 2022; 11(19):3115.
https://doi.org/10.3390/electronics11193115

**Chicago/Turabian Style**

Darwish, Ali, Marco Ricci, Flora Zidane, Jorge A. Tobon Vasquez, Mario R. Casu, Jerome Lanteri, Claire Migliaccio, and Francesca Vipiana.
2022. "Physical Contamination Detection in Food Industry Using Microwave and Machine Learning" *Electronics* 11, no. 19: 3115.
https://doi.org/10.3390/electronics11193115