Non-destructive testing method and apparatus for aflatoxin B1

CN116203001BActive Publication Date: 2026-09-01INTELLIGENT EQUIPMENT RESEARCH CENTER BEIJING ACADEMY OF AGRICULTURE AND FORESTRY SCIENCES
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310085105.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-28
Publication Date
2026-09-01
Estimated Expiration
2043-01-28

AI Technical Summary

Technical Problem

[0003]目前,用于AFB1检测的方法有薄层色谱法、液相色谱法以及酶联免疫法等,这些传统的方法采用有损伤性的实验室化学方法测定,因检测速度慢和劳动强度大等问题仅适合抽样检测,不适合对大批量谷物进行快速检测

Benefits of technology

[0037]本发明提供的黄曲霉毒素B1无损检测方法及装置,通过首先获取目标谷物对应的不同波段的荧光高光谱图像,然后提取各波段的荧光高光谱图像中的光谱数据,进而将光谱数据输入目标分类模型,获得目标分类模型输出的检测结果,实现了对目标谷物进行黄曲霉毒素B1的快速无损检测,降低了劳动强度,而且由于目标分类模型是基于Stacking集成模型构建的,可以提高模型分类的准确率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116203001B_ABST
    Figure CN116203001B_ABST
Patent Text Reader

Abstract

This invention provides a non-destructive testing method and apparatus for aflatoxin B1, relating to the field of grain quality testing technology. The method includes: acquiring fluorescence hyperspectral images of the target grain at different wavelengths; extracting spectral data from the fluorescence hyperspectral images of each wavelength; inputting the spectral data into a target classification model to obtain the detection result output by the target classification model. The target classification model is constructed based on a Stacking ensemble model, and the detection result is used to characterize whether the target grain is contaminated with aflatoxin B1. This invention achieves rapid and non-destructive testing of aflatoxin B1 in target grains by inputting the spectral data from the fluorescence hyperspectral images of the target grain into the target classification model and obtaining the detection result output by the target classification model. This reduces labor intensity, and because the target classification model is constructed based on a Stacking ensemble model, the accuracy of model classification can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of grain quality testing technology, and in particular to a non-destructive testing method and apparatus for aflatoxin B1. Background Technology

[0002] Aflatoxin B1 (AFB1) is a common toxin found in corn or corn products. The detection rate of AFB1 in food products is relatively high. In addition, AFB1 is heat-resistant and is difficult to destroy by general cooking. The feed hygiene standard stipulates that the upper limit of aflatoxin B1 in corn processed products is 50 ug / kg, while the Chinese food hygiene standard stipulates that the allowable amount of AFB1 in corn, peanuts and peanut oil is 20 ug / kg.

[0003] Currently, methods for AFB1 detection include thin-layer chromatography, liquid chromatography, and enzyme-linked immunosorbent assay (ELISA). These traditional methods employ invasive laboratory chemical methods and are only suitable for sampling tests due to their slow detection speed and high labor intensity. They are not suitable for rapid detection of large quantities of grains.

[0004] Therefore, how to quickly and non-destructively test large quantities of grains for aflatoxin B1 has become an urgent problem to be solved in the industry. Summary of the Invention

[0005] To address the problems existing in the prior art, the present invention provides a non-destructive testing method and apparatus for aflatoxin B1.

[0006] In a first aspect, the present invention provides a non-destructive detection method for aflatoxin B1, comprising:

[0007] Acquire fluorescence hyperspectral images of the target grain at different wavelengths;

[0008] Spectral data were extracted from the fluorescence hyperspectral images for each band.

[0009] The spectral data is input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection results are used to characterize whether the target grain is contaminated with aflatoxin B1.

[0010] Optionally, according to the non-destructive detection method for aflatoxin B1 provided by the present invention, before inputting the spectral data into the target classification model and obtaining the detection result output by the target classification model, the method further includes:

[0011] Obtain fluorescence hyperspectral image samples of different bands corresponding to the target grain sample;

[0012] Spectral data samples were extracted from the fluorescence hyperspectral image samples of each band respectively;

[0013] The spectral data samples are divided into a calibration set and a prediction set, and the spectral data samples included in the calibration set are randomly undersampled to generate multiple subsets;

[0014] Based on the multiple subsets, multiple base classifiers are trained respectively, and the multiple base classifiers correspond one-to-one with the multiple subsets;

[0015] The prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained.

[0016] Based on the target classification model, predictions are made on the spectral data samples in the prediction set.

[0017] Optionally, according to the non-destructive detection method for aflatoxin B1 provided by the present invention, dividing the spectral data sample into a calibration set and a prediction set includes:

[0018] Based on a preset classification threshold, variance analysis is performed on the spectral data samples to obtain the analysis results;

