Rice paraffin pollution detection method and system based on hyperspectral and deep learning

By constructing multiple industrial paraffin pollution data sets and training the SC-HybridSN model based on hyperspectral and deep learning methods, it solves the problems of low accuracy and insufficient robustness of existing detection methods, and achieves efficient and accurate rice paraffin detection. Contamination detection.

CN118134840BActive Publication Date: 2025-01-24NORTHEAST AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410044295.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-12
Publication Date
2025-01-24
Estimated Expiration
2044-01-12

AI Technical Summary

Technical Problem

The existing rice paraffin pollution detection methods have problems such as strong subjectivity, complex operation, low accuracy, and insufficient robustness to noise and data loss, which are difficult to meet the needs of large-scale rice sample detection.

Method used

Adopt a high spectrum and deep learning detection method, to obtain rice high spectrum images of different production areas and industrial paraffin types, and build multiple industrial paraffin pollution data sets, and in different scenarios (single scenarios, multi -source scenarios, small samples, samples, samples Scenario) SC-Hybridsn model of training Hybridsn deep learning architecture to improve detection accuracy.

Benefits of technology

The accuracy and robustness of the rice industry paraffin pollution detection is improved, and the level of rice paraffin pollution can be effectively identified under different detection conditions to meet the needs of large -scale testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118134840B_ABST
    Figure CN118134840B_ABST
Patent Text Reader

Abstract

The invention discloses a rice paraffin pollution detection method and system based on hyperspectral and deep learning. The invention belongs to the field of food detection, including: preparing contaminated rice samples, obtaining sample hyperspectral images, sample hyperspectral image marking and multiple industrial paraffin pollution data sets, multi-scenario modeling strategy data set combination, rice industrial paraffin pollution level discrimination model training; wherein, the multi-scenario modeling strategy data set combination is to construct multiple industrial paraffin pollution data sets according to the rice producing area, industrial paraffin type and content of the contaminated rice sample, and set them as training sets and data sets according to whether each data set is trained separately and the ratio of training sets to test sets. The discrimination model of rice industrial paraffin pollution level is trained to improve the detection accuracy of the model for a small amount of contaminated rice. The invention uses hyperspectral and deep imaging technology to propose a simple, efficient, and suitable rice paraffin pollution detection method for a small amount of samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of food detection, and in particular relates to a rice paraffin contamination detection method and system based on hyperspectral and deep learning. Background Art

[0002] Industrial paraffin contamination of rice is a serious food safety issue that can have adverse effects on human health. Therefore, the ability to detect the level of industrial paraffin contamination in rice has become crucial. Currently, the identification of industrial paraffin contamination in rice mainly relies on manual experience to judge the color and feel of rice, or uses physical and chemical tests such as gas chromatography and microcolumn chromatography for identification. However, the former is highly subjective and depends on the food safety training of the identification personnel; the latter has high detection accuracy, but the operation steps are complicated and time-consuming, which is difficult to meet the needs of large-scale rice sample testing.

[0003] Compared with the above traditional methods, spectral technology is non-destructive and can provide rich spectral information of different chemical components to achieve rapid detection of samples. However, the data obtained by traditional spectral technology lacks spatial information and is not suitable for simultaneous detection of multiple targets. Hyperspectral technology can combine the spectral information and spatial image information of the sample to quickly obtain the surface structure information and internal feature information of the rice sample, meeting the needs of rapid detection of large-scale rice samples. However, due to the high number of hyperspectral bands and strong correlation, traditional machine learning classification methods that rely on spectral features are prone to low classification accuracy and weak robustness to noise, data missing, etc., and there is an urgent need to break through new detection methods. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide a rice paraffin pollution detection method and system based on hyperspectral and deep learning; by acquiring hyperspectral images of rice contaminated with different types and different industrial paraffin contents, multiple industrial paraffin pollution data sets are constructed; according to whether the constructed multiple industrial paraffin pollution data sets are trained separately and the ratio of training set to test set, a single scenario, a multi-source scenario and a small sample scenario are set; the SC-HybridSN model based on the HybridSN deep learning architecture is trained and the effect is verified in different scenarios, and a model that can be used for rice industrial paraffin pollution detection is obtained.

