Introduction

Water is an essential resource for all living organisms, and access to clean water is crucial for maintaining good health. Regrettably, recent data from the World Health Organization (WHO) reveals that 2 billion people lack access to safely managed water service as of 2020, including 282 million people with limited services and 122 million drinking surface water1. Water pollution has become a serious threat to water safety due to economic development, global population increase, and climate changes. Organic pollutants, including pharmaceuticals, pesticides, organic dyes, detergents, and industrial waste, are of particular concern because they consume oxygen in water, generate toxic residues, and can persist in the water body for a long time due to their chemical stability2.

Traditional water purification approaches encompass chemical precipitation, filtration, adsorption, ion exchange, chlorination, adsorption, and distillation3,4,5,6. Although these techniques are widely used in industrial settings, they have limitations such as lengthy processing times, limited removal efficiencies, chemical resistance issues, and risks of re-contamination.

Zinc oxide (ZnO), with its exceptional photo- and piezo-catalytic properties, presents an eco-friendly material for processing contaminated water7,8. One major advantage of using ZnO in water treatment is its ability to react with persistent organic contaminants under natural sunlight, which contains UV light. Hence, it offers a more sustainable and eco-friendly approach for removing organic pollutants than traditional methods9,10,11. However, to fully leverage ZnO’s properties for wastewater treatment, a well-designed material and system must be in place. ZnO can be fabricated into various nanostructures, such as nanospheres12, nanorods13, and nanoflowers14, but there is still potential for improvement in degradation efficiency, secondary contamination prevention, and repeatability. To tackle these issues, ZnO nanoparticles can be anchored on silica substrates which have robust mechanical strength and chemical stability15. Growing ZnO on silica nanofibers (SNFs) can increase the contact area, prevent nano pollution, and enable reusability.

Monitoring water quality is crucial for environmental and human health on both large and small scales. However, detecting organic pollutants in water is challenging due to molecular variability and complexity16. Additionally, the necessity for achieving low limits of detection further complicates the monitoring process. Technologies such as photo-luminescence spectroscopy17, high-resolution mass spectrometry18, high-performance liquid chromatography19, and surface-enhanced Raman spectroscopy (SERS)20 have been used to detect water contaminants. SERS is extensively researched due to its label-free, ultrasensitive, fast, and versatile characteristics. Nevertheless, identifying complex Raman spectra presents challenges, including mixed features, complex datasets, instrument noise interference, and sample property effects. To extract meaningful information from the Raman spectrum, various machine learning (ML) algorithms have been developed, including partial least square (PLS) regression21,22, support vector machine23, convolutional neural network24, recurrent neural network25 and Deep learning (DL)26,27. DL is a type of ML algorithm that employs multiple hidden layers of neural networks to extract complex features from large and diverse datasets. These deep neural networks can efficiently learn and represent nonlinear relationships between input and output data without domain-specific knowledge, allowing accurate classification of Raman spectra for corresponding chemical compositions. However, detecting “out-of-distribution” (OOD) samples (i.e., class of unseen data points), which are significantly different from the training data, remains a common challenge in DL. Despite this challenge, OOD detection is vital for ensuring the reliability of ML algorithms for SERS detection, particularly when training data is limited, and diverse chemicals may be present in the test samples. Current ML-assisted Raman detection techniques also struggle to discern mixtures of molecules and accurately characterize complex mixtures.

This study aims to develop a water purification and detection material by incorporating SNF thin film with ZnO nanorods (ZnONRs) and silver nanoparticles (AgNPs). This innovative material system can efficiently degrade organic pollutants while enabling rapid, quantitative, and label-free detection of these contaminants through SERS (Fig. 1a, b). A DL algorithm is developed to facilitate the qualitative, quantitative, and OOD detection of mixed contaminants without the need of preliminary processing. A Laplacian operation is implemented to effectively extract the Raman peak information from the original Raman spectra. The neural network’s output can encompass both regression model, indicating the concentration of multiple analytes, and classification model for identifying analyte components and concentration levels, with an added K-nearest neighbor (KNN) model for detecting unknown classes (Fig. 1c).

Fig. 1: The schematic diagram of the pollutant degradation, detection, and ML algorithm-assisted data interpretation process of the dual functional device.
figure 1

a Components of the AgNP-ZnONR-SNF system for organic pollutant detection and degradation. b The diagrammatic sketch of the photo- and piezo-catalytic degradation process. c The schematic demonstration of the ML models.