[0019] Based on the analysis results, the target band fluorescence hyperspectral image samples in the fluorescence hyperspectral image samples of different bands are determined;

[0020] The spectral data samples in the fluorescence hyperspectral image samples of the target band are divided into a calibration set and a prediction set.

[0021] Optionally, according to the non-destructive detection method for aflatoxin B1 provided by the present invention, the step of extracting spectral data from the fluorescence hyperspectral images of each band includes:

[0022] Background data in the fluorescence hyperspectral images of each band is removed using a masking method to obtain spectral data of the region to which the target grain belongs in the fluorescence hyperspectral images of each band.

[0023] The spectral data of all pixels within the region to which the target grain belongs in the fluorescence hyperspectral image of each band are averaged, and the obtained average spectral data are used as the spectral data of the fluorescence hyperspectral image of each band.

[0024] Optionally, according to the non-destructive detection method for aflatoxin B1 provided by the present invention, before extracting the spectral data from the fluorescence hyperspectral images of each band, the method further includes:

[0025] The fluorescence hyperspectral images of each band are corrected using black and white reference images.

[0026] Optionally, according to the non-destructive detection method for aflatoxin B1 provided by the present invention, the correction of the fluorescence hyperspectral images of each band using a black reference image and a white reference image includes:

[0027] Based on the spectral image correction formula, the fluorescence hyperspectral images of each band are corrected using the black reference image and the white reference image. The spectral image correction formula is as follows:

[0028]

[0029] Among them, R c For the corrected fluorescence hyperspectral image, R raw The original fluorescence hyperspectral image, R dark As a black reference image, R white White reference image.

[0030] Secondly, the present invention also provides a non-destructive testing device for aflatoxin B1, comprising:

[0031] The acquisition module is used to acquire fluorescence hyperspectral images of the target grain in different bands.

[0032] An extraction module is used to extract spectral data from the fluorescence hyperspectral image for each band.

[0033] The detection module is used to input the spectral data into the target classification model and obtain the detection result output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection result is used to characterize whether the target grain is contaminated with aflatoxin B1.

[0034] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the non-destructive detection method for aflatoxin B1 as described in the first aspect.

[0035] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the non-destructive detection method for aflatoxin B1 as described in the first aspect.

[0036] Fifthly, the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the non-destructive testing method for aflatoxin B1 as described in the first aspect.

[0037] The aflatoxin B1 non-destructive detection method and apparatus provided by this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts spectral data from the fluorescence hyperspectral images of each wavelength, and then inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This achieves rapid and non-destructive detection of aflatoxin B1 in the target grain, reduces labor intensity, and improves the accuracy of model classification because the target classification model is built based on a Stacking ensemble model. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 This is a flowchart illustrating the non-destructive testing method for aflatoxin B1 provided by the present invention.

[0040] Figure 2 This is a flowchart illustrating the undersampling Stacking algorithm provided by the present invention;

[0041] Figure 3 This is one of the schematic diagrams of the spectral curves of corn samples provided by the present invention;

[0042] Figure 4 This is the second schematic diagram of the spectral curve of the corn sample provided by the present invention;

[0043] Figure 5 This is the third schematic diagram of the spectral curve of the corn sample provided by the present invention;

[0044] Figure 6 This is the fourth schematic diagram of the spectral curve of the corn sample provided by the present invention;

[0045] Figure 7 This is the fifth schematic diagram of the spectral curve of the corn sample provided by the present invention;

[0046] Figure 8 This is the sixth schematic diagram of the spectral curve of the corn sample provided by the present invention;

[0047] Figure 9 This is one of the schematic diagrams showing the results of variance analysis of spectral data provided by the present invention;

[0048] Figure 10 This is the second schematic diagram of the results of variance analysis of spectral data provided by the present invention;

[0049] Figure 11 This is the third schematic diagram of the results of variance analysis of spectral data provided by the present invention;

[0050] Figure 12 This is the fourth schematic diagram of the results of variance analysis of spectral data provided by the present invention;

[0051] Figure 13 This is the fifth schematic diagram of the results of variance analysis of spectral data provided by the present invention;

[0052] Figure 14 This is the sixth schematic diagram of the results of variance analysis of spectral data provided by the present invention;

[0053] Figure 15 This is a schematic diagram of the structure of the aflatoxin B1 non-destructive testing device provided by the present invention;

[0054] Figure 16 This is a schematic diagram of the physical structure of the electronic device provided by the present invention. Detailed Implementation

[0055] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0056] The non-destructive testing method and apparatus for aflatoxin B1 provided by the present invention will be described exemplarily below with reference to the accompanying drawings.

[0057] Figure 1 This is a schematic flowchart of the non-destructive testing method for aflatoxin B1 provided by the present invention, as shown below. Figure 1 As shown, the method includes:

[0058] Step 100: Obtain fluorescence hyperspectral images of the target grain at different wavelengths;

