Mango hardness batch prediction method based on hyperspectral imaging technology

By using hyperspectral imaging technology and ridge regression model, the problems of non-destructive testing and size adaptability in mango hardness testing were solved, achieving efficient, accurate and non-destructive testing of mango hardness.

CN121740765APending Publication Date: 2026-03-27GUANGXI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-20
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing methods for testing mango firmness struggle to balance non-destructive testing with high size adaptability, resulting in low testing efficiency and inaccurate results.

Method used

By employing hyperspectral imaging technology and constructing a ridge regression model, combined with texture analyzer measurements, a raw dataset of "spectral vector-hardness" is established, enabling non-destructive batch prediction of mango hardness.

Benefits of technology

This technology enables non-destructive testing of mangoes of different sizes, reduces the professional requirements for measurement personnel, improves testing efficiency and accuracy, and ensures the quality of mangoes harvested and sold.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121740765A_ABST
    Figure CN121740765A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of agricultural product quality detection and nondestructive testing, in particular to a mango hardness batch prediction method based on a hyperspectral imaging technology, which comprises the following steps: placing batch mangoes on a low-reflectivity sampling platform at equal intervals, and obtaining a hyperspectral image cube containing all mangoes in a darkroom by using a hyperspectral camera; extracting information from the hyperspectral image cube, calculating to obtain a full-wave band spectral vector of the mango in each label area, obtaining an actually measured hardness value of each mango, and establishing a'spectral vector-hardness' original data set; preprocessing the original data to obtain a training set and a verification set, and constructing a hardness prediction model by taking a ridge regression function as a target function; and inputting the spectrum vector of the to-be-detected mango into the model, and outputting a corresponding hardness prediction value to realize batch mango hardness nondestructive detection. The method constructs the mango high-luminosity hardness prediction model, has adaptability to mango samples, realizes nondestructive testing, and can accurately predict the mango hardness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural product quality testing and non-destructive testing technology, and in particular to a method for batch prediction of mango firmness based on hyperspectral imaging technology. Background Technology

[0002] In research on mango quality testing, mango maturity is one of the important research indicators, and firmness prediction can reflect the maturity level of mangoes. Therefore, measuring firmness is of great significance for evaluating the quality and value of mangoes.

[0003] Currently, methods for predicting mango hardness mainly include traditional destructive testing and emerging non-destructive testing. Traditional destructive testing typically employs methods such as puncture testing and deformation testing. Puncture testing involves inserting a cylindrical probe into a pre-peeled mango to measure the maximum force required to penetrate, thus determining the mango's hardness. Deformation testing involves squeezing the mango and measuring the force required to cause a certain degree of deformation. However, existing destructive testing methods are inefficient, and the tested samples lose their commercial value, resulting in significant waste. Currently, there are also commercially available measurement methods based on acoustic technology; however, these methods are highly sensitive to the size of the mango being tested, which can easily lead to a decrease in the accuracy of the test results.

[0004] Therefore, there is an urgent need for a testing method that can non-destructively test the firmness of mangoes and is highly adaptable to different mango sizes. Summary of the Invention

[0005] The main objective of this invention is to provide a batch prediction method for mango hardness based on hyperspectral imaging technology, aiming to solve the problem that existing mango hardness detection methods are difficult to balance non-destructive testing and high size adaptability.

[0006] To achieve the above objectives, this invention proposes a batch prediction method for mango firmness based on hyperspectral imaging technology, comprising the following:

[0007] To obtain a hyperspectral image cube of mangoes, a batch of mangoes were placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, all mangoes were scanned at once using a hyperspectral camera in the 400~1000nm band and dual-sided halogen light sources to obtain a hyperspectral image cube containing all mangoes.

[0008] A raw dataset of "spectral vector-hardness" was established. RGB images were extracted from the hyperspectral image cube to obtain regional labels for individual mangoes. The full-band spectral vector of mangoes in each label region was calculated, and the measured hardness values ​​of each mango were obtained using a texture analyzer.

[0009] To construct a hardness prediction model, the original data is smoothed and corrected after outliers are removed to obtain training and validation sets. Then, the ridge regression function is used as the objective function, and the regression coefficients of the objective function are solved using the training set to construct the hardness prediction model.

[0010] The spectral vector of the mango to be tested is input into the model, and the corresponding hardness prediction value is output, realizing non-destructive testing of mango hardness in batches.