Results and discussion

Characterization

The electrospun SNF thin film was collected from the aluminum foil and had a diameter of ~12 cm (Supplementary Fig. 1). The Scanning electron microscopy (SEM) analysis was conducted using an FEI Helios 5CX DualBeam scanning electron microscope operating at 5 kV. The energy-dispersive X-ray spectroscopic (EDS) measurements and the chemical mapping were performed with the Oxford Instruments Ultim Max detector attached to the FEI Helios 5CX scanning electron microscope operating at 30 kV. Figure 2a depicts the sequential process of synthesizing electrospun SNF, growing ZnONR, and decorating with AgNP. Figure 2b–e are SEM images demonstrating the structure of SNF, ZnONR-SNF and AgNP-ZnONR-SNF. The AgNPs were distributed three-dimensionally, with some on the top of the ZnONRs and others on their side walls, while pure ZnONRs had a smooth surface (Supplementary Fig. 2). In Fig. 2f-i, the EDS chemical mapping confirms the uniform distribution of Zn, O, and Ag elements in the sample. The average diameter of the SNF, AgNP, and ZnO-SNF are 868 nm, 40 nm, and 3 μm, respectively (Fig. 2j). The characteristic X-ray energy of the key elements, including Zn, Si, O, and Ag, are plotted and labeled in the energy spectrum Fig. 2k. The Ag element has its characteristic energies at 2.98 keV and 3.15 keV, the Zn element at 1.01 keV, the O element at 0.52 keV, and the Si element at 1.74 keV. Additionally, Optical images taken by Keyence 3D Microscope with high magnification reveal the fibrous and 3D structure of the AgNP-ZnONR-SNF thin film (Supplementary Fig. 3). Figure 2l exhibits the normalized UV–Visible optical absorption spectrum of the ZnONR-SNF and AgNP-ZnO-SNF thin films.

Fig. 2: Fabrication and characterization of the AgNP-ZnONR-SNF thin film.
figure 2

a Schematic diagram describes the synthesis procedure of the ZnONR and AgNP on electrospun SNF thin film. b SEM image of the SNF. cd SEM images of the ZnONR-SNF. e SEM image of the AgNPs on the top of the ZnONR. Scale bars are 20 μm, 10 μm, 2 μm, and 100 nm, respectively. EDS mapping of the AgNP-ZnO-SNF, including f SEM image, g Zn element), h O element, and i Ag element. Scale bars are 3 μm. j Diameter distribution of the SNF, AgNP, and ZnONR-SNF in semi-logarithmic plot. Within each box, horizontal line denotes median value; boxes extend from the 25th to the 75th percentile of each group’s distribution of values; vertical extending lines denote the most extreme values within 1.5 interquartile range of the 25th and 75th percentile of each group; dots denote observations. k EDS spectrum of the AgNP-ZnO-SNF. l Normalized UV–Visible optical absorption spectrum of the ZnONR-SNF and AgNP-ZnO-SNF.

Piezo- and photo-catalytic degradation

