Method for identifying pesticide residues on the surface of Hami melons and method for constructing an identification model

By improving the honey badger algorithm to optimize the ELM model and combining short-wave infrared hyperspectral technology, the problem of complex and time-consuming detection of pesticide residues on the surface of cantaloupe melon in the existing technology is solved, and a fast, lossless and accurate detection effect is achieved.

CN115420703BActive Publication Date: 2025-05-27SHIHEZI UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211106546.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-12
Publication Date
2025-05-27
Estimated Expiration
2042-09-12

AI Technical Summary

Technical Problem

When detecting pesticide residues on the surface of cantaloupe, the prior art methods are complex, time-consuming, high cost and polluting the environment, making it difficult to achieve rapid and non-destructive testing.

Method used

The improved honey badger algorithm is used to optimize the ultimate learning machine (ELM) classification model, and an identification model that can be used for non-destructive detection of pesticide residues on the surface of cantaloupe. The hyperspectral image of the surface of cantaloupe is obtained using short-wave infrared hyperspectral technology, the spectral data is extracted for normalization and pre-processing, and the optimized ELM model is used for detection.

Benefits of technology

It realizes rapid and non-destructive testing of pesticide residues on the surface of Hami melon, with high detection efficiency and accurate identification of different types of pesticides. It is simpler than traditional methods and takes short time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115420703B_ABST
    Figure CN115420703B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for constructing a discrimination model for pesticide residues on the surface of Hami melons. The method includes preparing Hami melon samples for training the model, collecting hyperspectral images of the Hami melon samples, extracting spectral data from the hyperspectral images and preprocessing it, performing mutation processing on the honey badger algorithm HBA using an adaptive t-distribution mutation method; inputting the preprocessed spectral data, and dividing the spectral data into a test set and a training set, and using the mutated tHBA algorithm to optimize the ELM classification model to obtain a final discrimination model tHBA-ELM; The present invention also discloses a method for discriminating pesticide residues on the surface of Hami melons. The method uses the discrimination model constructed by the above construction method to detect the Hami melon samples to be detected and output discrimination results. Using this discrimination model, not only can the pesticide residues on the surface of Hami melons be detected nondestructively, but also the detection efficiency is high. At the same time, different types of pesticides can be accurately discriminated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of pesticide residue detection, and particularly relates to a method for identifying pesticide residues on the surface of Hami melons and a method for constructing an identification model. Background Technique

[0002] Hami melons belong to thick-skinned melons, with a delicious taste and rich nutritional value, and are national geographical indication products. During the cultivation of Hami melons, they are susceptible to diseases such as powdery mildew, leaf blight, downy mildew, and aphids. To prevent these diseases, melon farmers often use insecticides and fungicides such as acetamiprid, difenoconazole, and chlorpyrifos for prevention and control. However, in agricultural production, pesticides are often overused intentionally or unintentionally, and some pesticides adhere to the surface of Hami melons and continuously contaminate the fruits, which not only seriously threatens human health but also causes environmental damage.

[0003] With the improvement of consumers' awareness of food safety and health, more and more researchers have begun to pay attention to the detection of pesticide residues in fruits. Traditional chemical detection methods are all destructive detections. In the past few decades, many effective technologies, such as supercritical fluid chromatography (SFC), immunoassay, liquid chromatography (LC), and gas chromatography-mass spectrometry (GC-MS), have been used to determine pesticide residues. Although these traditional methods have high detection accuracy and sensitivity, they have a long detection time, high detection cost, complex operation, rely on a large amount of chemical reagents, cause a lot of waste and pollution, and are not conducive to popularization. Therefore, it is very necessary and important to find a method for quickly and non-destructively detecting pesticide residues on the surface of Hami melons. Summary of the Invention

[0004] The present invention provides a method for identifying pesticide residues on the surface of Hami melons and a method for constructing an identification model. The main purpose is to optimize the ELM classification model based on an improved honey badger algorithm and then construct an identification model that can non-destructively detect pesticide residues on the surface of Hami melons. Using the constructed identification model, not only can the pesticide residues on the surface of Hami melons be non-destructively detected, but also the detection efficiency is high. At the same time, different types of pesticides can be accurately identified.

[0005] The present application provides a method for constructing an identification model for pesticide residues on the surface of Hami melons, comprising the following steps:

[0006] S1. Select Hami melon samples, and randomly divide the Hami melon samples into a control group and an experimental group. Distilled water is evenly sprayed on the surface of the Hami melon samples in the control group, and a pesticide solution is evenly sprayed on the surface of the Hami melon samples in the experimental group. The prepared samples are stored indoors for 10 - 14 hours;

[0007] S2. Obtain the hyperspectral images of the Hami melon samples in the SWIR hyperspectral imaging system in diffuse reflection mode, extract the spectral data of the hyperspectral images, and perform normalization preprocessing on the obtained spectral data;

[0008] S3. Select the Honey Badger Algorithm (HBA) as the optimization algorithm. Meanwhile, perform mutation processing on the HBA using an adaptive t-distribution mutation method to obtain the tHBA algorithm;

[0009] S4. Input the spectral data of the preprocessed cantaloupe samples, and divide this spectral data into a test set and a training set. Select the Extreme Learning Machine (ELM) neural network learning algorithm as the classification model. Use the tHBA algorithm to optimize the ELM classification model, and use the spectral data to train the optimized ELM model to obtain the final discrimination model tHBA-ELM.

[0010] As a preferred solution of this application, in step S1, the pesticide solution contains four solutions of acetamiprid, malathion, difenoconazole, and beta-cypermethrin. The ratio of pesticide to distilled water in these four solutions is 1:1000.