[0011] Furthermore, the steps of establishing the "spectral vector-hardness" original dataset, extracting RGB images from the hyperspectral image cube to obtain individual mango-level region labels, calculating the full-band spectral vector of the mango within each label region, and obtaining the measured hardness value of each mango using a texture analyzer, also include:

[0012] RGB images are generated by extracting three bands within the range of 710~730nm, 540~560nm, and 440~460nm.

[0013] Using max(R, G, B) > ε and ε = 0.1 as the color threshold, the mango region is segmented and a binary mask is generated;

[0014] Each connected component in the mask is assigned a unique number to obtain a single mango-level region label.

[0015] The average reflectance of all pixels in each label area is calculated band by band to form the full-band spectral vector of the mango.

[0016] A texture analyzer was used to perform compression tests on each mango in the same batch to obtain the measured hardness value of each mango, and a raw dataset of "spectral vector - hardness" was established.

[0017] Furthermore, the steps for constructing the hardness prediction model include: removing outliers from the original data, smoothing and correcting it to obtain a training set and a validation set; then using ridge regression as the objective function and solving for the regression coefficients of the objective function using the training set to construct the hardness prediction model.

[0018] Samples with hardness values ​​outside the range of 10N to 140N in the original dataset were removed;

[0019] Anomaly spectra are removed using the isolated forest algorithm;

[0020] Savitzky-Golay smoothing, SNV single-sample correction, and Z-Score normalization were used to obtain the training and validation sets.

[0021] Using the Ridge Regression function as the objective function, the regression coefficient β is solved using the training set to construct a hardness prediction model.

[0022] Furthermore, the Z-Score normalization is based on the mean μ of each band in the training set. j With standard deviation σ j Using this as a baseline, the same parameters were applied to the validation set and subsequent online prediction data.

[0023] Furthermore, the full-band spectral vector retains all bands within 400nm~1000nm without performing characteristic wavelength selection.

[0024] Furthermore, in the step of obtaining the hyperspectral image cube of mangoes, a batch of mangoes are placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, all mangoes are scanned at once using a hyperspectral camera in the 400~1000nm band and dual-sided halogen light sources to obtain a hyperspectral image cube containing all mangoes. In this step, the center distance between adjacent mangoes is kept at 0.5cm to avoid spatial aliasing in the hyperspectral image.

[0025] Furthermore, in the step of obtaining the hyperspectral image cube of mangoes, a batch of mangoes are placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate >95%, all mangoes are scanned at once using a hyperspectral camera in the 400~1000nm band and dual halogen light sources to obtain a hyperspectral image cube containing all mangoes. The halogen light source adopts a full-band halogen light source with a wavelength range of 400~2500nm, and the dual halogen light sources are located on both sides of the camera at a horizontal distance of 15cm and a horizontal elevation range of 60°. The hyperspectral camera scans at a uniform speed of 20 mm / s.

[0026] Furthermore, as in any of the above technical solutions, the hyperspectral camera frame rate is set to 30fps and the moving speed is 20mm / s to ensure a spatial resolution ≤0.8mm / pixel.

[0027] This invention constructs a high-gloss firmness prediction model for mangoes, enabling the testing of mango samples of different sizes and qualities. It reduces the professional requirements for measurement personnel, improves work efficiency, lowers labor costs, and achieves non-destructive testing of mangoes. By using a ridge regression model, it exhibits superior robustness against noise, outliers, and multicollinearity, accurately predicting mango firmness and ensuring that harvested and sold mangoes have optimal edible quality. Attached Figure Description

[0028] 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 drawings can be obtained based on the structures shown in these drawings without creative effort.

[0029] Figure 1 This is a flowchart illustrating the batch prediction method for mango hardness based on hyperspectral imaging technology in this invention.

[0030] Figure 2 A schematic diagram showing the component setup in the mango firmness batch prediction method of this invention;

[0031] Figure 3 This is a schematic diagram of RGB image extraction from a mango sample in this invention;

[0032] Figure 4 This is a schematic diagram of the mask and labeling of the mango sample in this invention.

[0033] Explanation of icon numbers:

[0034]

[0035] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0037] It should be noted that all directional indications in the embodiments of the present invention are only used to explain the relative positional relationship and movement of the components in a specific posture. If the specific posture changes, the directional indications will also change accordingly.

[0038] Furthermore, the use of terms such as "first" and "second" in this invention is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed by this invention.

