Hyperspectral image recognition method for quarantine apple diseases

Through hyperspectral image processing technology and deep learning models, the problem of insufficient accuracy in apple disease identification is solved, and fast and accurate disease classification is achieved, which is suitable for edge device deployment.

CN120766271APending Publication Date: 2025-10-10AGRI GENOMICS INST CHINESE ACADEMY OF AGRI SCI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510898953.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-01
Publication Date
2025-10-10

AI Technical Summary

Technical Problem

There is still room for improvement in the accuracy of existing technologies in identifying apple diseases, especially in the lack of efficiency and accuracy in quickly and accurately identifying the invasion of foreign pests.

Method used

Hyperspectral image processing technology is used to obtain hyperspectral images of apple fruits through professional acquisition equipment. The U2-Net model is used to segment the diseased area, and the ResNet18-CBAM model is combined to reorganize and identify feature bands. An apple fruit disease identification system is constructed to achieve fast and accurate disease classification.

Benefits of technology

It improves the accuracy and efficiency of apple disease identification, reduces hardware resource requirements, facilitates deployment on edge devices, and achieves lossless and rapid intelligent identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120766271A_ABST
    Figure CN120766271A_ABST
Patent Text Reader

Abstract

The invention discloses an apple quarantine disease hyperspectral image recognition method, and relates to the technical field of hyperspectral image processing and disease recognition, and the method comprises the following steps: obtaining a hyperspectral image of an apple quarantine disease by using professional collection equipment; segmenting the hyperspectral image of the apple fruit, and extracting a disease area; preprocessing the extracted image of the disease area; performing wave band dimension reduction processing on the preprocessed hyperspectral image data; recombining the hyperspectral image according to the selected characteristic wave band; dividing the recombined hyperspectral image into a training set, a test set and a verification set; and inputting the image data into a ResNet18-CBAM model for training, and generating a disease recognition model structure and a corresponding weight file. According to the method disclosed by the invention, 76 representative characteristic wavelengths are screened out from the collected 448 spectral wavelengths in combination with spectral separability analysis and are used for subsequent treatment, so that the classification result of the apple diseases is quickly obtained.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of hyperspectral image processing and disease identification, in particular to a hyperspectral image identification method for quarantine diseases of apples. BACKGROUND

[0002] With the continuous development of China's economy and the continuous opening of agricultural trade, China has become one of the world's major fruit importers. Data shows that by 2018, China has approved more than 55 kinds of fruits from 43 countries to enter the domestic market. With the rapid growth of imported fruit types and quantities, the risk of high-frequency invasion of alien harmful organisms has significantly increased, posing a serious challenge to China's agricultural ecological safety and fruit production system.

[0003] Therefore, in view of the growing demand for apple imports, it is urgent to establish a fast and accurate identification method to effectively address the challenges brought about by the continuous expansion of import trade, thereby reducing the risk of invasion of dangerous alien harmful organisms into China's agricultural ecological system.

[0004] Patent CN114819052B discloses an apple disease identification method based on an improved YOLOv5s model. The improved model achieves model lightweight and low storage occupation. The trained improved YOLOv5s model is used to identify target apple disease images, achieving fast identification speed and high identification accuracy.

[0005] The above patent obtains an apple disease dataset and pre-processes the apple disease dataset. The YOLOv5s model is improved to be lightweight. The improved YOLOv5s model is trained based on the pre-processed apple disease dataset. The trained improved YOLOv5s model is used to identify target apple disease images, but the above patent still has room for optimization in disease classification accuracy.

[0006] Therefore, the present application proposes a hyperspectral image identification method for quarantine diseases of apples with high disease classification accuracy. SUMMARY

[0007] The present application aims to provide a hyperspectral image identification method for quarantine diseases of apples to solve the technical problems raised in the background.

[0008] To achieve the above-mentioned purpose, the present application provides the following technical solution: a hyperspectral image identification method for quarantine diseases of apples, comprising the following steps:

[0009] S1, using professional acquisition equipment to obtain hyperspectral images of apple fruit quarantine diseases;

[0010] S2, segmenting the hyperspectral image of apple fruit and extracting the diseased area;

[0011] S3, preprocessing the extracted diseased area image;