The photocatalytic activities of ZnONR-SNF thin film in degrading organic dyes, including Methylene Blue (MB), Trypan Blue (TB) and Methyl Orange (MO), at an initial concentration of 10 μg/mL are investigated. The experimental setups are shown in Supplementary Fig. 4. Experimental groups involve ZnONR-SNF material and organic dye solutions, whereas control groups solely contain organic dye solutions, all subjected to UV irradiation and shaking treatment. Control experiments demonstrate that solar UV irradiation and shaking without any photocatalyst is negligible, and the concentration of the dyes remains almost unchanged. When ZnONR-SNF thin films are present, a degradation efficiency greater than 98% is achieved against the three organic dyes after 8 h exposure to UV light. Figure 3a–c displays the change in concentration of these organic pollutants over time under different conditions. Notably, the decline of the light absorbance intensity of the organic dyes at their characteristic peak wavelength is due to the cleavage of chromophore groups responsible for dye decoloration. Supplementary Fig. 5 shows the separate decomposition of these organic molecules under UV lamp and sunlight. Photocatalytic degradation efficiency for samples after 2-h sunlight exposure is even higher than under the UV lamp. Figure 3d, e displays the rate constants (k) for photocatalytic degradation, confirming the excellent photocatalytic property of ZnONR-SNF thin films. The degradation outcomes of the control groups lacking the ZnONR-SNF thin films are illustrated in Fig. 3f. In these groups, only a marginal decrease in dye concentrations is observed. In addition to organic dyes, the photocatalysis degradation against antibiotic Ciprofloxacin (Cip) is also studied under both UV light and sunlight (Supplementary Fig. 6). The cost efficiency of the ZnONR-SNF thin film in photocatalytic degradation is closely tied to its reusability. In the process of degrading MB, TB, and MO under UV lamp, the identical ZnONR-SNF samples were employed and subsequently dried in an oven at 50°C for a total of six cycles. The photocatalytic efficiency of ZnONR-SNF thin films remain high for five cycles (Supplementary Fig. 7). The photocatalytic degradation against organic molecules can be explained by the physical and optical properties of ZnO (Fig. 3g-h) as follows9,28,29: first organic pollutants diffuse from the liquid phase and are absorbed onto the surface of ZnONR. Then ZnO is irradiated by the UV light with energy larger than its bandgap energy, promoting electrons (\({e}^{-}\)) from valence band (VB) to conduction band (CB) and leave holes (\({h}^{+}\)) in the VB. Next, the photogenerated electron-hole (\({e}^{-}/{h}^{+}\)) pairs can migrate to the ZnONR surface, reacting with hydroxide ions (by \({h}^{+}\)) and oxygen (by \({e}^{-}\)) in water to generate reactive oxygen species (ROS) including hydroxyl radical (\(\cdot {OH}\)) and superoxide anion (\({{O}_{2}}^{\cdot -}\)). Finally, the ROS can directly oxidize organic pollutant molecules.

Fig. 3: Degradation results and schematic illustration of the degradation mechanism.
figure 3

a Photocatalytic degradation results. b Piezo-catalytic degradation results. c Hybrid degradation results. d Photo- and piezo-catalytic degradation kinetic curves of dye solutions catalyzed by the ZnONR-SNF. e Hybrid degradation kinetic curves of dye solutions catalyzed by the ZnONR-SNF. f Degradation results of control groups without the ZnONR-SNF. Error bars represent the standard deviation. g Schematic illustration of the degradation process. h Schematic graphic showing the piezo- and photo-catalytic properties of the ZnONR. i Schematic diagram of the piezoelectric property of ZnO.

The piezo-catalytic activity of ZnONR-SNF thin film on degrading organic dyes is shown in Fig. 3b. The catalyst is stimulated through orbiting shaking using a shaker motor with a rating output of 13.5 W. After 8 h of reaction, the piezo-catalytic efficiency against MB, TB, and MO reaches 15.5%, 38.4%, and 34.1%, respectively. The mechanical force exerted by the flowing water induces deformation in ZnONR, resulting in the formation of a strain field. As a consequence, the outer side of ZnONR experiences stretching, while the inner side of ZnONR undergoes compression. (Fig. 3h). This deformation leads to the generation of an electric field along the ZnONR, which induces a piezoelectric potential and surface charge accumulation on the opposite surface30. It allows \({e}^{-}/{h}^{+}\) to migrate to the ZnONR surface, triggering subsequent reactions similarly to the photocatalytic degradation process. Additionally, the piezoelectric potential also contributes to the adsorption of charged organic molecules.

In hybrid experiments, the combination of a UV lamp and a shaker results in the degradation of 96.3% of MB, 66.4% of TB, and 34.8% of MO after 2 h of irradiation. This degradation rate surpasses the individual catalytic activities of the two components. The improved degradation efficiency can be explained by the flowing water and semiconducting nature of ZnONR. The circulating water flow created by the orbiting shaker not only deflects ZnONR to create piezoelectric potential between the opposite surface but also promotes the adsorption of organic molecules. Moreover, the relative displacement of the Zn2+ cations regarding the O2– anions in the wurtzite crystal structure (Fig. 3i) generates a piezoelectric potential along the nanorod direction when the ZnONR is bent. This potential difference maintains as long as the strain exists and creates a potential difference between the compressed and the stretched side surface30. Correspondingly, the recombination of photo-induced \({e}^{-}/{h}^{+}\) pairs inside the ZnONR will be impeded, leading to more efficient carrier separation. Eventually, more redox reaction occurs on the surface of ZnONR, improving the photocatalytic degradation.

SERS detection

