Apple moldy core detection method and system and storage medium
By correcting the original spectrum of apples across the entire spectrum and using a dual-output classification model for detection and prediction, the problem of low accuracy in detecting apple core rot in existing technologies has been solved, achieving efficient detection of core rot and prediction of soluble solids content.
Patent Information
- Application Number
- CN202610002599.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2046-01-05
AI Technical Summary
The accuracy of apple core rot detection in existing technologies is low, mainly because the scattering and absorption effects of near-infrared light in apples increase with fruit size, resulting in poor detection results.
By performing full-band correction on the original spectrum of the apple to be tested, and inputting the corrected spectrum into a pre-trained dual-output classification model, the detection of core rot and prediction of soluble solids content are achieved. The dual-output classification model is used for spectral feature extraction and feature sample classification. Combined with model loss function optimization, accurate detection of core rot and prediction of soluble solids content in apples are realized.
It improves the accuracy of apple core rot detection, effectively identifies mold and simultaneously predicts soluble solids content, meeting the requirements of online detection.
Smart Images

Figure CN121453699A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of non-destructive testing technology for agricultural products, and in particular to a method, system, and storage medium for detecting apple core rot. Background Technology
[0002] Core rot is one of the major fruit diseases of apples, caused by a combination of pathogens. The disease is characterized by pathogens causing rot from the center of the fruit outwards, gradually rotting the flesh. In the early stages, the apple's exterior remains intact, showing no symptoms. To ensure apple quality, the detection of core rot is receiving increasing attention.
[0003] Current methods for detecting apple core rot generally rely on direct analysis of the near-infrared spectral characteristics of apples. However, when near-infrared light propagates within the apple, it undergoes scattering and absorption. Furthermore, the light absorption effect becomes more pronounced as the fruit size increases, resulting in low accuracy for apple core rot detection based on direct near-infrared spectral analysis. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, and storage medium for detecting apple core rot, in order to solve the problem of low accuracy in the detection of apple core rot in the prior art.
[0005] The present invention is implemented as follows: a method for detecting apple core rot, the method comprising: The spectrum of the apple to be tested is acquired to obtain the original spectrum, and the original spectrum is corrected in all bands to obtain the corrected spectrum; The modified spectrum was input into the pre-trained dual-output classification model to detect moldy core disease and predict soluble solids content, respectively, to obtain the detection results and content prediction results of moldy core disease. The soluble solids content is determined based on the results of the moldy core detection and the content prediction results. The formulas used to perform full-band correction on the original spectrum include: in, This indicates the apple to be detected. i The corrected spectrum, Represents the unit step function. This represents the first proportionality coefficient. This represents the second proportionality coefficient. This represents the original spectrum. Indicates the band range. This represents the exponential decay coefficient when the wavelength range is greater than 710 nm. This represents the exponential attenuation coefficient when the wavelength range is less than 710 nm. This represents the difference between the reference fruit diameter and the diameter of the apple to be tested. This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm. This indicates the extinction coefficient of the apple to be tested in the wavelength range before 710 nm. This indicates the diameter of the apple to be tested.
[0006] Preferably, the formula used for full-band correction of the original spectrum further includes: in, This represents the input value of the unit step function; in, express The magnitude of the extinction coefficient at 710 nm express The magnitude of the extinction coefficient at 710 nm.
[0007] Preferably, before inputting the corrected spectrum into the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, the method further includes: The spectrum of the apple sample is acquired to obtain a spectral sample, and the spectral sample is corrected across the entire spectrum to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
[0008] Preferably, determining the model loss based on the sample classification result, the predicted sample content, and the predicted soluble solids content includes: Obtain the standard classification results, standard content prediction values, and standard soluble solids content prediction values, and calculate the first loss based on the sample classification results and the standard classification results; A second loss is calculated based on the predicted value of the sample content and the predicted value of the standard content, and a third loss is calculated based on the predicted value of the soluble solids content and the predicted value of the standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss.
[0009] Preferably, the apple to be tested undergoes spectral acquisition to obtain the raw spectrum, including: The near-infrared spectral acquisition device was used to collect the spectrum of the apple to be tested. The light source of the near-infrared spectral acquisition device included two rows of halogen lamps with parameters of 12V and 100W. The lamps were preheated for 30 minutes before spectral acquisition. The detection speed of the near-infrared spectral acquisition device was set to 0.5 m / s and the exposure time was 100 ms.
[0010] Another objective of this invention is to provide an apple core rot detection system, the system comprising: The full-band correction module is used to acquire the spectrum of the apple to be tested, obtain the original spectrum, and perform full-band correction on the original spectrum to obtain the corrected spectrum. The core rot detection module is used to input the corrected spectrum into the pre-trained dual-output classification model to perform core rot detection and soluble solids content prediction, respectively, to obtain core rot detection results and content prediction results; The content prediction module is used to determine the soluble solids content detection value based on the core rot detection result and the content prediction result; The formulas used to perform full-band correction on the original spectrum include: in, This indicates the apple to be detected. i The corrected spectrum, Represents the unit step function. This represents the first proportionality coefficient. This represents the second proportionality coefficient. This represents the original spectrum. Indicates the band range. This represents the exponential decay coefficient when the wavelength range is greater than 710 nm. This represents the exponential attenuation coefficient when the wavelength range is less than 710 nm. This represents the difference between the reference fruit diameter and the diameter of the apple to be tested. This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm. This indicates the extinction coefficient of the apple to be tested in the wavelength range before 710 nm. This indicates the diameter of the apple to be tested.
[0011] Preferably, the core rot detection module is further used for: The spectrum of the apple sample is acquired to obtain a spectral sample, and the spectral sample is corrected across the entire spectrum to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
[0012] Preferably, the core rot detection module is further used for: Obtain the standard classification results, standard content prediction values, and standard soluble solids content prediction values, and calculate the first loss based on the sample classification results and the standard classification results; A second loss is calculated based on the predicted value of the sample content and the predicted value of the standard content, and a third loss is calculated based on the predicted value of the soluble solids content and the predicted value of the standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss.
[0013] In this embodiment of the invention, by performing full-band correction on the original spectrum, the influence of light absorption effect on the original spectrum is effectively reduced, the accuracy of the original spectrum is improved, and thus the accuracy of apple core rot detection is improved. By inputting the corrected spectrum into the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, the system can effectively identify whether the apple to be tested has become moldy and can simultaneously predict the soluble solids content of the apple to be tested. Attached Figure Description
[0014] Figure 1 This is a flowchart of the apple core rot detection method provided in the first embodiment of the present invention; Figure 2 This is a schematic diagram of the relationship curve between the characteristic band light intensity and the fruit diameter provided in the first embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the dual-output classification model provided in the first embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of the apple core rot detection system provided in the second embodiment of the present invention; Figure 5 This is a schematic diagram illustrating a specific implementation of the apple core rot detection system provided in the second embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of the terminal device provided in the third embodiment of the present invention. Detailed Implementation
[0015] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0016] To illustrate the technical solution described in this invention, specific embodiments are described below.
[0017] Example 1 Please see Figure 1 This is a flowchart of the apple core rot detection method provided in the first embodiment of the present invention. This apple core rot detection method can be applied to any device or system, and includes the following steps: Step S10: Collect the spectrum of the apple to be tested to obtain the original spectrum, and perform full-band correction on the original spectrum to obtain the corrected spectrum; The process of acquiring the original spectrum of the apple to be tested includes: using a near-infrared spectral acquisition device to acquire the spectrum of the apple. This near-infrared spectral acquisition device is a dynamic online diffuse transmission detection device with two rows of halogen lamps, five in each row, for a total of ten. The halogen lamps have parameters of 12 V and 100 W, providing the light source for collecting spectral information in diffuse transmission mode. The device is preheated for 30 minutes before acquisition, the detection speed is set to 0.5 m / s, and the exposure time is 100 ms. In this step, by performing full-band correction on the original spectrum, the influence of light absorption on the original spectrum is effectively reduced, improving the accuracy of apple core rot detection.
[0018] In this embodiment, at a given wavelength, the extinction rate of light entering the apple is approximately an exponential decay function, which can be expressed by the formula: The average extinction coefficient across the entire wavelength range. d The size of an apple's diameter. It indicates the intensity of the light before transmission. This represents the intensity of the transmitted light.
[0019] For example, the two depths inside an apple and The spectral intensities at these locations are respectively and ,right and The corresponding exponential decay functions are subtracted after taking ln: Substituting the reference, the spectrum of each sample, and the diameter into the above equation and performing an inverse transformation, the average extinction coefficient is obtained. Its formula is: For reference spectrum, For Apple i The original spectrum, For reference fruit diameter, For Apple i The fruit diameter, where n is the total number of samples; Optionally, the formula used to perform full-band correction on the original spectrum includes: in, This indicates the apple to be detected. i The corrected spectrum, Represents the unit step function. This represents the first proportionality coefficient. This represents the second proportionality coefficient. This represents the original spectrum. Indicates the band range. This represents the exponential decay coefficient when the wavelength range is greater than 710 nm. This represents the exponential attenuation coefficient when the wavelength range is less than 710 nm. This represents the difference between the reference fruit diameter and the diameter of the apple to be tested. This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm. This indicates the extinction coefficient of the apple to be tested in the wavelength range before 710 nm. This indicates the diameter of the apple to be tested.
[0020] Specifically, in the wavelength range after 710 nm (including 710 nm), the spectral intensity monotonically decreases with increasing diameter, closely resembling the relationship based on the exponential function-based extinction coefficient method. According to the propagation characteristics of light in a medium, this change can be described by an exponential decay function, which has the following form: In the wavelength range before 710 nm (excluding 710 nm), the spectral intensity exhibits a nonlinear growth followed by a decay with respect to diameter, displaying a symmetrical exponential relationship. The inflection point of this trend on diameter is approximately 80 mm, close to... To accurately describe this trend, a piecewise function is required: When the diameter is less than 80 mm, the light intensity increases exponentially with increasing diameter, as shown in the formula: when When the value is 0, the spectrum is not corrected in any way; the corrected light intensity is equal to the measured light intensity. Therefore, =0, = Substituting these values, we get a = 1 and b = 2. The final formula for diameters less than 80 mm is: Since any spectrum is continuous, the intensity of light corrected at 710 nm for an apple with a diameter less than 80 mm must be equal in both bands before and after 710 nm. Using the correction magnitude after 710 nm (including 710 nm) as a benchmark, a scaling factor is introduced into the correction function for the correction function before 710 nm (excluding 710 nm). So that it satisfies the following at 710 nm: in, express The magnitude of the extinction coefficient at 710 nm express The magnitude of the extinction coefficient at 710 nm This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm.
[0021] Solving for: When the diameter is greater than 80 mm, because the light intensity before wavelength 710 nm (excluding 710 nm) has a symmetrical exponential relationship with the diameter, the function for a diameter greater than 80 mm is symmetrical about 80 mm as the function for a diameter less than 80 mm. Therefore, the formula for a diameter greater than 80 mm is: Similarly, the proportionality factor for diameters greater than 80 mm is... The formula is: Substituting the average extinction coefficient into the mapping relationship, and further, to achieve a unified expression across different wavebands and diameter ranges, a unit step function is introduced, defined as: in, This represents the input value of the unit step function.
[0022] Step S20: Input the corrected spectrum into the pre-trained dual-output classification model to perform core rot detection and soluble solids content prediction, respectively, to obtain core rot detection results and content prediction results; A single-input dual-output classification model (CNN dual-response model) was designed to distinguish between moldy core disease in apple samples (classification task) and predict soluble solids content (regression task). Considering that only the presence of moldy core disease is required in practical applications, the classification task is set to two labels: healthy and moldy. The dual-output classification model adopts a dual-branch architecture to handle the classification and regression tasks separately. In the classification branch, the model extracts classification features from spectral data through a cascaded structure of one-dimensional convolutional layers (Conv1D) and max pooling layers (MaxPooling). The feature dimensionality reduction process is implemented through a Flatten layer, and then the data is passed to a fully connected layer (Dense) to further mine higher-level feature representations. The classification output layer uses the "sigmoid" activation function to generate classification probability values and uses the "argmax(0.5)" threshold to determine the sample category (healthy or moldy core). The regression branch, building upon the shared feature extraction layer, employs deeper convolutional and pooling structures to focus on extracting features related to core rot and soluble solids concentration (SSC) prediction. The output layer uses a linear activation function to generate continuous SSC predictions. To prevent overfitting and enhance model generalization, a dropout layer is introduced between fully connected layers, with a neuron dropout probability of 0.25. Except for the output layer, all hidden layers use the ReLU activation function to enhance the model's non-linear expressive power. By inputting the corrected spectrum into the CNN dual-response model, both discrimination and prediction tasks can be handled simultaneously.
[0023] To predict only the SSC of healthy apples, an innovative labeling scheme was adopted in the data processing strategy: the classification label for healthy apples was set to 1, and the SSC value was the actual measured value; the classification label for apples with moldy core was set to 0, and their SSC value was uniformly set to 0. Therefore, the classification branch outputs the binary classification result (0 or 1) after processing with "argmax(0.5)", while the regression branch outputs the product of the classification result and the predicted SSC value. This mechanism achieves conditional output: when an apple is judged to be healthy, the regression branch outputs the predicted SSC value; if the apple is judged to be moldy core, the regression branch outputs 0.
[0024] Optionally, before inputting the corrected spectrum into the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, the method further includes: The spectrum of the apple sample is acquired to obtain a spectral sample, and the spectral sample is corrected across the entire spectrum to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
[0025] Further, the model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content, including: Obtain standard classification results, standard content prediction values, and standard soluble solids content prediction values, and calculate a first loss based on the sample classification results and the standard classification results; wherein, the first loss is calculated based on the result similarity between the sample classification results and the standard classification results. A second loss is calculated based on the predicted sample content and the predicted standard content, and a third loss is calculated based on the predicted soluble solids content and the predicted standard soluble solids content; wherein, the second loss is calculated based on the content similarity between the predicted sample content and the predicted standard content, and the third loss is calculated based on the prediction similarity between the predicted soluble solids content and the predicted standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss; wherein, during the weighting process, the weighting coefficients of each loss can be set according to requirements.
[0026] Step S30: Determine the soluble solids content detection value based on the core rot detection results and the content prediction results; In this process, the determination of whether the apple to be tested has become moldy is based on the results of the core rot detection. The classification result in the core rot detection result is multiplied by the content value in the content prediction result to obtain the soluble solids content of the apple to be tested.
[0027] Specifically, in this embodiment, 300 apples out of 600 were randomly injected with pathogens for artificial infection and stored at room temperature for 7 days. 300 healthy apples and 300 moldy apples were then collected and numbered to obtain sample apples.
[0028] Near-infrared spectroscopy was used to collect the spectra of apple samples. Five characteristic bands (650 nm, 673 nm, 710 nm, 755 nm and 810 nm) of all samples were selected, and the intermediate band of 692 nm was added. A graph was plotted with apple diameter as the horizontal axis and spectral intensity as the vertical axis. Based on the extinction coefficient method, a fitting analysis was performed to obtain the mapping relationship between spectral range and size compensation parameters.
[0029] The acquired spectra are corrected, and the corrected spectra are fed into the CNN dual-response model to handle both discrimination and prediction tasks. The model structure is as follows: Figure 3 As shown, the model's processing mechanism is as follows: the classification branch outputs a binary classification result (0 or 1), while the regression branch outputs the product of the classification result and the predicted SSC value. This mechanism implements conditional output: when a sample is judged to be healthy, the regression branch outputs the predicted SSC value; if the sample is judged to have moldy heart disease, the regression branch outputs 0. The evaluation metrics for moldy heart disease discrimination are precision, recall, accuracy, and F1 score. Recall and precision are calculated with moldiness as a positive class reference. The evaluation metrics for SSC prediction are the coefficient of determination (R²), root mean square error (RMSE), and residual prediction bias (RPD).
[0030] The corrected average spectral density for different fruit diameters showed a significant reduction in longitudinal light intensity differences compared to the uncorrected values, achieving effective correction across the entire wavelength range. Dual-response discrimination and prediction results: Table 1 shows the model performance in two aspects: core rot discrimination and SSC prediction for healthy samples. In the core rot discrimination task, the model achieved accuracy, recall, precision, and F1 score of 0.98, 0.97, 1.00, and 0.98, respectively, on the validation data. In SSC prediction, the predicted R² reached 0.96, the RMSE was only 0.97, and the RPD was 1.84. This further demonstrates that the model has good detection capabilities for moldy samples and SSC prediction capabilities, which is crucial for reducing the harm of missed detections.
[0031] Table 1: In this embodiment, by performing full-band correction on the original spectrum, the influence of light absorption effect on the original spectrum is effectively reduced, improving the accuracy of the original spectrum and thus improving the accuracy of apple core rot detection. By inputting the corrected spectrum into the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, it can effectively identify whether the apple to be tested has become moldy and simultaneously predict the soluble solids content of the apple to be tested. This embodiment only requires the collection of sample spectra to complete full-band spectral correction and achieve simultaneous detection of apple core rot and healthy apple SSC, and the effect can meet the requirements of online detection.
[0032] Example 2 Please see Figure 4 This is a schematic diagram of the structure of the apple core rot detection system 100 provided in the second embodiment of the present invention, including: The full-band correction module 10 is used to acquire the spectrum of the apple to be tested, obtain the original spectrum, and perform full-band correction on the original spectrum to obtain the corrected spectrum.
[0033] Optionally, the full-band correction module 10 is also used to: use a near-infrared spectral acquisition device to acquire the spectrum of the apple to be tested, wherein the light source of the near-infrared spectral acquisition device includes two rows of halogen lamps with parameters of 12V and 100W, and is preheated for 30 min before spectral acquisition, and the detection speed of the near-infrared spectral acquisition device is set to 0.5 m / s and the exposure time is 100 ms.
[0034] The core rot detection module 11 is used to input the corrected spectrum into the pre-trained dual-output classification model to perform core rot detection and soluble solids content prediction, respectively, to obtain core rot detection results and content prediction results.
[0035] Optionally, the core rot detection module 11 is further configured to: acquire the spectrum of the apple sample to obtain a spectral sample, and perform full-band correction on the spectral sample to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
[0036] Furthermore, the moldy core detection module 11 is also used to: obtain standard classification results, standard content prediction values and standard soluble solids content prediction values, and calculate the first loss based on the sample classification results and the standard classification results; A second loss is calculated based on the predicted value of the sample content and the predicted value of the standard content, and a third loss is calculated based on the predicted value of the soluble solids content and the predicted value of the standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss.
[0037] The content prediction module 12 is used to determine the soluble solids content detection value based on the core rot detection result and the content prediction result.
[0038] Please see Figure 5 Apples of different diameters were placed in a near-infrared spectral acquisition device to obtain the original spectra. The original spectra were then corrected across the entire spectrum using a segmented extinction correction method. The corrected spectra were then input into a CNN dual-response model to simultaneously handle discrimination and prediction tasks, resulting in the detection results of moldy core disease and the content prediction results. Based on the moldy core disease detection results, it was determined whether mold had occurred. Based on the content prediction results, the SSC prediction values of all sample apples were determined. The SSC prediction values were then multiplied by the moldy core disease detection results to obtain the SSC prediction values of healthy apples.
[0039] In this embodiment, by performing full-band correction on the original spectrum, the influence of light absorption effect on the original spectrum is effectively reduced, the accuracy of the original spectrum is improved, and thus the accuracy of apple core rot detection is improved. By inputting the corrected spectrum into the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, the model can effectively identify whether the apple to be tested has become moldy and can simultaneously predict the soluble solids content of the apple to be tested.
[0040] Example 3 Figure 6 This is a structural block diagram of a terminal device 2 provided in the third embodiment of this application. For example... Figure 6 As shown, the terminal device 2 in this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program for detecting apple core rot. When the processor 20 executes the computer program 22, it implements the steps in the various embodiments of the apple core rot detection methods described above.
[0041] For example, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete this application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, the processor 20 and the memory 21.
[0042] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0043] The memory 21 can be an internal storage unit of the terminal device 2, such as a hard drive or memory of the terminal device 2. The memory 21 can also be an external storage device of the terminal device 2, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the terminal device 2. Furthermore, the memory 21 can include both internal and external storage units of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 can also be used to temporarily store data that has been output or will be output.
[0044] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0045] If an integrated module is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. This computer-readable storage medium can be non-volatile or volatile. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0046] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application 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. Such 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 this application, and should all be included within the protection scope of this application.
Claims
1. A method for detecting apple core rot, characterized in that, The method includes: The spectrum of the apple to be tested is acquired to obtain the original spectrum, and the original spectrum is corrected in all bands to obtain the corrected spectrum; The modified spectrum was input into the pre-trained dual-output classification model to detect moldy core disease and predict soluble solids content, respectively, to obtain the detection results and content prediction results of moldy core disease. The soluble solids content is determined based on the results of the moldy core detection and the content prediction results. The formulas used to perform full-band correction on the original spectrum include: in, This indicates the apple to be detected. i The corrected spectrum, Represents the unit step function. This represents the first proportionality coefficient. This represents the second proportionality coefficient. This represents the original spectrum. Indicates the band range. This represents the exponential decay coefficient when the wavelength range is greater than 710 nm. This represents the exponential attenuation coefficient when the wavelength range is less than 710 nm. This represents the difference between the reference fruit diameter and the diameter of the apple to be tested. This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm. This indicates the extinction coefficient of the apple to be tested in the wavelength range before 710 nm. This indicates the diameter of the apple to be tested.
2. The method for detecting apple core rot as described in claim 1, characterized in that, The formula used for full-band correction of the original spectrum also includes: in, This represents the input value of the unit step function; in, express The magnitude of the extinction coefficient at 710 nm express The magnitude of the extinction coefficient at 710 nm.
3. The method for detecting apple core rot as described in claim 1, characterized in that, Before using the modified spectral input to the pre-trained dual-output classification model for core rot detection and soluble solids content prediction, the following steps are also included: The spectrum of the apple sample is acquired to obtain a spectral sample, and the spectral sample is corrected across the entire spectrum to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
4. The method for detecting apple core rot as described in claim 3, characterized in that, The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content, including: Obtain the standard classification results, standard content prediction values, and standard soluble solids content prediction values, and calculate the first loss based on the sample classification results and the standard classification results; A second loss is calculated based on the predicted value of the sample content and the predicted value of the standard content, and a third loss is calculated based on the predicted value of the soluble solids content and the predicted value of the standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss.
5. The method for detecting apple core rot as described in claim 1, characterized in that, The apple to be tested undergoes spectral acquisition to obtain the raw spectrum, including: The near-infrared spectral acquisition device was used to collect the spectrum of the apple to be tested. The light source of the near-infrared spectral acquisition device included two rows of halogen lamps with parameters of 12V and 100W. The lamps were preheated for 30 minutes before spectral acquisition. The detection speed of the near-infrared spectral acquisition device was set to 0.5 m / s and the exposure time was 100 ms.
6. An apple core rot detection system, characterized in that, The system includes: The full-band correction module is used to acquire the spectrum of the apple to be tested, obtain the original spectrum, and perform full-band correction on the original spectrum to obtain the corrected spectrum. The core rot detection module is used to input the corrected spectrum into the pre-trained dual-output classification model to perform core rot detection and soluble solids content prediction, respectively, to obtain core rot detection results and content prediction results; The content prediction module is used to determine the soluble solids content detection value based on the core rot detection result and the content prediction result; The formulas used to perform full-band correction on the original spectrum include: in, This indicates the apple to be detected. i The corrected spectrum, Represents the unit step function. This represents the first proportionality coefficient. This represents the second proportionality coefficient. This represents the original spectrum. Indicates the band range. This represents the exponential decay coefficient when the wavelength range is greater than 710 nm. This represents the exponential attenuation coefficient when the wavelength range is less than 710 nm. This represents the difference between the reference fruit diameter and the diameter of the apple to be tested. This indicates the extinction coefficient of the apple to be tested in the wavelength range after 710 nm. This indicates the extinction coefficient of the apple to be tested in the wavelength range before 710 nm. This indicates the diameter of the apple to be tested.
7. The apple core rot detection system as described in claim 6, characterized in that, The moldy core disease detection module is also used for: The spectrum of the apple sample is acquired to obtain a spectral sample, and the spectral sample is corrected across the entire spectrum to obtain a corrected sample; The corrected sample is input into the dual-output classification model for spectral feature extraction and soluble solids feature extraction, respectively, to obtain spectral feature samples and soluble solids feature samples. The spectral feature samples are then classified to obtain the sample classification results. The content of the soluble solids characteristic sample is predicted to obtain the sample content prediction value, and the soluble solids content prediction value is determined based on the sample classification result and the sample content prediction value. The model loss is determined based on the sample classification results, the predicted sample content, and the predicted soluble solids content. The parameters of the dual-output classification model are then updated based on the model loss until the dual-output classification model converges, resulting in the pre-trained dual-output classification model.
8. The apple core rot detection system as described in claim 7, characterized in that, The moldy core disease detection module is also used for: Obtain the standard classification results, standard content prediction values, and standard soluble solids content prediction values, and calculate the first loss based on the sample classification results and the standard classification results; A second loss is calculated based on the predicted value of the sample content and the predicted value of the standard content, and a third loss is calculated based on the predicted value of the soluble solids content and the predicted value of the standard soluble solids content. The first loss, the second loss, and the third loss are weighted to obtain the model loss.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the apple core rot detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Fruit online detection method and system based on spectral correction
CN110376154A
Method for quickly identifying pear black heart disease based on near-infrared diffuse transmission spectroscopy
CN110376159A
Method for establishing apple moldy core detection model
CN111521583A
Fruit and vegetable nondestructive detection method fusing sugar degree and molding core spectral information
CN113971435A
Apple moldy heart disease detection method fused with spectral morphological characteristics
CN116242791A