[0012] S4, performing band dimensionality reduction processing on the pre-processed hyperspectral image data;

[0013] S5, recombining the hyperspectral image according to the selected characteristic bands;

[0014] S6. Divide the reconstructed hyperspectral image into a training set, a test set, and a validation set;

[0015] S7. Input the image data into the ResNet18-CBAM model for training to generate the disease recognition model structure and corresponding weight file;

[0016] S8. Use the hyperspectral apple fruit disease recognition system to identify the newly collected hyperspectral images of apple fruit diseases and identify the type of disease.

[0017] Preferably, the acquisition equipment is composed of a conveyor belt, a funnel and a hyperspectral camera, and is used to realize automatic transportation of apple fruits and acquisition of hyperspectral images.

[0018] Preferably, the collection objects of the collection device include hyperspectral images of apple fruits infected with apple ring rot, American Australian type pome brown rot and apple black rot, as well as healthy and mechanically damaged apple fruits.

[0019] Preferably, the segmentation uses a trained U2-Net model to accurately segment the hyperspectral image of the apple fruit to extract the apple fruit disease spot area.

[0020] Preferably, the preprocessing includes black and white correction, and the black and white correction is performed based on the following formula:

[0021] Among them, X is the black and white corrected image, Sample is the original image, White is the standard whiteboard reference, and Dark is the blackboard reference.

[0022] Preferably, the preprocessing includes multiple scattering correction, which is performed based on the following formula:

[0023] in, is the original spectrum, is the intercept, is the slope, The spectrum of each sample is With the average spectrum Obtained by linear regression;

[0024] The regression equation is as follows:

[0025] in For each sample spectrum, is the slope of the regression equation, is the intercept.

[0026] Preferably, in the band dimensionality reduction process, 76 spectral wavelengths of interest are selected in nanometers, and data corresponding to the remaining wavelengths are discarded.

[0027] Preferably, the hyperspectral image is reorganized using a function interface provided in the Spectral library to reconstruct image data according to the selected characteristic bands.

[0028] Preferably, the hyperspectral image is divided into a training set of 60%, a test set of 20% and a validation set of 20%.

[0029] Preferably, the ResNet18-CBAM model performs the following operations on the input 224×224×76 hyperspectral image data:

[0030] S71, first enter a 7×7 convolution kernel with a stride of 2 for convolution operation, the number of output channels is 64, then batch normalization and ReLU activation function processing are performed, the output feature map size is 112×112×64;

[0031] S72, input to the maximum pooling layer, the convolution kernel is 3×3, the stride is 2, and the output size is 56×56×64.

[0032] S73, enter the residual layer Layer1, which contains 2 BasicBlock modules with a step size of 1. Each BasicBlock is connected to the CBAM attention mechanism module, and the output size is 56×56×64;

[0033] S74, enter the residual layer Layer2, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 28×28×128. Both BasicBlocks are connected to the CBAM module;

[0034] S75, enter the residual layer Layer3, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 14×14×256. The CBAM module is introduced after both BasicBlocks.

[0035] S76, enter the residual layer Layer4, which contains 2 BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 7×7×512. A CBAM module is added after each BasicBlock;

[0036] S77, after the feature map is extracted by the residual module, it is input into the adaptive average pooling layer, and the output feature size is 1×1×512;

[0037] S78. Perform a flattening operation and input it into the fully connected layer to output the final classification result. The classification results have 5 categories.

[0038] Preferably, the system is capable of segmenting apple diseased areas, preprocessing the diseased areas, recombining hyperspectral images based on characteristic bands, uploading hyperspectral images for identification and outputting apple disease identification results.

[0039] Preferably, the method of use comprises the following steps:

[0040] A1. System initialization and front-end page startup: After the system starts, the front-end interface built based on the Flask framework is initialized and run for user interaction;

[0041] A2. Apple fruit disease area segmentation: Users upload hyperspectral images of apple fruit through the front-end page. The back-end uses the pre-trained U2-Net segmentation model to segment the uploaded image into diseased areas and save the segmented image to a designated folder in the system directory.

[0042] A3. Hyperspectral image preprocessing: Users upload the black and white correction file and the hyperspectral image to be corrected through the front-end page. After receiving the image, the system first performs black and white correction, and then uses multivariate scattering correction technology to preprocess the image and select characteristic bands.