[0005] To achieve the above object, the present invention provides the following technical solutions:

[0006] A method for detecting rice paraffin contamination based on hyperspectral and deep learning, comprising the following steps:

[0007] S1. Prepare contaminated rice samples from different production areas, with different types and contents of industrial paraffin, and collect hyperspectral images of all different contaminated rice samples;

[0008] S2, preprocessing the hyperspectral images of all contaminated rice samples, marking the sample hyperspectral images according to different rice producing areas and different industrial paraffin types during preparation, and constructing multiple industrial paraffin pollution data sets;

[0009] S3. Combine and divide the multiple industrial paraffin pollution data sets constructed, and set three modeling strategies: single scenario, multi-source scenario, and small sample scenario;

[0010] S4, using the multiple industrial paraffin pollution data sets obtained in step S2, and the three modeling strategies of single scenario, multi-source scenario and small sample scenario set in step S3, the SC-HybridSN model based on the HybridSN deep learning architecture is trained and verified, and the SC-HybridSN deep learning model for discriminating the paraffin pollution level of rice industry is obtained;

[0011] S5, obtaining a hyperspectral image of the rice sample to be detected, inputting the hyperspectral image to be detected into the rice industry paraffin pollution level discrimination model obtained in step S4, and obtaining a rice industry paraffin pollution discrimination result;

[0012] The three modeling strategies in step S3 are set based on whether the multiple industrial paraffin pollution data sets constructed are trained separately and the ratio of the training set to the test set, and then set a single scenario, a multi-source scenario and a small sample scenario;

[0013] The single scenario refers to dividing any industrial paraffin pollution data set into a training set and a test set according to a certain ratio of sample hyperspectral images in the data set;

[0014] The multi-source scenario refers to mixing two or more industrial paraffin pollution data sets to form a new multi-source data set, and then dividing the sample hyperspectral images in the multi-source data set into a training set and a test set according to a certain ratio;

[0015] The small sample scenario refers to a small sample data set in which the ratio of the training set to the data set is set to less than 0.1 in a single scenario and a multi-source scenario;

[0016] The SC-HybridSN model in step S4 is a model input module and a feature extraction module modified on the basis of the HybridSN deep learning architecture, using the SuperPCA unsupervised feature extraction module and the CBAM channel-spatial information enhancement feature module; the SC-HybridSN model includes the SuperPCA unsupervised feature extraction module, the CBAM channel-spatial information enhancement feature module, and the HybridSN network architecture;

[0017] The specific operation of the SuperPCA unsupervised feature extraction module is: M×N×D The sample hyperspectral image I is input into the SuperPCA unsupervised feature extraction module, which uses superpixel segmentation and PCA to extract features from the sample hyperspectral image to achieve data dimensionality reduction, outputs a simplified data cube X, and inputs the simplified data cube X into the HybridSN network architecture and the CBAM channel-spatial information enhancement feature module. The scale of the simplified data cube X is X∈R M×N×B .

[0018] The specific operations of step S1 of the rice paraffin pollution detection method based on hyperspectral and deep learning include:

[0019] S1.1. Select rice samples from different origins and different industrial paraffins; mix each different type of rice with each industrial paraffin liquid in different gradients to produce multiple contaminated rice samples, and mark each contaminated rice sample.

[0020] S1.2. Select 60 grains of each contaminated rice sample and arrange the rice in five rows and six columns on a black plastic plate. Use a hyperspectral camera to capture the hyperspectral image of the contaminated rice sample and transfer it to a computer for storage.

[0021] In step S1 of the rice paraffin contamination detection method based on hyperspectral and deep learning, the conditions for obtaining the sample hyperspectral image of the contaminated rice sample are: the spectral characteristic wavelength range is 397-978nm, and the number of spectral bands D is 196.

[0022] A rice paraffin pollution detection system based on a rice paraffin pollution detection method based on hyperspectral and deep learning, comprising a hyperspectral information acquisition module, an industrial paraffin pollution detection module and an output module;

