Vegetable surface pesticide residue grade detection method and device based on hyperspectral imaging
Through hyperspectral imaging technology and data processing algorithms, pesticide residue index is generated, which solves the problem of insufficient rapidity and accuracy of pesticide residue detection on vegetable surfaces in the existing technology, and achieves efficient and accurate detection of pesticide residues on vegetable surfaces to ensure food safety.
Patent Information
- Application Number
- CN202411745575.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-03-21
AI Technical Summary
The prior art has shortcomings in rapid detection, accuracy and equipment portability in the detection of pesticide residues on vegetable surfaces, which is difficult to meet the needs of modern agriculture for rapid and timely monitoring.
Hyperspectral imaging technology is used to collect hyperspectral images and illumination intensity data of vegetable leaves, and the pesticide residue index is generated through the spectral data processing algorithm to achieve a rapid evaluation of the pesticide residue level on the vegetable surface.
It realizes efficient and accurate detection of pesticide residues on the surface of vegetables, can quickly cover large areas of samples, provide immediate pesticide residue level assessment, improves the supervision ability of pesticide use, and ensures food safety.
Smart Images

Figure CN119666765A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vegetable surface pesticide residue level detection based on hyperspectral imaging, and in particular to a vegetable surface pesticide residue level detection method and device based on hyperspectral imaging. Background Art
[0002] With the continuous development of agricultural production, the use of pesticides has increased year by year, which has played a positive role in increasing crop yields and protecting crop health. However, the problem of pesticide residues has also attracted widespread attention, especially in the fields of food safety and environmental protection. Traditional monitoring methods often rely on laboratory testing, which is not only time-consuming and costly, but also difficult to achieve real-time monitoring. This has led to the continuous monitoring of pesticide residue concentrations becoming a technical challenge, and there is an urgent need to develop more efficient and accurate detection methods.
[0003] Hyperspectral imaging technology is an advanced remote sensing technology that can collect spectral information of objects in multiple wavelength ranges and provide rich spectral features. This technology is usually composed of a light source, a spectral detector and an imaging system. By analyzing the reflected spectrum, the composition and state of the object can be identified. In the field of agriculture, hyperspectral imaging is widely used in crop monitoring, pest and disease detection and soil analysis, especially in the detection of pesticide residues on the surface of vegetables, which has important application value. By analyzing hyperspectral images, the concentration of pesticide residues on the surface of vegetables can be evaluated non-contactly, so as to quickly judge their safety. The detection of pesticide residue levels on the surface of vegetables is an important part of ensuring food safety. It is not only related to the health of consumers, but also directly affects the sustainable development of the agricultural industry. Effective monitoring and evaluation of pesticide residue concentrations can not only help farmers use pesticides reasonably and reduce excessive application, but also enhance market competitiveness and consumer trust.
[0004] At present, the detection of pesticide residues on the surface of vegetables mainly relies on chemical analysis and instrumental analysis, such as gas chromatography-mass spectrometry (GC-MS) and liquid chromatography-mass spectrometry (LC-MS). Although these methods have high sensitivity and accuracy, they have disadvantages such as expensive equipment, complex detection process, and long time consumption, which cannot meet the needs of rapid detection. In addition, conventional laboratory testing is usually carried out after the product enters the market, which may lead to the influx of unqualified products and increase food safety risks.
[0005] Although existing technologies have made some progress in pesticide residue detection, they still have obvious shortcomings in terms of rapid detection, accuracy, and equipment portability. The detection process of traditional methods is cumbersome and time-consuming, which is difficult to meet the needs of modern agriculture for rapid and timely monitoring. Secondly, due to human errors in sample processing and analysis, the accuracy of the results may be affected. In addition, existing technologies are usually unable to provide detailed analysis of different areas on the surface of vegetables, affecting the comprehensive understanding of the spatial distribution of pesticide residues.
[0006] The present invention overcomes the shortcomings of traditional methods through hyperspectral imaging technology. Its non-contact characteristics make it possible to quickly cover large areas of samples and achieve immediate pesticide residue level assessment through real-time data analysis. In addition, the use of advanced spectral data processing algorithms can accurately identify different pesticide components and their concentrations, providing more accurate and scientific assessment results. This efficient and accurate detection method can effectively improve the regulatory capabilities of pesticide use, ensure food safety, and promote the sustainable development of agriculture.
[0007] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0008] The purpose of the present invention is to provide a method and device for detecting the level of pesticide residues on vegetable surfaces based on hyperspectral imaging, so as to solve the problems raised in the above-mentioned background technology.
[0009] To achieve the above object, the present invention provides the following technical solutions:
[0010] The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging includes the following specific steps:
[0011] Step 1: Collect the hyperspectral image of the vegetable leaves to be monitored and the light intensity data of the leaf surface to obtain a hyperspectral data cube, obtain the spectral intensity curve of each pixel in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data of the leaf surface;
[0012] Step 2: Process the calibrated spectral intensity curve of each pixel point to obtain the average intensity data of each pixel point in different bands to form a feature data set for each pixel point;
[0013] Step 3: Generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue index of all pixels points and classify them into grades, calculate the average of each grade to generate the comprehensive grade evaluation coefficient;
[0014] Step 4: Compare the obtained comprehensive grade evaluation coefficient with the set pesticide residue level to determine the pesticide residue level on the vegetable surface.
[0015] Furthermore, the wavelength range of the hyperspectral image is 400-1000 nanometers, and the hyperspectral data cube includes the position of each pixel point and the spectral intensity curve of each pixel point in the wavelength range of 400-1000 nanometers, that is, the spectral data cube is H(i,j,I (i,j) (λ)), where i is the row index, representing the vertical coordinate of the pixel, j is the column index, representing the horizontal coordinate of the pixel, and I (i,j) (λ) represents the spectral intensity curve of pixel (i, j), λ represents the wavelength, and λ∈[400,1000];
[0016] The light intensity data on the leaf surface includes the reflected light intensity I at the pixel position (i, j) re (i, j) and the incident light intensity I in , measure the light intensity I on the leaf surface in , record the reflected light intensity I at each pixel position (i, j) re (i,j), and calculate the reflectivity R(i,j) using the following formula:
[0017]
[0018] Among them, I re (i, j) represents the reflected light intensity at the pixel point (i, j), I in is the incident light intensity, which indicates the light intensity irradiating the sample surface, R(i,j) is the reflectivity at the pixel point (i,j), which indicates the ratio of the light reflected by the pixel point to the incident light;
[0019] The absorbance A(i,j) refers to the ratio of the light intensity absorbed by the plant leaves to the incident light intensity. When the transmitted light is ignored, the absorbance is calculated by the following formula:
[0020] A(i,j)=1-R(i,j)
[0021] Among them, A(i,j) is the absorptivity at the pixel point (i,j), which indicates the absorption capacity of the pixel point to the incident light;
[0022] According to the light intensity data on the leaf surface, the spectral intensity curve I (i,j) (λ) is calibrated to obtain the calibrated spectral intensity curve I′ (i,j) (λ):
[0023] I′ (i,j) (λ)=I (i,j) (λ)×R(i,j)+A(i,j)×Iin
[0024] Among them, I (i,j) (λ)×R(i,j) represents the spectral intensity part reflected by the leaf, A(i,j) represents the light intensity part absorbed by the leaf, A(i,j)×I in The intensity of the absorbed light is considered to be a fraction of the incident light intensity.
[0025] Furthermore, the intensity data of each pixel in different bands is obtained. The band ranges include: [400nm, 600nm), [600nm, 800nm) and [800nm, 1000nm]. For each pixel (i, j), the average spectral intensity data in different bands is obtained. When the band range is [400nm, 600nm), the average intensity data is:
[0026]
[0027] Among them, I avg1 (i, j) represents the average intensity in the band [400nm, 600nm); from this formula, the average light intensity I in the band [600nm, 800nm) can be calculated avg2 (i, j) and the average light intensity I in the band [800nn, 1000nm] avg3 (i,j);
[0028] By combining the average light intensity of each pixel with the reflectivity and absorptivity features, a feature data set D(i,j) of each pixel (i,j) is formed, which is expressed as:
[0029] D(i,j)={I avg1 (i,j),I avg2 (i,j),I avg3 (i,j)}
[0030] Among them, I avg1 (i,j),I avg2 (i,j),I avg3 (i, j) represent the spectral average intensity data at the bands [400nm, 600nm), [600nm, 800nm) and [800nm, 1000nm] respectively.
[0031] Furthermore, the pesticide residue index P(i,j) of each pixel is generated based on the feature data set, which can be defined as:
[0032]
[0033] Among them, P(i,j) is the pesticide residue index, which reflects the pesticide residue concentration in each pixel (i,j), ∈ is a stable constant, and 0<∈<1;
[0034] The image size is calibrated as M×N, where M represents the number of rows and N represents the number of columns. Therefore, the set of P(i,j) is: P = {P(i,j)|i = 1, 2, ..., M; j = 1, 2, ..., N};
[0035] Calculate the mean and standard deviation of the pesticide residue index P for all pixels:
[0036]
[0037] Among them, μ P The average value of the pesticide residue index of all pixels represents the central trend of the overall pesticide residue, σ P is the standard deviation of the pesticide residue index, reflecting the degree of dispersion of pesticide residues;
[0038] According to the index value, the pesticide residue index P(i,j) is divided into several levels:
[0039] High concentration: P(i,j)>μ P +2·σ P , the concentration of pesticide residues in pixels within this range is higher than the average level;
[0040] Medium concentration: μ P -2·σ P <P(i,j)≤μ P +2·σ P , the concentration of pesticide residues in pixels within this range is close to the average level;
[0041] Low concentration: P(i,j)≤μ P -2·σ P , the concentration of pesticide residues in pixels within this range is lower than the average level.
[0042] Furthermore, after dividing the concentration levels, the average value of each level is calculated, and the average value of the high concentration level is:
[0043]
[0044] Among them, N high Indicates the number of pixels with high concentration level;
[0045] Average values for medium concentration levels:
[0046]
[0047] Among them, N medium The number of pixels representing the medium concentration level;
[0048] Average value of the low concentration level:
[0049]
[0050] Where N low represents the number of pixel points of the low concentration level;
[0051] Finally, a comprehensive grade evaluation coefficient C is generated:
[0052]
[0053] Where μ high is the average pesticide residue index of the high concentration level, reflecting the highest risk of pesticide residue, and μ medium is the average pesticide residue index of the medium concentration level, with a moderate risk, and μ low is the average pesticide residue index of the low concentration level, with a relatively low risk;
[0054] In the numerator part of this formula, the high concentration has the greatest impact, followed by the medium concentration, and the low concentration has a smaller impact. This combination emphasizes the risk of high concentration and moderately considers the impacts of medium and low concentrations; in the denominator part, by taking the sum of the overall pesticide residues (i.e., the sum of the average values of all levels plus 1) as the base number, it prevents C from being overly dependent on the high concentration and ensures its value is within a reasonable range;
[0055] The value range of C is between [0, 1]. When C is close to 1, it indicates a relatively high overall pesticide residue level and a relatively high safety risk. When C is close to 0, it indicates a relatively low overall pesticide residue level and relatively high safety.
[0056] Furthermore, define the safety standard grades of pesticide residues. The set pesticide residue grades are as follows, and the following mathematical formula is used to judge the pesticide residue grade on the vegetable surface:
[0057]
[0058] Safe (safety grade); when C ≤ 0.3, it indicates that the pesticide residue concentration is within the safe range;
[0059] Warning (warning grade): when 0.3 < C ≤ 0.6, it indicates that the pesticide residue concentration is close to the safety limit;
[0060] Danger (danger grade): when C > 0.6, it indicates that the pesticide residue concentration exceeds the safety limit and poses a threat to health;
[0061] Among them, Level represents the safety level of pesticide residues on the surface of vegetables, and the thresholds of 0.3 and 0.6 are based on the boundaries set by safety standards and are used to divide different safety levels.
[0062] The present invention further provides a device for detecting the level of pesticide residues on vegetable surfaces based on hyperspectral imaging, the device being used to perform the above-mentioned method for detecting the level of pesticide residues on vegetable surfaces based on hyperspectral imaging, comprising:
[0063] The data acquisition module is used to collect the hyperspectral images of the vegetable leaves to be monitored and the light intensity data of the leaf surfaces, obtain the hyperspectral data cube, obtain the spectral intensity curve of each pixel point in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data of the leaf surfaces;
[0064] A data processing module is used to process the calibrated spectral intensity curve of each pixel point, obtain the average intensity data of each pixel point in different bands, and form a feature data set of each pixel point;
[0065] The grade calculation module is used to generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue index of all pixels points and classify them into grades, and calculate the average of each grade to generate a comprehensive grade evaluation coefficient;
[0066] The result judgment module is used to compare the obtained comprehensive grade evaluation coefficient with the set pesticide residue grade to judge the pesticide residue grade on the vegetable surface.
[0067] Compared with the prior art, the present invention has the following beneficial effects:
[0068] The present invention introduces hyperspectral imaging technology and systematic data processing methods to address the shortcomings of traditional pesticide residue detection methods and provides an efficient and accurate detection solution for pesticide residue levels on vegetable surfaces. Specifically, the technical features of the present invention effectively solve several major problems faced by the prior art:
[0069] The present invention forms a hyperspectral data cube by collecting hyperspectral images and light intensity of the vegetable leaves to be monitored, which can capture subtle spectral changes on the surface of vegetables. This process ensures full coverage of each pixel point of the leaves and avoids the result deviation caused by insufficient sampling in traditional methods. Through comprehensive data collection, the pesticide residues in different areas of the vegetable surface can be efficiently identified, which solves the limitation of traditional methods that can only detect local samples and improves the representativeness and reliability of monitoring.
[0070] The present invention processes the spectral intensity curve of each pixel point, extracts intensity data under different bands, and constitutes a feature data set. This process can accurately reflect the spectral characteristics of pesticide components through the extraction of spectral features, greatly enhancing the recognition rate of pesticide residue components. This solves the problem of decreased accuracy caused by complex sample processing and analysis processes in the prior art. Through this method, effective distinction between different types of pesticides can be achieved, thereby providing a more solid data foundation for subsequent evaluation.
[0071] The present invention generates the pesticide residue index of each pixel point according to the characteristic data set, and performs statistics and classification on the pesticide residue index of all pixel points, and then calculates the comprehensive grade evaluation coefficient. This step utilizes the comprehensiveness of hyperspectral data, ensures a comprehensive evaluation of the pesticide residue situation of each pixel point, solves the one-sidedness of the results caused by incomplete sample selection and analysis in the prior art, and can quantitatively describe the overall situation of pesticide residues through statistical analysis, thereby improving the accuracy and scientificity of the evaluation.
[0072] The obtained comprehensive grade evaluation coefficient is compared with the set pesticide residue level to determine the pesticide residue level on the vegetable surface. This process realizes the instant evaluation of pesticide residues, provides actionable monitoring results, and solves the delayed feedback problem caused by the long laboratory testing cycle of traditional methods. Through real-time evaluation results, agricultural producers and consumers can quickly obtain safety information on pesticide residues, so as to take corresponding measures to reduce health risks.
[0073] In summary, the present invention effectively solves the many shortcomings of traditional pesticide residue detection methods in terms of detection efficiency, accuracy and ease of operation through the integration of hyperspectral imaging and data processing technology. It not only improves the timeliness and accuracy of detection, but also provides a new technical means for agricultural safety supervision and promotes the sustainable development of agriculture. In addition, the implementation of this technology will help to establish a more transparent and reliable agricultural product safety monitoring system, providing strong support for ensuring consumers' food safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a schematic diagram of the overall method flow of the present invention;
[0075] Figure 2 It is a schematic diagram of the overall structure of the device of the present invention. DETAILED DESCRIPTION
[0076] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0077] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0078] Example:
[0079] Please refer to the attached Figure 1 , the present invention provides a technical solution:
[0080] The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging includes the following specific steps:
[0081] Step 1: Collect the hyperspectral image of the vegetable leaves to be monitored and the light intensity data of the leaf surface to obtain a hyperspectral data cube, obtain the spectral intensity curve of each pixel in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data of the leaf surface;
[0082] The wavelength range of the hyperspectral image is 400-1000 nanometers, and the hyperspectral data cube includes the position of each pixel point and the spectral intensity curve of each pixel point in the wavelength range of 400-1000 nanometers, that is, the spectral data cube is H(i,j,I (i,j) (λ)), where i is the row index, representing the vertical coordinate of the pixel, j is the column index, representing the horizontal coordinate of the pixel, and I (i,j) (λ) represents the spectral intensity curve of pixel (i, j), λ represents the wavelength, and λ∈[400,1000];
[0083] In a hyperspectral image, the position of a pixel is determined by the row index i and the column index j. Each pixel represents a small area in the image. The specific explanation is as follows: The row index i refers to the position of the pixel in the vertical direction of the image, usually numbered from top to bottom. In a hyperspectral image, the change in the value of i represents a different vertical position in the image. For example, i = 1 may correspond to the first row of the image, i = 2 corresponds to the second row, and so on;
[0084] The column index j refers to the horizontal position of the pixel in the image, usually numbered from left to right. In a hyperspectral image, changes in the value of j represent different lateral positions in the image. For example, j = 1 may correspond to the first column of the image, j = 2 corresponds to the second column, and so on.
[0085] The light intensity data on the leaf surface includes the reflected light intensity I at the pixel position (i, j) re (i, j) and the incident light intensity I in , measure the light intensity I on the leaf surface in , record the reflected light intensity I at each pixel position (i, j) re (i,j), and calculate the reflectivity R(i,j) using the following formula:
[0086]
[0087] Among them, I re (i, j) represents the reflected light intensity at the pixel point (i, j), I in is the incident light intensity, which indicates the light intensity irradiating the sample surface; R(i,j) is the reflectivity at the pixel point (i,j), which indicates the ratio of the light reflected by the pixel point to the incident light, reflecting the reflectivity of the pixel point to the incident light;
[0088] A high reflectivity means that the leaf surface in this area is relatively smooth or healthy, which may reflect the growth status of the plant. The larger the value of R(i,j), the more light is reflected, which means that the absorption rate of the corresponding band is lower. If the intensity of reflected light increases, the reflectivity R(i,j) increases, which means that the reflectivity of the area to the incident light is improved. If the intensity of incident light increases and the intensity of reflected light remains unchanged, the reflectivity may decrease. However, under normal circumstances, the change of incident light intensity has little effect on the reflectivity.
[0089] The absorbance A(i,j) refers to the ratio of the light intensity absorbed by the plant leaves to the incident light intensity. When the transmitted light is ignored, the absorbance is calculated by the following formula:
[0090] A(i,j)=1-R(i,j)
[0091] Among them, A(i,j) is the absorption rate at the pixel point (i,j), which means the ratio of the light intensity absorbed by the plant leaves at the pixel point (i,j) to the incident light intensity, reflecting the ability of the leaves to absorb light energy;
[0092] The level of absorptivity is directly related to the photosynthesis efficiency of the plant. A higher absorptivity may mean that the plant can effectively utilize light energy. The larger the value of A(i,j), the stronger the light energy absorbed, which means the greater the photosynthesis potential of the plant. When the reflectivity increases, the absorptivity A(i,j) will decrease, which means that the more light is reflected, the less light is absorbed. When the reflectivity R(i,j) decreases, the absorptivity A(i,j) increases, indicating that the plant may absorb more light energy.
[0093] According to the light intensity data on the leaf surface, the spectral intensity curve I (i,j) (λ) is calibrated to obtain the calibrated spectral intensity curve I′ (i,j) (λ):
[0094] I′ (i,j) (λ)=I (i,j) (λ)×R(i,j)+A(i,j)×I in
[0095] Among them, I (i,j) (λ)×R(i,j) represents the spectral intensity part reflected by the leaf, A(i,j) represents the light intensity part absorbed by the leaf, A(i,j)×I in The absorbed light intensity is considered to be a fraction of the incident light intensity, I′ (i,j) (λ) represents the calibrated spectral intensity curve, taking into account the effects of reflection and absorption, I (i,j) (λ) represents the original spectral intensity curve;
[0096] The higher the calibrated spectrum intensity is, the stronger the effective reflected and absorbed light intensity is in that area, which may indicate that the plant is in good health and has a strong photosynthesis capacity. The original spectrum intensity I (i,j) (λ) increases, the spectral intensity I′ after calibration (i,j) As the (λ) basis increases, R(i,j) increases, and the reflection part increases, resulting in a corresponding increase in the calibrated spectral intensity. As A(i,j) increases, the absorption part increases, further enhancing the calibrated spectral intensity.
[0097] Step 2: Process the calibrated spectral intensity curve of each pixel point to obtain the average intensity data of each pixel point in different bands to form a feature data set for each pixel point;
[0098] Get the intensity data of each pixel in different bands. The bands include: [400nm, 600nm), [600nm, 800nm) and [800nm, 1000nm]. For each pixel (i, j), get the average spectral intensity data in different bands. When the band is [400nm, 600nm), the average intensity data is:
[0099]
[0100] Among them, I avg1 (i, j) represents the average intensity of the wavelength band from 400 to 600 nanometers at the pixel point (i, j), and the wavelength range is λ = 400, 401, ..., 600; this formula can be used to calculate the average light intensity I in the wavelength band from 600 to 800 nanometers avg2 (i, j) and the average light intensity I in the band from 800 to 1000 nm avg3 (i,j);
[0101] I avg (i, j) is the average light intensity, which reflects the distribution of light intensity in this band. This value can reflect the reflectance characteristics of plants in different light bands. The light intensity in different bands can be used to analyze the health status, photosynthesis capacity and response of plants to environmental conditions. avg A larger (i, j) value indicates that more light in this band is reflected, which may be related to the physiological state (such as water and nutritional status) or spectral characteristics (such as color and leaf structure) of the plant. Generally speaking, a band with high reflectivity indicates that the plant has weak absorption capacity, and vice versa;
[0102] I avg1 (i,j),I avg2 (i,j),I avg3 (i, j) respectively reflect the average value of spectral intensity in different bands, which is an important indicator to characterize the reflectance characteristics of plant leaves in different spectral ranges. These average light intensity values can be used to evaluate the health status, photosynthesis potential and reflection and absorption capacity of plants;
[0103] By combining the average light intensity of each pixel with the reflectivity and absorptivity features, a feature data set D(i,j) of each pixel (i,j) is formed, which is expressed as:
[0104] D(i,j)={I avg1 (i,j),I avg2 (i,j),I avg3 (i,j)}
[0105] Among them, I avg1 (i,j),I avg2 (i,j),I avg3 (i, j) represent the average spectral intensity data at [400nm, 600nm], [600nm, 800nm) and [800nm, 1000nm], respectively, which reflect the spectral characteristics of plants in different bands and can indicate the health status and growth environment of plants;
[0106] The feature data set D(i,j) contains the important spectral features of each pixel (i,j), including the average light intensity of the three bands. These features can provide comprehensive information for subsequent analysis and processing; the average light intensity of each band I avg The larger the value, the stronger the reflectivity of light in this band, which may indicate the physiological status of the plant or its response to the environment;
[0107] The average light intensity of each band I avg There is also a correlation between reflectance R and absorptivity A. High reflectance means low absorptivity, and vice versa. There is a certain relationship between the various characteristics. For example, when R(i,j) increases, A(i,j) will decrease accordingly (because A(i,j) = 1-R(i,j)), which reflects the mutual constraints between plant reflection and absorption under spectra of different wavelengths.
[0108] Step 3: Generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue index of all pixels points and classify them into grades, calculate the average of each grade to generate the comprehensive grade evaluation coefficient;
[0109] The pesticide residue index P(i,j) for each pixel is generated based on the feature data set and can be defined as:
[0110]
[0111] Among them, P(i,j) is the pesticide residue index, which reflects the pesticide residue concentration in each pixel (i,j), and ∈ is a small constant (1×10 -6 ), used to avoid the situation where the denominator is zero and ensure the numerical stability of the formula;
[0112] The first two terms in the formula and Reflects the effect of reflectivity on light intensity in different bands. These light intensities may be related to the concentration of pesticide residues. The third The importance of absorption characteristics in pesticide residue detection is reflected, and it is emphasized how the absorbance will be affected if the plant spectral characteristics are affected by pesticides;
[0113] When R(i,j) increases, the reflectivity increases, which usually means that the possibility of pesticide residues also increases, so the P(i,j) value may increase; when A(i,j) increases, the ability to absorb light increases, which means that pesticide residues may be absorbed in the plant body, resulting in a possible increase in the P(i,j) value;
[0114] The pesticide residue index P(i,j) is used to quantify the pesticide residue concentration in each pixel (i,j). This index comprehensively considers the average light intensity, reflectivity and absorptivity in different bands, and reflects the sensitivity of each pixel to pesticide residues. This value can indicate the pesticide residue status of each pixel. The higher the value, the higher the pesticide residue concentration in the area, and the greater the potential risk to plants and the environment. If the P(i,j) value is large, it means that the pixel area may be affected by higher concentrations of pesticides, which may hinder plant growth or pose a threat to human health.
[0115] The image size is calibrated as M×N, where M represents the number of rows and N represents the number of columns. Therefore, the set of P(i,j) is: P = {P(i,j)|i = 1, 2, ..., M; j = 1, 2, ..., N};
[0116] Calculate the mean and standard deviation of the pesticide residue index of all pixels, the mean value μ P It is defined as the sum of the pesticide residue index of all pixels divided by the number of pixels:
[0117]
[0118] The standard deviation measures the degree of dispersion of the pesticide residue index. The calculation steps of the standard deviation are as follows:
[0119] Calculate the difference between each pixel and the mean:
[0120] d i,j =P(i,j)-μ P
[0121] Compute the square of each difference:
[0122]
[0123] Compute the sum of all squared differences:
[0124]
[0125] Calculate the standard deviation:
[0126]
[0127] Among them, μ P It is the average value of the pesticide residue index of all pixels, representing the central trend of the overall pesticide residue and indicating the level of overall pesticide residue. P is the standard deviation of the pesticide residue index, which reflects the degree of dispersion of pesticide residues and indicates the degree of variation of pesticide residue concentrations in different regions;
[0128] The higher the mean value, the higher the overall pesticide residue level, which may mean that the sample area is more affected; the larger the standard deviation, the more dispersed the distribution of pesticide residues, and there may be coexistence of high-concentration and low-concentration areas;
[0129] When μ P When σ is higher, it indicates that the overall pesticide residue risk is higher; when σ P When it is larger, it indicates that there is a large heterogeneity and further attention may be needed to the pesticide residue situation in a specific area;
[0130] According to the index value, the pesticide residue index P(i,j) is divided into several levels:
[0131] High concentration: P(i,j)>μ P +2·σ P , the concentration of pesticide residues in pixels within this range is higher than the average level;
[0132] Medium concentration: μ P -2·σ P <P(i,j)≤μ P +2·σ P , the concentration of pesticide residues in pixels within this range is close to the average level;
[0133] Low concentration: P(i,j)≤μ P -2·σ P , the concentration of pesticide residues in pixels within this range is lower than the average level;
[0134] This part is used to classify the pesticide residue index P(i,j) into high, medium and low concentration levels in order to better understand and manage the pesticide residue risk. By comparing with the mean value and standard deviation, the pesticide residue concentration level of each pixel can be determined, and corresponding management measures can be taken according to different concentration levels;
[0135] After dividing the concentration levels, calculate the average value of each level, the average value of the high concentration level:
[0136]
[0137] Among them, N high Indicates the number of pixels with high concentration level;
[0138] Average values for medium concentration levels:
[0139]
[0140] Among them, N medium The number of pixels representing the medium concentration level;
[0141] Average values for low concentration levels:
[0142]
[0143] Among them, N low The number of pixels representing low concentration levels;
[0144] Calculate the average pesticide residue index for each concentration level to better understand the characteristics of pesticide residues in different concentration ranges. A higher average concentration level means that the risk in the area is greater and priority measures need to be taken;
[0145] Finally, a comprehensive grade evaluation coefficient C is generated:
[0146]
[0147] Among them, μ high is the average pesticide residue index at high concentration levels, reflecting the highest risk of pesticide residues, μ medium is the average pesticide residue index at the medium concentration level, with moderate risk, μ low It is the average pesticide residue index at low concentration levels, and the risk is relatively low;
[0148] The comprehensive rating evaluation coefficient C is a comprehensive indicator used to quantify the overall pesticide residue risk. It considers the impact of high, medium and low concentrations in a weighted manner, emphasizes the risk of high concentrations, and reflects the overall pesticide residue level in the sample area;
[0149] In the numerator of the formula, high concentration has the greatest impact, followed by medium concentration, and low concentration has a smaller impact. This combination emphasizes the risk of high concentration and moderately considers the impact of medium and low concentrations. In the denominator, by taking the sum of the overall pesticide residues (i.e. the sum of the average values of all levels plus 1) as the base, C is prevented from being too dependent on high concentrations and its value is ensured to be within a reasonable range.
[0150] The value range of C is between [0,1]. When C is close to 1, it means that the overall pesticide residue level is high and there is a greater safety risk. When C is close to 0, it means that the overall pesticide residue level is low and relatively safe.
[0151] Suppose we calculate the following values:
[0152] μ high =0.8,μ medium =0.5, μ low =0.2;
[0153] Therefore, the calculation of the comprehensive grade evaluation coefficient is:
[0154]
[0155] This formula more effectively evaluates potential risks by increasing the impact of high concentrations (weight = 1) and decreasing the impacts of medium and low concentrations (weights = 0.5 and 0.2 respectively). The design of the denominator part (plus 1) ensures that the value is within a reasonable range, preventing C from overly relying on the impact of high concentrations.
[0156] Step 4: Compare the obtained comprehensive rating coefficient with the set pesticide residue level to determine the pesticide residue level on the vegetable surface;
[0157] Define the safety standard levels of pesticide residues. The set pesticide residue levels are the following levels, and the pesticide residue level on the vegetable surface is determined by the following mathematical formula:
[0158]
[0159] Safe (safety level); when C ≤ 0.3, it means that the pesticide residue concentration is within the safe range, usually indicating that the vegetable can be safely consumed with a low health risk;
[0160] Warning (warning level): when 0.3 < C ≤ 0.6, it means that the pesticide residue concentration is close to the safety limit, and consumers should be vigilant, consume moderately or strengthen cooking treatment;
[0161] Danger (danger level): when C > 0.6, it means that the pesticide residue concentration exceeds the safety limit, which may pose a threat to health. It is recommended to avoid consumption or take measures to reduce the risk;
[0162] Among them, Level represents the safety level of pesticide residues on the vegetable surface. The thresholds 0.3 and 0.6 are the boundaries set based on safety standards and are used to divide different safety levels;
[0163] This formula is used to determine the safety level of pesticide residues on the vegetable surface. It is classified according to the value of the comprehensive rating coefficient C. Through the set thresholds, the potential risks of pesticide residues can be effectively evaluated, thus providing a safety reference for consumers;
[0164] Level represents the safety level of pesticide residues on the vegetable surface. Its value can be Safe (safety), Warning (warning), or Danger (danger). These levels reflect the potential impact of pesticide residues on consumers' health;
[0165] The larger the value of C, the higher the overall pesticide residue level and the随之 increased potential health risk. Therefore, the above classification of safety levels is linear and is directly proportional to the value of C;
[0166] When the actual concentration of pesticide residues increases (for example, more pesticides are applied or used improperly), the value of P(i,j) will increase, resulting in an increase in the comprehensive grade evaluation coefficient C; the increase in C directly leads to a change in the safety level: that is, with other conditions remaining unchanged, as the pesticide residues increase, the larger the value of C, the more likely the judged safety level will change from Safe to Warning, and finally to Danger.
[0167] Please refer to the attached Figure 2 The present invention also provides a device for detecting the level of pesticide residues on vegetable surfaces based on hyperspectral imaging, the device being used to perform the above-mentioned method for detecting the level of pesticide residues on vegetable surfaces based on hyperspectral imaging, comprising:
[0168] The data acquisition module is used to collect the hyperspectral images of the vegetable leaves to be monitored and the light intensity data of the leaf surfaces, obtain the hyperspectral data cube, obtain the spectral intensity curve of each pixel point in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data of the leaf surfaces;
[0169] A data processing module is used to process the calibrated spectral intensity curve of each pixel point, obtain the average intensity data of each pixel point in different bands, and form a feature data set of each pixel point;
[0170] The grade calculation module is used to generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue index of all pixels points and classify them into grades, and calculate the average of each grade to generate a comprehensive grade evaluation coefficient;
[0171] The result judgment module is used to compare the obtained comprehensive grade evaluation coefficient with the set pesticide residue grade to judge the pesticide residue grade on the vegetable surface.
[0172] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0173] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0175] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging, characterized in that: The specific steps include: Step 1: Collect the hyperspectral image of the vegetable leaves to be monitored and the light intensity data of the leaf surface to obtain a hyperspectral data cube, obtain the spectral intensity curve of each pixel in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data of the leaf surface; Step 2: Process the calibrated spectral intensity curve of each pixel point to obtain the average intensity data of each pixel point in different bands to form a feature data set for each pixel point; Step 3: Generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue index of all pixels points and classify them into grades, calculate the average of each grade to generate the comprehensive grade evaluation coefficient; Step 4: Compare the obtained comprehensive grade evaluation coefficient with the set pesticide residue level to determine the pesticide residue level on the vegetable surface.
2. The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging according to claim 1, characterized in that: The wavelength range of the hyperspectral image is 400-1000 nanometers, and the hyperspectral data cube includes the position of each pixel point and the spectral intensity curve of each pixel point in the wavelength range of 400-1000 nanometers, that is, the spectral data cube is H(i,j,I (i,j) (λ)), where i is the row index, representing the vertical coordinate of the pixel, j is the column index, representing the horizontal coordinate of the pixel, and I (i,j) (λ) represents the spectral intensity curve of pixel (i, j), λ represents the wavelength, and λ∈[400,1000]; The light intensity data on the leaf surface includes the reflected light intensity I at the pixel position (i, j) re (i, j) and the incident light intensity I in , measure the light intensity I on the leaf surface in , record the reflected light intensity I at each pixel position (i, j) re (i,j), and calculate the reflectivity R(i,j) using the following formula: Among them, I re (i, j) represents the reflected light intensity at the pixel point (i, j), I in is the incident light intensity, which indicates the light intensity irradiating the sample surface, R(i,j) is the reflectivity at the pixel point (i,j), which indicates the ratio of the light reflected by the pixel point to the incident light; The absorbance A(i,j) refers to the ratio of the light intensity absorbed by the plant leaves to the incident light intensity. When the transmitted light is ignored, the absorbance is calculated by the following formula: A(i,j)=1-R(i,j) Among them, A(i,j) is the absorptivity at the pixel point (i,j), which indicates the absorption capacity of the pixel point to the incident light; According to the light intensity data on the leaf surface, the spectral intensity curve I (i,j) (λ) is calibrated to obtain the calibrated spectral intensity curve I′ (i,j) (λ): I′ (i,j) (λ)=I (i,j) (λ)×R(i,j)+A(i,j)×I in Among them, I (i,j) (λ)×R(i,j) represents the spectral intensity part reflected by the leaf, A(i,j) represents the light intensity part absorbed by the leaf, A(i,j)×I in The intensity of the absorbed light is considered to be a fraction of the incident light intensity.
3. The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging according to claim 2, characterized in that: Get the intensity data of each pixel in different bands. The bands include: [400nm, 600nm), [600nm, 800nm) and [800nm, 1000nm]. For each pixel (i, j), get the average spectral intensity data in different bands. When the band is [400nm, 600nm), the average intensity data is: Among them, I avg1 (i, j) represents the average intensity in the band [400nm, 600nm); from this formula, the average light intensity I in the band [600nm, 800nm) can be calculated avg2 (i, j) and the average light intensity I in the band [800nm, 1000nm] avg3 (i,j); By combining the average light intensity of each pixel with the reflectivity and absorptivity features, a feature data set D(i,j) of each pixel (i,j) is formed, which is expressed as: D(i,j)={I avg1 (i,j),I avg2 (i,j),I avg3 (i,j)} Among them, I avg1 (i,j),I avg2 (i,j),I avg3 (i, j) represent the spectral average intensity data at the bands [400nm, 600nm), [600nm, 800nm) and [800nm, 1000nm] respectively.
4. The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging according to claim 3 is characterized in that: The pesticide residue index P(i,j) for each pixel is generated based on the feature data set and can be defined as: Among them, P(i,j) is the pesticide residue index, which reflects the pesticide residue concentration in each pixel (i,j), ∈ is a stable constant, and 0<∈<1; The image size is calibrated as M×N, where M represents the number of rows and n represents the number of columns. Therefore, the set of P(i,j) is: P = {P(i,j)|i = 1, 2, ..., M; j = 1, 2, ..., N}; Calculate the mean and standard deviation of the pesticide residue index P for all pixels: Among them, μ P The average value of the pesticide residue index of all pixels represents the central trend of the overall pesticide residue, σ P is the standard deviation of the pesticide residue index, reflecting the degree of dispersion of pesticide residues; According to the index value, the pesticide residue index P(i,j) is divided into several levels: High concentration: P(i,j)>μ P +2·σ P , the concentration of pesticide residues in pixels within this range is higher than the average level; Medium concentration: μ P -2·σ P <P(i,j)≤μ P +2·σ P , the concentration of pesticide residues in pixels within this range is close to the average level; Low concentration: P(i,j)≤μ P -2·σ P , the concentration of pesticide residues in pixels within this range is lower than the average level.
5. The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging according to claim 4 is characterized in that: After dividing the concentration levels, calculate the average value of each level, the average value of the high concentration level: Among them, N high Indicates the number of pixels with high concentration level; Average values for medium concentration levels: Among them, N medium The number of pixels representing the medium concentration level; Average values for low concentration levels: Among them, N low The number of pixels representing low concentration levels; Finally, a comprehensive grade evaluation coefficient C is generated: Among them, μ high is the average pesticide residue index at high concentration levels, reflecting the highest risk of pesticide residues, μ medium is the average pesticide residue index at the medium concentration level, with moderate risk, μ low It is the average pesticide residue index at low concentration levels, and the risk is relatively low; In the numerator of the formula, high concentration has the greatest impact, followed by medium concentration, and low concentration has a smaller impact. This combination emphasizes the risk of high concentration and moderately considers the impact of medium and low concentrations. In the denominator, by taking the sum of the overall pesticide residues (i.e. the sum of the average values of all levels plus 1) as the base, C is prevented from being too dependent on high concentrations and its value is ensured to be within a reasonable range. The value range of C is between [0, 1]. When C is close to 1, it indicates a relatively high overall pesticide residue level and a relatively high safety risk. When C is close to 0, it indicates a relatively low overall pesticide residue level and relatively high safety.
6. The method for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging according to claim 5, characterized in that: In step 4, define the safety standard levels of pesticide residues. The set pesticide residue levels are as follows, and the following mathematical formula is used to determine the pesticide residue level on the vegetable surface: Safe (safety level); when C ≤ 0.3, it indicates that the pesticide residue concentration is within the safe range; Warning (warning level): when 0.3 < C ≤ 0.6, it indicates that the pesticide residue concentration is close to the safety limit; Danger (danger level): when C > 0.6, it indicates that the pesticide residue concentration exceeds the safety limit and poses a threat to health; Among them, Level represents the safety level describing the pesticide residues on the vegetable surface. The thresholds 0.3 and 0.6 are the boundaries set based on the safety standards and are used to divide different safety levels.
7. A device for detecting pesticide residue levels on vegetable surfaces based on hyperspectral imaging, characterized in that: The device is used to execute a method for detecting the pesticide residue level on the vegetable surface based on hyperspectral imaging according to any one of claims 1-6, and includes: A data acquisition module, which is used to collect the hyperspectral image of the vegetable leaf to be monitored and the light intensity data on the leaf surface, obtain a hyperspectral data cube, obtain the spectral intensity curve of each pixel point in the leaf through the hyperspectral data cube, and calibrate the spectral intensity curve according to the light intensity data on the leaf surface; A data processing module, which is used to process the calibrated spectral intensity curve of each pixel point, obtain the average intensity data of each pixel point in different wavelength bands, and form a feature data set for each pixel point; A level calculation module, which is used to generate the pesticide residue index of each pixel point according to the feature data set, count the pesticide residue indexes of all pixel points and perform level division, and calculate the average value of each level to generate a comprehensive level evaluation coefficient; A result judgment module, which is used to compare the obtained comprehensive level evaluation coefficient with the set pesticide residue levels to judge the pesticide residue level on the vegetable surface.