[0059] Step 110: Extract spectral data from the fluorescence hyperspectral images of each band;

[0060] Step 120: Input the spectral data into the target classification model to obtain the detection result output by the target classification model. The target classification model is constructed based on the Stacking ensemble model. The detection result is used to characterize whether the target grain is contaminated with aflatoxin B1.

[0061] It should be noted that the subject executing the non-destructive testing method for aflatoxin B1 provided in this embodiment of the invention can be an electronic device, a component in an electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. For example, a mobile electronic device can be a mobile phone, tablet computer, laptop computer, PDA, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc., while a non-mobile electronic device can be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This embodiment of the invention does not specifically limit the specific implementation of these methods.

[0062] The following describes the technical solution of the present invention in detail, taking the computer execution of the non-destructive testing method for aflatoxin B1 provided by the present invention as an example.

[0063] Specifically, to overcome the shortcomings of existing aflatoxin B1 detection methods, which employ invasive laboratory chemical methods and are only suitable for sampling due to slow detection speed and high labor intensity, making them unsuitable for rapid detection of large quantities of grains, this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts the spectral data from each wavelength's fluorescence hyperspectral image, and finally inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This achieves rapid and non-destructive detection of aflatoxin B1 in target grains, reduces labor intensity, and improves the model's classification accuracy because the target classification model is built based on a Stacking ensemble model.

[0064] Optionally, in this embodiment of the invention, a fluorescence hyperspectral imaging system can be used to acquire fluorescence hyperspectral images of the target grain at different wavelengths.

[0065] Optionally, a fluorescence hyperspectral imaging system with a spectral range of 327 nm to 1097 nm can be used to acquire fluorescence hyperspectral images of the germ side or endosperm side of the target grain. It should be noted that the fluorescence hyperspectral images of the germ side and the endosperm side can be understood as fluorescence hyperspectral images of side A and side B of the target grain.

[0066] It should be noted that the fluorescence hyperspectral imaging system mainly includes: an imaging spectrometer, a fluorescence excitation source (365nm), a CCD camera (charge coupled device camera), and a horizontal moving platform.

[0067] Optionally, in this embodiment of the invention, the acquisition parameters for the fluorescence hyperspectral image can be: camera exposure time of 3ms, platform moving speed of 25mm / s, and object distance of 365mm.

[0068] Optionally, the target grain can be corn, peanuts, wheat, rice, soybeans, etc., and the embodiments of the present invention do not specifically limit it.

[0069] It should be noted that, in this embodiment of the invention, corn is taken as the target grain as an example to illustrate the technical solution of the embodiment of the invention in detail.

[0070] Optionally, after obtaining fluorescence hyperspectral images of different bands corresponding to the target grain to be detected, spectral data can be extracted from the fluorescence hyperspectral images of each band.

[0071] Optionally, after extracting the spectral data from the fluorescence hyperspectral images of each band, the extracted spectral data can be input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model, and the detection results output by the target classification model are used to characterize whether the target grain to be detected is contaminated with aflatoxin B1.

[0072] It should be noted that the target classification model is trained based on sample data. However, since most of the sample data corresponds to healthy target grains, i.e., not contaminated by aflatoxin B1, and only a few sample data corresponds to unhealthy target grains, there is an imbalance in the sample data, which will affect the classification performance of the target classification model.

[0073] Therefore, in this embodiment of the invention, by constructing a target classification model based on a Stacking ensemble model, the shortcomings of poor model performance caused by imbalanced samples can be overcome, thereby improving the classification effect of the target classification model under imbalanced sample conditions and realizing rapid and accurate non-destructive detection of aflatoxin B1.

[0074] The non-destructive detection method for aflatoxin B1 provided by this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts the spectral data from each wavelength's fluorescence hyperspectral image, and then inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This method achieves rapid and non-destructive detection of aflatoxin B1 in target grains, reduces labor intensity, and improves the accuracy of model classification because the target classification model is built based on a Stacking ensemble model.

[0075] Optionally, before inputting the spectral data into the target classification model and obtaining the detection result output by the target classification model, the method further includes:

[0076] Obtain fluorescence hyperspectral image samples of different bands corresponding to the target grain sample;

[0077] Spectral data samples were extracted from the fluorescence hyperspectral image samples of each band respectively;

[0078] The spectral data samples are divided into a calibration set and a prediction set, and the spectral data samples included in the calibration set are randomly undersampled to generate multiple subsets;

[0079] Based on the multiple subsets, multiple base classifiers are trained respectively, and the multiple base classifiers correspond one-to-one with the multiple subsets;

[0080] The prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained.

[0081] Based on the target classification model, predictions are made on the spectral data samples in the prediction set.

