A smart online detection system and method for fruit quality
By constructing an intelligent online fruit quality detection system, and utilizing spectral data to generate quality scores and a closed-loop retesting mechanism, the destructive and stability issues of traditional detection methods have been resolved, achieving efficient and reliable fruit quality detection.
Patent Information
- Application Number
- CN202611340603.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional fruit quality testing methods are highly destructive, have low sampling rates, and are difficult to adapt to continuous production lines. Furthermore, existing spectral detection systems have poor stability when the environment changes, high model maintenance costs, and lack adaptive retesting mechanisms, resulting in unreliable results.
An online closed-loop detection system is formed by employing a delivery and triggering module, a spectrum acquisition module, a communication parsing module, a spectrum quality evaluation and multi-frame fusion module, a category condition multi-task prediction module, and a result output module, combined with a spectrum calibration and closed-loop retesting module. The system generates a spectrum quality score through light intensity data, wavelength data, and temperature data, and adjusts equipment parameters for retesting when conditions are not met.
It achieves non-destructive testing of fruit quality, reduces the impact of ambient light, light source drift and temperature changes, realizes three-category testing, and automatically adjusts parameters when spectral quality or model confidence is insufficient, preventing unreliable results from entering the sorting process, thus improving the reliability and efficiency of testing.
Smart Images