[0011] As a preferred solution of this application, in step S2, the SWIR hyperspectral imaging system includes a box with a black inner surface and a data acquisition terminal. Inside the box, there are a short-wave infrared spectral camera, a halogen surface light source, and an electric positioning sample stage operated by a stepper motor from top to bottom. The cantaloupe samples can be placed on the electric positioning sample stage. The halogen surface light source can adjust the brightness of the shooting field of view of the short-wave infrared spectral camera. The short-wave infrared spectral camera can obtain the hyperspectral image of the cantaloupe samples on the electric positioning sample stage; the data acquisition terminal is used to collect and store the hyperspectral image.

[0012] As a preferred solution of this application, the exposure time of the short-wave infrared spectral camera and the rotation speed of the electric positioning sample stage are adjusted to 4.1 milliseconds and 53.4 millimeters per second respectively.

[0013] As a preferred solution of this application, in step S3, the method for performing mutation processing on the HBA includes: introducing iter as the degree-of-freedom parameter of the t-distribution in the HBA. This degree-of-freedom parameter iter is used to disrupt the position of the honey badger in the algorithm. After mutation processing, a new honey badger algorithm is obtained, that is, the tHBA algorithm. Among them, the honey badger position algorithm in the tHBA algorithm is specifically:

[0014] X i t+1 = X i t + X i t ·t(iter) (1),

[0015] where, X i t+1 is the position of the honey badger after perturbation, X t iIt is the position of the honey badger at the t-th iteration, where t is the number of iterations, and t(iter) is the t-distribution with the number of iterations iter of the algorithm as the degree-of-freedom parameter.

[0016] As a preferred solution of the present application, in step S4, the tHBA algorithm is used to optimize the ELM classification model, which specifically includes:

[0017] S41. Use the tHBA algorithm to obtain the connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b in the ELM model at each iteration. Use the obtained connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b at each time to optimize the ELM model, and use the spectral data of the honeydew melon samples in the training set as the training samples of the optimized ELM model to train it;

[0018] S42. Verify the trained ELM model with the spectral data of the honeydew melon samples in the test set;

[0019] S43. When the number of iterations reaches the maximum value, terminate the optimization process and output the globally optimal connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b. Use the optimal connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b to optimize the ELM model to obtain the final discrimination model tHBA-ELM.

[0020] As a preferred solution of the present application, when training and optimizing the ELM model, the specific steps of the tHBA algorithm include:

[0021] 1) Determine the relevant parameters in the tHBA algorithm and initialize the population using formula (2);

[0022] x i = lb i + r 1 ×(ub i - lb i ) (2)

[0023] where r 1 is a random number between 0 and 1, x i is the position of the i-th honey badger candidate in the N populations, lb i and ub i are the lower and upper bounds of the search domain respectively;

[0024] 2) Define the odor intensity using formula (3); the odor intensity is related to the degree of prey concentration and the distance between honey badgers.

[0025] I i = r 2 × S / 4πd i 2

[0026] S = (x i - x i+1 ) 2 (3)

[0027] d i = x prey - x i

[0028] where I is the odor intensity, r 2 is a random number between 0 and 1, S is the source intensity or concentration intensity, d i is the distance between the prey and the honey badger i, x prey is the prey position;

[0029] 3) Update the density factor using formula (4); when the value of this density factor can be controlled, it is random to ensure a smooth transition from exploration to exploitation; update the decreasing factor α that decreases with the number of iterations to reduce the randomization over time,

[0030] α = C × exp(-t / t max ) (4)

[0031] where t max is the maximum number of iterations, and C is a constant ≥ 1 (default is 2);

[0032] Escape from local optimum; HBA uses the symbol F to change the search direction to take advantage of the high chance that the agent scans the search space strictly;

[0033] Generate a random number rand between [0, 1]. If rand < p (p is the mutation probability), then perform adaptive t-distribution mutation according to formula (1), calculate the fitness value and update the position of the honey badger;

[0034] When the number of iterations exceeds t max , the optimization process will terminate and output the global optimal position, that is, the optimal values of the connection weights ω between the input layer and the hidden layer and the thresholds b of the hidden layer neurons.

[0035] As a preferred solution of this application, in step S2, the hyperspectral image acquisition of each honeydew melon sample is along the equatorial direction, and one hyperspectral image is acquired for each honeydew melon sample every 90° rotation along the equatorial direction; and / or, the specific method for extracting the spectral data of the hyperspectral image includes: first input the hyperspectral image into ENVI software, randomly frame a 50*50 pixel block in the input hyperspectral image as the region of interest, and take the average of this region of interest to obtain the spectral data.

[0036] As a preferred embodiment of the present application, in step S2, the spectral resolution of the hyperspectral image of the cantaloupe sample is 6.20 nm, and the spectral range is 1000 - 2500 nm.

[0037] The present application also provides a method for identifying pesticide residues on the surface of cantaloupe, which specifically includes the following steps:

[0038] 1) Prepare a cantaloupe sample to be detected, obtain the hyperspectral image of the cantaloupe sample to be detected in the SWIR hyperspectral imaging system in the diffuse reflection mode, extract the spectral data of the hyperspectral image, and perform normalization preprocessing on the spectral data;

[0039] 2) Input the preprocessed spectral data, and use the discrimination model constructed in the method for constructing the discrimination model of pesticide residues on the surface of cantaloupe described above to analyze and discriminate the preprocessed spectral data;

[0040] 3) Output the result of identifying pesticide residues on the cantaloupe.