[0043] A4. Feature band recombined hyperspectral image: Users select and upload the target hyperspectral image through the front-end page. The system performs band recombining operations on the uploaded image based on the preset feature band information to generate a hyperspectral image with the feature band combination.

[0044] A5. Display and download of test results: The system classifies and identifies uploaded hyperspectral images based on the trained recognition model, and counts the number of identified diseases of each category. The front-end interface displays the test result information in a list format, including the uploaded file name and the corresponding classification result. Users can download the recognition result file as needed to facilitate subsequent data analysis and storage.

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

[0046] 1. The present invention selects 76 representative characteristic wavelengths from the 448 collected spectral wavelengths, combined with spectral separability analysis, for subsequent processing. Experiments have shown that this band combination is optimal, and any increase or decrease in the number of wavelengths will lead to a decrease in recognition accuracy. The system retains only these 76 characteristic wavelengths and inputs them into the recognition model, which can quickly obtain apple disease classification results.

[0047] 2. The present invention uses a hyperspectral image acquisition device with a conveyor belt to achieve rapid and continuous acquisition of apple fruits, thereby improving the efficiency of data acquisition;

[0048] 3. This invention significantly compresses the amount of hyperspectral data through preprocessing operations, reduces data redundancy, and further improves recognition speed. At the same time, the proposed recognition model structure is lightweight, reducing the hardware resource requirements of the operating equipment, making it easy to deploy on edge devices or embedded systems.

[0049] 4. By combining the constructed apple fruit disease identification client, the present invention allows users to quickly process hyperspectral images and detect diseases, achieving non-destructive, rapid and accurate intelligent identification of apple diseases. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 It is the overall process of apple fruit disease identification based on hyperspectral images;

[0051] Figure 2 Resnet18-CBAM model structure diagram;

[0052] Figure 3 It is a professional device for collecting hyperspectral images;

[0053] Figure 4 is the average spectrum curve of apple fruit diseases;

[0054] Figure 5 It is the confusion matrix diagram of the recognition results of the recognition model. DETAILED DESCRIPTION

[0055] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0056] In the description of the present invention, it should be noted that the terms "upper," "lower," "inner," "outer," "front end," "rear end," "both ends," "one end," "the other end," and the like, indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limiting the present invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0057] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "installed," "provided with," "connected," etc., should be understood in a broad sense. For example, "connected" may refer to a fixed connection, a detachable connection, or an integral connection; it may refer to a mechanical connection or an electrical connection; it may refer to a direct connection or an indirect connection through an intermediate medium; it may refer to internal communication between two components. Those skilled in the art will be able to understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0058] See also Figure 1 and Figure 3 The present invention provides an embodiment of a method for identifying apple quarantine diseases using hyperspectral images, comprising the following steps:

[0059] S1. Use professional data acquisition equipment to obtain hyperspectral images of apple fruit quarantine diseases;

[0060] S2, segmenting the hyperspectral image of apple fruit and extracting the diseased area;

[0061] S3, preprocessing the extracted diseased area image;

[0062] S4, performing band dimensionality reduction processing on the pre-processed hyperspectral image data;

[0063] S5, recombining the hyperspectral image according to the selected characteristic bands;

[0064] S6. Divide the reconstructed hyperspectral image into a training set, a test set, and a validation set;

[0065] S7. Input the image data into the ResNet18-CBAM model for training to generate the disease recognition model structure and corresponding weight file;

[0066] S8. Using the hyperspectral apple fruit disease recognition system, the newly collected hyperspectral images of apple fruit diseases are identified to identify the disease types.

[0067] The collection equipment consists of a conveyor belt, a funnel and a hyperspectral camera, and is used to realize automatic transportation of apple fruits and acquisition of hyperspectral images;

[0068] The acquisition objects of the acquisition device include hyperspectral images of apple fruits infected with apple ring rot, American-Australian pome brown rot and apple black rot, as well as healthy and mechanically damaged apple fruits;

[0069] The segmentation uses a trained U2-Net model to accurately segment the hyperspectral image of the apple fruit to extract the apple fruit lesion area;