[0039] In existing technologies, besides destructive testing methods, there are other non-destructive methods for measuring fruit, such as acoustic testing or spectroscopic measurement. However, existing acoustic measurement methods are quite sensitive to the quality and size of mangoes, which greatly affect the acoustic test results. Mangoes are usually of varying quality and size, leading to large errors in the results. Furthermore, the cost of setting up the measurement environment is high, as acoustic measurements need to be conducted in a low-background-noise environment, thus requiring the construction of an anechoic chamber or soundproof room. Spectroscopic measurement methods suffer from low data acquisition efficiency, as only one mango's hyperspectral information can be collected at a time. If a large amount of hyperspectral information needs to be collected, operators need to spend a lot of time on repetitive acquisition. Moreover, the automation level of data processing is low, requiring manual drawing of ROI regions on the mango image for spectral data extraction. In data preprocessing, PLSR (Partial Least Squares Regression) is often used to build predictive models, which makes the prediction results sensitive to noise and outliers and poorly adaptable to new data.

[0040] Therefore, this invention proposes a batch prediction method for mango hardness based on hyperspectral imaging technology. The automated processing flow of this invention reduces the impact of human factors on hyperspectral data processing, improves the reliability and consistency of data processing, ensures the accuracy and repeatability of each measurement result, and enhances data credibility.

[0041] The hyperspectral image involved in this invention refers to a three-dimensional data cube that simultaneously contains spatial and spectral information, capable of reflecting the external morphology and internal material composition information of the measured object. In this invention, it is used to provide global spectral information for mango samples. The Savitzky-Golay (SG) smoothing algorithm is a convolutional smoothing algorithm based on local polynomial least squares fitting, which can effectively avoid spectral distortion. In this invention, it is used to improve the signal-to-noise ratio of the original hyperspectral data of mangoes. Standardized Normal Variable Transform (SNV) is a preprocessing method for correcting single-spectral curves. In this invention, it is used to eliminate background noise and optical path differences in spectral data. Z-SCORE standardization is a data standardization method that can bring all features to a uniform scale. In this invention, it is used to standardize the same band of different samples. The Ridge Regression algorithm is an improved linear regression algorithm specifically designed for handling multicollinear data. In this invention, it is used to construct a robust prediction model from hyperspectral features to mango firmness.

[0042] like Figure 1 As shown, the present invention discloses a method for batch prediction of mango firmness based on hyperspectral imaging technology, which specifically includes the following steps:

[0043] S1. Obtain a hyperspectral image cube of mangoes. Place a batch of mangoes at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, use a hyperspectral camera in the 400~1000nm band and dual-sided halogen light source to scan all mangoes at once to obtain a hyperspectral image cube containing all mangoes.

[0044] In detail, the components involved in image acquisition in this invention are configured as follows: Figure 2As shown. First, a rigid frame is constructed, and a layer of black light-blocking cloth (light-blocking rate > 95%) is covered outside the frame to create a darkroom environment 4. The darkroom environment 4 is used to ensure that the hyperspectral camera 1 can obtain a pure image signal when acquiring spectral images, thereby improving the accuracy and stability of the detection results. The hyperspectral camera 1 used in this invention has a spectral resolution of <10nm and a wavelength range of 400nm~1000nm, capable of acquiring near-infrared data. It is positioned 75cm above the mango placement platform 7 and faces the platform to capture images, ensuring accurate acquisition of key near-infrared spectral information of the mango 6, providing a precise data foundation for hardness prediction. This invention also includes two parallel full-band halogen light source devices 2. Each device comprises six halogen bulbs with a power of 35W and a wavelength range of 400~2500nm. The total power of either device is 225W. The two devices are positioned on either side of the hyperspectral camera 1, with a horizontal spacing of 15cm and a vertical angle of 60 degrees, providing uniform and stable illumination for the mango 6. This ensures the hyperspectral camera 1 can acquire high-quality spectral images, thereby improving the reliability and accuracy of the data. A camera guide rail 3 is also provided, with the hyperspectral camera 1 slidably connected to it. The camera guide rail 3 provides the hyperspectral camera 1 with precise movement capabilities during data acquisition, enabling batch collection of mango samples 6. The mango placement platform 7 is horizontally set on the ground, and a layer of professional light-absorbing flocked cloth with a reflectivity ≤5% is laid on top of the mango placement platform 7 to avoid reflection interference. The invention also includes a host computer 5, which controls the coordinated operation of various system devices such as the hyperspectral camera 1, the full-band halogen light source device 2, and the camera guide rail 3, ensuring the automated and efficient operation of the entire detection process, while facilitating real-time processing and analysis of the collected data.

