A device and method for nondestructive testing of apple sugar content based on multispectral images
By using a mobile phone non-destructive testing device and method based on multispectral images, and combining a common light source and a mobile phone with recursive feature elimination and gradient boosting regression algorithms, the high cost and destructive nature of apple sugar content detection are solved, achieving non-destructive testing and efficient prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HARBIN ENG UNIV
- Filing Date
- 2023-03-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing technologies for apple sugar content testing require expensive specialized equipment and computing resources, and destructive testing methods are time-consuming and labor-intensive, making non-destructive testing impossible.
A non-destructive testing device for mobile phones based on multispectral images is adopted. By using ordinary light sources, mobile phones and multispectral image analysis technology, combined with recursive feature elimination method and gradient boosting regression algorithm, a sugar content prediction model is established, and non-destructive testing is achieved through multispectral image acquisition and processing.
It achieves non-destructive testing of apple sugar content, reduces testing costs, has strong predictive ability, does not damage apples, and is cost-effective.
Smart Images

Figure CN116429704B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of apple sugar content detection, and particularly relates to a device and method for nondestructive detection of apple sugar content based on a multi-spectrum image. BACKGROUND
[0002] China is a large country in the world for planting fruit trees, and the yield of many varieties of fruits ranks in the world. With the improvement of fruit consumption level in China, people have higher and higher requirements for the quality of fresh fruits, not only the appearance of the fruits, but also the internal quality, and the sugar content is an important index for judging the internal quality. The detection of the sugar content of fruits is divided into internal detection and external detection, wherein the internal detection mainly relies on chemical analysis or the use of a digital refractometer to measure the actual sugar content of apples after juicing. This destructive detection method is more accurate, but it is time-consuming, labor-intensive, and has high cost and cannot achieve full detection. The external detection is mainly realized by using spectral technology.
[0003] The main technologies for nondestructive detection of apple sugar content by using spectrum include spectral analysis technology, multi-spectrum image analysis technology, and hyperspectral image analysis technology. The spectral analysis technology uses near-infrared spectrum to study the sugar content of apples. The multi-spectrum image analysis technology uses the collected spectral images of multiple wavelengths to analyze and establish a model for predicting the sugar content of apples. The hyperspectral image analysis technology is a combination of the above two technologies.
[0004] The above technologies have achieved good experimental results in the laboratory, but they all need to arrange high-quality light sources and professional cameras, and also need a large amount of computing resources to process the collected spectral information, which increases the detection cost. SUMMARY
[0005] To solve the above problems, the present application provides a device and method for nondestructive detection of apple sugar content based on a multi-spectrum image, which only needs to use an ordinary light source and a mobile phone to perform nondestructive detection of the sugar content of apples, thereby reducing the detection cost.
[0006] To achieve the above purpose, the present application provides a device for nondestructive detection of apple sugar content based on a multi-spectrum image, which comprises a light source, an adjustable lens group, an optical fiber, and an optical fiber collimator arranged in sequence along an optical path, the optical fiber collimator is aligned with the equator of an apple to be detected placed on a lifting moving platform, and is used to generate a scattering spot on the surface of the apple to be detected;
[0007] A neutral density filter and a detection terminal carrying a sugar content prediction model are further arranged in sequence above the apple to be detected, and are used to predict the sugar content of the apple according to the collected scattering spot image.
[0008] Preferably, the adjustable lens group comprises a first focusing lens, a second focusing lens, a reflecting mirror, and an adjusting filter arranged in sequence along the optical path and arranged at the input end of the optical fiber.
[0009] The bandwidth of the filter is adjusted to 15nm, and the wavelength is 635nm, 650nm, 675nm, 800nm, 850nm or 905nm.
[0010] Preferably, the diameter of the optical fiber is 600μm, and the numerical aperture is 0.22.
[0011] The optical fiber and the optical fiber collimator cooperate with each other to form an incident light spot with a diameter of 0.8mm at a distance of 30mm from the apple to be detected, and a scattering light spot with a diameter of 25mm on the surface of the apple to be detected.
[0012] Preferably, the light source is a halogen tungsten lamp with a power of 250w.
[0013] The detection terminal is a mobile phone with a camera function.
[0014] The lifting and moving platform comprises a GCM-17 series scissor lifting platform and a moving wheel arranged at the bottom end of the GCM-17 series scissor lifting platform.
[0015] A method for nondestructive detection of apple sugar content based on a multi-spectral image of a mobile phone, comprising the following steps:
[0016] S1, a detection device is built and connected, and an apple to be detected is placed on a lifting and moving platform.
[0017] S2, after placing a wavelength-adjusting filter with a wavelength of 635nm at the input end of the optical fiber, turn on the light source.
[0018] S3, adjust the position of the apple to be detected through the lifting and moving platform, until the light emitted by the light source forms a scattering light spot on the surface of the apple to be detected after passing through the adjustable mirror group, the optical fiber and the optical fiber collimator in turn.
[0019] S4, use the camera of the mobile phone to collect the spectral image, and use image processing to obtain the scattering distribution curve of the light spot on the surface of the apple to be detected.
[0020] S5, use the improved Lorentz distribution curve to fit the scattering distribution curve of the light spot, to obtain four variables of the adjusted Lorentz distribution function.
[0021] S6, remove the wavelength-adjusting filter with a wavelength of 635nm, and replace the wavelength-adjusting filters with wavelengths of 650nm, 675nm, 800nm, 850nm and 905nm at the input end of the optical fiber in turn, and repeat steps S3-S5, so as to obtain four variables of the Lorentz distribution function at each wavelength, i.e. 24 characteristic parameters.
[0022] S7, using recursive feature elimination method for dimension reduction, screening out the feature parameters with importance ranking after a set number of positions, and taking the reserved feature parameters as the input of the sugar content prediction model;
[0023] S8, using gradient boosting regression algorithm to establish a sugar content prediction model;
[0024] S9, replacing the apple to be detected, and repeating steps S2-S7, so as to obtain the sugar content of the apple to be detected.
[0025] Preferably, step S4 specifically comprises the following steps:
[0026] S41, converting the collected spectrum image into a gray image;
[0027] S42, obtaining the coordinate position of the center point pixel of the scattering light spot;
[0028] S43, taking the center point of the scattering light spot as the center, obtaining a set number of pixel light intensity information in the upward, downward, left and right four directions, and obtaining the light intensity distribution in the four directions;
[0029] S44, averaging the light intensity distribution in the four directions, that is, averaging the light intensity of the four pixels at the same distance from the center point of the scattering light spot in the four directions, and arranging in turn to obtain the average light intensity distribution curve;
[0030] S45, normalizing the average light intensity distribution curve to obtain the light spot scattering distribution curve of the apple surface light spot.
[0031] Preferably, step S42 specifically comprises the following steps:
[0032] S421, using a two-dimensional sliding window to traverse the image to calculate the gray average value of each sliding window;
[0033] S422, taking the sliding window with the maximum gray average value, and taking the center point coordinates of the sliding window as the center point coordinates of the scattering light spot.
[0034] Preferably, the fitting equation of step S5 is:
[0035] R = a + b (1-e -exp(ε-δz) )
[0036] In the formula, R is the average light intensity value; z is the distance from the center point coordinates of the scattering light spot, and a, b, e, d are four variables of the Lorentz distribution function.
[0037] Preferably, in step S6, the adjustment filter with wavelength of 635nm, 650nm, 675nm is placed at the input end of the optical fiber, and the corresponding mode 1 is selected on the mobile phone, in which the ISO is set to 100, the WB is 5000K, and the exposure time is 1s;
[0038] The adjustment filter with wavelength of 800nm, 850nm, 905nm is placed at the input end of the optical fiber, and the corresponding mode 2 is selected on the mobile phone, in which the ISO is set to 100, the WB is 5000K, and the exposure time is 5s.
[0039] Preferably, in step S7, the recursive feature elimination method built in sklearn in python is used, which specifically includes the following steps:
[0040] S71, set the parameter of the estimator as a random forest;
[0041] S72, according to the feature importance determined in the recursive feature elimination stage, select different numbers of features in turn for cross-validation, and finally select the best k parameters as the input of the model:
[0042] S721, initialization: all feature parameters are considered important, and the number of feature parameters to be retained is set to k;
[0043] S722, iteration and in each iteration, train a random forest model;
[0044] S723, calculate the importance of each feature parameter, and according to the importance index of the feature parameter in the random forest model, eliminate the least important feature parameter, i.e. the feature parameter with the lowest importance;
[0045] S724, if the number of features is greater than k, continue iteration until the number of feature parameters after elimination is equal to the required number of retained feature parameters k, then stop iteration;
[0046] S725, output the retained feature parameter set, and divide the retained feature parameter set into a training set and a test set;
[0047] S726, train an RFE model using the training set, and retain k features;
[0048] S727, test the performance of the RFE model using the test set, and record the performance of the RFE model on the test set and the number of retained features k;
[0049] S728, select the RFE model with the best performance and the number of features k retained by the model;
[0050] S729, training a final RFE model using the k value obtained in step S728 to perform feature selection.
[0051] The present application has the following beneficial effects:
[0052] The overall device has high cost performance and strong prediction ability, and does not cause damage to apples while detecting the sugar content of the apples.
[0053] The technical solutions of the present application will be further described in detail below with the aid of the accompanying drawings and examples. BRIEF DESCRIPTION OF DRAWINGS
[0054] Figure 1 A structural schematic diagram of a mobile phone nondestructive testing apple sugar content device based on a multi-spectral image according to the present application;
[0055] Figure 2 A flowchart of a mobile phone nondestructive testing apple sugar content method based on a multi-spectral image according to the present application;
[0056] Figure 3 Gray original images of six wavelengths collected in an experimental example of the present application;
[0057] Figure 4 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 635 nm in an experimental example of the present application;
[0058] Figure 5 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 650 nm in an experimental example of the present application;
[0059] Figure 6 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 675 nm in an experimental example of the present application;
[0060] Figure 7 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 800 nm in an experimental example of the present application;
[0061] Figure 8 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 850 nm in an experimental example of the present application;
[0062] Figure 9 A light spot scattering profile diagram of a fitted adjustment filter with a wavelength of 905 nm in an experimental example of the present application;
[0063] Figure 10 A prediction result diagram of an experimental example of the present application.
[0064] Wherein: 1, light source; 2, light source controller; 3, adjustable mirror group; 31, first focusing lens; 32, second focusing lens; 33, reflecting mirror; 34, adjusting filter; 4, optical fiber; 5, apple to be detected; 6, optical fiber collimator; 7, mobile phone; 8, neutral density filter; 9, scattering light spot; 10, incident light; 11, lifting and moving platform. DETAILED DESCRIPTION
[0065] The application will be further described below with reference to the drawings. It should be noted that the embodiments are based on the technical solutions and give detailed implementation and specific operation process, but the protection scope of the application is not limited to the embodiments.
[0066] A kind of based on multi-spectral image's mobile phone nondestructive testing apple sugar content device, including light source 1, adjustable mirror group 3, optical fiber 4 and optical fiber collimator 6 that are sequentially arranged along optical path, optical fiber collimator 6 is aligned with the equator of apple to be detected 5 placed on lifting and moving platform 11, for generating scattering light spot 9 on the surface of apple to be detected 5;
[0067] The upper side of apple to be detected 5 is also sequentially provided with neutral density filter 8 and the detection terminal with sugar content prediction model, for predicting the sugar content of apple according to the scattering light spot 9 image collected.
[0068] Preferably, adjustable mirror group 3 includes first focusing lens 31, second focusing lens 32, reflecting mirror 33 and adjusting filter 34 arranged along optical path in sequence and arranged at the input end of optical fiber 4;Adjustable mirror group 3 is used to convert light source 1 into parallel light, and after focusing and filtering, light is converged on optical fiber 4, transmitted by optical fiber 4, and emitted by optical fiber collimator 6.In the embodiment, light source 1 is electrically connected with light source controller 2, and the light intensity can be adjusted. Neutral density filter 8 is used to make the pixel points of the photographed picture not reach the saturation state.
[0069] The bandwidth of adjusting filter 34 is 15nm, the wavelength is 635nm, 650nm, 675nm, 800nm, 850nm or 905nm.
[0070] Preferably, the diameter of optical fiber 4 is 600 μm, and the numerical aperture is 0.22.
[0071] Optical fiber 4 and optical fiber collimator 6 cooperate with each other to form an incident light spot with a diameter of 0.8mm at a distance of 30mm from apple to be detected 5, and form a scattering light spot 9 with a diameter of 25mm on the surface of apple to be detected 5.
[0072] Preferably, the light source 1 is a halogen tungsten lamp light source with a power of 250w; the detection terminal is a mobile phone 7 with a camera function; the lifting and moving platform 11 comprises a GCM-17 series scissor lifting platform and a moving wheel arranged at the bottom end of the GCM-17 series scissor lifting platform.
[0073] A non-destructive detection method of apple sugar content based on multi-spectral image of mobile phone, comprising the following steps:
[0074] S1, build and connect the detection device, and place the apple to be detected 5 on the lifting and moving platform 11;
[0075] S2, after placing the wavelength of 635nm adjusting filter 34 to the input end of the optical fiber 4, turn on the light source 1;
[0076] S3, adjust the position of the apple to be detected 5 through the lifting and moving platform 11, until the light emitted by the light source 1 passes through the adjustable mirror group 3, the optical fiber 4 and the optical fiber collimating mirror 6 in turn, and forms a scattering spot 9 on the surface of the apple to be detected 5;
[0077] S4, use the camera of the mobile phone 7 to collect the spectral image (the size ratio is 1:1, and the resolution is 3456*3456 pixels), and use image processing to obtain the scattering distribution curve of the spot on the surface of the apple to be detected 5 (similar to the form of Gaussian distribution in two-dimensional coordinate system);
[0078] Preferably, step S4 specifically comprises the following steps:
[0079] S41, convert the collected spectral image into a gray scale image;
[0080] S42, obtain the coordinate position of the center point pixel of the scattering spot 9;
[0081] Preferably, step S42 specifically comprises the following steps:
[0082] S421, use a two-dimensional sliding window to traverse the image, and calculate the gray average value of each sliding window;
[0083] S422, take the sliding window with the maximum gray average value, and take the center point coordinate of the sliding window as the center point coordinate of the scattering spot 9.
[0084] During step S42, because the image resolution is high, if the sliding window is too small, the center point cannot be accurately obtained, and if the sliding window is too large, the calculation time is too long. Through experiments, the finally selected sliding window size is 25*25 pixels, which can accurately obtain the center point of the spot while reducing the calculation time. After obtaining the center point coordinate of the first scattering spot 9, the size of the sliding window is reduced to 5*5 pixels in the subsequent calculation, and the search range is controlled near the first center point, so as to improve the efficiency of the algorithm.
[0085] S43, taking the center point of the scattering light spot as the center, obtaining a set of pixel light intensity information in each of the four directions, and obtaining light intensity distribution in the four directions;
[0086] In this embodiment, the center point of the light spot is taken as the center, and 1 pixel of light intensity information is obtained in each of the four directions in turn at intervals of 5 pixels. Each direction obtains 200 pixels of light intensity information.
[0087] S44, taking the average of the light intensity distribution in the four directions, that is, taking the average of the light intensity of the four pixels at the same distance from the center point of the scattering light spot in the four directions, and arranging in turn to obtain the average light intensity distribution curve;
[0088] S45, normalizing the average light intensity distribution curve to obtain the light spot scattering distribution curve of the apple surface light spot.
[0089] S5, fitting the improved Lorentz distribution curve and the light spot scattering distribution curve to obtain four variables of the adjusted Lorentz distribution function;
[0090] Preferably, the fitting equation of step S5 is:
[0091] R=α+β(1-e -exp(ε-δz) )
[0092] In the formula, R is the average light intensity value; z is the distance from the center point coordinate of the scattering light spot 9, and α, β, ε, δ are four variables of the Lorentz distribution function.
[0093] S6, take out the adjusting filter 34 with a wavelength of 635 nm, replace the adjusting filter 34 with a wavelength of 650 nm, 675 nm, 800 nm, 850 nm and 905 nm to the input end of the optical fiber 4 in turn, and cycle steps S3-S5, so as to obtain four variables of the Lorentz distribution function at each wavelength, that is, 24 characteristic parameters are obtained;
[0094] Preferably, in step S6, when the adjusting filter 34 with a wavelength of 635 nm, 650 nm, 675 nm is placed at the input end of the optical fiber 4, the corresponding mode 1 is selected on the mobile phone 7, in which the ISO is set to 100, the WB is 5000 K, and the exposure time is 1 s; when the adjusting filter 34 with a wavelength of 800 nm, 850 nm, 905 nm is placed at the input end of the optical fiber 4, the corresponding mode 2 is selected on the mobile phone 7, in which the ISO is set to 100, the WB is 5000 K, and the exposure time is 5 s. (When the 800 nm-905 nm band is shot, the light intensity collected is small, and when the 635 nm-675 nm band is shot, the light intensity is large, in order to avoid the saturation of the light intensity of the picture, the light intensity distribution of appropriate size is obtained, so the exposure time is adjusted)
[0095] S7, using recursive feature elimination (Recursive Feature Elimination, RFE) for dimension reduction, screening out the feature parameters with importance ranking after a certain number of positions, and taking the remaining feature parameters as the input of the sugar degree prediction model;
[0096] The principle is that in the random forest, the importance of the feature is calculated according to the contribution of each feature to the splitting of the decision tree. If a feature is used for splitting in many trees, its importance is high, otherwise it is low. Therefore, RFE uses the random forest model to calculate the importance of each feature to determine which features are most important to the performance of the model.
[0097] Preferably, in step S7, the recursive feature elimination method built in python sklearn is used, which specifically includes the following steps:
[0098] S71, setting the parameter of the estimator as a random forest;
[0099] S72, according to the feature importance determined in the recursive feature elimination stage, selecting different numbers of features in turn for cross-validation, and finally selecting the best k parameters as the input of the model (in this embodiment, k = 22, that is, among the 24 parameters, 2 parameters with poor contribution to the prediction effect of the model are removed, and 22 parameters with good contribution are left):
[0100] S721, initialization: all feature parameters are considered important, and the number of feature parameters to be retained is set to k;
[0101] S722, iteration and in each iteration, training a random forest model;
[0102] S723, calculating the importance of each feature parameter, and removing the least important feature parameter according to the importance index of the feature parameter in the random forest model, that is, the feature parameter with the lowest importance.
[0103] S724, if the number of features is greater than k, continue iteration until the number of features after elimination is equal to the required number of retained feature parameters k, then stop iteration;
[0104] S725, output the retained feature parameter set, and divide the retained feature parameter set into a training set and a test set;
[0105] S726, train an RFE model using the training set, retaining k features;
[0106] S727, test the performance of the RFE model using the test set (for example, calculate the root mean square error (RMSE) of the model), and record the performance of the RFE model on the test set and the number of retained features k;
[0107] S728, select the RFE model with the best performance (i.e., the model with the smallest RMSE) and the number of features retained by the model k;
[0108] S729, train a final RFE model using the k value obtained in step S728 for feature selection.
[0109] S8, establish a sugar content prediction model using a gradient boosting regression algorithm;
[0110] The gradient boosting algorithm is an ensemble of multiple weak learners. The algorithm trains multiple weak learners in series, each of which fits the negative gradient of the model loss function. Then, the overall model is added to the cumulative model loss after the weak learner, which can reduce the negative gradient.
[0111] S9, replace the apple to be detected 5, and repeat steps S2-S7 to obtain the sugar content of the apple to be detected 5.
[0112] Experimental example:
[0113] Red Fuji apples were used as samples, the diameter of the apple samples was 80-85 mm, and the sample cold storage time was about ten months. A total of 203 apple samples were used for experiments, and the apple surface was wiped clean and numbered after purchase, and placed in a temperature environment of about 24°C for 24 hours.
[0114] The power of the light source 1 was adjusted to 250W using the light source controller 2, the adjustable mirror group 3 was adjusted to couple the light source 1 into the optical fiber 4, and the optical fiber collimating mirror 6 can form an incident light spot with a diameter of 0.8mm at 30mm. The incident light 10 forms a scattering light spot 9 on the surface of the apple with a diameter of 25mm.
[0115] The spectral scattering image is collected by the mobile phone 7. Six different wavelength adjusting filters 34 (635, 650, 675, 800, 850, 905 nm with a bandwidth of 15 nm) are used, which have the characteristics of high temperature resistance and can ensure stable performance when being irradiated by the 250W light source 1 for a long time.
[0116] The neutral density filter 8 is used to ensure that the pixel points of the picture taken by the mobile phone 7 do not reach saturation, and the complete scattering profile is obtained.
[0117] The lifting moving platform 11 is used to adjust the position of the apple, so that the multispectral image can be collected at the same height and horizontal position each time. In this way, the scattering light spot 9 collected each time can be kept stable
[0118] Then, the scattering profile curve obtained by fitting is as shown in the following figure: Figures 4-9 F1 to F6 are the scattering profile curves under six different wavelengths of 635 nm, 650 nm, 675 nm, 800 nm, 850 nm and 905 nm respectively. The final result is as shown in the following figure: Figure 10 It can be seen that the correlation coefficient RP is 0.84 and the standard deviation SEP is 0.92%.
[0119] Therefore, the apple nondestructive sugar detection device and method based on the multispectral image of the mobile phone are used, and only ordinary light source and mobile phone are needed to perform nondestructive sugar detection of the apple, so that the detection cost is reduced.
[0120] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application but not to limit it. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can still be modified or replaced by equivalents, and these modifications or replacements cannot make the modified technical solutions deviate from the spirit and scope of the technical solutions of the present application.
Claims
1. A mobile phone non-destructive testing device for apple sugar content based on multispectral images, characterized in that: It includes a light source, an adjustable mirror group, an optical fiber, and an optical fiber collimating lens arranged sequentially along the optical path. The optical fiber collimating lens is aligned with the equator of the apple to be tested, which is placed on a lifting and moving platform, to generate a scattered light spot on the surface of the apple to be tested. Above the apple to be tested, there are also a neutral density filter and a detection terminal equipped with a sugar content prediction model, which are used to predict the sugar content of the apple based on the collected scattered light spot image. A non-destructive testing method for apple sugar content using mobile phones based on multispectral images includes the following steps: S1. Set up and connect the detection device, and place the apple to be detected on the lifting and moving platform; S2. After placing the 635nm wavelength adjustment filter at the input end of the optical fiber, turn on the light source; S3. The position of the apple to be tested is adjusted by the lifting and moving platform until the light emitted by the light source passes through the adjustable lens group, optical fiber and optical fiber collimating lens in sequence to form a scattered light spot on the surface of the apple to be tested. S4. Use the mobile phone camera to collect spectral images, and use image processing to obtain the light spot scattering distribution curve on the surface of the apple to be tested. S5. By fitting the improved Lorentz distribution curve with the light spot scattering distribution curve, the four variables of the adjusted Lorentz distribution function are obtained. The fitting equation between the improved Lorentz distribution curve and the light spot scattering distribution curve is as follows: In the formula, R is the average light intensity value; z is the distance from the center point of the scattered light spot. The four variables are the Lorentz distribution function; S6. Take out the adjustment filter with a wavelength of 635nm, and replace the adjustment filters with wavelengths of 650nm, 675nm, 800nm, 850nm and 905nm with the input end of the optical fiber in turn, and repeat steps S3-S5 to obtain the four variables of the Lorentz distribution function at each wavelength, that is, to obtain a total of 24 characteristic parameters. S7. Use the recursive feature elimination method to reduce dimensionality, filter out feature parameters whose importance ranking is after a set number of positions, and use the remaining feature parameters as input to the sugar content prediction model. S8. Establish a sugar content prediction model using the gradient boosting regression algorithm; S9. Replace the apple to be tested and repeat steps S2-S7 to obtain the sugar content of the apple to be tested.
2. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: The adjustable lens assembly includes a first focusing lens, a second focusing lens, a reflector, and an adjustable filter aligned with the input end of the optical fiber, arranged sequentially along the optical path. Adjust the bandwidth of the filter to 15nm and the wavelength to 635nm, 650nm, 675nm, 800nm, 850nm or 905nm.
3. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: The optical fiber has a diameter of 600 μm and a numerical aperture of 0.
22. The optical fiber and the optical fiber collimating lens work together to form an incident light spot with a diameter of 0.8 mm at a distance of 30 mm from the apple to be tested, and a scattered light spot with a diameter of 25 mm on the surface of the apple to be tested.
4. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: The light source is a 250W halogen tungsten lamp; The detection terminal is a mobile phone with a camera function; The lifting mobile platform includes the GCM-17 series scissor lift and the casters located at the bottom of the GCM-17 series scissor lift.
5. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: Step S4 Specifically, the following steps are included: S41. Convert the acquired spectral image into a grayscale image; S42. Obtain the coordinates of the pixel at the center of the scattered light spot; S43. Using the center point of the scattered light spot as the center, acquire a set number of pixel light intensity information in each of the four directions (up, down, left, and right) to obtain the light intensity distribution in the four directions. S44. Take the average light intensity distribution in the four directions, that is, take the average light intensity of four pixels at the same distance from the center of the scattered light spot in the four directions, and arrange them in order to obtain the average light intensity distribution curve. S45. Normalize the averaged light intensity distribution curve to obtain the light spot scattering distribution curve of the light spot on the apple surface.
6. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 5, characterized in that: Step S42 specifically includes the following steps: S421. Use a two-dimensional sliding window to traverse the image and calculate the average gray value of each sliding window; S422. Take the sliding window with the largest average gray value, and use the center point coordinates of the sliding window as the center point coordinates of the scattered light spot.
7. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: In step S6, when the adjustment filters with wavelengths of 635nm, 650nm, and 675nm are placed at the input end of the optical fiber, mode 1 is selected on the mobile phone. In mode 1, the ISO is set to 100, the WB is set to 5000K, and the exposure time is 1s. When placing the adjustable filters with wavelengths of 800nm, 850nm, and 905nm at the input end of the optical fiber, select mode 2 on the mobile phone. In mode 2, set the ISO to 100, WB to 5000K, and the exposure time to 5s.
8. The mobile phone non-destructive testing device for apple sugar content based on multispectral images according to claim 1, characterized in that: In step S7, the recursive feature elimination method built into sklearn in Python is used, which specifically includes the following steps: S71. Set the parameters of the estimator to random forest; S72. Based on the feature importance determined in the recursive feature elimination stage, different numbers of features are selected for cross-validation in turn, and finally the best k parameters are selected as the input of the model: S721. Initialization: Treat all feature parameters as important and set the number of feature parameters to be retained to k. S722, Iterate and train a random forest model in each iteration; S723. Calculate the importance of each feature parameter. Based on the importance index of the feature parameters in the random forest model, remove the least important feature parameters, i.e., the feature parameters with the lowest importance. S724. If the number of features is greater than k, continue iterating until the number of feature parameters after removal is equal to the required number of feature parameters to be retained, k, then stop iterating. S725. Output the retained feature parameter set and divide the retained feature parameter set into a training set and a test set; S726. Train an RFE model using the training set, retaining k features; S727. Test the performance of the RFE model using the test set, and record the performance of the RFE model on the test set and the number of features retained, k. S728. Select the RFE model with the best performance and the number of features k that the model retains; S729. Use the k value obtained in step S728 to train a final RFE model for feature selection.
Citation Information
Patent Citations
Rapid nondestructive detection method for content of insoluble dietary fibers in fresh-cut bamboo shoots
CN113670840A
Apple sugar degree nondestructive testing method based on machine learning
CN114993963A