Raman spectroscopy provides a label-free and rapid tool for sensing organic molecules. A SERS approach is used in this study to quantitatively measure the concentration of an organic dye and an antibiotic. Before conducting the Raman experiments, the enhancement of localized surface plasmonic resonance was simulated using the finite element method (FEM) by COMSOL. Three scenarios of AgNP placement were observed in the SEM images: on the top side, on the side wall, and at the edge of ZnONR (Supplementary Fig. 8). When AgNPs are in close proximity and interact with incident light, they create a plasmonic “hot-spot” region characterized by a significant enhancement of the localized electromagnetic field31. This enhanced electromagnetic field can amplify SERS enhancement factor to the fourth power of the field, and the “hot-spot” sites created by AgNP dimers generate more than 50% of the total SERS signal with only 1% of total surface area32,33. Prior research has demonstrated the efficacy of utilizing AgNPs-decorated ZnO mesoporous materials as substrates for SERS-based detection34. Nevertheless, achieving precise control over “hot-spot” regions on mesoporous substrates is challenging, potentially leading to less consistent performance in SERS sensing. In our proposed approach, we leverage ZnONR. This multifunctional material functions as a photo- and piezo-catalyst while also providing a stable platform for AgNP decoration and enhancing uniformity in SERS sensing. Additionally, AgNP trimer structure on the top of ZnONR was found to even better enhance the field (Supplementary Fig. 9), which aligns with the experiment observation35. According to the simulation results, the diameter and the gap between the AgNPs affect the enhancement, while the locations have limited effect (Supplementary Fig. 10). As most of the peaks of the extinction cross-section area for all AgNP arrangements lay in the range from 475 nm to 550 nm, 532 nm laser is chosen as the excitation source.

In the Raman experiments, MB and Cip, whose chemical structures are shown in Fig. 4a, are used as demonstrations. In the test, 10 µL of the sample solution are dropped on the AgNP-ZnONR-SNF chip which has a size about 5 mm \(\times\) 5 mm. Figure 4b and Fig. 4c show the raw Raman spectra of the Cip and MB samples, respectively, at concentrations ranging from 100 µg mL−1 to 1 pg mL−1. The most distinguishable characteristic peaks of the Cip are at 1382 cm1, 1465 cm−1, 1605 cm1, and 1548 cm−1, and MB at 1437 cm−1 and 1614 cm−1. It is shown that there is a general trend of concentration of the samples being proportional to the intensity of the Raman signal. Therefore, the intensity of the highest peaks of the MB (1437 cm−1) and Cip (1382 cm−1) dyes are plotted against their concentrations as shown in Fig. 4d and e, on a log10 scale. MB and Cip calibration curves show high linearity of R2 = 0.992 and R2 = 0.946, respectively, demonstrating the device’s functionality as a sensor that can quantitatively monitor the concentration of organic dye and antibiotic. To demonstrate the superb signal enhancement from the AgNP-ZnONR-SNF chip, Raman signals on various substrates are measured, including a pristine glass substrate with no specimen, a glass substrate with a drop (10 µL) of MB, ZnONR-SNF with a drop of MB, and AgNP-ZnONR-SNF with a drop of MB solution (Fig. 4f). The intensity at the 1437 cm−1 peaks of MB on the AgNP-ZnONR-SNF, ZnONR-SNF, and the glass substrate are 19861.9, 62.1, and 18.8, respectively. The results demonstrate a significant increase in intensity when using the AgNP-ZnONR-SNF substrate compared to the glass substrate. Specifically, the intensity from the ZnONR-SNF substrate is 3.3 times higher than that from the glass substrate, and the intensity from the AgNP-ZnONR-SNF sensor is 1056 times higher than that from the glass substrate. The inset of Fig. 4f shows the spectrum in the 1600–1800 cm−1 range, which contains two other characteristic peaks of MB at 1700 cm−1 and 1732 cm−1. The intensities of these peaks from the AgNP-ZnONR-SNF are 645.3 and 778.2, respectively, which are about 1.8 times greater than those from the glass substrate. These results indicate that the SERS enhancement mainly occurs in the range of 1050–1650 cm−1, where the enhancement is up to 1056-fold. Enhancement outside this range is less than 2-fold. Several factors contribute to the significant enhancement range of nanosensor, including particle composition (e.g., Ag, Au, or other noble metals) and nanomaterial geometry (e.g., particle size). To achieve a substantial enhancement across a broader spectrum, it is advisable to employ multiple types of nanoparticles and various sizes in decorating the ZnONR. Moreover, the AgNP-ZnONR-SNF chip exhibits relatively consistent and uniform sensing performance on its surface. A color map of the signal intensity of the highest peak (1614 cm−1) of MB dye is plotted (15 \(\times 15\) data points on an area of 400 \(\times\)400 µm2) to represent the magnitude of the intensity, as shown in Fig. 4g. Microscale Raman mapping analysis reveals that the magnitude of the signal intensity is generally consistent across this testing area, indicating a uniform sensing ability across the chip. The box chart of Fig. 4h shows the distribution of the Raman signal intensity for the characteristic peak at 1614 cm−1 of MB.