[0045] More specifically, in step S1, the operator places the mangoes 6 evenly spaced on the mango placement platform 7, with a center-to-center distance of 0.5cm between each mango 6; the operator turns on the full-band halogen light source device 2 to ensure that the light covers the entire mango collection platform 7; the operator opens the shutter of the hyperspectral camera 1 and starts the camera guide rail 3 through the host computer 5, so that the hyperspectral camera 1 can collect the spectral information of each mango 6 at 20mm / s and 30fps / s.

[0046] S2. Establish the "Spectral Vector-Hardness" original dataset. Extract three bands (710-730nm, 540-560nm, and 440-460nm) from the hyperspectral image cube to generate RGB images. Use max(R, G, B) > ε and ε = 0.1 as color thresholds to segment the mango region and generate a binary mask. Assign a unique number to each connected component in the mask to obtain a region label at the mango level. Calculate the mean reflectance of all pixels in each label region band by band to form the full-band spectral vector of the mango. Use a texture analyzer to perform compression tests on each mango in the same batch to obtain the measured hardness value of each mango and establish the "Spectral Vector-Hardness" original dataset.

[0047] Among them, in detail, such as Figure 3 Three bands were extracted from the hyperspectral image data, namely the red (710nm-730nm), green (540nm-560nm), and blue (440nm-460nm) bands. The spectral information of these three bands was combined to generate an RGB image, which is convenient for subsequent visual analysis and processing.

[0048] The final obtained image can be represented as:

[0049]

[0050] Where w and h are the corresponding horizontal and vertical coordinates, and R(w, h), G(w, h), and B(w, h) are the corresponding values ​​of the coordinates in the RGB space.

[0051] Based on the color characteristics of mangoes, a color threshold is set, and the color range of the mango is automatically identified by analyzing the color values ​​of each pixel in the RGB image. Based on the pre-set color threshold, a mask of the mango is automatically extracted, separating the mango image from the background and providing accurate regional information for subsequent steps.

[0052] The mask involved in this invention refers to a binary image, in which the pixel value of the mango region is 1 (displayed as white in the image), and the pixel value of the background region is 0 (displayed as black in the image).

[0053]

[0054] in, This is the color threshold, with a value of 0.1.

[0055] like Figure 4 As shown, the operator analyzes the extracted mango mask, automatically identifies the independent region of each mango, and then assigns a unique label to each mango based on its position.

[0056] In the hyperspectral data extraction stage of mangoes, for each extracted and labeled mango mask, all bands in the hyperspectral image are traversed sequentially to accurately select all pixels within the mask, and the average spectral reflectance of these pixels in each band is calculated. These averages are then integrated to form a single mango hyperspectral dataset, reflecting the spectral characteristics of mangoes in different bands.

[0057] The operators then used a texture analyzer (accuracy <0.001g, maximum value >25kg, stroke range 0~200mm) to measure the hardness of these mangoes. The texture analyzer is used to perform mechanical pressure testing, quantify the hardness of the mango flesh, and provide corresponding hardness reference values ​​for hyperspectral image data.

[0058] S3. Construct a hardness prediction model by removing samples from the original dataset whose hardness values ​​are outside the range of 10N to 140N; remove abnormal spectra using the isolated forest algorithm; obtain training and validation sets by using Savitzky-Golay smoothing, SNV single-sample correction, and Z-Score standardization; construct the hardness prediction model by using the Ridge Regression function as the objective function and solving for the regression coefficient β using the training set.

[0059] In step S3, the hardness value is expressed as the force applied by the texture analyzer. Specifically, after acquiring the mango hyperspectral-hardness dataset, samples with abnormally extreme hardness values—namely, ultra-low and ultra-high hardness data—are first discarded. These extreme values ​​may be due to measurement errors or sample anomalies, and could significantly interfere with subsequent analysis.

[0060] The specific formula for eliminating abnormal hardness values ​​is as follows:

[0061]

[0062] Where i is the sample number, x i For the spectral characteristics of the corresponding sample, y i This represents the hardness value of the corresponding sample.

[0063] After removing outlier hardness values, the Isolation Forest algorithm is used to further remove potential outliers. The Isolation Forest algorithm is a tree-based unsupervised learning algorithm that effectively identifies and removes outliers from the data, thereby improving data quality and ensuring the accuracy and reliability of subsequent analysis.

[0064] The specific formula for the Isolation Forest algorithm is as follows:

[0065]