[0041] Compared with the prior art, the advantages of the method for identifying pesticide residues on the surface of cantaloupe and the method for constructing the discrimination model in the present application are as follows: The hyperspectral reflectance of different pesticide residues on the surface of cantaloupe is obtained by using the short-wave infrared hyperspectral technology. Since the hyperspectral reflectance of different types of pesticide residues obtained by using the short-wave infrared hyperspectral technology is slightly different, but the change trend of the spectral curve is similar. In this way, it is not only convenient to subsequently identify the types of pesticide residues on the surface of cantaloupe, but also the steps are simple and time-consuming compared with the chemical detection method. At the same time, it is also convenient to train the discrimination model, increasing the diversity of the discrimination model detection and improving the detection accuracy of the discrimination model. At the same time, the honey badger algorithm tHBA after mutation is used to optimize the classification model ELM. Since the mutated tHBA algorithm has strong global search ability and fast convergence speed, that is, the mutated tHBA algorithm can further improve its optimization ability. Therefore, when using the mutated tHBA algorithm to optimize the classification model ELM, it can converge to the optimal solution of the classification model ELM in the later stage. Using this optimal solution, a discrimination model with higher classification accuracy and detection accuracy can be constructed. In this way, when using this discrimination model to detect pesticide residues on the surface of cantaloupe, the detection accuracy and the discrimination accuracy of the pesticide types can be improved. Description of the Drawings

[0042] Figure 1 It is a flow chart of the method for constructing the discrimination model provided in Embodiment 1 of the present invention.

[0043] Figure 2 It is a schematic structural diagram of the SWIR hyperspectral imaging system provided in Embodiment 1 of the present invention.

[0044] Figure 3Flow chart of optimizing the ELM classification model using the tHBA algorithm provided in the first embodiment of the present invention.

[0045] Figure 4 a is a schematic diagram of the confusion matrix of the classification results of the NM-ELM classification model provided in the first embodiment of the present invention.

[0046] Figure 4 b is a schematic diagram of the confusion matrix of the classification results of the NM-GA-ELM classification model provided in the first embodiment of the present invention.

[0047] Figure 4 c is a schematic diagram of the confusion matrix of the classification results of the NM-HBA-ELM classification model provided in the first embodiment of the present invention.

[0048] Figure 4 d is a schematic diagram of the confusion matrix of the classification results of the NM-tHBA-ELM classification model provided in the first embodiment of the present invention.

[0049] Figure 5 Schematic diagram of the fitness curves of three classification models of GA-ELM, HBA-ELM, and tHBA-ELM provided in the first embodiment of the present invention.

[0050] Reference numerals

[0051] Box 1, short-wave infrared spectral camera 11, halogen surface light source 12, electric positioning sample stage 13, light source regulator 14, data acquisition terminal 2, honeydew melon 3;

[0052] 4 is the fitness curve of the GA-ELM model, 5 is the fitness curve of the HBA-ELM model, and 6 is the fitness curve of the tHBA-ELM model. Detailed implementation manners

[0053] The present invention will be further described in detail below in conjunction with the detailed implementation manners and with reference to the accompanying drawings. It should be emphasized that the following description is merely exemplary and is not intended to limit the scope and application of the present invention.

[0054] Example 1: This example provides a method for constructing a honeydew melon surface pesticide residue identification model. The detection method includes the following steps. See Figure 1 :

[0055] S1. Select honeydew melon samples and randomly divide them into a control group and an experimental group. Distilled water is evenly sprayed on the surface of the honeydew melon samples in the control group, and a pesticide solution is evenly sprayed on the surface of the honeydew melon samples in the experimental group. The prepared samples are stored indoors for 10 - 14 hours;

[0056] S2. In the SWIR hyperspectral imaging system, obtain the hyperspectral image of the cantaloupe sample in diffuse reflection mode, extract the spectral data of the hyperspectral image, and perform normalization preprocessing on the obtained spectral data;

[0057] S3. Select the Honey Badger Algorithm (HBA) as the optimization algorithm. At the same time, perform mutation processing on the HBA using the adaptive t-distribution mutation method to obtain the tHBA algorithm;

[0058] S4. Input the spectral data of the preprocessed cantaloupe sample, divide the spectral data into a test set and a training set, select the Extreme Learning Machine (ELM) neural network learning algorithm as the classification model, use the tHBA algorithm to optimize the ELM classification model, and use the spectral data to train the optimized ELM model to obtain the final discrimination model tHBA-ELM.

[0059] In step S1, the selected cantaloupe samples are oval-shaped and weigh about 3 - 4 kg. Before spraying pesticides, it is preferred to wipe and number all the cantaloupe samples, and then place them in a well-ventilated laboratory (room temperature 22°C, relative humidity about 40%) for 24 hours. This is mainly to reduce the influence of environmental factors on the model accuracy. In this embodiment, preferably 200 cantaloupe samples are used. The 200 cantaloupe samples are randomly divided into a control group and an experimental group. In this embodiment, the 200 samples are preferably randomly and evenly divided into 5 groups (40 samples in each group). One group is used as the control group, and the remaining 4 groups are used as the experimental group. Distilled water is evenly sprayed on the surface of the cantaloupe samples in the control group, and a pesticide solution is evenly sprayed on the surface of the cantaloupe samples in the experimental group. The prepared cantaloupe samples are stored indoors for 10 - 14 hours.

[0060] In this step S1, the pesticide solution sprayed on the surface of the cantaloupe samples in the experimental group contains multiple types. Preferably, it contains a mixed solution of four commonly used standard pesticides and distilled water. The four standard pesticides specifically include acetamiprid (active ingredient content 70%, water-dispersible granules, Shandong Baixin Biotechnology Co., Ltd. 136), malathion (active ingredient 70%, emulsifiable oil, Ningbo Sanjiang Yinong Chemical Co., Ltd. 137), difenoconazole (active ingredient 20%, microemulsion, Chengdu Kelong Biochemical Co., Ltd. 138), and beta-cypermethrin (active ingredient 4.5%, emulsion, Jiangsu Yixing Xingnong Chemical Products Co., Ltd. 139). The ratio of the standard pesticide to distilled water in the above four solutions is 1:1000. In this embodiment, for the convenience of recording and distinction, it is preferred to number the control group as group 0, and number the experimental groups as group 1, group 2, group 3, and group 4.