[0070] Furthermore, apple fruits infected with apple ring rot, American-Australian brown rot and black rot of apples, as well as healthy and mechanically damaged apple fruits, were placed flat on the conveyor belt of the collection equipment; hyperspectral images of apple fruits were taken with a hyperspectral camera, with an image size of 448×1024×857. When training the segmentation model U2-Net, the diseased areas of the PNG format images of apple fruits were manually annotated. A total of 200 images were annotated for each type of disease, and they were divided into training set, test set and validation set in a ratio of 6:2:2. The EISeg image segmentation tool provided by the Baidu PaddlePaddle platform was used to generate training set and test set data for segmenting the diseased areas of hyperspectral images; in the training of the U2net segmentation model for the PNG images of the diseased areas of apple fruits, the number of training rounds was set to 100, and finally a model for segmenting the diseased areas of apples was obtained to support the rapid segmentation processing of subsequent images; all hyperspectral image data were cropped using Python 3.9 The image background is removed using the Torch library. The specific method is to perform matrix operations on the hyperspectral image and the corresponding segmentation result file to remove the image background and only retain the target area.

[0071] When recombining the hyperspectral image based on the selected characteristic bands, the hyperspectral image needs to be further cropped into a minimum square after removing the background. This cropping operation is implemented using Python 3.9. The specific steps are as follows: first, determine the upper, lower, left, and right outermost pixel coordinates of the sample area in the image to obtain the minimum circumscribed rectangular outline of the target area; then, based on the long side of the rectangle, evenly fill the background area with a pixel value of 0 on both sides of the short side to form a square image with consistent side length. Finally, a standardized hyperspectral image centered on the apple sample is obtained.

[0072] See also Figure 1 、 Figure 4 and Figure 5 The present invention provides an embodiment of a hyperspectral image recognition method for apple quarantine diseases, wherein the preprocessing includes black and white correction, and the black and white correction is performed based on the following formula:

[0073]

[0074] Among them, X is the black and white corrected image, Sample is the original image, White is the standard whiteboard reference, and Dark is the blackboard reference;

[0075] The preprocessing includes multiple scatter correction, which is performed based on the following formula:

[0076]

[0077] in, is the original spectrum, is the intercept, is the slope, The spectrum of each sample is With the average spectrum Obtained by linear regression;

[0078] The regression equation is as follows:

[0079]

[0080] in For each sample spectrum, is the slope of the regression equation, is the intercept;

[0081] Furthermore, all hyperspectral image data are subjected to black and white correction to remove the parts with larger noise. By calculating the average value of each pixel, a black and white corrected image is generated to eliminate the influence of uneven illumination. After the black and white corrected image, the average spectrum is extracted and the average spectrum data is saved in a file format such as CSV or Excel for subsequent processing. The average spectrum data file is imported and the bands to be processed are identified. The multiple scattering correction algorithm is applied to eliminate the multivariate scattering effect by constructing a correction model based on the mean. The black and white corrected data is subjected to multiple scattering correction to eliminate the spectral differences caused by different scattering levels during the hesitant spectral measurement process and enhance the correlation between the spectrum and the data. The spectral data file processed by multiple scattering correction makes the features more prominent and easy to screen feature bands.

[0082] See also Figure 1 , an embodiment provided by the present invention: a hyperspectral image recognition method for apple quarantine diseases, wherein 76 spectral wavelengths of interest are selected in the band dimensionality reduction process, with the unit being nanometers, and the data corresponding to the remaining wavelengths are discarded;

[0083] The hyperspectral image is reorganized using the function interface provided in the Spectral library to reconstruct the image data according to the selected characteristic bands;

[0084] The hyperspectral image is divided according to a training set of 60% and a test set of 20%;