[0082] Specifically, in this embodiment of the invention, before classifying the target grain to be detected using the target classification model, the target classification model needs to be trained. The specific training process is as follows: First, acquire fluorescence hyperspectral image samples of different bands corresponding to the target grain sample. Then, extract spectral data samples from the fluorescence hyperspectral image samples of each band. The extracted spectral data samples are then divided into a calibration set and a prediction set. Random undersampling is performed on the spectral data samples included in the calibration set to generate multiple subsets. Based on the generated multiple subsets, multiple base classifiers are trained respectively, wherein the multiple base classifiers correspond one-to-one with the multiple subsets. At the same time, the prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained. Finally, based on the target classification model, the spectral data samples in the prediction set are predicted to predict the performance of the target classification model.

[0083] Understandably, before obtaining fluorescence hyperspectral image samples of different bands corresponding to the target grain sample, it is necessary to prepare sample seeds containing aflatoxin B1.

[0084] Optionally, in this embodiment of the invention, the sample can be corn seeds of variety Jingke 968, with all corn seeds being of uniform size and without obvious defects. 192 groups of samples were used for aflatoxin B1 testing, each group containing 40 seeds, placed in transparent petri dishes. The fungal solution was evenly sprayed onto each group of samples, and the samples were placed in an incubator for constant temperature incubation. In this embodiment of the invention, 9 groups of samples were set as control groups, and the control group samples were not sprayed with the fungal solution. For the aflatoxin B1 testing sample groups, on the second day of incubation, 30 groups of samples were randomly selected to test their AFB1 content. Subsequently, every 3 days, 30 groups of samples were randomly selected to test their AFB1 content until the AFB1 content of all samples was tested.

[0085] It should be noted that, in the embodiments of the present invention, since the toxin content inside the sample increases exponentially with the culture time, the sample imbalance problem also seriously affects the prediction effect of the model. Therefore, the present invention improves the prediction accuracy of the target classification model under the condition of sample imbalance by randomly undersampling the spectral data samples included in the calibration set and constructing a target classification model based on the Stacking ensemble model.

[0086] Optionally, in embodiments of the present invention, spectral data samples can be divided into a calibration set and a prediction set in equal proportions.

[0087] Optionally, the spectral data samples included in the calibration set can be randomly undersampled to generate multiple subsets. The number of subsets generated can be determined by cross-validation or pre-experimentation. This embodiment of the invention does not specifically limit this. For example, after pre-experimental analysis, the number of subsets is determined to be 20.

[0088] Optionally, in this embodiment of the invention, any algorithm can be selected as the base classifier and meta classifier based on the actual application. This embodiment of the invention does not make specific limitations on this. For example, the Adaboost algorithm can be selected as the base classifier and logistic regression as the meta classifier.

[0089] Figure 2 This is a flowchart illustrating the undersampling stacking algorithm provided by the present invention, as shown below. Figure 2As shown, random undersampling is performed on the spectral data samples included in the calibration set to generate multiple subsets. Then, based on the generated subsets, multiple base classifiers (Adaboost) are trained respectively. At the same time, the prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifier (Logistic regression).

[0090] This invention improves the prediction accuracy of the target classification model under imbalanced conditions by randomly undersampling the spectral data samples included in the calibration set to generate multiple subsets, and then training the target classification model based on the Stacking ensemble model based on the multiple subsets.

[0091] Optionally, dividing the spectral data samples into a calibration set and a prediction set includes:

[0092] Based on a preset classification threshold, an analysis of variance (ANOVA) is performed on the spectral data samples to obtain the analysis results.

[0093] Based on the analysis results, the target band fluorescence hyperspectral image samples in the fluorescence hyperspectral image samples of different bands are determined;

[0094] The spectral data samples in the fluorescence hyperspectral image samples of the target band are divided into a calibration set and a prediction set.

[0095] Specifically, in this embodiment of the invention, after extracting spectral data samples from fluorescence hyperspectral image samples of each band, variance analysis can be performed on the extracted spectral data samples based on a preset classification threshold to obtain analysis results. Then, based on the analysis results, the fluorescence hyperspectral image samples of the target band in the fluorescence hyperspectral image samples of different bands are determined, and the spectral data samples in the fluorescence hyperspectral image samples of the target band are further divided into a calibration set and a prediction set.

[0096] Optionally, the preset classification threshold can be adaptively set based on actual applications. This embodiment of the invention does not specifically limit this. For example, the preset classification threshold can be 20ug / kg or 50ug / kg, etc.

[0097] It is understood that, in the embodiments of the present invention, ANOVA analysis can be performed on spectral data samples of different categories. The band representing the greatest difference between groups can be selected based on the F value of the analysis results. The band with a higher F value indicates that the difference between different groups is most significant under that band. Different bands are selected as feature bands to simplify the model and improve classification efficiency.