[0061] In this embodiment, to ensure the equality of the amount of different types of cantaloupe samples sprayed and facilitate result analysis, it is preferred that each of the 4 groups of cantaloupe samples in the experimental group is sprayed with a type of pesticide solution.

[0062] In step S2, the SWIR hyperspectral imaging system includes a box with a black inner surface and a data acquisition terminal. Refer to Figure 2 , in this embodiment, the inner surface of the box is set to black mainly to avoid the interference of stray light and ensure the acquisition of hyperspectral data in a dark environment. Inside the box, there are successively arranged from top to bottom a short-wave infrared spectral camera (this short-wave infrared spectral camera has the functions of a short-wave infrared spectrometer and a camera), a halogen surface light source, and an electric positioning sample stage operated by a stepping motor. The honeydew melon sample can be placed on the electric positioning sample stage. The halogen surface light source can adjust the brightness of the shooting field of view of the short-wave infrared spectral camera, and the short-wave infrared spectral camera can obtain the hyperspectral image of the honeydew melon sample on the electric positioning sample stage; the data acquisition terminal is used to collect and store the hyperspectral image; in the embodiment, it is preferably that the halogen surface light source includes two groups and the power of each group is 150W. When the light angles of the two groups of halogen surface light sources are adjusted to about 45°C, the shooting field of view of the short-wave infrared spectral camera can be fully brightened. In this way, it is convenient for the short-wave infrared spectral camera to obtain a high-definition and distortion-free hyperspectral image.

[0063] In this step S2, SWIR is the abbreviation of short-wave infrared, that is, in this embodiment, the short-wave infrared hyperspectral technology is adopted to obtain the hyperspectral image of the honeydew melon sample in the diffuse reflection mode. In this embodiment, it is preferably that the spectral range provided by the short-wave infrared spectral camera is 1000 - 2500nm, the spectral resolution is 6.20nm, and the image resolution is 320×256 pixels; in this embodiment, before using the short-wave infrared hyperspectral technology to collect the hyperspectral image of the pesticide residues on the surface of the honeydew melon, the implicit relationship between the spectral data and the pesticide residues is tested. According to the test results, it can be known that in the hyperspectral image obtained by using the short-wave infrared hyperspectral technology, the hyperspectral reflectivities of different types of residual pesticides are different, but the change trends of the spectral curves are similar. In this way, different pesticides can be identified and reflected according to different reflectivities.

[0064] In this step S2, before using the SWIR hyperspectral imaging system, the short-wave infrared spectral camera needs to be calibrated for black and white to reduce the influence of uneven light source intensity distribution and dark current noise of the CCD camera.

[0065] In step S2, before collecting hyperspectral data, the short-wave infrared spectral camera needs to be preheated for 30 minutes. At the same time, the exposure time of the short-wave infrared spectral camera is adjusted to 4.1 ms, and the rotation speed of the electric positioning sample stage is adjusted to 53.4 mm / s. At the same time, the brightness provided by the halogen surface light source to the electric positioning sample stage is adjusted; when collecting hyperspectral images, the Hami melon samples are placed on the electric positioning sample stage, and each Hami melon sample is rotated along the equatorial direction, that is, each Hami melon sample is rotated 90° along the equatorial direction. A hyperspectral image is collected, so that one Hami melon sample can collect four hyperspectral images. Since 200 Hami melon samples have been selected in step S1, a total of 800 hyperspectral images can be collected. The collected hyperspectral images are imported into the ENVI software, and a 50*50 pixel block is randomly framed at the equatorial part of the Hami melon as the region of interest to obtain 800 average spectral data.

[0066] In this step, since the original hyperspectral image is easily affected by external factors such as the detection environment, operating level, and instrument status during acquisition, the original hyperspectral image will have more noise and interference. In order to reduce the impact of noise on data analysis, this embodiment preferably uses normalization to perform pre-processing such as interference reduction and denoising on the averaged spectral data, thereby improving the quality of the spectral data and the accuracy of subsequent classification.

[0067] In step S3, the honey badger algorithm HBA is selected as the optimization algorithm. The honey badger algorithm HBA is a new meta-heuristic algorithm. The algorithm is inspired by the intelligent foraging behavior of the honey badger and provides an effective search strategy for solving mathematical optimization problems. Compared with the commonly used meta-heuristic algorithms, the honey badger algorithm HBA has the advantages of simple mechanism, few parameters, fast convergence speed, etc. It has advantages in convergence speed and balance between exploration and development, but it also has certain shortcomings, that is, it is easy to fall into local convergence; in order to further improve the optimization performance of the algorithm and enable it to pick out local convergence, this embodiment uses an adaptive t-distribution mutation method to mutate the honey badger algorithm HBA. Since the t-distribution combines the advantages of Cauchy mutation (with strong global search ability, mutation can effectively maintain the diversity of the population) and Gaussian mutation (with strong local development ability, which can ensure the convergence speed in the late stage of evolution), therefore, the adaptive t-distribution mutation method is used to perturb the individual position, which can improve the ability of the honey badger algorithm HBA to jump out of local convergence, and at the same time, it will also improve the global optimization performance of the honey badger algorithm HBA.