[0085] Further, the data after the multiple scattering correction processing is subjected to band screening, CARS algorithm is adopted to determine which wavelengths are most important for the hyperspectral image recognition, and the accuracy and effectiveness of the hyperspectral data analysis are improved, the screened spectral wavelengths are: 1004.52, 970.73, 939.88, 909.13, 881.28, 854.91, 830.0, 806.54, 783.15, 762.57, 742.03, 724.28, 705.21, 688.9, 672.62, 657.72, 644.21, 630.71, 617.24, 606.48, 594.4, 583.67, 574.3, 563.59, 555.58, 546.24, 538.24, 530.25, 523.6, 516.95, 510.31, 503.68, 498.38, 493.08, 487.78, 482.49, 478.52, 473.24, 469.28, 465.32, 461.36, 458.72, 454.77, 452.13, 448.18, 445.55, 442.92, 440.29, 437.66, 436.34, 433.71, 432.4, 429.77, 428.46, 425.83, 424.52, 423.21, 421.9, 420.58, 419.27, 417.96, 416.65, 415.34, 414.03, 412.72, 411.41, 410.1, 408.79, 407.48, 406.17, 404.86, 403.55, 402.24, 400.93, 399.63, 398.32, a total of 76 wavelengths; then a function provided by the Spectral library is used to screen the characteristic wave bands from the hyperspectral data, and a new hyperspectral image is composed, and the reorganized hyperspectral image is divided into data sets according to a training set, a test set and a validation set in a ratio of 6:2:2.

[0086] Please refer to Figure 1 and Figure 2In one embodiment of the present invention, a method for recognizing apple quarantine diseases using hyperspectral images is provided. The ResNet18-CBAM model performs the following operations on the input 224×224×76 hyperspectral image data:

[0087] S71, first enter a 7×7 convolution kernel with a stride of 2 for convolution operation, the number of output channels is 64, then batch normalization and ReLU activation function processing are performed, the output feature map size is 112×112×64;

[0088] S72, input to the maximum pooling layer, the convolution kernel is 3×3, the stride is 2, and the output size is 56×56×64.

[0089] S73, enter the residual layer Layer1, which contains 2 BasicBlock modules with a step size of 1. Each BasicBlock is connected to the CBAM attention mechanism module, and the output size is 56×56×64;

[0090] S74, enter the residual layer Layer2, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 28×28×128. Both BasicBlocks are connected to the CBAM module;

[0091] S75, enter the residual layer Layer3, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 14×14×256. The CBAM module is introduced after both BasicBlocks.

[0092] S76, enter the residual layer Layer4, which contains 2 BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 7×7×512. A CBAM module is added after each BasicBlock;

[0093] S77, after the feature map is extracted by the residual module, it is input into the adaptive average pooling layer, and the output feature size is 1×1×512;

[0094] S78, perform a flattening operation and input it into the fully connected layer, outputting the final classification result. The classification results have 5 categories;

[0095] Furthermore, the data and corresponding labels used as the training set are input into the recognition model of apple fruit diseases, and the training steps of the apple fruit disease recognition model are established. The spectral data and corresponding labels used as the validation set are input into the established recognition model to evaluate the recognition performance of the model. The test set is input into the saved model, and the corresponding disease category is output. It is compared with the real label to obtain the model effect.

[0096] See also Figure 1 , an embodiment of the present invention provides: a hyperspectral image recognition system for apple quarantine diseases, the system can segment apple disease areas, pre-process the diseased areas, reconstruct hyperspectral images based on characteristic bands, upload hyperspectral images for recognition and output apple disease recognition results;

[0097] A method for using a hyperspectral image recognition system for apple quarantine diseases, the method comprising the following steps:

[0098] A1. System initialization and front-end page startup: After the system starts, the front-end interface built based on the Flask framework is initialized and run for user interaction;

[0099] A2. Apple fruit disease area segmentation: Users upload hyperspectral images of apple fruit through the front-end page. The back-end uses the pre-trained U2-Net segmentation model to segment the uploaded image into diseased areas and save the segmented image to a designated folder in the system directory.

[0100] A3. Hyperspectral image preprocessing: Users upload the black and white correction file and the hyperspectral image to be corrected through the front-end page. After receiving the image, the system first performs black and white correction, and then uses multivariate scattering correction technology to preprocess the image and select characteristic bands.

[0101] A4. Feature band recombined hyperspectral image: Users select and upload the target hyperspectral image through the front-end page. The system performs band recombining operations on the uploaded image based on the preset feature band information to generate a hyperspectral image with the feature band combination.

[0102] A5. Display and download of test results: The system classifies and identifies uploaded hyperspectral images based on the trained recognition model, and counts the number of identified diseases in each category. The front-end interface displays the test results in a list format, including the uploaded file name and the corresponding classification result. Users can download the recognition result file as needed to facilitate subsequent data analysis and storage.