[0098] Optionally, the step of extracting spectral data from the fluorescence hyperspectral image for each band includes:

[0099] Background data in the fluorescence hyperspectral images of each band is removed using a masking method to obtain spectral data of the region to which the target grain belongs in the fluorescence hyperspectral images of each band.

[0100] The spectral data of all pixels within the region to which the target grain belongs in the fluorescence hyperspectral image of each band are averaged, and the obtained average spectral data are used as the spectral data of the fluorescence hyperspectral image of each band.

[0101] Specifically, in this embodiment of the invention, background data in fluorescence hyperspectral images of each band can be removed based on a masking method to obtain spectral data of the region to which the target grain belongs in the fluorescence hyperspectral images of each band. Then, the spectral data of all pixels in the region to which the target grain belongs in the fluorescence hyperspectral images of each band are averaged, and the obtained average spectral data are used as the spectral data of the fluorescence hyperspectral images of each band.

[0102] Optionally, the 472nm grayscale image with the highest contrast between the seed (target grain) and the background in all fluorescence hyperspectral images can be selected as a mask first; then, the mask image is applied to all images to remove background data and retain the spectral information of the seed region. The spectral data of all pixels in the seed region are averaged to obtain the spectral data of the fluorescence hyperspectral image.

[0103] Optionally, before extracting the spectral data from the fluorescence hyperspectral images of each band, the method further includes:

[0104] The fluorescence hyperspectral images of each band are corrected using black and white reference images.

[0105] Specifically, in this embodiment of the invention, before extracting spectral data from the fluorescence hyperspectral images of each band, the fluorescence hyperspectral images of each band are first corrected using a black reference image and a white reference image.

[0106] It should be noted that, due to the inconsistency of fluorescence intensity in different bands and the dark current in the CCD camera causing significant noise in certain bands, the original hyperspectral image needs to be corrected using black and white reference images.

[0107] Optionally, in this embodiment of the invention, a white reference image can be obtained using a polytetrafluoroethylene white board, and a black reference image can be obtained by turning off the light source and tightening the lens cap of the fluorescence hyperspectral imaging system.

[0108] Optionally, the step of correcting the fluorescence hyperspectral images of each band using a black reference image and a white reference image includes:

[0109] Based on the spectral image correction formula, the fluorescence hyperspectral images of each band are corrected using the black reference image and the white reference image. The spectral image correction formula is as follows:

[0110]

[0111] Among them, R c For the corrected fluorescence hyperspectral image, R raw The original fluorescence hyperspectral image, R dark As a black reference image, R white White reference image.

[0112] Optionally, the average spectrum can be extracted from the corrected fluorescence hyperspectral image. Background segmentation is a key step in spectral extraction. First, the 472nm grayscale image with the highest contrast between the target grain and the background is selected from all fluorescence hyperspectral images across all bands as a mask. Then, the mask image is applied to all band images to remove background data and retain the spectral information of the region to which the target grain belongs. The spectral data of all pixels within the region to which the target grain belongs are averaged to obtain the spectral data of a single sample.

[0113] Optionally, to compare the discrimination performance of different spectral types against toxins within the target grain, the average spectra of the germ and endosperm sides of the target grain can be extracted separately. Then, the spectra of the germ and endosperm sides are averaged to obtain the average spectra of both sides. Furthermore, since the signal-to-noise ratio is relatively low at the beginning and end of the full spectral range, the spectrum within the 380nm-814nm range can be selected for analysis.

[0114] Figures 3 to 8 These are schematic diagrams of the spectral curves of corn samples provided by this invention, where the horizontal axis represents wavelength and the vertical axis represents spectral intensity. Figure 3 The corresponding spectrum is the average spectrum of the corn germ side, classified based on a threshold of 20 ug / kg. Figure 4 The corresponding spectrum is the average spectrum of the corn germ side, classified based on a threshold of 50 ug / kg. Figure 5 The corresponding spectrum is the average spectrum of the corn endosperm side, classified based on a threshold of 20 ug / kg. Figure 6 The corresponding spectrum is the average spectrum of the corn endosperm side, classified based on a threshold of 50 ug / kg. Figure 7 The corresponding data is the average spectrum on both sides of the corn germ and endosperm, classified based on a threshold of 20 ug / kg. Figure 8The corresponding data is the average spectrum on both sides of the corn germ and endosperm, classified based on a threshold of 50 ug / kg.

[0115] Depend on Figures 3 to 8 It can be seen that there is no significant difference in the spectral curves of corn samples classified based on the 20ug / kg threshold and those classified based on the 50ug / kg threshold, and there is also no significant difference in the spectral curves of the corn germ side, the corn endosperm side, and both sides of the corn germ and endosperm.