[0068] In this step, the mutation processing method for the Honey Badger Algorithm HBA includes:

[0069] In the honey badger algorithm HBA, iter is introduced as the degree of freedom parameter of the t-distribution, and mutation processing is performed to obtain a new honey badger algorithm, namely the tHBA algorithm. In the tHBA algorithm, the honey badger position algorithm is specifically as follows:

[0070] X i t+1 = X i t + X i t ·t(iter) (1),

[0071] where X i t+1 is the position of the honey badger after perturbation, X t i is the position of honey badger i at the t-th iteration, t is the number of iterations, and t(iter) is the t-distribution with the algorithm iteration number iter as the degree of freedom parameter;

[0072] That is, in this embodiment, by introducing the t-distribution degree of freedom parameter iter, a random interference term X i t ·t(iter) is added to the original honey badger position algorithm. Using this random interference term X i t ·t(iter) can disrupt the position of the honey badger in the algorithm. In this way, both the current position information is fully utilized and random interference information is added, which is beneficial for the mutated honey badger algorithm to jump out of the local optimum. As iter increases, the t-distribution will gradually approach the Gaussian distribution, which is beneficial for improving the convergence speed of the algorithm. That is, in this embodiment, by introducing the degree of freedom parameter iter as a mutation operator, the mutated honey badger algorithm has better global development ability in the early iteration and better local exploration ability in the later iteration, improving the convergence speed of the algorithm.

[0073] In step S4, the spectral data of the preprocessed honeydew melon samples is input, and the spectral data is divided into a test set and a training set. Among them, the number of honeydew melon samples in the test set and the training set is 3:1. That is, among 800 spectral data, there are 600 spectral data in the test set and 200 spectral data in the training set.

[0074] In this step, the neural network learning algorithm ELM is selected as the classification model. The ELM algorithm is a neural network algorithm for single-hidden-layer feedforward neural networks, which has the advantages of high learning efficiency and strong generalization ability. It is widely used in classification, regression, clustering, feature learning and other problems. At the same time, the ELM algorithm adopts a non-linear modeling method, and the spectral information of the pesticide residues on the surface of honeydew melons is also non-linear. Therefore, the ELM algorithm has better effect when used for the classification and detection of pesticide residues on the surface of honeydew melons. For the SVM classification model that also adopts the non-linear modeling method, it is found through research that the algorithms of both the ELM and SVM classification models map the problem to a high-dimensional space and then conduct classification research in the high-dimensional space. The classification effect is affected by the mapping method. If the mapping method is good, there will be obvious differences in the high-dimensional space, and the corresponding classification effect will also be good. If the mapping method does not show in the high-dimensional space, the classification effect will be relatively poor. However, it is actually found that the algorithm of the ELM classification model can project into the high-dimensional space in an infinite number of ways, making the training speed fast, and can also adjust the mapping mode multiple times. Once the kernel function is determined in the algorithm of the SVM classification model, the mapping mode is uniquely determined, and its training speed is slower than that of the ELM algorithm. Therefore, in this embodiment, through research, the ELM algorithm with better classification performance is selected as the classification model.

[0075] At the same time, it is found through research in this embodiment that compared with the ELM classification model constructed from the spectral data preprocessed by MSC and SNV, the ELM model constructed from the spectral data preprocessed by NM (normalization) has better classification effect and higher model accuracy (82.00%). Its precision, sensitivity and F1 score are 82.07%, 82.00% and 0.8201 respectively. Therefore, this embodiment is suitable for using the normalization (NM) preprocessing method to preprocess the spectral data of the pesticide residues of honeydew melon samples. The ELM model constructed from the spectral data preprocessed by this preprocessing method has high classification accuracy.

[0076] In this step, the tHBA algorithm is used to optimize the ELM classification model, which specifically includes the training optimization and test verification of the ELM splitting model. See Figure 3 ;

[0077] S41. First, set the number of iterations. In this embodiment, the variable parameter t of the number of iterations is set. In this embodiment, t is preferably max=iter=300 times, that is, the given value of the degree of freedom parameter iter of the t-distribution is the maximum value of the number of iterations. The connection weights ω between the input layer and the hidden layer and the hidden layer neuron thresholds b (hereinafter referred to as the connection weights ω and neuron thresholds b) in the ELM model are obtained using the tHBA algorithm for each iteration. The ELM model is optimized using the connection weights ω between the input layer and the hidden layer and the hidden layer neuron thresholds b obtained each time; to save optimization time, it is preferred that when the set of connection weights ω and neuron thresholds b found by tHBA optimization at the current iteration number is not better than the connection weights ω and neuron thresholds b obtained last time (which can be reflected by the fitness curve), the parameters ω and b in the ELM model will not be replaced, that is, no optimization will be performed until the set of connection weights ω and neuron thresholds b obtained by optimization is better than the connection weights ω and neuron thresholds b in the current ELM model, at which time they will be replaced and the ELM model will be optimized. At the same time, the spectral data of the honeydew melon samples in the training set are used as the training samples of the optimized ELM model for training. This training enables the optimized model ELM to learn the spectral characteristics of different pesticides from the spectral data in the training set;

[0078] S42. Validate the trained ELM model using the spectral data of the honeydew melon samples in the test set;

[0079] S43. When the number of iterations reaches the maximum number of iteration values, that is, when t >= 300, terminate the optimization process and output the globally optimal connection weights ω between the input layer and the hidden layer and the hidden layer neuron thresholds b. Use the optimal connection weights ω and neuron thresholds b to optimize the ELM model to obtain the final discrimination model tHBA-ELM; in this embodiment, when the number of iterations is less than the maximum number of iteration values, steps S41 and S42 are looped above.