[0023] The hyperspectral information acquisition module uses a hyperspectral camera to capture the hyperspectral image of the rice to be detected, and pre-processes the hyperspectral image of the rice to be detected and inputs it into the built-in industrial paraffin pollution detection module of the PC;

[0024] The industrial paraffin pollution detection module has a built-in SC-HybridSN deep learning model for distinguishing the paraffin pollution level of rice industry, performs detection processing on the input rice hyperspectral image to be tested, and obtains the paraffin pollution detection result of the rice hyperspectral image to be tested;

[0025] The output module outputs a "polluted" or "non-polluted" mark according to the paraffin pollution detection result of the hyperspectral image of the rice to be tested, thereby completing the industrial paraffin pollution detection of the rice.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] (1) In view of the problem of industrial paraffin pollution of rice in real life, such as the diversity of rice varieties and the small number of available samples, the rice paraffin pollution detection method based on hyperspectral and deep learning proposed in the present invention selects rice from different origins, multiple industrial paraffins and different paraffin contents in the sample preparation process, and prepares multiple different contaminated rice samples; in the model training process, a single scenario, a multi-source scenario and a small sample scenario are set, which are: according to any industrial paraffin pollution data set, the sample hyperspectral images in the data set are divided into a single scenario of a training set and a test set according to a certain ratio; two or more industrial paraffin pollution data sets are mixed to form a new scenario; A multi-source dataset is obtained, and then the sample hyperspectral images in the multi-source dataset are divided into a multi-source scenario of a training set and a test set according to a certain ratio; in a single scenario and a multi-source scenario, the ratio of the training set to the dataset is set to be less than 0.1 in a small sample scenario of a small sample dataset; by training and verifying the effect of the SC-HybridSN model based on the HybridSN deep learning architecture in different scenarios, an SC-HybridSN deep learning model for discriminating the paraffin pollution level in the rice industry is obtained, so as to improve the detection accuracy of the rice industry paraffin pollution detection system under different detection conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 The invention provides a rice paraffin pollution detection method and system based on hyperspectral and deep learning;

[0029] Figure 2 The SC-HybridSN deep learning model for distinguishing the paraffin pollution level in the rice industry of the present invention

[0030] Figure 3 It is an overall flow chart of the rice industry paraffin pollution detection system of the present invention;

[0031] Figure 4 It is a flow chart of a verification test in an embodiment of the present invention. DETAILED DESCRIPTION

[0032] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0033] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0034] Example 1

[0035] like Figure 1 As shown, a method for detecting rice paraffin pollution based on hyperspectral and deep learning comprises the following steps:

[0036] S1. Prepare contaminated rice samples from different production areas, with different types and contents of industrial paraffin, and collect hyperspectral images of all different contaminated rice samples;

[0037] S2, preprocessing the hyperspectral images of all contaminated rice samples, marking the sample hyperspectral images according to different rice producing areas and different industrial paraffin types during preparation, and constructing multiple industrial paraffin pollution data sets;

[0038] S3. Combine and divide the multiple industrial paraffin pollution data sets constructed, and set three modeling strategies: single scenario, multi-source scenario, and small sample scenario;

[0039] S4, using the multiple industrial paraffin pollution data sets obtained in step S2, and the three modeling strategies of single scenario, multi-source scenario and small sample scenario set in step S3, the SC-HybridSN model based on the HybridSN deep learning architecture is trained and verified, and the SC-HybridSN deep learning model for discriminating the paraffin pollution level of rice industry is obtained;

[0040] S5, obtaining a hyperspectral image of the rice sample to be detected, inputting the hyperspectral image to be detected into the rice industry paraffin pollution level discrimination model obtained in step S4, and obtaining a rice industry paraffin pollution discrimination result;

[0041] The three modeling strategies in step S3 are set based on whether the multiple industrial paraffin pollution data sets constructed are trained separately and the ratio of the training set to the test set, and then set a single scenario, a multi-source scenario and a small sample scenario;