Fig. 4: SERS detection of organic molecules using the AgNP-ZnONR-SNF thin film.
figure 4

a Chemical structure of antibiotic Cip and dye MB. b Raman spectra of Cip solution of various concentrations. c Raman spectra of MB solution of various concentrations. d The Raman intensity vs. concentration curve of Cip (in log10 scale). e The Raman intensity vs. concentration curve of MB (in log10 scale). Error bars represent the standard deviation. f The SERS enhancement of MB dye (1 μg mL−1) on different substrates. The inserted figure shows the zoomed area between 1600 cm−1 and 1800 cm−1. g Raman signal mapping (15\(\times\)15 data points on an area of 400\(\times\) 400 µm2) of MB dye’s 1614 cm-1 characteristic peak showing uniform intensity across the AgNP-ZnONR-SNF chip. Color bar represents Raman signal intensity. h The distribution of Raman intensity. Within the box, horizontal line denotes median value; box extend from the 25th to the 75th percentile of the group’s distribution of values; vertical extending lines denote the most extreme values within 1.5 interquartile range of the 25th and 75th percentile of the group; dots denote observations.

ML-assisted detection

Raman spectra obtained by AgNP-ZnONR-SNF chip contain inherent molecular fingerprints for analyte identification (Supplementary Fig. 11a). However, accurately characterizing and explaining the molecular structure of mixtures with overlapping characteristic peaks can be challenging (Supplementary Fig. 11b). To address this issue, a combination of deep neural network is employed. The deep neural network consists of a prior treatment stage, a fully connected neural network structure and KNN to provide qualitative and quantitative detection results. While pre-processing is a standard practice in Raman detection models, the intrinsic complexity of Raman spectra and the presence of background noise frequently lead to the generation of weak signals36,37. To enhance the informative content, a prior treatment is implemented leveraging the knowledge of Raman spectrum characteristics. The removal of marginal data points is undertaken, and a Laplacian operation is applied to the raw Raman spectrum data, intensifying the signal gradient and unveiling pertinent Raman peak information. The strengthened data is then fed into a four-layer fully connected neural network structure with sigmoid/ReLU activation between each linear layer, where the size of each layer is 128, 64, 32, and 16. The neural network structure and training parameters are shown in Supplementary Table 1.

Neural network classification

The classification is assessed using Raman spectra obtained from a mixture of two types of dyes (MB, TB, MB&TB at different ratios, and water only) across different concentrations, as detected by the AgNP-ZnONR-SNF chip. The output of the neural network is a five-digit tensor. The first four digits of the output tensor correspond to the dye type, providing information about the potential affiliation of the sample component with one of four classes: water, MB only, TB only, and the mixture of TB and MB. The last digit of the output tensor indicates whether the concentration of a specific analyte surpasses a typical cutoff threshold: [1] above the threshold and [0] indicates a smaller concentration. In this study, the concentration threshold was set as 5 μg mL−1. The qualitative detection results are illustrated in Supplementary Fig. 12a, where the positions of the points indicate the predicted sample components, and the color of the points indicates their true components. The statistical results are shown in Supplementary Fig. 12b, with an accuracy of 92.3% in qualitative detection and 90.8% in quantitative detection. A comprehensive summary containing 100 tests is listed in Supplementary Table 2.

Neural network regression