[0080] In this embodiment, when training and optimizing the ELM model, the specific steps of the tHBA algorithm include:

[0081] 1) Determine the relevant parameters in the tHBA algorithm. These parameters include the population size, mutation ratio, and maximum number of iterations, etc. Among the above parameters, the maximum number of iterations t max is preferably 300 times. The other parameters can be randomly set according to actual needs, and the population is initialized using formula (2);

[0082] x i =lb i +r 1 ×(ub i -lb i ) (2)

[0083] where r 1 is a random number between 0 and 1, and xi is the i-th honey badger position candidate among N populations, lb i and ub i are the lower and upper bounds of the search domain respectively;

[0084] 2) Define the odor intensity using formula (3); the odor intensity is related to the prey concentration and the distance between honey badgers,

[0085] I i = r 2 × S / 4πd i 2

[0086] S = (x i - x i+1 ) 2 (3)

[0087] d i = x prey - x i

[0088] where I is the odor intensity, r 2 is a random number between 0 and 1, S is the source intensity or concentration intensity, d i is the distance between the prey and honey badger i, x prey is the prey position;

[0089] 3) Update the density factor α using formula (4); the value of this density factor can control the randomness during the transition from exploration to exploitation to ensure a smooth transition;

[0090] α = C × exp(-t / t max ) (4)

[0091] where t max is the maximum number of iterations, and C is a constant ≥ 1 (default is 2);

[0092] 4) Escape from local optima; HBA uses the symbol F to change the search direction to take advantage of the high chance of agents scanning the search space strictly ((F: represents changing the search direction of agents and provides population diversity for a strict exploration of the given search space));

[0093] 5) Generate a random number rand between [0, 1]. If rand < p (p is the mutation probability, which is determined to be 0.8 through multiple experiments), then perform adaptive t-distribution mutation according to equation (1), calculate the fitness value, and update the honey badger position;

[0094] 6) When the number of iterations exceeds t maxWhen = 300, the optimization process will terminate and output the global optimal position, that is, the optimal values of the connection weights ω between the input layer and the hidden layer and the thresholds b of the hidden layer neurons.

[0095] In this embodiment, in order to test the classification performance of the final discrimination model tHBA-ELM, the traditional metaheuristic optimization algorithm (GA) is used to optimize the ELM model. At the same time, the original HBA algorithm is used to optimize the ELM model, that is, the final discrimination model tHBA-ELM is compared with the GA-ELM model and the HBA-ELM model. The test data still uses 200 spectral data in the test set, and other conditions are the same.

[0096] Refer to Table 1, which shows the final classification results of the three models provided in this embodiment.

[0097] In this embodiment, it should be noted that NM-GA-ELM represents the ELM classification algorithm optimized by using the GA algorithm and the spectral data preprocessed by the NM method, NM-HBA-ELM represents the ELM classification algorithm optimized by using the HBA algorithm and the spectral data preprocessed by the NM method, and NM-tHBA-ELM represents the ELM classification algorithm optimized by using the mutated tHBA algorithm and the spectral data preprocessed by the NM method.

[0098] Table 1

[0099]

[0100] It can be seen from Table 1 that the three ELM classification models based on different metaheuristic optimization algorithms have improved the classification effect and accuracy. However, the overall accuracy of the ELM classification model optimized by the tHBM algorithm is 93.50%, the precision is 93.73%, the sensitivity is 93.50%, and the F1-score is 0.9355. Its overall performance and classification effect are better than those of the ELM classification models optimized by the GA algorithm and the HBA algorithm.

[0101] At the same time, in this embodiment, in order to further illustrate that the overall performance of the ELM classification model optimized by the tHBA algorithm is better, Figure 4 shows the confusion matrices of the classification results of the four classification models NM-ELM, NM-GA-ELM, NM-HBA-ELM, and NM-tHBA-ELM established by using 200 spectral data in the test set. In Figure 4 Figure 4 a represents the confusion matrix of the classification results of the NM-ELM classification model, Figure 4 b represents the confusion matrix of the classification results of the NM-GA-ELM classification model, Figure 4 ​c represents the confusion matrix of the classification results of the NM-HBA-ELM classification model. Figure 4 d represents the confusion matrix of the classification results of the NM-tHBA-ELM classification model.

[0102] In this Figure 4 , 0 on the abscissa and ordinate represents the distilled water sprayed on the surface of the honeydew melon, 1 represents acetamiprid sprayed on the surface of the honeydew melon, 2 represents malathion sprayed on the surface of the honeydew melon, 3 represents difenoconazole sprayed on the surface of the honeydew melon, 4 represents beta-cypermethrin sprayed on the surface of the honeydew melon. In terms of overall recognition ability, the NM-tHBA-ELM model only misjudged 13 samples, which is the least number of misjudged samples among the four models, and the number of types of misjudgments is basically the same, as Figure 4 shown in d; in the NM-ELM model, as Figure 4 shown in a, the NM-ELM model has a relatively high misjudgment rate for beta-cypermethrin, with 10 samples misjudged (the misjudgment rate is 20.00%), among which the misjudgment rate for acetamiprid is the lowest, and the misjudgment rate for the other 4 cases is 2.50%; in Figure 4 b, the NM-GA-ELM model has a good identification effect on acetamiprid samples, with only 2 samples misjudged. Secondly, the misjudgment rate of samples without residues is 3.00%, and most samples are misjudged as beta-cypermethrin; in the NM-HBA-ELM model, as Figure 4 shown in c, the misjudgment rates of malathion and beta-cypermethrin are 12.50%, but the overall discrimination ability is higher than that of the original ELM classification model. The test results show that the classification accuracy of the tHBA-ELM model is higher than that of the ELM model, GA-ELM model and HBA-ELM model, and it has good classification accuracy for different types of pesticide residues and can be used for the identification of pesticide residues on the surface of honeydew melons.