[0042] The single scenario refers to dividing any industrial paraffin pollution data set into a training set and a test set according to a certain ratio of sample hyperspectral images in the data set;

[0043] The multi-source scenario refers to mixing two or more industrial paraffin pollution data sets to form a new multi-source data set, and then dividing the sample hyperspectral images in the multi-source data set into a training set and a test set according to a certain ratio;

[0044] The small sample scenario refers to a small sample data set in which the ratio of the training set to the data set is set to less than 0.1 in a single scenario and a multi-source scenario;

[0045] like Figure 2As shown, the SC-HybridSN model in step S4 is a model input module and a feature extraction module modified on the basis of the HybridSN deep learning architecture, using the SuperPCA unsupervised feature extraction module and the CBAM channel-spatial information enhancement feature module; the SC-HybridSN model includes the SuperPCA unsupervised feature extraction module, the CBAM channel-spatial information enhancement feature module, and the HybridSN network architecture;

[0046] The specific operation of the SuperPCA unsupervised feature extraction module is: M×N×D The sample hyperspectral image I is input into the SuperPCA unsupervised feature extraction module, which uses superpixel segmentation and PCA to extract features from the sample hyperspectral image to achieve data dimensionality reduction, outputs a simplified data cube X, and inputs the simplified data cube X into the HybridSN network architecture and the CBAM channel-spatial information enhancement feature module. The scale of the simplified data cube X is X∈R M×N×B .

[0047] The specific operations of step S1 of the rice paraffin pollution detection method based on hyperspectral and deep learning include:

[0048] S1.1. Select rice samples from different origins and different industrial paraffins; mix each different type of rice with each industrial paraffin liquid in different gradients to produce multiple contaminated rice samples, and mark each contaminated rice sample.

[0049] S1.2. Select 60 grains of each contaminated rice sample and arrange the rice in five rows and six columns on a black plastic plate. Use a hyperspectral camera to capture the hyperspectral image of the contaminated rice sample and transfer it to a computer for storage.

[0050] In step S1 of the rice paraffin contamination detection method based on hyperspectral and deep learning, the conditions for obtaining the sample hyperspectral image of the contaminated rice sample are: the spectral characteristic wavelength range is 397-978nm, and the number of spectral bands D is 196.

[0051] like Figure 3 As shown, a rice paraffin pollution detection system based on a rice paraffin pollution detection method based on hyperspectral and deep learning comprises a hyperspectral information acquisition module, an industrial paraffin pollution detection module and an output module;

[0052] The hyperspectral information acquisition module uses a hyperspectral camera to capture the hyperspectral image of the rice to be detected, and pre-processes the hyperspectral image of the rice to be detected and inputs it into the built-in industrial paraffin pollution detection module of the PC;

[0053] The industrial paraffin pollution detection module has a built-in SC-HybridSN deep learning model for distinguishing the paraffin pollution level of rice industry, performs detection processing on the input rice hyperspectral image to be tested, and obtains the paraffin pollution detection result of the rice hyperspectral image to be tested;

[0054] The output module outputs a "polluted" or "non-polluted" mark according to the paraffin pollution detection result of the hyperspectral image of the rice to be tested, thereby completing the industrial paraffin pollution detection of the rice.

[0055] Embodiment 2

[0056] This embodiment provides a verification test of a rice paraffin contamination detection method based on hyperspectral and deep learning. Figure 4 As shown, including:

[0057] Step 1, preparation of contaminated rice samples; select 5 rice samples from different origins, respectively marked as YY, PJ, YL, BJ, DW; select 2 industrial paraffins, respectively marked as PW1, PW2; mix the 5 rice samples marked with YY, PJ, YL, BJ, DW with industrial paraffins PA and PB with different contents of Z to prepare contaminated rice samples, respectively marked as YY+PA+Z, YL+PA+Z, PJ+PA+Z, PJ+PB+Z, BJ+PB+Z, DW+PB+Z; wherein the content of industrial paraffin Z includes 0.0%, 0.1%, 0.2%, 0.3%, 0.4%, 0.5%; the contaminated rice samples total 36 types;

