# A CNN-Based Method for Heavy-Metal Ion Detection
## 4 Results and Discussion
### Ion Concentration Detections  
Twelve different classes or concentrations of test solutions were used to test the detection of ion concentrations. Each solution had 7 different samples, leading to a total of 84 samples to be tested. The graph below shows the predicted concentrations of these 84 samples by HMID-NET compared to the true concentrations.  
As seen from Figure 10, the majority of the predicted concentrations were concentrated around the true concentration, with an average relative error of 8.85%.  
Figure 8: (**a**) Patterns of the HMI data matrices with size \(4\times 200\). (**b**) Features extracted from the backbone.  
Figure 9: The results of the classification with HMID-NET. (**a**–**c**) are the probabilities of the classification of \(Cd^{2+}\), \(Cu^{2+}\), and \(Zn^{2+}\) at the four concentrations in order, where category 1 is \(Cd^{2+}\), category 2 is \(Cu^{2+}\), and category 3 is \(Zn^{2+}\). The values in the bar chart refer to the magnitude of the probability that the sample belongs to that category.  
The average relative error was 10.36% for \(Zn^{2+}\), 7.57% for \(Cu^{2+}\), and 8.62% for \(Cd^{2+}\), using the ionic species as the analytical criterion.  
The average relative error was 12.48% for the 0.2 g/L solution, 9.63% for the 0.5 g/L solution, 7.62% for the 1 g/L solution, and 5.68% for the 2 g/L solution, using the ionic concentration as the analytical criterion. It can be seen that the relative error of prediction was greater for the lower-concentration solutions.  
Finally, we comprehensively compared the accuracy of the HMI detection method proposed in this paper with other methods, and the results are shown in Table 2.  
As shown in column 2 of the table, the accuracy of the method proposed in this paper is 99.99%, the same as in the literature [22] and higher than all the other methods, in terms of the classification prediction of ion types. As shown in column 3 of the table, the relative error of this paper for the ion concentration detection was 8.85%, which is better than the PCA method used in the literature [12].  
Conventional heavy-metal detection algorithms require manual analysis of the curves to derive HMI species and concentrations, and thus cannot perform automated detection. Recently proposed data-processing methods can automate electrochemical analysis, but they are unable to simultaneously detect the species and concentration of the measured substance. The automated, simultaneous qualitative and quantitative detection scheme proposed in this paper extends and elaborates on these two methods.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Method** & **Classification Accuracy** & **Concentration Error (MRE)** \\ \hline MLP [13] & 94\% & — \\ LENET-5 [23] & 98.67\% & — \\ Literature [24] & 96.87\% & — \\ Literature [22] & 99.99\% & — \\ PCA [34] & 90\% & — \\ PCA [12] & — & 16\% \\ HMID-NET (this work) & 99.99\% & 8.85\% \\ \hline \multicolumn{3}{c}{Data not available.} \\ \end{tabular}
\end{table}
Table 2: Comparison of the detection accuracy of multiple data-processing methods.  
Figure 10: The set of multiple concentration predictions for all solutions. The horizontal axis is the calibrated concentration, and the vertical axis is the predicted concentration. The dashed line represents an error of more than \(\pm\)20% or \(\pm\)200 mg/L.