[0103] This embodiment also provides the fitness curves of the three classification models of GA-ELM, HBA-ELM and tHBA-ELM, as Figure 5 shown. In this figure, the horizontal axis represents the number of iterations, and the vertical axis represents the fitness value; from Figure 5 it can be seen that the tHBA-ELM classification model has the fastest convergence speed. When the number of iterations is 30 generations, the complete convergence rate; while the GA-ELM and HBA-ELM classification models still do not converge completely when the number of iterations is 250; the fitness value of the tHBA-ELM classification model (the fitness value is the error rate when the model discriminates 200 spectral data in the test set) is lower than 0.10, while the fitness values of the GA-ELM and HBA-ELM classification models are both higher than 0.10. Therefore, it shows that the tHBA-ELM classification model has a faster convergence speed and the lowest fitness value.

[0104] It can be seen that in this embodiment, a mutation operator is added to the original Honey Badger Algorithm (HBA), that is, the Honey Badger Algorithm (HBA) is mutated using the adaptive t-distribution mutation method. The mutated Honey Badger Algorithm (tHBA) has a certain local random search ability, which on the one hand speeds up the convergence to the optimal solution in the later stage, and on the other hand maintains diversity. Taking the number of iterations iter as the degree-of-freedom parameter of the t-distribution, the adaptive t-distribution mutation method is used to perturb the individual positions, improving the optimization ability of the Honey Badger Algorithm (tHBA). Since the tHBA algorithm has good optimization ability, therefore, using the mutated Honey Badger Algorithm (tHBA) to optimize the existing classification model Extreme Learning Machine (ELM) can improve the performance of the classification model ELM. When it is applied to the identification of pesticide residues on the surface of honeydew melons, it can accurately identify the types of pesticides.

[0105] In summary, in this embodiment, the short-wave infrared hyperspectral technology is used to obtain the hyperspectral reflectance of different pesticide residues on the surface of honeydew melons. Since the hyperspectral reflectance of different types of pesticide residues obtained by using the short-wave infrared hyperspectral technology is slightly different, but the changing trends of the spectral curves are similar. In this way, it is not only convenient for subsequent identification of the types of pesticide residues on the surface of honeydew melons, but also has simpler steps and shorter time consumption compared with chemical detection methods. At the same time, it is also convenient for training the identification model, increasing the diversity of the detection of the identification model and improving the detection accuracy of the identification model. At the same time, the mutated Honey Badger Algorithm (tHBA) is used to optimize the classification model ELM. Since the mutated tHBA algorithm has strong global search ability and fast convergence speed, that is, the mutated tHBA algorithm can further improve its optimization ability. Therefore, when using the mutated tHBA algorithm to optimize the classification model ELM, it can converge to the optimal solution of the classification model ELM in the later stage. Using this optimal solution, an identification model with higher classification accuracy and detection accuracy can be constructed. In this way, when using this identification model to detect pesticide residues on the surface of honeydew melons, the detection accuracy and the identification accuracy of the types of pesticides can be improved.

[0106] Embodiment 2: This embodiment provides a method for identifying pesticide residues on the surface of honeydew melons, which specifically includes the following steps:

[0107] 1) Prepare the honeydew melon samples to be detected, obtain the hyperspectral images of the honeydew melon samples to be detected in the SWIR hyperspectral imaging system in the diffuse reflection mode, extract the spectral data of the hyperspectral images, and perform normalization preprocessing on the spectral data (the acquisition and processing of the spectral data of the honeydew melon samples to be detected are the same as the method steps in the above Embodiment 1, and will not be repeated in this embodiment);

[0108] 2) Input the preprocessed spectral data, and use the identification model for pesticide residues on the surface of honeydew melons constructed in Embodiment 1 to analyze and identify the preprocessed spectral data;

[0109] 3) Output the identification result of pesticide residues in Hami melons.

[0110] The above are only embodiments of the present invention. Common knowledge such as specific structures and characteristics known in the art are not described in detail herein. It should be noted that for those skilled in the art, several improvements can be made without departing from the present invention, and these should also be regarded as the protection scope of the present invention, which will not affect the implementation effect of the present invention and the practicability of the patent. The protection scope required by this application shall be subject to the content of the claims, and the specific implementation manners described in the specification can be used to interpret the content of the claims.

Claims