[0058] Step 2: Acquire hyperspectral images of contaminated rice samples. Select 60 grains of each contaminated rice sample, arrange the rice samples in five rows and six columns on a black plastic plate, and use a hyperspectral camera to capture a total of 2160 hyperspectral images of contaminated rice samples. Classify the hyperspectral images of contaminated rice samples with different labels into different industrial paraffin pollution data sets and transfer them to a computer for storage.

[0059] Step 3: Training scenario setting: Based on the production area of ​​the contaminated rice samples and the level of industrial paraffin, whether different samples are mixed, and the ratio of training set to test set, set a single scenario, a multi-source scenario, and a small sample scenario;

[0060] The single scenario refers to dividing any industrial paraffin pollution dataset into a training set and a test set according to a ratio of 7:3;

[0061] The multi-source scenario refers to the mixing of two or more industrial paraffin pollution datasets to form a new multi-source dataset, and then dividing the sample hyperspectral images in the dataset into training and test sets according to a certain ratio;

[0062] The small sample scenario refers to a small sample data set with the ratio of training set to data set set set to 0.05 in the single scenario and multi-source scenario;

[0063] Step 4: Experimental setup: This was implemented in the Pytorch 1.9.0 framework on a Windows 10 machine, and trained and tested on a platform equipped with a 10th generation Intel(R) Core(TM) i7-10750H@2.60GHz CPU and NVIDIA Geforce GTX 1650GPU. Twenty experiments were conducted on each industrial paraffin pollution dataset, multi-source dataset, and each small sample dataset in three scenarios.

[0064] Step 5. Evaluation indicators: Overall accuracy (OA), average accuracy (AA) and Kappa coefficient (Kappa) evaluation indicators were used to judge the performance of rice IPCL classification.

[0065] Step 6. Evaluation of classification results: Using different constructed data sets in three scenarios, the SC-HybridSN model and the original HybridSN architecture, the S-HybridSN improved architecture, the C-HybridSN improved architecture, and the classic architectures such as 2D-CNN and 3D-CNN are used to evaluate the effectiveness of the proposed rice paraffin pollution detection method based on hyperspectral and deep learning for rice paraffin pollution detection. According to the experimental results, in a single scenario, except for 2D-CNN, the overall accuracy OA, average accuracy AA, and Kappa coefficient are all greater than 98%; in a multi-source scenario, the overall accuracy OA of all classification models is above 98.18%. The average accuracy AA is above 97.99%, and the Kappa coefficient is above 97.92%; in a small sample scenario, the overall accuracy OA of the S-HybridSN and SC-HybridSN models is above 97%. The average accuracy AA is above 97%, and the Kappa coefficient is above 96%. In the multi-source scenario, the accuracy of 2D-CNN, 3D-CNN, HybridSN, C-HybridSN, S-HybridSN, and SC-HybridSN are 64.84%, 88.95%, 90.90%, 91.39%, 96.16%, and 97.38%, respectively. The established SC-HybridSN model can still achieve classification accuracy that exceeds traditional methods and outperforms all deep learning classification models used for comparison even when the training samples are extremely limited.

[0066] In the second embodiment, taking the multi-source scenario as an example, the layer type, output graph size and number of parameters of the SC-HybridSN model are:

[0067]

[0068]