[0066] After removing hardness outliers, the operators randomly divided the data into training and validation sets at a ratio of 80% and 20%. Next, the Savitzy-Golay (SG) smoothing algorithm was applied sequentially to the hyperspectral data in both the training and validation sets to remove noise. The spectral characteristics of each sample are known as follows:

[0067]

[0068]

[0069] Where B is the number of bands, To perform SG smoothing on band j of sample i, where j is the band number and w is the weight, it can be understood that using the SG algorithm is equivalent to performing a weighted summation on band j within the band range from jm to j+m.

[0070] Then, a standardized normal variable transformation (SNV) is performed to eliminate scale differences and background effects in the spectrum. The specific formula is as follows:

[0071]

[0072] in, and These represent the mean and variance of the spectral characteristics of the corresponding samples, respectively.

[0073] Furthermore, the training set data is Z-SCORE standardized, and this standardization parameter is applied to the validation set to ensure that the data in the training and validation sets are on the same scale, providing a high-quality and consistent data foundation for subsequent model training and validation. Z-SCORE standardization is an innovative processing method proposed in this invention, used to reduce the absolute value differences between different bands, allowing the model to focus on each band equally. The specific formula is as follows:

[0074]

[0075] in, and These are the mean and variance of the corresponding spectral features across all samples in the training set, respectively.

[0076] Furthermore, this invention also discloses the use of the Ridge Regression model for hardness prediction. Compared with the PLSR method (Partial Least Squares Regression, a multivariate statistical analysis method mainly used to deal with datasets with high collinearity among independent variables), the input information of the Ridge Regression model is uncompressed, more interpretable, and more robust to noise, outliers, and multicollinearity.

[0077] Specifically, the operator first constructs the ridge regression objective function:

[0078]

[0079] in, These are the regression coefficients to be estimated. It is a regularization parameter. Let L2 norm represent the vector. Ridge regression coefficients can be obtained by minimizing the objective function. The final prediction model is constructed. In this invention, the regularization parameter... Through five-fold cross-validation at 10 -3 ~10 1 The optimal selection is obtained within the specified range.

[0080] S4: Input the spectral vector of the mango to be tested into the model and output the corresponding hardness prediction value to realize batch non-destructive testing of mango hardness.

[0081] Understandably, this invention, through the acquisition and automatic processing of mango hyperspectral image data, can automatically predict the firmness of mangoes in batches, reducing the professional skill requirements for measurement personnel and lowering the labor costs associated with training them. Furthermore, this invention, through automated operation, can acquire a large amount of mango hyperspectral image data in a short time, enabling simultaneous maturity detection and grading of a large number of mangoes, saving significant time and improving detection efficiency.

[0082] In detail, the full-band spectral vector retains all bands within 400nm~1000nm without performing characteristic wavelength selection, in order to obtain a complete dataset.

[0083] In detail, the process of obtaining the hyperspectral image cube of mangoes is as follows: A batch of mangoes are placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, all mangoes are scanned at once using a hyperspectral camera in the 400~1000nm band and dual halogen light sources to obtain a hyperspectral image cube containing all mangoes. During this process, the center-to-center distance between adjacent mangoes is kept at 0.5cm to avoid spatial aliasing in the hyperspectral image.

[0084] In detail, to obtain a hyperspectral image cube of mangoes, a batch of mangoes were placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, all mangoes were scanned at once using a hyperspectral camera in the 400~1000nm band and dual halogen light sources to obtain a hyperspectral image cube containing all mangoes. The halogen light source used was a full-band halogen light source with a wavelength range of 400~2500nm. The dual halogen light sources were located on both sides of the camera at a horizontal distance of 15cm and a horizontal elevation range of 60°. The hyperspectral camera scanned at a uniform speed of 20 mm / s.

[0085] Specifically, as in any of the above technical solutions, the hyperspectral camera frame rate is set to 30fps and the moving speed is 20mm / s to ensure a spatial resolution ≤0.8mm / pixel.

[0086] This invention constructs a high-gloss firmness prediction model for mangoes, enabling the testing of mango samples of different sizes and qualities. It reduces the professional requirements for measurement personnel, improves work efficiency, lowers labor costs, and achieves non-destructive testing of mangoes. By using a ridge regression model, it exhibits superior robustness against noise, outliers, and multicollinearity, accurately predicting mango firmness and ensuring that harvested and sold mangoes have optimal edible quality.