Figure CN123111982A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectrometer technology, and in particular to an intelligent online detection system and method for fruit quality. Background Technology
[0002] The variety and quality of fruits are crucial criteria for grading, storage, sales, and processing. Traditional testing methods typically require cutting open the fruit to extract juice and then using a refractometer for analysis. This method is destructive, has a low sampling rate, and is difficult to adapt to continuous production lines. To address these issues, miniature spectrometers have been developed. Miniature spectrometers can acquire the reflection or absorption responses of the peel and shallow pulp to different wavelengths of light, providing a data foundation for non-destructive testing of fruits.
[0003] In related technologies, spectral detection systems using miniature spectrometers typically employ fixed integration time, fixed light source brightness, and single-frame acquisition. When changes occur in fruit surface color, bloom, curvature, distance from the probe, ambient temperature, or light source output, issues such as excessively low light intensity, localized saturation, and spectral drift can easily arise. Furthermore, incomplete serial data frames or misaligned frame headers can lead to parsing failures. Directly using the previous data or substituting simulated data undermines the reliability of real-time results.
[0004] Furthermore, fruits such as Kyoho grapes, waxberries, and cherries share certain similarities in appearance and spectral response. Setting up multiple models for each fruit would result in high system maintenance costs. Conversely, using a single regression model to directly output sugar content for all fruits could lead to incorrect mappings due to category differences. Existing solutions typically only provide model predictions and lack an adaptive retesting mechanism based on spectral quality and model confidence, making it difficult to form an online closed loop from data collection, judgment, parameter tuning, retesting, to sorting. Summary of the Invention
[0005] In view of the above, embodiments of the present invention provide an intelligent online detection system and method for fruit quality, the technical solution of which is as follows.
[0006] On one hand, embodiments of the present invention provide an intelligent online fruit quality detection system, the system comprising: The delivery and triggering module is used to deliver the fruit to be tested into the detection area and establish a detection label for the fruit; The spectral acquisition module is used to obtain spectral data within the acquisition time corresponding to the detection identifier; The communication parsing module is used to extract light intensity data, wavelength data, and temperature data from spectral data; The spectral quality assessment and multi-frame fusion module is used to generate quality scores for each frame of the spectral data based on light intensity data, wavelength data, and temperature data. The category-conditional multi-task prediction module includes a fruit category recognition branch and a category-conditional sugar content regression branch. The fruit category recognition branch is used to identify and output the category of the fruit to be tested and the category confidence level corresponding to the category. The category-conditional sugar content regression branch includes sugar content regression heads corresponding to different categories of the fruit to be tested. When the category confidence level meets the preset confidence level conditions, the sugar content regression head corresponding to the category of the fruit to be tested is activated and the sugar content value of the fruit to be tested is output. The results output module is used to output the fruit category, category confidence level, quality score, and sugar content value.
[0007] Furthermore, the system also includes: The spectral calibration module is used to correct spectral data based on dark and white reference spectra to obtain the corrected spectrum.
[0008] Furthermore, the spectral calibration module is used to obtain the calibration spectrum according to R(λ)=[I_s(λ)-I_d(λ)] / [I_r(λ)-I_d(λ)], where I_s(λ) is the fruit measurement spectrum, I_d(λ) is the dark reference spectrum, I_r(λ) is the white reference spectrum, and R(λ) is the calibration spectrum.
[0009] Furthermore, the spectral calibration module is used to perform temperature compensation on the calibrated spectrum based on temperature data and pre-stored temperature drift coefficients.
[0010] Furthermore, the system also includes: The closed-loop retest module is used to adjust at least one of the following: integration time, illumination source brightness, and spectral averaging count, and control the spectral acquisition module to re-acquire data when the quality score, category confidence level, or sugar content value of the spectrum does not meet the preset conditions.
[0011] Furthermore, the spectral quality assessment and multi-frame fusion module is used to generate quality indicators, including at least average light intensity, saturation data ratio, signal-to-noise ratio, and inter-frame consistency, based on light intensity data, wavelength data, and temperature data; and to generate quality scores for each frame of the spectral data based on the quality indicators, including at least average light intensity, saturation data ratio, signal-to-noise ratio, and inter-frame consistency.
[0012] Furthermore, the closed-loop retest module is used to increase the integration time or the brightness of the illumination source when the average light intensity is lower than the lower threshold, decrease the integration time or the brightness of the illumination source when the proportion of saturated data is higher than the upper threshold, and increase the number of spectral averages or the number of acquisition frames when the inter-frame consistency is lower than the threshold. When the number of consecutive retests reaches the preset upper limit and still does not meet the conditions, the fruit to be tested is marked as a sample to be retested.
[0013] Furthermore, the spectral acquisition module includes a miniature spectrometer; the miniature spectrometer has a detection band covering 340 nm to 850 nm and outputs 288 spectral data points; The communication parsing module retrieves the first frame header used to identify the light intensity data area and the second frame header used to identify the wavelength data area from the received data. It then parses the light intensity data after the first frame header and the wavelength data after the second frame header.
[0014] Furthermore, the fruits to be tested included at least one of the following: Kyoho grapes, bayberries, and cherries.
[0015] On the other hand, embodiments of the present invention provide a method for intelligent online detection of fruit quality, the method comprising: The fruits to be tested are transported into the testing area and testing labels are established for the fruits; Spectral data is obtained within the acquisition time corresponding to the detection identifier; Light intensity, wavelength, and temperature data were extracted from the spectral data. A quality score for each frame of the spectrum in the spectral data is generated based on light intensity data, wavelength data, and temperature data. Identify and output the category of the fruit to be tested and the category confidence level corresponding to the category. When the category confidence level of the fruit to be tested reaches the preset threshold, activate the sugar content regression head corresponding to the category of the fruit to be tested and output the sugar content value of the fruit to be tested. Output the fruit category, category confidence score, quality score, and sugar content value.
[0016] This invention provides an intelligent online detection system and method for fruit quality, which includes at least the following beneficial technical effects.
[0017] The delivery and triggering module transports the fruit to be tested into the detection area and establishes a detection label for the fruit. The spectral acquisition module acquires spectral data within the acquisition time corresponding to the detection label. The communication parsing module parses light intensity data, wavelength data, and temperature data from the spectral data. The spectral quality evaluation and multi-frame fusion module generates quality scores for each frame of the spectral data based on the light intensity data, wavelength data, and temperature data. The category condition multi-task prediction module outputs the category of the fruit to be tested and the corresponding category confidence level. It is configured to activate the sugar content regression head corresponding to the category of the fruit to be tested and output the sugar content value of the fruit when the category confidence level meets the preset confidence level conditions. The result output module outputs the fruit category, category confidence level, quality score, and sugar content value, effectively forming an online closed loop from acquisition, judgment, parameter adjustment, retesting to sorting.
[0018] In addition, it addresses the acquisition failure issues caused by invalid bytes, frame header offsets, or insufficient data length in real-time communication of miniature spectrometers; it also reduces the impact of ambient light, light source drift, temperature changes, fruit surface curvature, and fruit posture on spectral stability; furthermore, it enables three-class classification of Kyoho grapes, bayberries, and cherries in the same lightweight network, and outputs corresponding fruit sugar content values with category constraints based on the identified category; and it automatically adjusts equipment parameters and performs retesting when spectral quality or model confidence is insufficient, preventing unreliable results from entering the sorting process. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a schematic diagram of the structure of an intelligent online fruit quality detection system according to an embodiment of the present invention; Figure 2 This is a structural block diagram of an intelligent online fruit quality detection system provided in one embodiment of the present invention; Figure 3 A flowchart illustrating an intelligent online detection method for fruit quality according to an embodiment of the present invention; Figure 4 A schematic diagram of a category-conditional multi-task 1D CNN model structure provided in an embodiment of the present invention; Figure 5 A schematic diagram of an adaptive retest closed loop based on spectral quality and model confidence, provided as an embodiment of the present invention; Figure 6 A confusion matrix diagram of a three-classification model provided in one embodiment of the present invention; Figure 7 An analysis diagram of the sugar content modeling results of a one-dimensional convolutional neural network (1D CNN) for bayberries provided in an embodiment of the present invention; Figure 8 An analysis diagram of the sugar content modeling results of cherries using a one-dimensional convolutional neural network (1D CNN) provided in an embodiment of the present invention; Figure 9 An analysis diagram of the sugar content modeling results of a one-dimensional convolutional neural network (1D CNN) for Kyoho grapes provided in an embodiment of the present invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.
[0022] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.
[0023] Figure 1 This is a schematic diagram of the structure of an intelligent online fruit quality detection system provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the system includes: a delivery and triggering module, a spectrum acquisition module, a communication parsing module, a spectrum quality evaluation and multi-frame fusion module, a category-conditional multi-task prediction module, and a result output module.
[0024] The conveying and triggering module is used to convey the fruit to be tested into the detection area and establish a detection label for the fruit. The fruit to be tested may include at least one of Kyoho grapes, bayberries, and cherries. Exemplarily, the conveying and triggering module may include a conveyor belt, a photoelectric sensor, and an encoder. The controller determines the acquisition time based on the triggering time of the photoelectric sensor and the conveying displacement output by the encoder, and associates the detection label, the detection result, and the position of the fruit on the conveyor belt. The result output module is connected to at least one of an air blowing mechanism, an electromagnetic push rod, or a flipping mechanism to perform sorting according to the fruit category, the corresponding fruit sugar content range, and the re-inspection mark.
[0025] The spectral acquisition module is used to obtain spectral data within the acquisition time corresponding to the detection identifier; such as Figure 2 As shown, the spectral acquisition module includes a miniature spectrometer, an illumination source, and a light-shielding detection cavity. The miniature spectrometer can be an M1000-01 model device, with a serial port baud rate set to 115200 bit / s. A single frame contains 288 light intensity points, temperature data, and 288 wavelength points, with a detection wavelength range of approximately 340nm to 850nm. The light source is arranged around the acquisition field of view to reduce shadows caused by unilateral illumination.
[0026] The communication parsing module is used to extract light intensity, wavelength, and temperature data from spectral data. The module retrieves the first frame header (identifying the light intensity data area) and the second frame header (identifying the wavelength data area) from the received data. It then parses the light intensity data after the first frame header and the wavelength data after the second frame header. For example, before sending a single acquisition command, the module clears the receive buffer and reads the byte stream in segments within a limited time. The module retrieves the DATS identifier from the byte stream and parses the light intensity data in big-endian format after that identifier; it continues to retrieve the COEF identifier and parse the wavelength data. If there are invalid bytes before the byte stream, parsing begins from the retrieved identifier position. If the data length is insufficient, the light intensity data is all zeros, or the average light intensity is below the valid threshold, the acquisition is deemed invalid, and a retry process is initiated. When the COEF data area is missing but the light intensity data area is valid, the communication parsing module calls the pre-stored wavelength calibration data corresponding to the spectrometer's serial number. When multiple consecutive acquisitions fail, the system displays a device malfunction and marks the current fruit for re-examination; randomly generated simulated spectra or cached spectra of the previous fruit must not be used as valid input for the current fruit. This setting isolates the fault tolerance features in the program from the authenticity of the test results.
[0027] The spectral quality assessment and multi-frame fusion module is used to generate quality scores for each frame of the spectral data based on light intensity data, wavelength data, and temperature data. Further, this module generates quality indices including at least average light intensity, saturated data ratio, signal-to-noise ratio, and inter-frame consistency based on light intensity data, wavelength data, and temperature data; and generates quality scores for each frame of the spectral data based on these quality indices. For example, the module calculates the quality score q_i of the i-th frame spectrum and obtains the fused spectrum S_f(λ) according to S_f(λ) = Σ[q_i·S_i(λ)] / Σq_i; the quality score is determined based on at least three of the following: effective light intensity interval ratio, saturated data ratio, zero-value ratio, signal-to-noise ratio, and similarity between adjacent frame spectra.
[0028] The categorical conditional multi-task prediction module includes a fruit category identification branch and a categorical conditional sugar content regression branch. The fruit category identification branch outputs the category of the fruit to be tested and the corresponding category confidence level. The categorical conditional sugar content regression branch includes sugar content regression heads corresponding to different fruit categories to be tested. When the category confidence level meets a preset confidence condition, the sugar content regression head corresponding to the fruit category to be tested is activated and the sugar content value of the fruit to be tested is output. For example, the categorical conditional multi-task prediction module sets a category gating function g_k for Kyoho grapes, bayberries, and cherries respectively. When the predicted category is the kth category and the probability of this category is not lower than the category threshold, g_k=1 and the sugar content output of the corresponding category is enabled. The gating value for other categories is 0. The categorical conditional sugar content regression branch also outputs the prediction uncertainty, which is obtained from at least one of the following: the dispersion of multiple inference results, the regression residual model, or the variance output node.
[0029] For example, spectral data of three types of fruit samples—Kyoho grapes, bayberries, and cherries—were collected. Multiple spectral frames were collected from each fruit in different poses, but during data partitioning, the data was grouped by individual fruit or collection batch to ensure that different frames from the same fruit did not simultaneously enter the training and validation sets, thus avoiding data leakage. After spectral acquisition, the Kyoho grape, bayberry, and cherry samples were cut open and juiced. The soluble solids content was measured using a refractometer to obtain the true sugar content of the corresponding fruit. Category labels and sugar content labels were assigned to all three types of fruit samples, and the corresponding sugar content regression head was gated by the true category to participate in the regression loss calculation. Anomaly scores were obtained using an isolated forest before training. An isolated forest can consist of 100 isolated trees, with each tree randomly sampling no more than 256 samples. Unlike fixed deletion of a certain percentage of samples, this embodiment prioritizes reviewing abnormal samples back to the initial spectra and experimental records of a fruit quality intelligent online detection system and method: abnormal samples caused by collection failure or labeling errors were removed; samples belonging to true extreme sugar content or special surface conditions were retained and their training weights were reduced.
[0030] The training of the category-conditional multi-task prediction module includes: collecting spectral samples of Kyoho grapes, bayberries, and cherries, and dividing the training set and validation set by individual fruit or collection batch; using the soluble solids content of Kyoho grapes, bayberries, and cherries measured by a refractometer as the sugar content label of the corresponding fruit; using an isolated forest to score anomalies in the training samples, and performing at least one of the following treatments on the anomaly samples: reducing training weight, review, or removal; and using a joint loss function composed of classification loss and regression loss applied to the corresponding sugar content regression head according to the true fruit category.
[0031] For example, when training the category-conditional multi-task prediction module, the joint loss function is: L=L_cls+λ·Σ_{k=1}^{3}(g_{y,k}·L_reg,k)+μ·L_u, Where L_cls is the classification loss for Kyoho grapes, bayberries, and cherries, L_reg,k is the sugar content regression loss for the k-th fruit category, g_{y,k} is the gating value corresponding to the true fruit category, L_u is the prediction uncertainty constraint term, and λ and μ are weighting coefficients.
[0032] In addition, such as Figure 4 As shown, the category-conditional multi-task prediction module also includes a shared one-dimensional convolutional neural network feature extraction backbone. This backbone consists of a first convolutional layer, a second convolutional layer, and a third convolutional layer, with 32, 64, and 128 kernels respectively, and kernel lengths of 5, 5, and 3. Each convolutional layer is followed by a non-linear activation layer and a pooling layer. The fruit category recognition branch uses Softmax to output three class probabilities, while the category-conditional sugar content regression branch fuses the shared spectral features with the predicted fruit category code, and outputs the sugar content value from the sugar content regression head corresponding to the predicted fruit category.
[0033] The three-class classification results of the classification branch can be evaluated using a confusion matrix, such as... Figure 6 As shown in the diagram, the confusion matrix represents the predicted class on the horizontal axis and the true class on the vertical axis; the diagonal elements represent the number of correctly classified samples, and the off-diagonal elements represent the number of misclassified samples between classes. This matrix can be used to intuitively evaluate the recognition performance of the classification branches. The joint training loss can be expressed as:
[0034] Where L_cls is the three-class cross-entropy loss, L_reg,k is the mean squared error or Huber loss of the k-th class of fruit samples, g_{y,k} is 1 if the true label belongs to the k-th class, and 0 otherwise, and L_u is the uncertainty constraint term. During inference, when the predicted class probability of Kyoho grapes, bayberries, or cherries is not lower than the preset threshold and the corresponding sugar content prediction uncertainty is not higher than the threshold, the corresponding class sugar content regression head is activated and the sugar content is output; otherwise, only the class or re-examination label is output. Figure 7 As shown, in an example bayberry sugar content dataset, the model's coefficient of determination (R²) for the training set is 0.9907, and for the validation set it is 0.9017. The root mean square error (RMSE) of the validation results is 0.4288°Brix, and the mean absolute error (MAE) is 0.2707°Brix. These results demonstrate that the model has the ability to fit sugar content. Figure 8As shown, in an example cherry sugar content dataset, the model's coefficient of determination (R²) for the training set is 0.9868, and for the validation set it is 0.9276. The root mean square error (RMSE) of the validation results is 0.2948 Brix, and the mean absolute error (MAE) is 0.2140 Brix. These results demonstrate that the model has the ability to fit sugar content. Figure 9 As shown, in an example Kyoho glucose content dataset, the model's coefficient of determination (R²) for the training set is 0.9901, and for the validation set it is 0.9095. The root mean square error (RMSE) of the validation results is 0.3538°Brix, and the mean absolute error (MAE) is 0.1974°Brix. These results demonstrate that the model has the ability to fit glucose content.
[0035] The results output module then outputs the fruit category, category confidence level, quality score, and sugar content value.
[0036] In some embodiments, the intelligent online fruit quality detection system provided by this invention further includes a spectral calibration module. The spectral calibration module is used to correct spectral data based on a dark reference spectrum and a white reference spectrum to obtain a corrected spectrum. Further, the spectral calibration module is used to obtain the corrected spectrum according to R(λ)=[I_s(λ)-I_d(λ)] / [I_r(λ)-I_d(λ)], where I_s(λ) is the fruit measurement spectrum, I_d(λ) is the dark reference spectrum, I_r(λ) is the white reference spectrum, and R(λ) is the corrected spectrum. Additionally, the spectral calibration module is used to perform temperature compensation on the corrected spectrum based on temperature data and a pre-stored temperature drift coefficient.
[0037] In other embodiments, the present invention provides an intelligent online fruit quality detection system that further includes a closed-loop retesting module. The closed-loop retesting module is used to adjust at least one of the following—integration time, illumination source brightness, and spectral averaging frequency—and control the spectral acquisition module to re-acquire data when the spectral quality score, category confidence level, or sugar content value does not meet preset conditions. Further, the closed-loop retesting module is used to increase the integration time or illumination source brightness when the average light intensity is below a lower threshold, decrease the integration time or illumination source brightness when the saturated data ratio is above an upper threshold, and increase the spectral averaging frequency or the number of acquisition frames when the inter-frame consistency is below a threshold; when the number of consecutive retests reaches a preset upper limit and the conditions are still not met, the fruit to be tested is marked as a sample to be retested.
[0038] In practical applications, a system architecture consisting of a hardware detection chain, a spectral data chain, an intelligent model chain, and a closed-loop control chain is adopted. The hardware detection chain includes a conveyor belt or detection platform, trigger sensors, a miniature spectrometer, a ring light source, a light-shielding detection cavity, and an optional sorting actuator; the spectral data chain includes serial communication, frame header retrieval, data parsing, dark / white reference correction, temperature compensation, quality evaluation, and multi-frame fusion; the intelligent model chain includes a shared 1D CNN feature extraction backbone, a three-class classification branch, a category-conditional sugar content regression branch, and prediction uncertainty calculation; the closed-loop control chain adjusts the integration time, light source brightness, averaging frequency, or number of acquisition frames based on signal quality and model confidence. Within one detection cycle, the system continuously acquires N frames of spectrum. The corrected reflectance of each frame can be expressed as:
[0039] The system reads temperature data from the spectrometer data frames and compensates for R_i(λ) using a pre-calibrated temperature drift coefficient. The system calculates the effective intensity range percentage, saturated data percentage, zero-value percentage, signal-to-noise ratio, and spectral similarity between adjacent frames for each frame, and normalizes these values to obtain a quality score q_i. Multiple quality-compliant spectra are fused according to the following formula:
[0040] The fused spectrum S_f(λ), after standardization, is input into the category-conditional multi-task model. A shared 1D CNN extracts local absorption features and cross-band combined features from the spectrum. The classification branch outputs the category probabilities for Kyoho grapes, bayberries, and cherries. The category-conditional sugar content regression branch includes sugar content regression heads corresponding to Kyoho grapes, bayberries, and cherries, respectively. When the probability of a predicted category reaches a threshold, the regression head corresponding to that category is opened, and the shared features are fused with the category code to output the sugar content, thus avoiding incorrect mappings between different fruit categories. In real-time detection, the system simultaneously judges the spectral quality score, the maximum probability of the category, the uncertainty of the corresponding fruit sugar content prediction, and the consistency of multi-frame predictions. If any indicator fails to meet the standard, the system selects to increase or decrease the integration time, change the light source brightness, increase the averaging count, or reposition the acquisition window according to the anomaly type. If the maximum number of retests is reached and the standard is still not met, a retest flag is output, and valid results are not generated using cached data or simulated spectra.
[0041] like Figure 3 The diagram shown is a flowchart of an intelligent online detection method for fruit quality provided in one embodiment of the present invention. Figure 3As shown, the detection method includes: S101 detecting fruit entering the detection area and establishing sample numbers; S102 setting integration time, light source brightness, and averaging times, and acquiring multiple frames of raw spectra; S103 analyzing light intensity, wavelength, and temperature data, and completing dark / white reference correction and temperature compensation; (if quality is unqualified → return to S102); S104 calculating spectral quality scores; if unqualified, adjusting equipment parameters and re-acquiring; S105 performing quality-weighted fusion and standardization on qualified multi-frame spectra; S106 inputting a shared 1D CNN and outputting three-class classification results for Kyoho grapes, bayberries, and cherries; S107 when the predicted category confidence level meets the standard, activating the corresponding category sugar content regression branch; S108 outputting the category, confidence level, and corresponding fruit sugar content; controlling the re-inspection or sorting mechanism. Specifically, S101-S108 involve: the fruit being placed on the detection table or conveyed into the light-shielding detection chamber by a conveyor belt. After the photoelectric sensor is triggered, the controller establishes sample numbers and determines the acquisition time window based on the conveyor belt encoder. The system sets the initial integration time, light source brightness, and averaging frequency, and continuously acquires multiple frames of spectrum. Communication resolution, spectral calibration, and quality evaluation are performed sequentially. If the quality is unsatisfactory, [further steps are taken]. Figure 5 The strategy is adjusted and retested; if the quality is acceptable, multi-frame spectra are weighted and fused and input into the model. The model first outputs the category of Kyoho grapes, bayberries, or cherries; when the category confidence reaches the threshold, the corresponding sugar content regression head is called, and the interface displays the category, confidence, sugar content value, sugar content uncertainty, spectral quality, and quality grade. The results output module saves the sample number, detection time, equipment parameters, spectral quality score, category probability, corresponding fruit sugar content value, and number of retests. If the system is connected to a sorting mechanism, the time when the fruit arrives at the sorting position is calculated based on the sample number and conveyor belt displacement, and the corresponding actuator is controlled. Retested samples enter a separate channel to avoid mixing with normal sugar content grades.
[0042] Furthermore, the software interface can include a device connection area, integration time settings, light source brightness settings, average count settings, detection start / stop buttons, real-time spectral curves, category and sugar content display areas, historical trend areas, and operation log areas. The detection thread and interface thread are separated; data acquisition and prediction are executed in a background thread, and the interface is updated via thread-safe callbacks to avoid interface blocking. When the device is disconnected, model files are missing, the normalizer fails to load, or the spectral data is invalid, the software enters a fault state and generates a log. Empirical formulas, random simulation data, or cached data used for demonstration purposes can only be used for software integration testing and must not be marked as actual fruit testing results; in production mode, a "invalid / pending retest" status must be output.
[0043] Without altering the core concept of this invention, the lighting source can be divided into multiple independent control sectors, acquiring and fusing spectra from different lighting directions; a distance sensor can be added to compensate for spectral intensity based on the distance between the fruit surface and the probe; the full-spectrum model can be distilled into a few-channel device consisting of several narrow-band filters and photodetectors; in addition to the three types of fruit sugar content prediction, hardness, acidity, or ripeness branches can be added. All of the above extensions can be combined with category gating and closed-loop retesting mechanisms.
[0044] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0045] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A smart online fruit quality detection system, characterized in that, The system includes: The delivery and triggering module is used to deliver the fruit to be tested into the detection area and establish a detection mark for the fruit to be tested. The spectral acquisition module is used to obtain spectral data within the acquisition time corresponding to the detection identifier; The communication parsing module is used to parse light intensity data, wavelength data, and temperature data from the spectral data; The spectral quality assessment and multi-frame fusion module is used to generate a quality score for each frame of the spectral data based on the light intensity data, the wavelength data, and the temperature data. The category-conditional multi-task prediction module includes a fruit category identification branch and a category-conditional sugar content regression branch. The fruit category identification branch is used to identify and output the category of the fruit to be tested and the category confidence level corresponding to the category. The category-conditional sugar content regression branch includes sugar content regression heads corresponding to different categories of the fruit to be tested. When the category confidence level meets the preset confidence level conditions, the sugar content regression head corresponding to the category of the fruit to be tested is activated and the sugar content value of the fruit to be tested is output. The results output module is used to output the fruit category, the confidence level of the category, the quality score, and the sugar content value.
2. The system according to claim 1, characterized in that, The system also includes: The spectral calibration module is used to correct the spectral data based on the dark reference spectrum and the white reference spectrum to obtain the corrected spectrum.
3. The system according to claim 2, characterized in that, The spectral calibration module is used to obtain the calibration spectrum according to R(λ)=[I_s(λ)-I_d(λ)] / [I_r(λ)-I_d(λ)], where I_s(λ) is the fruit measurement spectrum, I_d(λ) is the dark reference spectrum, I_r(λ) is the white reference spectrum, and R(λ) is the calibration spectrum.
4. The system according to claim 3, characterized in that, The spectral calibration module is used to perform temperature compensation on the calibration spectrum based on the temperature data and the pre-stored temperature drift coefficient.
5. The system according to any one of claims 1-4, characterized in that, The system also includes: The closed-loop retest module is used to adjust at least one of the integration time, illumination source brightness, and spectral averaging times and control the spectral acquisition module to re-acquire when the quality score of the spectrum, the category confidence level, or the sugar content value does not meet the preset conditions.
6. The system according to claim 5, characterized in that, The spectral quality evaluation and multi-frame fusion module is used to generate quality indicators, including at least average light intensity, saturation data ratio, signal-to-noise ratio, and inter-frame consistency, based on the light intensity data, wavelength data, and temperature data; and to generate quality scores for each frame of the spectral data based on the quality indicators, including at least average light intensity, saturation data ratio, signal-to-noise ratio, and inter-frame consistency.
7. The system according to claim 6, characterized in that, The closed-loop retest module is used to increase the integration time or the brightness of the lighting source when the average light intensity is lower than the lower threshold, decrease the integration time or the brightness of the lighting source when the saturated data ratio is higher than the upper threshold, and increase the number of spectral averages or the number of acquisition frames when the inter-frame consistency is lower than the threshold. If the conditions are still not met after the number of consecutive retests reaches the preset limit, the fruit to be tested will be marked as a sample to be retested.
8. The system according to claim 1, characterized in that, The spectral acquisition module includes a miniature spectrometer; the miniature spectrometer has a detection band covering 340 nm to 850 nm and outputs 288 spectral data points; The communication parsing module retrieves a first frame header for identifying the light intensity data area and a second frame header for identifying the wavelength data area from the received data, and parses the light intensity data after the first frame header and the wavelength data after the second frame header.
9. The system according to claim 1, characterized in that, The fruits to be tested include at least one of Kyoho grapes, bayberries, and cherries.
10. A method for intelligent online detection of fruit quality, characterized in that, The method includes: The fruit to be tested is transported into the testing area and a testing label is created for the fruit. Spectral data is obtained within the acquisition time corresponding to the detection identifier; Light intensity data, wavelength data, and temperature data are extracted from the spectral data; A quality score for each frame of the spectrum in the spectral data is generated based on the light intensity data, the wavelength data, and the temperature data. Identify and output the category of the fruit to be tested and the category confidence level corresponding to the category. When the category confidence level of the fruit to be tested reaches a preset threshold, activate the sugar content regression head corresponding to the category of the fruit to be tested and output the sugar content value of the fruit to be tested. Output the fruit category, the confidence level of the category, the quality score, and the sugar content value.
