Rapid detection device and method for sugar degree of prune
By designing a rapid detection device for prune sugar content with integrated spectral acquisition, micro spectrometer and Raspberry Pi, the speed and accuracy of prune sugar content detection in the existing technology are solved, and a fast, accurate and non-destructive detection effect is achieved.
Patent Information
- Application Number
- CN202510212950.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art cannot quickly and accurately detect the sugar content of prunes, and the traditional methods are cumbersome to operate and require destructive testing.
A rapid detection device for sugar content in plums was designed. The spectrum acquisition device was used to send light signals to the prunes to be detected through the light source. The spectral information of reflected light was collected using a micro spectrometer, and a two-dimensional spectral feature matrix was constructed through a Raspberry Pi, and the least squares support vector machine regression model was input for sugar content detection.
The rapid and accurate detection of the prune sugar content is achieved, the calculation amount is reduced, the accuracy of the detection is improved, and the device is hand-held, non-destructive, and convenient for operation.
Smart Images

Figure CN119985351A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of agricultural product detection, and in particular relates to a device and method for quickly detecting the sugar content of prunes. Background Art
[0002] Prunes, also known as European plums, belong to the genus Prunus in the Rosaceae family. They are a hybrid of blackthorn and cherry plum. They are mainly distributed in northern China, such as Xinjiang and Shaanxi. They are one of the characteristic pillar industries in Kashgar, Xinjiang, and are deeply loved by consumers. Prunes are rich in vitamins, cellulose and antioxidants, as well as minerals such as iron and potassium, as well as trace elements, but do not contain fat and cholesterol. They have the functions of preventing and protecting cardiovascular diseases, anti-aging, promoting bone growth, and treating constipation. The citric acid, malic acid and succinic acid rich in prunes also have the effects of lowering blood pressure, clearing away heat and stopping body fluid. In European and American countries and regions, prunes are also known as "human scavengers".
[0003] The sugar content of prunes is one of the key indicators for evaluating the quality of prunes. Currently, the sugar content of prunes can only be detected by chemical methods, which are cumbersome and complex, and require destructive testing of prunes. Therefore, there is an urgent need for a device and method for rapid detection of the sugar content of prunes. Summary of the invention
[0004] The purpose of the present invention is to provide a device and method for quickly detecting the sugar content of prunes, so as to solve the problems existing in the above-mentioned prior art.
[0005] On the one hand, to achieve the above-mentioned purpose, the present invention provides a rapid detection device for the sugar content of prunes, comprising a sugar content meter housing, a power supply unit and a sugar content detection unit are installed inside the sugar content meter housing, the sugar content detection unit comprises a signal sending module, a signal receiving module and an information processing module, the signal sending module, the signal receiving module and the power supply unit are all electrically connected to the information processing module; a sugar content meter control unit, a sugar content display unit and an optical fiber probe are installed on the outer side of the sugar content meter housing, the sugar content meter control unit and the sugar content display unit are both electrically connected to the information processing module, and the optical fiber probe is connected to the signal sending module and the signal receiving module via an optical fiber.
[0006] Optionally, the information processing module adopts Raspberry Pi.
[0007] Optionally, the signal sending module adopts an electrically adjustable light source.
[0008] Optionally, the signal receiving module adopts a miniature spectrometer.
[0009] Optionally, the saccharimeter control unit includes a plurality of physical control buttons.
[0010] Optionally, a charging base electrically connected to the power supply unit is movably mounted at the bottom of the saccharimeter housing.
[0011] On the one hand, to achieve the above-mentioned purpose, the present invention provides a method for rapid detection of prune sugar content, which is applied to the device for rapid detection of prune sugar content, comprising:
[0012] A light source is used to send a light signal to the prunes to be tested, and a micro-spectrometer is used to collect spectral information of the reflected light;
[0013] The collected spectral information is transmitted to the Raspberry Pi to construct a two-dimensional spectral feature matrix, and the two-dimensional spectral feature matrix is input into the prune regression model to perform sugar content detection to obtain the sugar content detection result; wherein, the prune regression model is constructed based on the least squares support vector machine regression model.
[0014] Optionally, the process of constructing the two-dimensional spectral feature matrix specifically includes:
[0015] Performing multivariate scattering correction and standard normal variable transformation on the spectral information to obtain effective spectral information;
[0016] Based on the UVE algorithm, characteristic wavelength points are selected from the effective spectral information, and the one-dimensional spectral feature matrix of the characteristic wavelength points is converted into a two-dimensional spectral feature matrix.
[0017] Optionally, the training process of the prune regression model specifically includes:
[0018] Acquiring training data, wherein the training data includes training spectrum information and corresponding actual sugar content;
[0019] An initial prune regression model is constructed, the training data is input into the initial prune regression model for sugar content detection, and training is performed with the goal of minimizing the loss between the initial training result after sugar content detection and the actual sugar content corresponding to the training spectral information to obtain a trained prune regression model.
[0020] The technical effects of the present invention are:
[0021] (1) The present invention uses a spectrum acquisition device to collect the spectrum of prunes. The near-infrared spectrometer is more sensitive to distinguish prunes with different sugar contents, and can effectively obtain the spectrum information of prunes. At the same time, the present invention constructs a prune sugar content regression model based on the least squares support vector machine, which can quickly and accurately detect the sugar content of prunes with different sugar contents.
[0022] (2) The present invention performs effective spectral information interception and noise data removal on the collected spectral information of prunes with different sugar contents, and obtains wavelength points that can reflect the differences in prunes with different sugar contents by selecting characteristic wavelength points, which effectively reduces the amount of calculation and improves the accuracy of prune regression detection. By converting the one-dimensional spectral feature matrix of prunes into a two-dimensional spectral feature matrix, the spectral features of prunes can be more accurately represented, thereby improving the accuracy of prune regression prediction.
[0023] (3) The present invention develops spectrum acquisition software, uses the language secondary development API of the spectrum acquisition device, and completes the call of the spectrum acquisition device in the Qt development platform; uses the QLabel class of Qt5.12 to display the prune spectrum information and the regression detection result of the prune on the display screen of the Raspberry Pi; uses the software control button to control the output of the GPIO port of the Raspberry Pi, and adjusts the parameters of the light source and the micro-spectrometer when detecting the sugar content of the prune; implements the call of the trained model in the Qt development environment; and builds the software system under Release, packages it, and deploys it to the Raspberry Pi.
[0024] (4) The present invention improves the traditional device for detecting the sugar content of prunes by making it handheld and non-destructive for detecting prune samples. The handheld saccharimeter shell is used, and the shell integrates a miniature spectrometer, a light source, a Raspberry Pi, a Y-shaped optical fiber, an optical fiber probe, a battery, a charging stand and other devices, so that the detection device can not only be portable for detection and power replenishment at any time, but also allows prune samples to be detected without any processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0026] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0027] Figure 1 This is a schematic diagram of the overall appearance of a rapid prune sugar content detection device in an embodiment of the present invention;
[0028] Figure 2 This is a schematic diagram of the overall rear view of the prune sugar content rapid detection device in an embodiment of the present invention;
[0029] Figure 3Schematic diagram of the internal structure of a rapid detection device for prune sugar content in an embodiment of the present invention;
[0030] Figure 4 This is a schematic diagram of a charging port of a rapid prune sugar content detection device in an embodiment of the present invention;
[0031] Figure 5 This is a flowchart of rapid detection of sugar content of prunes in an embodiment of the present invention;
[0032] Explanation of reference numbers: 1. Overall housing of saccharimeter; 2. Fiber optic probe; 3. Load-bearing charging dock; 4. Power plug of charging dock; 5. Raspberry Pi display screen; 6. Control buttons of saccharimeter; 7. Raspberry Pi; 8. Mini spectrometer; 9. Spectrometer fiber optic interface; 10. Spectrometer USB interface; 11. Raspberry Pi USB interface 1; 12. Raspberry Pi USB interface 2; 13. Light source USB interface; 14. Light source; 15. Light source fiber optic interface; 16. Y-type optical fiber; 17. Charging port of saccharimeter; 18. Charging port of charging dock. DETAILED DESCRIPTION
[0033] Various exemplary embodiments of the present invention will now be described in detail. This detailed description should not be considered as limiting the present invention, but should be understood as a more detailed description of certain aspects, features, and embodiments of the present invention.
[0034] It should be understood that the terms described in the present invention are only for describing special embodiments and are not intended to limit the present invention. In addition, for the numerical range in the present invention, it should be understood that each intermediate value between the upper and lower limits of the scope is also specifically disclosed. Each smaller range between the intermediate value in any stated value or stated range and any other stated value or intermediate value in the described range is also included in the present invention. The upper and lower limits of these smaller ranges can be independently included or excluded in the scope.
[0035] It will be apparent to those skilled in the art that various modifications and variations may be made to the specific embodiments of the present invention description without departing from the scope or spirit of the present invention. Other embodiments derived from the present invention description will be apparent to those skilled in the art. The present application description and examples are exemplary only.
[0036] The words “include,” “including,” “have,” “contain,” etc. used in this article are open-ended terms, meaning including but not limited to.
[0037] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0038] like Figure 1 - Figure 5 As shown, a rapid detection device for the sugar content of prunes is provided in this embodiment, including a sugar meter housing, a power supply unit and a sugar content detection unit are installed inside the sugar meter housing, the sugar content detection unit includes a signal sending module, a signal receiving module and an information processing module, the signal sending module, the signal receiving module and the power supply unit are all electrically connected to the information processing module; a sugar meter control unit, a sugar content display unit and an optical fiber probe are installed on the outer side of the sugar meter housing, the sugar meter control unit and the sugar content display unit are both electrically connected to the information processing module, and the optical fiber probe is connected to the signal sending module and the signal receiving module via an optical fiber.
[0039] A method for rapid detection of prune sugar content is applied to a device for rapid detection of prune sugar content, comprising: using a light source to send an optical signal to prunes to be detected, and using a micro-spectrometer to collect spectral information of reflected light; transmitting the collected spectral information to a Raspberry Pi to construct a two-dimensional spectral feature matrix, and inputting the two-dimensional spectral feature matrix into a prune regression model to perform sugar content detection to obtain a sugar content detection result; wherein the prune regression model is constructed based on a least squares support vector machine regression model.
[0040] The present embodiment provides a handheld prune sugar content rapid detection device, which includes a handheld prune sugar content detector, the handheld prune sugar content detector is provided with a sugar content meter housing 1, and a light source 14 with an optical fiber interface and a USB interface is provided in the housing, and the light outlet of the light source 14 is the light source optical fiber interface 15 and is connected to a Y-type optical fiber 16. The Y-type optical fiber 16 is divided into two ends, one end of which is merged together and connected to an optical fiber probe 2, and the other end is divided into two branches, which serve as a sending optical fiber and a receiving optical fiber respectively, wherein the optical fiber connected to the light source 14 is the sending optical fiber of the Y-type optical fiber 16, firstly, it transmits the light emitted by the light source 14 to the optical fiber probe 2 fixed on the sugar content meter housing 1 through a perforation, and the optical fiber probe 2 shines the light on the prune sample, and collects the light reflected by the prune sample, and collects the spectrum information of the prune sample to the miniature spectrometer 8 through the receiving optical fiber connected to the optical fiber interface 9 of the spectrometer at the other end of the Y-type optical fiber 16. The spectrometer USB interface 10 is connected to the first Raspberry Pi USB interface 11 through a USB data cable to transmit the collected spectral information to the Raspberry Pi 7 with an integrated display screen, and the Raspberry Pi 7 with an integrated display screen analyzes the spectral information of the prune to determine its sugar content, and displays the result on the display screen 5 of the Raspberry Pi 7. The Raspberry Pi 7 with a display screen is connected to the spectrometer USB interface 10 and the light source USB interface 13 through its USB interface 111 and USB interface 212 respectively, which can not only display the parameters of the micro-spectrometer 8 and the light source 14 through the display screen 5, but also adjust the two instrument parameters through the sugar meter control button 6 below the display screen 5. The sugar meter control button 6 is the control button of the Raspberry Pi 7 and is embedded in the surface of the sugar meter housing 1 with the Raspberry Pi display screen 5. The power supply of the light source 14, the power supply of the micro-spectrometer 8 and the Raspberry Pi 7 are all connected in series and powered by a battery embedded in the bottom of the handle of the saccharimeter housing 1; the battery is charged by inserting the saccharimeter charging socket 17 into the charging socket 18 on the load-bearing charging socket 3, and then charging it through the power plug 4 of the load-bearing charging socket 3.
[0041] The micro-spectrometer 8 is used to collect the spectral information of the prunes. In this embodiment, the micro-spectrometer 8 adopts the near-infrared spectrometer of Shenzhen Spectronix Interconnection Co., Ltd., which can collect diffuse reflectance spectrum data of prune samples with a collection range of 200-1400nm and a resolution of 4cm -1 .
[0042] The Y-type optical fiber 16 is used to transmit the light from the light source 14 to the optical fiber probe 2, and then the optical fiber probe 2 collects the diffuse reflected light information of the plum sample to the micro-spectrometer 8, and then transmits it to the Raspberry Pi 7; the Y-type optical fiber in this embodiment is an external purchased part and is a universal part.
[0043] The housing 1 of the handheld saccharimeter is used to carry various functional components. In this embodiment, the housing 1 of the handheld saccharimeter is made of ABS plastic, and the handle part of the housing is made of anti-slip and wear-resistant material.
[0044] The light source 14 is used to project light onto the prune sample; the power of the light source 14 can be electrically adjusted.
[0045] The charging socket 17 of the prune sugar meter is equipped with a battery for powering the micro-spectrometer 8, the light source 14, the Raspberry Pi display screen 5 and the Raspberry Pi 10; the charging socket 18 of the load-bearing charging stand 3 should be matched with the charging socket 17 of the prune sugar meter; the power plug 4 of the charging stand should have an explosion-proof function and the power should meet the requirements.
[0046] The Raspberry Pi with integrated display is a Raspberry Pi 4B with an external 5-inch LCD display.
[0047] Raspberry Pi 7 is used to predict the sugar content of the prunes according to the spectral information, and display the result through its display screen; in this embodiment, the hardware configuration of Raspberry Pi 7 is CPU Intel Core i7-1210M 2.50GHz processor, RAM (8G), windows64-bit operating system; Raspberry Pi 7 is embedded with spectral data processing software, and the spectral information processing flow of the processing software includes:
[0048] A. Read spectral data;
[0049] B. Intercept effective spectral information and perform spectral preprocessing;
[0050] C. Select characteristic wavelength points;
[0051] D. Convert one-dimensional spectral data into a two-dimensional spectral matrix;
[0052] E. Import the spectral two-dimensional matrix into the trained regression model;
[0053] F. Get the test results.
[0054] The specific working process of the handheld prune sugar content rapid detection device in this embodiment includes:
[0055] First, confirm whether the parameters of each detection instrument displayed on the Raspberry Pi display screen 5 need to be adjusted. If necessary, adjust the parameters of each detection instrument in the detection device through the saccharimeter control button 6; including setting the parameters of the micro-spectrometer 8 and the power parameters of the light source 14; if charging is required, first connect the load-bearing charging socket 3 to the external power supply through its power plug 4, and then put the prune saccharimeter charging socket 17 into the charging socket 18 of the load-bearing charging base 3.
[0056] Secondly, the spectrum information of the prunes is collected, and the sugar content of the prunes is predicted based on the spectrum information; and the information is displayed on the Raspberry Pi display 5.
[0057] Reference Figure 2 As shown, this embodiment also provides a handheld prune sugar content rapid detection method, comprising the following steps:
[0058] S1. Build a collection platform for prune spectra;
[0059] S2. Collect the spectrum information of prunes through the collection platform; the collected spectrum wave number range is 400~1100nm wave number range, and the resolution is 4cm -1 , repeated sampling 8 times;
[0060] S3, processing the collected prune spectrum information to obtain a two-dimensional spectrum feature matrix;
[0061] S3. Input the two-dimensional spectral feature matrix into the trained prune regression model and output the sugar content detection result.
[0062] The construction and training process of the prune regression model includes:
[0063] The effective spectral information is intercepted, and multivariate scattering correction and standard normal variable transformation are performed for preprocessing to obtain a sample set;
[0064] The original spectrum collected has large noise, light scattering and dimension due to the complex shape of prunes, which ultimately increases the difficulty of regression model training and reduces prediction accuracy. After being processed by the multivariate scatter correction algorithm, the spectral curve will be smoothed to reduce noise, and then after the standard normal variable transformation algorithm, the spectral dimension will be greatly reduced, which also reduces the difficulty of recognition model training.
[0065] Label the sample set and divide it into training set and test set through the algorithm;
[0066] All samples in the sample set are labeled. The labels of prunes with different sugar contents correspond to their sugar contents obtained by the refractometer method. The sample set is divided using the SPXY algorithm based on the principle that the ratio of training set to test set is 7:3.
[0067] Selection of characteristic wavelength points for samples in the training set: The intercepted spectrum contains 1000 wavelength points, and the amount of data is large, which increases the calculation time of the regression model. Therefore, characteristic wavelength points are selected for the spectrum intercepted from the training set samples; this embodiment uses the UVE algorithm to select wavelength points that can reflect the difference between prunes with different sugar contents, and a total of 170 wavelength points are retained.
[0068] Based on the characteristic wavelength points selected from the training set samples, a two-dimensional spectral feature matrix is constructed: the selected characteristic wavelength points are a 1×11 one-dimensional spectral feature matrix, and the 1×11 one-dimensional spectral feature matrix is converted into a 11×11 two-dimensional spectral feature matrix by multiplying the one-dimensional spectral feature matrix with the transposed matrix of the one-dimensional spectral feature matrix.
[0069] A prune regression model was built based on the least squares support vector machine and the two-dimensional spectral feature matrix, and the prune regression model was trained;
[0070] In this embodiment, a least squares support vector machine and a two-dimensional spectral feature matrix are used to establish a prune regression model. The prune regression model is trained using a training set, which is saved as a pb file and exported after training. The prune regression model is tested using a test set to determine the applicability of the prune regression model.
[0071] The effective spectral information of the prunes to be tested is intercepted and converted into a two-dimensional spectral feature matrix through characteristic wavelength points. The two-dimensional spectral feature matrix is input into the trained prune regression model to complete the prediction of prunes with different sugar contents. The pb file is called and the two-dimensional spectral feature matrix of prunes is input to complete the non-destructive detection of the sugar content of prunes.
[0072] In order to further verify the effectiveness of the method of this embodiment, 60 prunes were purchased from Australia, Xinjiang Yili and Xinjiang Kashgar as experimental materials. There were 135 training sets and 45 test sets. The determination coefficient of the training set prediction was 99.8%, and the determination coefficient of the test set prediction was 80.3%. The method of this embodiment can meet the requirements of actual production.
[0073] In this embodiment, a spectrum acquisition device is used to collect the spectrum of prunes. The near-infrared spectrometer is more sensitive to the difference between prunes with different sugar contents, and can effectively obtain the spectrum information of prunes. At the same time, this embodiment constructs a prune sugar content regression model based on the least squares support vector machine, which can quickly and accurately detect the sugar content of prunes with different sugar contents.
[0074] This embodiment performs effective spectral information interception to remove noise data from the collected spectral information of prunes with different sugar contents, and obtains wavelength points that can reflect the differences in prunes with different sugar contents through the selection of characteristic wavelength points, which effectively reduces the amount of calculation and improves the accuracy of prune regression detection. By converting the one-dimensional spectral feature matrix of prunes into a two-dimensional spectral feature matrix, the spectral characteristics of prunes can be more accurately represented, thereby improving the accuracy of prune regression prediction.
[0075] In this embodiment, spectral acquisition software is developed. The language secondary development API of the spectral acquisition device is used to complete the call of the spectral acquisition device in the Qt development platform; the QLabel class of Qt5.12 is used to display the prune spectrum information and the regression detection results of the prune on the display screen of the Raspberry Pi; the software control button is used to control the output of the GPIO port of the Raspberry Pi, and the parameters of the light source and the micro-spectrometer are adjusted when the sugar content of the prune is detected; the call of the trained model is realized in the Qt development environment; and the software system is built under Release, packaged and released, and deployed to the Raspberry Pi.
[0076] This embodiment improves the traditional device for detecting the sugar content of prunes by making it handheld and non-destructive for the detection of prune samples. The handheld saccharimeter shell is used, and the shell integrates a miniature spectrometer, a light source, a Raspberry Pi, a Y-shaped optical fiber, an optical fiber probe, a battery, a charging stand and other devices, so that the detection device can not only be portable for detection and power replenishment at any time, but also allows the prune samples to be used for detection without any processing.
[0077] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A rapid detection device for prune sugar content, characterized in that: The invention comprises a saccharimeter shell, wherein a power supply unit and a saccharimeter detection unit are installed inside the saccharimeter shell, wherein the saccharimeter detection unit comprises a signal sending module, a signal receiving module and an information processing module, wherein the signal sending module, the signal receiving module and the power supply unit are all electrically connected to the information processing module; a saccharimeter control unit, a saccharimeter display unit and an optical fiber probe are installed outside the saccharimeter shell, wherein the saccharimeter control unit and the saccharimeter display unit are both electrically connected to the information processing module, and the optical fiber probe is connected to the signal sending module and the signal receiving module via an optical fiber.
2. A rapid detection device for prune sugar content according to claim 1, characterized in that: The information processing module adopts Raspberry Pi.
3. A rapid detection device for prune sugar content according to claim 1, characterized in that: The signal sending module adopts an electrically adjustable light source.
4. A rapid detection device for prune sugar content according to claim 1, characterized in that: The signal receiving module adopts a micro-spectrometer.
5. A rapid detection device for prune sugar content according to claim 1, characterized in that: The saccharimeter control unit includes a plurality of physical control buttons.
6. A rapid detection device for prune sugar content according to claim 1, characterized in that: A charging base electrically connected to the power supply unit is movably mounted at the bottom of the saccharimeter housing.
7. A method for rapid detection of prune sugar content, applied to a device for rapid detection of prune sugar content according to any one of claims 1 to 6, characterized in that: include: A light source is used to send a light signal to the prunes to be tested, and a micro-spectrometer is used to collect spectral information of the reflected light; The collected spectral information is transmitted to the Raspberry Pi to construct a two-dimensional spectral feature matrix, and the two-dimensional spectral feature matrix is input into the prune regression model to perform sugar content detection to obtain the sugar content detection result; wherein, the prune regression model is constructed based on the least squares support vector machine regression model.
8. A method for rapid detection of prune sugar content according to claim 7, characterized in that: The process of constructing the two-dimensional spectral feature matrix specifically includes: Performing multivariate scattering correction and standard normal variable transformation on the spectral information to obtain effective spectral information; Based on the UVE algorithm, characteristic wavelength points are selected from the effective spectral information, and the one-dimensional spectral feature matrix of the characteristic wavelength points is converted into a two-dimensional spectral feature matrix.
9. A method for rapid detection of prune sugar content according to claim 7, characterized in that: The training process of the prune regression model specifically includes: Acquiring training data, wherein the training data includes training spectrum information and corresponding actual sugar content; An initial prune regression model is constructed, the training data is input into the initial prune regression model for sugar content detection, and training is performed with the goal of minimizing the loss between the initial training result after sugar content detection and the actual sugar content corresponding to the training spectral information to obtain a trained prune regression model.
Citation Information
Cited By
Multispectral berry maturity grading method and device based on leaf node sequence self-attention mechanism
CN122361312A