The regression model undergoes additional testing with Raman spectra obtained from mixtures of three components, MB, TB, and Cip, mixed at various concentration ratios. The concentration ratios of the detected analytes are displayed in Fig. 5a, demonstrating a notable concordance with the ground truth curves. The average absolute error, computed within a concentration ratio range of 0 to 10, is 0.327, indicating a high level of agreement. The presence of the particular analyte in the sample can also be determined from the regression output. A notably low concentration ratio in the output suggests the absence of the specific analyte in the sample. For each analyte of the three, we have existence (1) or non-existence (0) to create eight different combinations in total. Figure 5b illustrates the qualitative detection of neural network regression. Testing points are positioned within the corresponding background area based on the predictions made by the NN regressor. The color of each point represents the actual components, while their positions reflect the corresponding predictions. The results demonstrate a qualitative detection accuracy of 92%. Compared with neural network classification, the neural network regression can directly output the concentration ratio but has a slightly lower accuracy in qualitative detection, making these two models suitable for different scenarios. The statistical detection accuracy of each type of sample is shown in Fig. 5c, from mono-component samples to mixed opponent samples.

Fig. 5: Neural network regressor for the SERS detection of mixing samples.
figure 5

a Quantitative detection results of three component mixture from neural network regression. b Qualitative detection results of neural network regression, where the point colors show the true components, and the point positions show the predicted results. c The statistical detection accuracy of each type of sample. The vertical axis denotes the ground truth analytes, while the horizontal axis represents the predicted analytes. The color bar on the right illustrates a colormap ranging from 0% to 100% of predictions.

Neural network classifier combined with KNN

The KNN model is incorporated with the neural network classifier for detecting unseen dataset. The neural network classifier and the KNN are trained with the same dataset as the neural network regressor, which is the mixtures of three components, MB, TB, and Cip, mixed at different concentration ratios. The output of the neural network classifier is an 8-digit tensor to show the possibility of each class, and 8 clusters are established with the KNN clustering method through supervised training. In the testing scenarios, seen classes points (mixture of MB, TB, and Cip) are used. Additionally, data points from unseen classes, specifically Raman spectra of three bacteria (E. coli, S. epidermidis and E. aerogenes) are incorporated into the evaluation. The minimum distance of each test point to the established clusters is calculated, where seen class points tend to have an extremely small distance to the cluster (in most cases the distance is 0) and the unseen class points typically are far from each established cluster. Therefore, a threshold can be employed to decide if the test point is an unseen class sample. The calculated minimum distances to the established clusters are shown in Fig. 6a, b with thresholds to determine whether the test data points belong to seen classes or unseen classes. A comparison is made between the outcomes of the neural network classifier combined with KNN (Fig. 6a) and that of KNN alone (Fig. 6b). The results show that when employing the neural network classifier and KNN, a significant portion of observed data points is situated within the proximity (threshold) of the clusters, characterized by a small distance. In contrast, only a minimal number of data points from the unseen class exhibit such a proximity. However, outcome of using KNN alone does not provide the apparent dividing line for the two types of samples. The detection results are shown in Fig. 6c, where neural network classifier together with KNN reaches 80% sensitivity (the true seen classes samples are correctly detected as seen) and 89.3% specificity (the true unseen classes samples are correctly detected as unseen). However, applying KNN method alone only yields 22% sensitivity and 46.7% specificity. The detection results together with data distribution are displayed in Fig. 6d.

Fig. 6: Unseen class detection results from the neural network classifier combined with KNN clustering.
figure 6

a The calculated minimum distance toward established clusters using KNN clustering method. b The calculated minimum distance toward established clusters using neural network classifier and KNN clustering methods. c The accuracy of unseen class points detection from KNN alone, and neural network classifier together with KNN. d The statistics of unseen class points detection using neural network classifier and KNN.

In comparison, standard analysis technique hierarchical cluster analysis is used for classifying Cip, MB, and TB from 15 different mixtures. As shown in Supplementary Fig. 13, many mixed analytes from different mixtures were inaccurately grouped into one cluster. This suggests that SERS signal combined with DL is a reliable method to identify different organic pollutants in mixtures with high accuracy.

Laplacian operation

The detection of different analytes is critically based on the Raman peaks. The model implements the Laplacian operation to strengthen the useful information before the deep neural network without additional processing of Raman spectra. To validate the improvement from the Laplacian operator, the learning curves of neural network regression are compared with and without Laplacian operation are shown in Supplementary Fig. 14, which confirms that incorporating the Laplacian operation leads to a significant decrease in loss over the training.

Conclusions