[0087] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. All equivalent structural transformations made under the concept of the present invention using the contents of the present invention specification and drawings, or direct / indirect applications in other related technical fields, are included within the patent protection scope of the present invention.

Claims

1. A method for batch prediction of mango firmness based on hyperspectral imaging technology, characterized in that, Includes the following steps: To obtain a hyperspectral image cube of mangoes, a batch of mangoes were placed at equal intervals on a low reflectivity sampling platform. In a dark room with a shading rate of >95%, all mangoes were scanned at once using a hyperspectral camera in the 400~1000nm band and dual-sided halogen light sources to obtain a hyperspectral image cube containing all mangoes. A raw dataset of "spectral vector-hardness" was established. RGB images were extracted from the hyperspectral image cube to obtain regional labels for individual mangoes. The full-band spectral vector of mangoes in each label region was calculated, and the measured hardness values ​​of each mango were obtained using a texture analyzer. To construct a hardness prediction model, the original data is smoothed and corrected after outliers are removed to obtain training and validation sets. Then, the ridge regression function is used as the objective function, and the regression coefficients of the objective function are solved using the training set to construct the hardness prediction model. The spectral vector of the mango to be tested is input into the model, and the corresponding hardness prediction value is output, realizing non-destructive testing of mango hardness in batches.

2. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 1, characterized in that, The steps of establishing the "spectral vector-hardness" original dataset, including extracting RGB images from the hyperspectral image cube to obtain individual mango-level region labels, calculating the full-band spectral vector of the mango in each label region, and obtaining the measured hardness value of each mango using a texture analyzer, further include: RGB images are generated by extracting three bands within the range of 710~730nm, 540~560nm, and 440~460nm. Using max(R, G, B) > ε and ε = 0.1 as color thresholds, the mango region is segmented and a binary mask is generated; Each connected component in the mask is assigned a unique number to obtain a single mango-level region label. The average reflectance of all pixels in each label area is calculated band by band to form the full-band spectral vector of the mango. Compression tests were performed on each mango in the same batch using a texture analyzer to obtain the measured hardness values ​​of each mango, and a raw dataset of "spectral vector-hardness" was established.

3. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 2, characterized in that, The steps for constructing a hardness prediction model include: removing outliers from the original data, smoothing and correcting it to obtain a training set and a validation set; then using ridge regression as the objective function and solving for the regression coefficients of the objective function using the training set; and finally constructing the hardness prediction model. Samples with hardness values ​​outside the range of 10N to 140N in the original dataset were removed; Anomaly spectra are removed using the isolated forest algorithm; Savitzky-Golay smoothing, SNV single-sample correction, and Z-Score normalization were used to obtain the training and validation sets. Using the Ridge Regression function as the objective function, the regression coefficient β is solved using the training set to construct a hardness prediction model.

4. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 3, characterized in that, The Z-Score standardization is based on the mean μ of each band in the training set. j With standard deviation σ j Using this as a baseline, the same parameters were applied to the validation set and subsequent online prediction data.

5. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 4, characterized in that, The full-band spectral vector retains all bands within 400nm~1000nm without selecting characteristic wavelengths.

6. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 1, characterized in that, The process of obtaining a hyperspectral image cube of mangoes involves placing a batch of mangoes at equal intervals on a low-reflectivity sampling platform. In a dark room with a shading rate >95%, all mangoes are scanned at once using a hyperspectral camera in the 400-1000nm band and dual-sided halogen light sources to obtain a hyperspectral image cube containing all mangoes. During this process, the center-to-center distance between adjacent mangoes is maintained at 0.5cm to avoid spatial aliasing in the hyperspectral image.

7. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in claim 1, characterized in that, The process of obtaining a hyperspectral image cube of mangoes involves placing a batch of mangoes at equal intervals on a low-reflectivity sampling platform. In a dark room with a shading rate >95%, all mangoes are scanned at once using a hyperspectral camera in the 400-1000nm band and dual halogen light sources to obtain a hyperspectral image cube containing all mangoes. The halogen light source is a full-band halogen light source with a wavelength range of 400-2500nm, and the dual halogen light sources are located on both sides of the camera at a horizontal distance of 15cm and a horizontal elevation range of 60°. The hyperspectral camera scans at a uniform speed of 20 mm / s.

8. The method for batch prediction of mango firmness based on hyperspectral imaging technology as described in any one of claims 1-7, characterized in that, The hyperspectral camera is set to a frame rate of 30fps and a movement speed of 20 mm / s to ensure a spatial resolution of ≤0.8mm / pixel.