[0116] Optionally, in this embodiment of the invention, ANOVA analysis can be performed on spectral samples of different categories. The band representing the greatest difference between groups can be selected based on the F-value of the analysis results. The band with a higher F-value indicates that the difference between different groups is most significant under that band. Different bands are selected as feature bands to simplify the model and improve classification efficiency.

[0117] Figures 9 to 14 These are schematic diagrams of the results of variance analysis of spectral data provided by the present invention, where the horizontal axis represents wavelength and the vertical axis represents the F-value obtained by variance analysis of the spectral data. Figure 9 The corresponding result is the analysis of variance of the germ-side spectrum based on a threshold of 20 ug / kg. Figure 10 The corresponding result is the analysis of variance of the germ-side spectrum based on a threshold of 50 ug / kg. Figure 11 The corresponding result is the analysis of variance of the endosperm side spectrum based on a threshold of 20 ug / kg. Figure 12 The corresponding result is the analysis of variance of the endosperm side spectrum based on a threshold of 50 ug / kg. Figure 13 The corresponding data is the result of variance analysis based on the average spectra on both sides of the germ and endosperm, categorized using a threshold of 20 ug / kg. Figure 14 This corresponds to the analysis of variance results of the average spectra on both sides of the germ and endosperm, classified based on a threshold of 50 ug / kg. For example... Figures 9 to 14 As shown, different bands can be selected as feature bands based on different types of spectra and classification thresholds to simplify the model and improve classification efficiency.

[0118] Optionally, in this embodiment of the invention, classification accuracy and recall can be used as evaluation parameters for the classification performance of the target classification model to assess its performance. The formulas are as follows:

[0119] Accuracy=(TP+FN) / (TP+FP+TN+FN)

[0120] Recall = TP / (TP + FN)

[0121] Among them, TP is a true positive, TN is a true negative, FP is a false positive, and FN is a false negative.

[0122] For example, 140 samples were randomly selected from all corn seed samples according to different category proportions as a calibration set for establishing the target classification model, and the remaining 61 samples formed a prediction set to evaluate the performance of the target classification model. Addressing the data imbalance problem (taking a classification threshold of 20 ug / kg as an example, with a total sample size of 201, 27 samples were below this threshold, indicating severe sample imbalance), the classification results based on different classification algorithms and spectral types are shown in Table 1. Different types of spectra can classify corn seeds with different toxin contents. The target classification model based on the Stacking ensemble model proposed in this embodiment can significantly improve the accuracy and recall of the prediction set. The results show that the non-destructive detection method for aflatoxin B1 provided in this embodiment can improve the classification accuracy under imbalanced sample conditions.

[0123] Table 1. Classification results based on different classification algorithms and spectral types.

[0124]

[0125]

[0126] It should be noted that the selection of feature bands is also an important step in the establishment of the target classification model. In this embodiment of the invention, the target classification model is further established based on the bands selected by single-band ANOVA analysis, and the classification results are shown in Table 2. This result shows that the feature bands selected based on single-band ANOVA analysis are effective, and different samples can be classified using only three bands. Furthermore, this result also shows that the target classification model built based on the Stacking ensemble model is equally effective when dealing with unfamiliar feature data, indirectly proving the effectiveness of this method. As can be seen from Table 2, the target classification model established based on the feature bands selected from the endosperm side spectrum exhibits the best classification accuracy and recall when dealing with different classification thresholds.

[0127] Table 2 Classification results based on different characteristic bands and spectral types

[0128]

[0129]

[0130] It should be noted that traditional aflatoxin B1 detection methods are cumbersome and cannot meet the market demand for rapid detection. Furthermore, in natural environments, the toxin content within a sample increases exponentially with culture time, and sample imbalance severely impacts model prediction performance. The non-destructive aflatoxin B1 detection method provided in this invention, based on fluorescence hyperspectral imaging technology and a target classification model built using a Stacking ensemble model, achieves rapid detection and grading of toxins within target grains. This reduces labor intensity and overcomes the poor model performance caused by sample imbalance, improving model accuracy and recall. In addition, the selection of feature bands significantly improves model development efficiency and reduces development costs.

[0131] The non-destructive detection method for aflatoxin B1 provided by this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts the spectral data from each wavelength's fluorescence hyperspectral image, and then inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This method achieves rapid and non-destructive detection of aflatoxin B1 in target grains, reduces labor intensity, and improves the accuracy of model classification because the target classification model is built based on a Stacking ensemble model.

[0132] The aflatoxin B1 non-destructive testing device provided by the present invention is described below. The aflatoxin B1 non-destructive testing device described below and the aflatoxin B1 non-destructive testing method described above can be referred to in correspondence with each other.

[0133] Figure 15 This is a schematic diagram of the non-destructive testing device for aflatoxin B1 provided by the present invention, as shown below. Figure 15 As shown, the device includes: an acquisition module 1510, an extraction module 1520, and a detection module 1530; wherein:

[0134] The acquisition module 1510 is used to acquire fluorescence hyperspectral images of the target grain to be detected in different bands;

[0135] The extraction module 1520 is used to extract spectral data from the fluorescence hyperspectral image of each band respectively;

[0136] The detection module 1530 is used to input the spectral data into the target classification model and obtain the detection result output by the target classification model. The target classification model is constructed based on the Stacking ensemble model. The detection result is used to characterize whether the target grain is contaminated with aflatoxin B1.

[0137] The aflatoxin B1 non-destructive testing device provided by this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts the spectral data from each wavelength's fluorescence hyperspectral image, and then inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This achieves rapid and non-destructive testing of aflatoxin B1 in the target grain, reduces labor intensity, and improves the accuracy of model classification because the target classification model is built based on a Stacking ensemble model.

[0138] Optionally, the device further includes a training module, the training module being used for:

[0139] Obtain fluorescence hyperspectral image samples of different bands corresponding to the target grain sample;

[0140] Spectral data samples were extracted from the fluorescence hyperspectral image samples of each band respectively;

[0141] The spectral data samples are divided into a calibration set and a prediction set, and the spectral data samples included in the calibration set are randomly undersampled to generate multiple subsets;

[0142] Based on the multiple subsets, multiple base classifiers are trained respectively, and the multiple base classifiers correspond one-to-one with the multiple subsets;

[0143] The prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained.

[0144] Based on the target classification model, predictions are made on the spectral data samples in the prediction set.

[0145] Optionally, the training module is further configured to:

[0146] Based on a preset classification threshold, variance analysis is performed on the spectral data samples to obtain the analysis results;

[0147] Based on the analysis results, the target band fluorescence hyperspectral image samples in the fluorescence hyperspectral image samples of different bands are determined;

[0148] The spectral data samples in the fluorescence hyperspectral image samples of the target band are divided into a calibration set and a prediction set.

[0149] Optionally, the extraction module 1520 is specifically used for:

[0150] Background data in the fluorescence hyperspectral images of each band is removed using a masking method to obtain spectral data of the region to which the target grain belongs in the fluorescence hyperspectral images of each band.

[0151] The spectral data of all pixels within the region to which the target grain belongs in the fluorescence hyperspectral image of each band are averaged, and the obtained average spectral data are used as the spectral data of the fluorescence hyperspectral image of each band.

[0152] Optionally, the device further includes a calibration module, the calibration module being used for:

[0153] The fluorescence hyperspectral images of each band are corrected using black and white reference images.

[0154] Optionally, the correction module is specifically used for:

[0155] Based on the spectral image correction formula, the fluorescence hyperspectral images of each band are corrected using the black reference image and the white reference image. The spectral image correction formula is as follows:

[0156]

[0157] Among them, R c For the corrected fluorescence hyperspectral image, R raw The original fluorescence hyperspectral image, R dark As a black reference image, R white White reference image.

[0158] The aflatoxin B1 non-destructive testing device provided by this invention first acquires fluorescence hyperspectral images of the target grain at different wavelengths, then extracts the spectral data from each wavelength's fluorescence hyperspectral image, and then inputs the spectral data into a target classification model to obtain the detection results output by the target classification model. This achieves rapid and non-destructive testing of aflatoxin B1 in the target grain, reduces labor intensity, and improves the accuracy of model classification because the target classification model is built based on a Stacking ensemble model.

[0159] It should be noted that the aflatoxin B1 nondestructive testing device provided in this embodiment of the invention can realize all the method steps implemented in the above-mentioned aflatoxin B1 nondestructive testing method embodiment, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0160] Figure 16 This is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as... Figure 16As shown, the electronic device may include: a processor 1610, a communication interface 1620, a memory 1630, and a communication bus 1640, wherein the processor 1610, the communication interface 1620, and the memory 1630 communicate with each other through the communication bus 1640. The processor 1610 can call logical instructions in the memory 1630 to execute the aflatoxin B1 non-destructive testing method provided by the above methods, which includes:

[0161] Acquire fluorescence hyperspectral images of the target grain at different wavelengths;

[0162] Spectral data were extracted from the fluorescence hyperspectral images for each band.

[0163] The spectral data is input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection results are used to characterize whether the target grain is contaminated with aflatoxin B1.

[0164] Furthermore, the logical instructions in the aforementioned memory 1630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0165] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is capable of executing the aflatoxin B1 non-destructive testing method provided by the above methods, the method comprising:

[0166] Acquire fluorescence hyperspectral images of the target grain at different wavelengths;

[0167] Spectral data were extracted from the fluorescence hyperspectral images for each band.

[0168] The spectral data is input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection results are used to characterize whether the target grain is contaminated with aflatoxin B1.