The presented research has developed a dual-functional AgNP-ZnONR-SNF nanophotonic sensor by combining electrospinning, hydrothermal, and wet-chemical synthesis techniques. The ZnONR-SNF thin films exhibit remarkable efficacy in decomposing organic dyes (MB, TB, and MO) when exposed to low-intensity UV and mechanical radiation, and they can be reused. Even after undergoing five cycles, the film maintains its impressive degradation efficiency. The results demonstrate the potential of this low-cost, eco-friendly technology for water decontamination against organic pollutants. Additionally, the vertically aligned ZnONR provide suitable geometry for the incorporation of Ag nanoparticles. This configuration creates high-density “hot-spots” for SERS enhancement. Consequently, the AgNP-ZnONR-SNF thin films serve as an effective SERS substrate, facilitating the detection of exceptionally low concentrations of both organic dye (MB) and antibiotics (Cip). A machine learning algorithm is developed for both qualitative and quantitative pollutants detection based on the Raman spectra obtained from AgNP-ZnONR-SNF nanosensor. It has an accuracy of 92.3% in qualitative detection and 90.8% in quantitative classification. This label-free dual-functional nanophotonic sensor, assisted by a machine learning algorithm, is sensitive, fast, and portable, holding great promise towards environmental monitoring and sustainability studies.

Methods

Chemical and reagents

Tetraethyl orthosilicate (TEOS, 98%), formic acid, ethanol, Polyvinylpyrrolidone (PVP, Mw = 1,300,000 g mol−1), Zinc acetate ((CH3CO2)2Zn, 99.99%), zinc nitrate hexahydrate (Zn (NO3)2·6H2O, 98.0%), hexamethylenetetramine (C6H12N4, HMTA, ≥99.0%), silver nitrate powder (AgNO3, ≥99.0%), Methylene blue (MB, C16H18ClN3S∙xH2O, Mw=319.85 g mol-1), Trypan Blue (TB, C34H24N6O14S4Na4, Mw = 960.81 g mol−1), Methyl Orange (MO, C14H14N3NaO3S, Mw = 327.33 g mol−1) and Ciprofloxacin (Cip, C17H18FN3O3, Mw = 331.34 g mol−1) are purchased from Sigma-Aldrich Inc. Deionized (DI) water is from a Milli-Q water ultrapure water purification system.

Silica nanofiber fabrication

The silica nanofiber thin film was prepared through electrospinning according to a reported protocol with modifications38. In a typical run, 1.9 g of TEOS, 3.15 g of ethanol, 2.0 g of water and 0.04 g of formic acid were mixed with 0.9 g of PVP. The mixture was stirred for 1 h at room temperature until a transparent solution was formed. The solution was electrospun at a feed rate of 0.9 mL h−1 through a 22G stainless needle under a high voltage (16 kV). The ejected silica nanofibers were collected by a flat aluminum plate collector 10 cm away from the needle tip. The silica nanofiber thin film was peeled off from the aluminum foil gently and was then subjected to the calcination for 3 h at 800 °C to remove PVP and other solvent residues.

ZnO nanorods growth

The ZnO nanorods were created based on a seeding-growth method we reported previously39. First, the silica nanofiber thin film was immersed in 5 mM zinc acetate solution (in DI water) and then vacuumized to remove air bubbles. It was then transferred into an oven at 180 °C for 20 min for thermal decomposition of the zinc acetate to create ZnO seeds. This process was repeated three times. Then, zinc nitrate hexahydrate (35 mM) and HMTA (25 mM) were added to 45 mL of DI water to provide the hydrothermal growth solution. Next, the seeded thin film was placed in the growth solution in a beaker which was covered by aluminum foil and placed in a water bath for 3 h at a temperature of 90 °C. This growth cycle was repeated twice to form the ZnO nanorods. Finally, the thin film was rinsed with DI water to remove excessive ZnO residuals and dried in an oven at 50 °C.

Silver nanoparticles decoration

Ag nanoparticles were fabricated on top of the ZnO nanorods by UV irradiation. The fabricated thin film was immersed in a 5 mM AgNO3 solution (in DI water) and irradiated under a UV lamp (365 nm, 30 W) for 30 min. Then, the film was washed with DI water and dried in an oven at 50 °C.

SEM and EDS characterization

The morphologies of SNFs, ZnONR-SNF and AgNP-ZnONR-SNF were studied by SEM performing on a FEI Helios 5CX DualBeam scanning electron microscope operating at 5 kV. The EDS measurements and the chemical mapping were performed with the SDD X-ray detector (Oxford®) attached to the SEM microscope operating at 30 kV.

Photo- and piezo-catalytic degradation

