Heavy metal contamination of agricultural soil is one of those invisible threats that farmers and regulators cannot detect with the naked eye. Nickel and cadmium accumulate silently in the ground, enter crops, and eventually reach human diets, yet the standard way of confirming their presence remains slow, expensive laboratory chemistry. A new study from researchers at the American University of Beirut, published in Environmental Science and Pollution Research, reports that a camera-like instrument paired with artificial intelligence can predict how much of these two toxic metals lurks in Lebanese farmland soils, with prediction quality in some cases exceeding 0.94 on the coefficient of determination scale, a level that approaches the reliability of conventional laboratory measurement.
The research team, led by Ayoub Alayoub and Samir Mustapha of the Department of Mechanical Engineering, together with Reinde Alhouri Alhomsi and Darine A. Salam, set out to test whether hyperspectral imaging could serve as a fast screening tool for soil contamination across Lebanon’s diverse agricultural landscapes. Hyperspectral imaging works by capturing reflected light from a sample across hundreds of narrow, contiguous wavelength bands, spanning the visible, near-infrared, and shortwave infrared regions of the electromagnetic spectrum. Where the human eye registers only a single color of soil, the hyperspectral sensor records a full spectral fingerprint, a curve of reflectance values that encodes information about the minerals, organic matter, moisture, and particle surfaces that light has interacted with on its way back to the detector.
The logic behind using such spectra to detect heavy metals is subtle, because nickel and cadmium themselves are not strong absorbers of light in these wavelength ranges. Instead, the metals influence the soil’s spectral signature indirectly, through their associations with clay minerals, iron oxides, organic matter, and other matrix components that do absorb light in characteristic ways. This indirect relationship is precisely why machine learning is required: algorithms such as partial least squares regression, support vector regression, neural networks, and convolutional neural networks can detect statistical correlations between subtle spectral features and metal concentrations that no simple linear rule could capture. The technique has precedent, with earlier studies using reflectance spectroscopy to estimate contamination after mining accidents and to map heavy metals from airborne platforms, but the Lebanese study adds a rigorous comparison of model families across contrasting soil textures.
The researchers worked with three agricultural soils from Lebanon, classified as clayey, silty, and sandy, deliberately chosen to represent the range of physical matrices that a field-deployed sensing system would encounter. Before any modeling, the team contaminated the soils with known levels of nickel and cadmium and recorded their hyperspectral images. Even at this early stage, the three soil groups told different optical stories. They exhibited distinct absorption features, different overall reflectance intensities, and different spectral shapes, a reminder that soil is not a generic brown medium but a complex optical material whose signature depends on texture, mineralogy, and surface chemistry.
Four modeling approaches were then trained to translate spectra into contamination predictions. Partial least squares regression served as the classical chemometric baseline, projecting the high-dimensional spectral data onto a small number of latent variables that maximize covariance with the metal concentrations. Support vector regression, a kernel-based method that fits a function within a tolerance margin while ignoring small errors, represented the machine learning tier. On the deep learning side, the team built artificial neural networks and convolutional neural networks, the latter designed to automatically extract local spectral patterns from the raw reflectance curves much as CNNs extract edges and textures from photographs. Across the board, support vector regression and convolutional neural networks emerged as the strongest performers.
The numbers reveal both the promise and the texture-dependence of the approach. For nickel contamination, support vector regression achieved coefficients of determination of 0.850 in clayey soil, 0.830 in silty soil, and 0.790 in sandy soil. For cadmium, the same model performed even better, reaching 0.930, 0.931, and 0.945 in the clayey, silty, and sandy soils respectively. The convolutional neural network matched or exceeded these figures in several cases, with values of 0.899 for nickel and 0.944 for cadmium in silty soil, and 0.872 and 0.938 in sandy soil. Notably, the clayey soil yielded its best nickel and cadmium predictions from the neural network model, which reached 0.930 and 0.950 respectively. Cadmium was consistently predicted more reliably than nickel across all soil groups and models, a pattern the authors highlight as one of the study’s key findings.
Crucially, the team did not stop at internal cross-validation. They validated the support vector regression and convolutional neural network models against newly contaminated soil samples that the models had never seen, and the models held up, maintaining coefficients of determination above 0.790 across all tested soils. This external validation step matters enormously in spectroscopic modeling, where overfit models can look spectacular on training data and fail embarrassingly in the field. The result suggests that, within a given soil type, the spectral-to-metal relationship is stable enough to support practical screening applications.
But the study also delivers a sobering caveat. When the trained models were transferred across soil types, asked to predict contamination in a soil texture different from the one they were calibrated on, performance collapsed. The support vector regression models dropped to coefficients of determination ranging from 0.107 to 0.242, and the convolutional neural network models fared little better, ranging from 0.110 to 0.260. In other words, a model calibrated on clayey soil was essentially useless on sandy soil, and vice versa. The authors attribute this to the distinct physicochemical properties of each soil matrix, which reshape the spectral signature in ways the models cannot generalize across, and they conclude that soil-specific or matrix-informed calibration models are needed. They also acknowledge a limitation: because only three soils were investigated and detailed mineralogical characterization was not performed, the specific contribution of individual soil characteristics to the transferability failure could not be isolated.
For Lebanon, a country whose agricultural soils face pressure from industrial activity, unregulated waste practices, and decades of environmental stress, the implications are tangible. Conventional heavy metal analysis relies on techniques such as atomic absorption spectroscopy and inductively coupled plasma mass spectrometry, which require sample collection, acid digestion, and laboratory time. A hyperspectral workflow, by contrast, could in principle screen many samples rapidly once calibrated for the local soil type, allowing regulators to prioritize the handful of samples that truly need confirmatory wet chemistry. The study was supported by the US-Middle East Partnership Initiative Tomorrow’s Leadership Graduate program at the American University of Beirut, and all of the analyzed data are included in the published article and its supplementary files, with additional data available on reasonable request.
The broader lesson extends well beyond Lebanon’s borders. Around the world, soil monitoring programs struggle with the cost of chemical analysis, and the dream of cheap, fast, spectroscopy-based contamination screening has been building for two decades. This study moves that dream forward by showing that deep learning can extract cadmium and nickel signals from hyperspectral images with accuracy rivaling traditional methods, while simultaneously delivering a warning that the field must take seriously: soil is heterogeneous, and a model trained on one matrix cannot be blindly deployed on another. The path forward, the authors suggest, lies in building calibration frameworks that explicitly account for soil matrix information, whether by calibrating per soil class or by incorporating physicochemical descriptors into the models themselves. Until then, the combination of hyperspectral imaging and artificial intelligence stands as a powerful but soil-aware tool, one that could transform how the world’s farmland is screened for the heavy metals that threaten both crops and the people who eat them.
Subject of Research: Prediction of nickel and cadmium contamination in Lebanese agricultural soils using hyperspectral imaging and machine learning models
Article Title: Prediction of Ni and Cd contamination in agricultural soils in Lebanon using hyperspectral imaging and artificial intelligence
Article References: Prediction of Ni and Cd contamination in agricultural soils in Lebanon using hyperspectral imaging and artificial intelligence. (n.d.). https://doi.org/10.1007/s11356-026-38271-0
Image Credits: AI Generated
DOI: 10.1007/s11356-026-38271-0
Keywords: hyperspectral imaging, heavy metal contamination, nickel, cadmium, agricultural soils, machine learning, support vector regression, convolutional neural networks, soil spectroscopy, Lebanon, soil calibration, environmental monitoring
Cite Scienmag News
Alan Morgan. (October 8, 2026). AI and hyperspectral imaging reveal hidden nickel and cadmium in Lebanese farm soils. Scienmag. https://scienmag.com/ai-and-hyperspectral-imaging-reveal-hidden-nickel-and-cadmium-in-lebanese-farm-soils/
Alan Morgan. "AI and hyperspectral imaging reveal hidden nickel and cadmium in Lebanese farm soils." Scienmag, 8 October 2026, https://scienmag.com/ai-and-hyperspectral-imaging-reveal-hidden-nickel-and-cadmium-in-lebanese-farm-soils/. Accessed 8 October 2026.
Alan Morgan. "AI and hyperspectral imaging reveal hidden nickel and cadmium in Lebanese farm soils." Scienmag. October 8, 2026. https://scienmag.com/ai-and-hyperspectral-imaging-reveal-hidden-nickel-and-cadmium-in-lebanese-farm-soils/