[0169] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the aforementioned non-destructive detection methods for aflatoxin B1, the method comprising:

[0170] Acquire fluorescence hyperspectral images of the target grain at different wavelengths;

[0171] Spectral data were extracted from the fluorescence hyperspectral images for each band.

[0172] The spectral data is input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection results are used to characterize whether the target grain is contaminated with aflatoxin B1.

[0173] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0174] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0175] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A non-destructive testing method for aflatoxin B1, characterized in that, include: Acquire fluorescence hyperspectral images of the target grain at different wavelengths; Spectral data were extracted from the fluorescence hyperspectral images for each band. The spectral data is input into the target classification model to obtain the detection results output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection results are used to characterize whether the target grain is contaminated with aflatoxin B1. The target classification model is trained based on sample data; Before inputting the spectral data into the target classification model and obtaining the detection result output by the target classification model, the method further includes: Obtain fluorescence hyperspectral image samples of different bands corresponding to the target grain sample; Spectral data samples were extracted from the fluorescence hyperspectral image samples of each band respectively; The spectral data samples are divided into a calibration set and a prediction set, and the spectral data samples included in the calibration set are randomly undersampled to generate multiple subsets; Based on the multiple subsets, multiple base classifiers are trained respectively, and the multiple base classifiers correspond one-to-one with the multiple subsets; The prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained. Based on the target classification model, predictions are made on the spectral data samples in the prediction set.

2. The non-destructive testing method for aflatoxin B1 according to claim 1, characterized in that, The step of dividing the spectral data samples into a calibration set and a prediction set includes: Based on a preset classification threshold, variance analysis is performed on the spectral data samples to obtain the analysis results; Based on the analysis results, the target band fluorescence hyperspectral image samples in the fluorescence hyperspectral image samples of different bands are determined; The spectral data samples in the fluorescence hyperspectral image samples of the target band are divided into a calibration set and a prediction set.

3. The non-destructive testing method for aflatoxin B1 according to claim 1, characterized in that, The extraction of spectral data from the fluorescence hyperspectral images of each band includes: Background data in the fluorescence hyperspectral images of each band is removed using a masking method to obtain spectral data of the region to which the target grain belongs in the fluorescence hyperspectral images of each band. The spectral data of all pixels within the region to which the target grain belongs in the fluorescence hyperspectral image of each band are averaged, and the obtained average spectral data are used as the spectral data of the fluorescence hyperspectral image of each band.

4. The non-destructive testing method for aflatoxin B1 according to claim 1, characterized in that, Before extracting the spectral data from the fluorescence hyperspectral images of each band, the method further includes: The fluorescence hyperspectral images of each band are corrected using black and white reference images.

5. The non-destructive testing method for aflatoxin B1 according to claim 4, characterized in that, The correction of the fluorescence hyperspectral images of each band using black and white reference images includes: Based on the spectral image correction formula, the fluorescence hyperspectral images of each band are corrected using the black reference image and the white reference image. The spectral image correction formula is as follows: ; in, The corrected fluorescence hyperspectral image, This is the original fluorescence hyperspectral image. Black reference image, White reference image.

6. A non-destructive testing device for aflatoxin B1, characterized in that, include: The acquisition module is used to acquire fluorescence hyperspectral images of the target grain in different bands. An extraction module is used to extract spectral data from the fluorescence hyperspectral image for each band. The detection module is used to input the spectral data into the target classification model and obtain the detection result output by the target classification model. The target classification model is built based on the Stacking ensemble model. The detection result is used to characterize whether the target grain is contaminated with aflatoxin B1. The target classification model is trained based on sample data; Before inputting the spectral data into the target classification model and obtaining the detection result output by the target classification model, the method further includes: Obtain fluorescence hyperspectral image samples of different bands corresponding to the target grain sample; Spectral data samples were extracted from the fluorescence hyperspectral image samples of each band respectively; The spectral data samples are divided into a calibration set and a prediction set, and the spectral data samples included in the calibration set are randomly undersampled to generate multiple subsets; Based on the multiple subsets, multiple base classifiers are trained respectively, and the multiple base classifiers correspond one-to-one with the multiple subsets; The prediction results of the multiple base classifiers on the calibration set are determined, and the probabilities corresponding to the prediction results are used as the meta-training set to train the meta-classifiers. After training, the target classification model is obtained. Based on the target classification model, predictions are made on the spectral data samples in the prediction set.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the non-destructive testing method for aflatoxin B1 as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the non-destructive testing method for aflatoxin B1 as described in any one of claims 1 to 5.

9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the non-destructive testing method for aflatoxin B1 as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method for identifying aflatoxin in corn kernels based on hyperspectral imaging technology

    CN113433076A

  • Transformer oil aging detection method and detection system, electronic equipment and readable storage medium

    CN115565028A