[0069] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A rice paraffin pollution detection method based on hyperspectral and deep learning, characterized in that: The following steps are involved: S1. Prepare contaminated rice samples from different production areas, with different types and contents of industrial paraffin, and collect hyperspectral images of all different contaminated rice samples; S2, preprocessing the hyperspectral images of all contaminated rice samples, marking the sample hyperspectral images according to different rice producing areas and different industrial paraffin types during preparation, and constructing multiple industrial paraffin pollution data sets; S3. Combine and divide the multiple industrial paraffin pollution data sets constructed, and set three modeling strategies: single scenario, multi-source scenario, and small sample scenario; S4, using the multiple industrial paraffin pollution data sets obtained in step S2, and the three modeling strategies of single scenario, multi-source scenario and small sample scenario set in step S3, the SC-HybridSN model based on the HybridSN deep learning architecture is trained and verified, and the SC-HybridSN deep learning model for discriminating the paraffin pollution level of rice industry is obtained; S5, obtaining a hyperspectral image of the rice sample to be detected, inputting the hyperspectral image to be detected into the rice industry paraffin pollution level discrimination model obtained in step S4, and obtaining a rice industry paraffin pollution discrimination result; The three modeling strategies in step S3 are set based on whether the multiple industrial paraffin pollution data sets constructed are trained separately and the ratio of the training set to the test set, and then set a single scenario, a multi-source scenario and a small sample scenario; The single scenario refers to dividing any industrial paraffin pollution data set into a training set and a test set according to a certain ratio of sample hyperspectral images in the data set; The multi-source scenario refers to mixing two or more industrial paraffin pollution data sets to form a new multi-source data set, and then dividing the sample hyperspectral images in the multi-source data set into a training set and a test set according to a certain ratio; The small sample scenario refers to a small sample data set in which the ratio of the training set to the data set is set to less than 0.1 in a single scenario and a multi-source scenario; The SC-HybridSN model in step S4 is a model input module and a feature extraction module modified on the basis of the HybridSN deep learning architecture, using the SuperPCA unsupervised feature extraction module and the CBAM channel-spatial information enhancement feature module; the SC-HybridSN model includes the SuperPCA unsupervised feature extraction module, the CBAM channel-spatial information enhancement feature module, and the HybridSN network architecture; The specific operation of the SuperPCA unsupervised feature extraction module is: M×N×D The sample hyperspectral image I is input into the SuperPCA unsupervised feature extraction module, which uses superpixel segmentation and PCA to extract features from the sample hyperspectral image to achieve data dimensionality reduction, outputs a simplified data cube X, and inputs the simplified data cube X into the HybridSN network architecture and the CBAM channel-spatial information enhancement feature module. The scale of the simplified data cube X is X∈R M×N×D .

2. The rice paraffin pollution detection method based on hyperspectral and deep learning according to claim 1, characterized in that, The specific operations of step S1 include: S1.

1. Select rice samples from different origins and different industrial paraffins; mix each different type of rice with each industrial paraffin liquid in different gradients to produce multiple contaminated rice samples, and mark each contaminated rice sample; S1.

2. Select 60 grains of each contaminated rice sample, arrange the rice in five rows and six columns on a black plastic plate, use a hyperspectral camera to capture the hyperspectral image of the contaminated rice sample, and transfer it to a computer for storage.

3. The rice paraffin pollution detection method based on hyperspectral and deep learning according to claim 2, characterized in that, The conditions for obtaining the sample hyperspectral image of the contaminated rice sample in step S1 are: the spectral characteristic wavelength range is 397-978 nm, and the number of spectral bands D is 196.

4. A rice paraffin pollution detection system based on the rice paraffin pollution detection method based on hyperspectral and deep learning according to any one of claims 1-3, characterized in that, The detection system includes a hyperspectral information acquisition module, an industrial paraffin pollution detection module and an output module; The hyperspectral information acquisition module uses a hyperspectral camera to capture the hyperspectral image of the rice to be detected, and pre-processes the hyperspectral image of the rice to be detected and inputs it into the built-in industrial paraffin pollution detection module of the PC; The industrial paraffin pollution detection module has a built-in SC-HybridSN deep learning model for distinguishing the level of paraffin pollution in the rice industry, performs detection processing on the input hyperspectral image of rice to be tested, and obtains the paraffin pollution detection result of the hyperspectral image of rice to be tested; The output module outputs a "polluted" or "non-polluted" mark according to the paraffin pollution detection result of the rice hyperspectral image to be tested, thereby completing the industrial paraffin pollution detection of rice.

Citation Information

Patent Citations

  • Method for gait information processing and identity identification based on fusion feature

    CN101630364A

  • Small sample remote sensing image scene classification method based on double-flow structure

    CN116844040A