1. A method for constructing a discrimination model for pesticide residues on the surface of Hami melons, characterized in that, it comprises the following steps: S1. Select Hami melon samples, and randomly divide the Hami melon samples into a control group and an experimental group. Uniformly spray distilled water on the surface of the Hami melon samples in the control group, and uniformly spray a pesticide solution on the surface of the Hami melon samples in the experimental group. The prepared samples are stored indoors for 10 - 14 hours; S2. Obtain the hyperspectral images of the Hami melon samples in the SWIR hyperspectral imaging system in diffuse reflection mode, extract the spectral data of the hyperspectral images, and perform normalization preprocessing on the obtained spectral data; S3. Select the Honey Badger Algorithm HBA as the optimization algorithm. At the same time, perform mutation processing on the Honey Badger Algorithm HBA using the adaptive t - distribution mutation method to obtain the tHBA algorithm; In step S3, the method for mutating the Honey Badger Algorithm (HBA) includes: introducing as the degree-of-freedom parameter of the t-distribution, and this degree-of-freedom parameter is used to disrupt the position of the honey badger in the algorithm. Through mutation processing, a new honey badger algorithm, namely the tHBA algorithm, is obtained. Among them, the honey badger position algorithm in the tHBA algorithm is specifically: (1), Among them, is the position of the honey badger after perturbation, is the position of the i-th honey badger at the t-th iteration, is the number of iterations, is the number of iterations of the algorithm is the t-distribution of the degree-of-freedom parameter; S4. Input the spectral data of the pre - processed Hami melon samples, and divide the spectral data into a test set and a training set. Select the Extreme Learning Machine ELM neural network learning algorithm as the classification model, use the tHBA algorithm to optimize the ELM classification model, and use the spectral data to train the optimized ELM model to obtain the final discrimination model tHBA - ELM; In step S4, using the tHBA algorithm to optimize the ELM classification model specifically includes: S41. Use the tHBA algorithm to obtain the connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b in the ELM model at each iteration. Use the obtained connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b at each time to optimize the ELM model, and use the spectral data of the Hami melon samples in the training set as the training samples of the optimized ELM model to train it; S42. Use the spectral data of the Hami melon samples in the test set to verify the trained ELM model; S43. When the number of iterations reaches the maximum value, terminate the optimization process and output the globally optimal connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b. Use the optimal connection weight ω between the input layer and the hidden layer and the hidden layer neuron threshold b to optimize the ELM model to obtain the final discrimination model tHBA - ELM; When training and optimizing the ELM model, the specific steps of the tHBA algorithm include: 1) Determine the relevant parameters in the tHBA algorithm, and initialize the population using formula (2); (2) Among them, is a random number between 0 and 1, is the position of the i-th honey badger candidate in N populations, and are the lower and upper bounds of the search domain respectively; 2) Define the odor intensity using formula (3); The odor intensity is related to the prey concentration and the distance between honey badgers. (3) Among them, is the odor intensity, is a random number between 0 and 1, is the source intensity or concentration intensity, is the distance between the prey and the honey badger and, is the prey position; 3) Update the density factor using formula (4); The value of this density factor can be controlled randomly to ensure a smooth transition from exploration to exploitation; Update the decreasing factor α that decreases with the number of iterations to reduce the randomization over time. (4) Among them, is the maximum number of iterations, is a constant ≥ 1 (default is 2); Escape from local optima; HBA uses symbols to change the search direction to take advantage of the high chance that the agent scans the search space strictly. Generate a random number rand between [0, 1]. If rand < p (p is the mutation probability), then perform adaptive t - distribution mutation according to formula (1), calculate the fitness value and update the honey badger position; When the number of iterations exceeds , the optimization process will terminate and output the global optimal position, that is, the optimal values of the connection weights ω between the input layer and the hidden layer and the thresholds b of the hidden layer neurons.

2. The method for constructing a discrimination model for pesticide residues on the surface of Hami melons according to claim 1, characterized in that, In step S1, the pesticide solution contains four solutions of acetamiprid, malathion, difenoconazole, and beta-cypermethrin. The ratio of pesticide to distilled water in these four solutions is 1:1000.

3. The method for constructing a cantaloupe surface pesticide residue discrimination model according to claim 1, characterized in that, in step S2, the SWIR hyperspectral imaging system includes a box with a black inner surface and a data acquisition terminal. Inside the box, a short-wave infrared spectral camera, a halogen surface light source, and an electric positioning sample stage operated by a stepper motor are sequentially arranged from top to bottom. The cantaloupe sample can be placed on the electric positioning sample stage. The halogen surface light source can adjust the brightness of the shooting field of view of the short-wave infrared spectral camera. The short-wave infrared spectral camera can obtain the hyperspectral image of the cantaloupe sample on the electric positioning sample stage; the data acquisition terminal is used to collect and store the hyperspectral image.

4. The method for constructing a cantaloupe surface pesticide residue discrimination model according to claim 3, characterized in that, the exposure time of the short-wave infrared spectral camera and the rotation speed of the electric positioning sample stage are adjusted to 4.1 milliseconds and 53.4 millimeters per second respectively.

5. The method for constructing a cantaloupe surface pesticide residue discrimination model according to claim 1, characterized in that, in step S2, the hyperspectral image acquisition of each cantaloupe sample is along the equatorial direction. For each cantaloupe sample, a hyperspectral image is acquired every 90° rotation along the equatorial direction; and / or, the specific method for extracting the spectral data of the hyperspectral image includes: first input the hyperspectral image into ENVI software, randomly frame a 50*50 pixel block in the input hyperspectral image as the region of interest, and average the region of interest to obtain the spectral data.

6. The method for constructing a cantaloupe surface pesticide residue discrimination model according to claim 1, characterized in that, in step S2, the spectral resolution of the hyperspectral image of the cantaloupe sample is 6.20 nm, and the spectral range is 1000 - 2500 nm.

7. A method for discriminating pesticide residues on the surface of cantaloupe, characterized in that, specifically includes the following steps: 1) Prepare the cantaloupe sample to be detected, obtain the hyperspectral image of the cantaloupe sample to be detected in diffuse reflection mode in the SWIR hyperspectral imaging system, extract the spectral data of the hyperspectral image, and perform normalization preprocessing on the spectral data; 2) Input the preprocessed spectral data, and use the discrimination model constructed in the method for constructing a cantaloupe surface pesticide residue discrimination model according to any one of claims 1 - 6 to analyze and discriminate the preprocessed spectral data; 3) Output the discrimination result of cantaloupe pesticide residues.

Citation Information

Patent Citations

  • Lithium battery SOC (State of Charge) estimation method and system for optimizing EnInEntropy-ELM (Extreme Learning Mode) based on badger algorithm

    CN117233606A

  • Cascade small hydropower station group optimization scheduling method

    CN117973792A

  • Honeypot network security situation prediction method and system

    CN118540166A