[0103] Further, the system includes four functions: segmenting apple disease area, disease area preprocessing, reorganizing hyperspectral images according to characteristic wavebands, uploading hyperspectral images for recognition and obtaining apple disease recognition results; the client uses Flask to build a front-end page, processes the hyperspectral images uploaded by the user, communicates with the back-end deep learning model to obtain the detection results, and presents the results to the user. Flask is a lightweight web framework;

[0104] The system operation process is as follows:

[0105] Step 1: The terminal inputs python apple.py to initialize the system: clear the previously uploaded data file, and start the local server, the server address is http: / / 127.0.0.1:5000 / , enter the server address in the browser page to open the front-end page of the system;

[0106] Step 2: In the front-end page, select the model file, HDR file and IMG file to be uploaded. Ensure that the uploaded file format is correct;

[0107] Step 3: Click the "Upload" button, the system will start processing the uploaded file, and use the loaded model to make predictions;

[0108] Step 4: After processing, the results will be displayed on the page, including the prediction label of each HDR file;

[0109] Step 5: As needed, you can download the processing results or continue to upload other files. If you need to use the system again, repeat step 1.

[0110] Working principle: First, the hyperspectral image of the apple fruit is obtained through automatic acquisition equipment, and the design of the combination of the conveyor belt and the hyperspectral camera realizes the continuous conveying of the sample and the synchronous acquisition of multi-waveband data; then, the U2-Net model is used to segment the disease area, and through preprocessing methods such as black and white correction and multivariate scatter correction, light interference and background noise are eliminated, and at the same time, 76 key spectral wavelengths are selected through waveband dimension reduction, and low-redundancy hyperspectral data containing disease characteristic information are reconstructed; this process condenses hundreds of original wavebands into core spectral features representing disease differences, providing high-quality input for subsequent classification;

[0111] Next, the constructed ResNet18-CBAM deep learning model performs multi-level feature extraction on the preprocessed 224×224×76 three-dimensional hyperspectral data. This model uses a residual structure to alleviate the vanishing gradient problem and combines channel and spatial attention mechanisms to enhance the characteristic response of the diseased area. In the four-layer residual module, step-by-step downsampling is used to extract abstract features. The adaptive pooling layer maps the features into 512-dimensional vectors, and finally a fully connected layer outputs the classification probabilities of the five disease categories. The training process adopts a three-stage data partitioning strategy: 60% training set, 20% validation set, and 20% test set. Backpropagation is used to optimize network weights to ensure the model has strong generalization capabilities.

[0112] Finally, during the deployment phase, the recognition system built on the Flask framework implements an end-to-end processing flow. The hyperspectral images uploaded by users are sequentially segmented, preprocessed, and band reorganized before being input into the trained model. The system automatically parses the classification results and displays the disease categories and statistical information in a visual interface. This technology reveals subtle spectral differences in diseases through hyperspectral imaging, and combines it with an improved deep learning architecture to achieve efficient recognition, providing a non-destructive, high-precision automated detection method for apple quarantine, significantly improving the efficiency and accuracy of disease screening.

[0113] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A hyperspectral image recognition method for apple quarantine diseases, characterized in that: The following steps are involved: S1. Use professional data acquisition equipment to obtain hyperspectral images of apple fruit quarantine diseases; S2, segmenting the hyperspectral image of apple fruit and extracting the diseased area; S3, preprocessing the extracted diseased area image; S4, performing band dimensionality reduction processing on the pre-processed hyperspectral image data; S5, recombining the hyperspectral image according to the selected characteristic bands; S6. Divide the reconstructed hyperspectral image into a training set, a test set, and a validation set; S7. Input the image data into the ResNet18-CBAM model for training to generate the disease recognition model structure and corresponding weight file; S8. Use the hyperspectral apple fruit disease recognition system to identify the newly collected hyperspectral images of apple fruit diseases and identify the type of disease.

2. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The collection equipment consists of a conveyor belt, a funnel and a hyperspectral camera, and is used to realize automatic transportation of apple fruits and collection of hyperspectral images.

3. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The acquisition objects of the acquisition device include hyperspectral images of apple fruits infected with apple ring rot, American-Australian pome brown rot and apple black rot, as well as healthy and mechanically damaged apple fruits.

4. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The segmentation uses a trained U2-Net model to accurately segment the hyperspectral image of the apple fruit to extract the apple fruit lesion area.

5. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The preprocessing includes black and white correction, which is performed based on the following formula: Among them, X is the black and white corrected image, Sample is the original image, White is the standard whiteboard reference, and Dark is the blackboard reference.

6. The hyperspectral image recognition method for apple quarantine diseases according to claim 4, characterized in that: The preprocessing includes multiple scatter correction, which is performed based on the following formula: in, is the original spectrum, is the intercept, is the slope, The spectrum of each sample is With the average spectrum Obtained by linear regression; The regression equation is as follows: in For each sample spectrum, is the slope of the regression equation, is the intercept.

7. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: In the band dimensionality reduction process, 76 spectral wavelengths of interest are selected, with the unit being nanometers, and the data corresponding to the remaining wavelengths are discarded.

8. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The hyperspectral image is reorganized using a function interface provided in the Spectral library to reconstruct image data based on the selected characteristic bands.

9. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The hyperspectral image is divided into a training set of 60%, a test set of 20% and a validation set of 20%.

10. The hyperspectral image recognition method for apple quarantine diseases according to claim 1, characterized in that: The ResNet18-CBAM model performs the following operations on the input 224×224×76 hyperspectral image data: S71, first enter a 7×7 convolution kernel with a stride of 2 for convolution operation, the number of output channels is 64, then batch normalization and ReLU activation function processing are performed, the output feature map size is 112×112×64; S72, input to the maximum pooling layer, the convolution kernel is 3×3, the stride is 2, and the output size is 56×56×64. S73, enter the residual layer Layer1, which contains 2 BasicBlock modules with a step size of 1. Each BasicBlock is connected to the CBAM attention mechanism module, and the output size is 56×56×64; S74, enter the residual layer Layer2, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 28×28×128. Both BasicBlocks are connected to the CBAM module; S75, enter the residual layer Layer3, which contains two BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 14×14×256. The CBAM module is introduced after both BasicBlocks. S76, enter the residual layer Layer4, which contains 2 BasicBlock modules. The first module has a stride of 2 to achieve downsampling, and the output size is 7×7×512. A CBAM module is added after each BasicBlock; S77, after the feature map is extracted by the residual module, it is input into the adaptive average pooling layer, and the output feature size is 1×1×512; S78. Perform a flattening operation and input it into the fully connected layer to output the final classification result. The classification results have 5 categories.

11. A hyperspectral image recognition system for apple quarantine diseases, comprising the hyperspectral image recognition method for apple quarantine diseases according to any one of claims 1 to 10, characterized in that: The system can segment apple disease areas, pre-process the diseased areas, reconstruct hyperspectral images based on characteristic bands, upload hyperspectral images for identification and output apple disease identification results.

12. A method for using a hyperspectral image recognition system for apple quarantine diseases, applicable to the hyperspectral image recognition system for apple quarantine diseases according to claim 11, characterized in that: The method of use comprises the following steps: A1. System initialization and front-end page startup: After the system starts, the front-end interface built based on the Flask framework is initialized and run for user interaction; A2. Apple fruit disease area segmentation: Users upload hyperspectral images of apple fruit through the front-end page. The back-end uses the pre-trained U2-Net segmentation model to segment the uploaded image into diseased areas and save the segmented image to a designated folder in the system directory. A3. Hyperspectral image preprocessing: Users upload the black and white correction file and the hyperspectral image to be corrected through the front-end page. After receiving the image, the system first performs black and white correction, and then uses multivariate scattering correction technology to preprocess the image and select characteristic bands. A4. Feature band recombined hyperspectral image: Users select and upload the target hyperspectral image through the front-end page. The system performs band recombining operations on the uploaded image based on the preset feature band information to generate a hyperspectral image with the feature band combination. A5. Display and download of test results: The system classifies and identifies uploaded hyperspectral images based on the trained recognition model, and counts the number of identified diseases of each category. The front-end interface displays the test result information in a list format, including the uploaded file name and the corresponding classification result. Users can download the recognition result file as needed to facilitate subsequent data analysis and storage.