All organic molecules were dissolved in distilled water at a concentration of 10 μg mL-1 under sonication at room temperature. Calibration curves were obtained by considering the characteristic UV-Vis absorbance values (MB at 664 nm, TB at 590 nm, MO at 463 nm), obtained from a series of diluted solutions at prefixed concentration values. ZnONR-SNF films were cut into 0.8\(\times\)0.8 cm2 pieces and employed in glass vials with 3 \({\rm{mL}}\) of pollutant solutions for each degradation experiment. The control experiments were carried out in the absence of ZnONR-SNF films. Photocatalytic degradation experiments were carried out by applying a 30 W UV lamp (irradiated from upper side of the vials) at a fixed distance of around 5 cm. In piezo-catalytic degradation experiments, vials were fixed on the MTS 2/4 digital shaker orbiting at 300 rpm. In hybrid experiments, vials were fixed at the shaker and irradiated by the UV lamp simultaneously. All experiments were performed in the dark room at room temperature.

The degradation efficiency was measured by means of light absorbance. First, 30 \(\mu\)L solution was withdrawn from the vials at a 2-h time interval (0 h, 2 h, 4 h, 6 h, 8 h) and placed in a 96-well UV-Star microplate. Then the light absorbance was read by a microplate reader (TECAN SPARK 10 M) at each characteristic peak wavelength. According to the light absorbance readout and recorded calibration curve obtained previously, the concentration of the organic pollutants after degradation was finalized. The degradation efficiency can be calculated by the following equation:

$${Degradation}\,{efficiency}=\frac{{C}_{0}-C}{{C}_{0}}\times 100 \%$$
(1)

Where \({C}_{0}\) is the initial concentration and C is the measured concentration at different time intervals.

SERS detection

The SERS measurements were processed in a liquid system. The AgNP-ZnONR-SNF film was first cut into a square piece (0.5 cm \(\times\) 0.5 cm). Then the film was focused by a 10\(\times\) objective lens. Next, the sample aqueous solution (10 µL) was added onto the film. Finally, SERS signals were obtained point-by-point from the mapping grid using a 532 nm laser as the excitation source.

Machine learning algorithm development

The machine learning algorithm consists of a Laplacian operator, a deep neural network with two output modes to show the qualitative and quantitative detection results, and a KNN cluster method which is combined with the classification mode output to enable detection of unseen classes. Every Raman spectrum collected displays the Raman signals of chemical structures in the samples across a 238-point Raman shift axis. The Laplacian operation was directly implemented on the Raman spectra without additional need of preliminary processing. After the Laplacian operation, the treated data was taken into the deep neural network to output the detection results through the two modes. In the first mode, the neural network is a classification (fully connected layers with sigmoid as activation layer) to show the analyte components and concentration level. The output of this mode is a tensor with part of the tensor to show the possibility that the sample belongs to a specific class and part of the tensor either 0 or 1 to indicate if the specific chemical is above a typical cutoff concentration. In the second mode, the neural network is a regression (fully connected with ReLU as activation layer) to directly show the concentration of multiple chemicals that are included in the sample. The output of this mode is a tensor with arbitrary numbers showing the concentration of each chemical, where an extremely small number indicates that the specific analyte does not exist. Both two modes can output the qualitative and quantitative detection of mixed analytes to satisfy different application requests. The model is implemented with python. To enhance OOD detection, specifically for identifying unseen classes, a KNN clustering method is incorporated with the neural network classifier. Clusters aligned with the known classes from the neural network classifier’s output can be established through the KNN clustering model. By calculating the distance of a test point to the established clusters after clustering, the test point can be identified as seen class data or unseen class data.

PyTorch, along with its associated toolsets such as Scikit-learn, NumPy, and Skorch, was employed to implement the machine learning models. The model was executed on a standard workstation equipped with an Intel(R) Core(R) i9-9980 XE CPU running at 3.00 GHz, featuring 18 CPU cores, and an 8GB NVIDIA GeForce RTX 2080Ti.

During each training process, the training and testing data were randomly divided. To ensure reliable outcomes, the process was repeated ten times, with the final error and prediction accuracy calculated across these ten training iterations. For instance, in the experiments involving the regressor model, we employed a tenfold cross-validation approach using a total of 1095 data samples. This dataset was further divided into 995 training samples and 100 testing samples. Additional details regarding the sizes of the training and testing datasets can be found in Supplementary Table 1. Furthermore, Supplementary Figs. 15 and 16 present the confusion matrices pertaining to both the training and testing samples.