Method and system for detecting moisture content of fruits and vegetables during fruit and vegetable drying process

Image processing technology is used to extract the characteristics of fruit and vegetable samples and combined with GRNN to establish a prediction model, which solves the problems of complexity and lack of accuracy of traditional detection methods, and achieves efficient and accurate moisture content detection in dried fruits and vegetables, which is suitable for a variety of fruits and vegetables.

CN113554625BActive Publication Date: 2024-10-18JINAN INST OF FRUIT PRODS CHINA GENERAL SUPPLY & MARKETING COOP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110843092.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-26
Publication Date
2024-10-18
Estimated Expiration
2041-07-26

AI Technical Summary

Technical Problem

Traditional fruit and vegetable moisture content detection methods are complex, time-consuming and highly destructive to carrot slices. Existing rapid detection methods have shortcomings in accuracy and real-time performance, especially in drying ovens with large temperature changes, which are prone to deviations.

Method used

Using image processing technology, by extracting the color, grayscale and shape characteristics of fruit and vegetable samples, combined with generalized regression neural network (GRNN) and least squares polynomial fitting, a prediction model is established to achieve non-contact and non-destructive detection of fruit and vegetable moisture content.

Benefits of technology

It achieves efficient and accurate moisture content measurement in the drying process of fruits and vegetables, reduces measurement errors, meets real-time detection requirements, and is suitable for fruit drying processes with low product added value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113554625B_ABST
    Figure CN113554625B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables, belonging to the technical field of drying fruits and vegetables, obtaining slice images of fruit and vegetable samples to be detected; using a trained prediction model, processing the slice images of fruit and vegetable samples to be detected to obtain processing results, and the processing results include the moisture content of the fruit and vegetable samples; wherein the trained prediction model is obtained by training a training set, and the training set includes a plurality of slice images of fruit and vegetable samples and labels of the true moisture content of the fruit and vegetable samples in the annotated images. The present invention extracts the grayscale features, color features and shape features of the fruits in the images, verifies the connection between them and the moisture content of the fruits, and can effectively determine the moisture content of the fruits by combining polynomial fitting with a GRNN neural network, thereby reducing the measurement error and realizing the non-destructive moisture content determination of fruits and vegetables in the process of drying fruits and vegetables.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of fruit and vegetable drying, and in particular to a method and system for detecting the moisture content of fruits and vegetables in a fruit and vegetable drying process. Background Art

[0002] For seasonal vegetables such as carrots and apples, if the storage or transportation methods are not appropriate, it will cause significant losses. Fruit and vegetable drying is an effective way to regulate supply and demand and digest seasonal surpluses. Through drying technology, the moisture content of fruits and vegetables is effectively reduced, the activity of microorganisms in fruits can be inhibited, the activity of enzymes and the rate of chemical reactions can be reduced, and dried fruits and vegetables can be preserved for a long time.

[0003] Moisture content is an important indicator to measure the degree and effect of drying. Therefore, rapid and accurate determination of moisture content in fruits and vegetables is of great significance to the drying process as well as further storage and sales. Traditional methods for measuring moisture content mainly include direct drying, vacuum drying, azeotropic distillation, etc. Traditional measurement methods have good performance in terms of reliability and accuracy, but their measurement process is complicated, time-consuming, and highly destructive to carrot slices.

[0004] In order to solve the problems existing in traditional moisture content detection methods, rapid non-destructive detection technology of food moisture content has been widely studied. It is a common method to study the moisture content through the dielectric constant of fruits and vegetables. Guo et al. measured the moisture content of honey simply and quickly through the strong linear correlation between dielectric constant and moisture content. Besharati et al. used a capacitor with an oscillation circuit to measure the capacitance of seeds and estimated the moisture content of seeds through linear regression modeling. Ling et al. studied the relationship between moisture content, temperature, microwave frequency and salt content and dielectric constant, and established a polynomial equation of moisture content, temperature and dielectric constant, which can be used for moisture content detection. The method of obtaining the moisture content of fruits and vegetables by measuring the dielectric constant of fruits and vegetables is simple in operation, but the dielectric constant of fruit and vegetable materials is greatly affected by temperature and is prone to deviation in a drying oven with large temperature changes.

[0005] In order to more accurately measure the moisture content, Li et al. used low-field nuclear magnetic resonance (LF-NMR) technology to study the different moisture changes of apples during the drying process. This technology can accurately measure the moisture content and water activity. Sun et al. used a combination of LF-NMR and back propagation artificial neural network (BP-ANN) technology to achieve online detection of moisture content during the drying process of carrots. Nuclear magnetic resonance technology can not only accurately measure the moisture content, but also see the migration state and movement law of moisture. It is of great significance in the field of food research. However, nuclear magnetic resonance equipment is expensive and complicated to operate, making it difficult to apply in the fruit drying process with low product added value.

[0006] In order to reduce the cost of moisture content detection, Tham et al. used near-infrared spectroscopy to measure the moisture content of wood. Near-infrared spectroscopy has the advantage of being sensitive to chemical composition and can accurately detect color changes in samples, but it can only measure local areas of the sample, and the information in the local area cannot truly reflect the overall moisture information.

[0007] Hyperspectral imaging technology can obtain spectral and spatial information at the same time. Since a large amount of data of hyperspectral images is collected and processed in a wide band, its detection speed is difficult to meet the real-time detection speed required in practical applications. In order to improve the real-time performance of hyperspectral image detection, multispectral imaging technology is introduced in hyperspectral image quality detection, and multispectral imaging technology is used to detect the moisture content of carrots, etc. However, this method cannot achieve a high accuracy rate. Summary of the invention

[0008] The object of the present invention is to provide a contactless, non-destructive, efficient and high-precision method and system for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process, so as to solve at least one technical problem existing in the above-mentioned background technology.

[0009] In order to achieve the above object, the present invention adopts the following technical solutions:

[0010] In one aspect, the present invention provides a method for detecting the moisture content of fruits and vegetables during a fruit and vegetable drying process, comprising:

[0011] Acquire slice images of fruit and vegetable samples to be tested;

[0012] The trained prediction model is used to process the slice images of the fruit and vegetable samples to be tested to obtain processing results, and the processing results include the moisture content of the fruit and vegetable samples; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0013] Preferably, the prediction model obtained by training the training set includes:

[0014] Extract the color features of the sliced ​​images of fruit and vegetable samples and calculate the hue feature values;

[0015] Extract the grayscale features of the sliced ​​images of fruit and vegetable samples and calculate the grayscale feature values;

[0016] Extract shape features of fruit and vegetable sample slice images and calculate shape feature values;

[0017] The hue eigenvalue, grayscale eigenvalue and shape eigenvalue are associated with moisture content through polynomial fitting, and the generalized regression neural network GRNN is introduced to calculate the weight of each feature. The least squares polynomial curve fitting is used to optimize GRNN until the sum of squares of the error between the true value and the predicted value is minimized, thus obtaining a trained prediction model.

[0018] Preferably, calculating the hue characteristic value includes: after converting the image into an HSV image, extracting the hue characteristics of the sample for statistical analysis to obtain a hue histogram, different fruit and vegetable sample slices have different hue peaks, the higher the moisture content, the higher the hue peak, and the hue peak is the hue characteristic value.

[0019] Preferably, calculating the grayscale feature value includes: converting the image into a grayscale image, analyzing the extracted grayscale features to obtain a grayscale histogram, and calculating the grayscale feature value F G As shown below:

[0020]

[0021] Among them, v i Indicates the i-th maximum value in the peak range corresponding to the sample in the grayscale histogram, F G is the average of these n maximum values.

[0022] Preferably, calculating the shape feature value includes:

[0023] The image is grayed out and segmented into a binary image using the OTSU threshold segmentation algorithm to extract the fruit and vegetable area. The opening operation in the morphological method is used to smooth the contours of the fruit and vegetable area, calculate the projection area of ​​the fruit and vegetable area, and obtain the area of ​​the minimum circumscribed circle of the area. The ratio of the projection area to the area of ​​the minimum circumscribed circle is the shape feature value.

[0024] Preferably, in order to evaluate the performance of the prediction model, the correlation coefficient and the root mean square error of the model prediction are calculated. The larger the correlation coefficient and the smaller the root mean square error, the more accurate the prediction result.

[0025] Preferably, calculating the correlation coefficient R and the root mean square error RMSE of the model prediction includes:

[0026]

[0027]

[0028] Among them, X represents the true moisture content, Y represents the predicted moisture content, cov represents the covariance, and E is the mathematical expectation.

[0029] In a second aspect, the present invention provides a system for detecting the moisture content of fruits and vegetables during a fruit and vegetable drying process, comprising:

[0030] An acquisition module is used to acquire slice images of fruit and vegetable samples to be tested;

[0031] The prediction module is used to use the trained prediction model to process the slice image of the fruit and vegetable sample to be detected to obtain a processing result, and the processing result includes the moisture content of the fruit and vegetable sample; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the actual moisture content of the fruit and vegetable samples in the annotated images.

[0032] In a third aspect, the present invention provides a non-transitory computer-readable storage medium, which is used to store computer instructions. When the computer instructions are executed by a processor, the instructions for the method for detecting the moisture content of fruits and vegetables in the fruit and vegetable drying process as described above are implemented.

[0033] In a fourth aspect, the present invention provides an electronic device, comprising: a processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes the method for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables as described above.

[0034] The beneficial effects of the present invention are as follows: the grayscale features, color features and shape features of the fruits in the image are extracted, and the relationship between them and the moisture content of the fruits is verified. By combining polynomial fitting with the GRNN neural network, the moisture content of the fruits can be effectively determined, the measurement error is reduced, and the non-destructive moisture content determination of fruits and vegetables in the process of fruit and vegetable drying is realized.

[0035] Additional aspects and advantages of the present invention will be given in part in the following description, which will become obvious from the following description, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0037] Figure 1 This is a statistical histogram of the H channel of the HSV color model of carrot slices with different moisture contents according to an embodiment of the present invention.

[0038] Figure 2 This is a grayscale statistical histogram of carrot slices with different moisture contents according to an embodiment of the present invention.

[0039] Figure 3This is a schematic diagram of the deformation of carrot slices with different moisture contents according to an embodiment of the present invention.

[0040] Figure 4 1 is a structural diagram of the GRNN network described in an embodiment of the present invention.

[0041] Figure 5 This is a schematic diagram of the relative error of the measurement of the moisture content of carrot slices detected by the method of the present invention as described in an embodiment of the present invention.

[0042] Figure 6 The figure is a schematic diagram comparing the actual moisture content and the predicted moisture content in the carrot slices according to the embodiment of the present invention. DETAILED DESCRIPTION

[0043] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below by the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0044] It should be understood by those skilled in the art that unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which this invention belongs.

[0045] It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have a meaning consistent with that in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless as defined herein.

[0046] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or groups thereof.

[0047] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0048] To facilitate understanding of the present invention, the present invention is further explained below with reference to specific embodiments in conjunction with the accompanying drawings, and the specific embodiments do not constitute a limitation on the embodiments of the present invention.

[0049] Those skilled in the art should understand that the drawings are merely schematic diagrams of embodiments, and the components in the drawings are not necessarily necessary for implementing the present invention.

[0050] Example 1

[0051] In this embodiment 1, a system for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process is provided, and the system comprises:

[0052] An acquisition module is used to acquire slice images of fruit and vegetable samples to be tested;

[0053] The prediction module is used to use the trained prediction model to process the slice image of the fruit and vegetable sample to be detected to obtain a processing result, and the processing result includes the moisture content of the fruit and vegetable sample; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the actual moisture content of the fruit and vegetable samples in the annotated images.

[0054] In this embodiment 1, the above system is used to implement a method for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process. The method includes:

[0055] Using the acquisition module, the slice image of the fruit and vegetable sample to be tested is acquired;

[0056] Using the prediction module, based on the trained prediction model, the slice image of the fruit and vegetable sample to be tested is processed to obtain a processing result, and the processing result includes the moisture content of the fruit and vegetable sample; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the actual moisture content of the fruit and vegetable samples in the annotated images.

[0057] In this embodiment 1, the prediction model obtained by training the training set includes:

[0058] Extract the color features of the sliced ​​images of fruit and vegetable samples and calculate the hue feature values;

[0059] Extract the grayscale features of the sliced ​​images of fruit and vegetable samples and calculate the grayscale feature values;

[0060] Extract shape features of fruit and vegetable sample slice images and calculate shape feature values;

[0061] The hue eigenvalue, grayscale eigenvalue and shape eigenvalue are associated with moisture content through polynomial fitting, and the generalized regression neural network GRNN is introduced to calculate the weight of each feature. The least squares polynomial curve fitting is used to optimize GRNN until the sum of squares of the error between the true value and the predicted value is minimized, thus obtaining a trained prediction model.

[0062] The calculation of the hue characteristic value includes: after converting the image into an HSV image, extracting the hue characteristics of the sample for statistical analysis to obtain a hue histogram. Different fruit and vegetable sample slices have different hue peaks. The higher the moisture content, the higher the hue peak. The hue peak is the hue characteristic value.

[0063] Calculating the grayscale eigenvalue includes: converting the image into a grayscale image, analyzing the extracted grayscale features, obtaining a grayscale histogram, and calculating the grayscale eigenvalue F G As shown below:

[0064]

[0065] Among them, v i Indicates the i-th maximum value in the peak range corresponding to the sample in the grayscale histogram, F G is the average of these n maximum values.

[0066] Calculating shape feature values ​​includes:

[0067] The image is grayed out and segmented into a binary image using the OTSU threshold segmentation algorithm to extract the fruit and vegetable area. The opening operation in the morphological method is used to smooth the contours of the fruit and vegetable area, calculate the projection area of ​​the fruit and vegetable area, and obtain the area of ​​the minimum circumscribed circle of the area. The ratio of the projection area to the area of ​​the minimum circumscribed circle is the shape feature value.

[0068] In this embodiment 1, in order to evaluate the performance of the prediction model, the correlation coefficient and the root mean square error of the model prediction are calculated. The larger the correlation coefficient and the smaller the root mean square error, the more accurate the prediction result.

[0069] Among them, the correlation coefficient R and root mean square error RMSE of the calculation model prediction include:

[0070]

[0071]

[0072] Among them, X represents the true moisture content, Y represents the predicted moisture content, cov represents the covariance, and E is the mathematical expectation.

[0073] Example 2

[0074] In this embodiment 2, a system for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process is provided, and the system can be used to detect the moisture content of carrots during the carrot drying process. The system includes:

[0075] An acquisition module is used to acquire the carrot slice image to be detected;

[0076] The prediction module is used to process the carrot slice image to be detected using the trained prediction model to obtain a processing result, wherein the processing result includes the moisture content of the carrot slice; wherein the trained prediction model is obtained by training a training set, and the training set includes a plurality of dried carrot sample slice images and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0077] In this embodiment 2, the above system is used to implement a method for detecting the moisture content of carrots during the carrot drying process, and the method includes:

[0078] Using the acquisition module, the carrot slice image to be detected is acquired;

[0079] The prediction module is used to process the carrot slice image to be detected based on the trained prediction model to obtain a processing result, wherein the processing result includes the moisture content of the carrot slice; wherein the trained prediction model is obtained by training a training set, and the training set includes a plurality of dried carrot sample slice images and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0080] In this embodiment 2, the prediction model obtained by training the training set includes:

[0081] Extract the color features of the carrot sample slice image and calculate the hue feature value;

[0082] Extract the grayscale features of the carrot sample slice image and calculate the grayscale feature value;

[0083] Extract the shape features of the carrot sample slice image and calculate the shape feature value;

[0084] The hue eigenvalue, grayscale eigenvalue and shape eigenvalue are associated with moisture content through polynomial fitting, and the generalized regression neural network GRNN is introduced to calculate the weight of each feature. The least squares polynomial curve fitting is used to optimize GRNN until the sum of squares of the error between the true value and the predicted value is minimized, thus obtaining a trained prediction model.

[0085] The calculation of the hue characteristic value includes: after converting the image into an HSV image, extracting the hue characteristics of the sample for statistical analysis to obtain a hue histogram. Different fruit and vegetable sample slices have different hue peaks. The higher the moisture content, the higher the hue peak. The hue peak is the hue characteristic value.

[0086] Calculating the grayscale eigenvalue includes: converting the image into a grayscale image, analyzing the extracted grayscale features, obtaining a grayscale histogram, and calculating the grayscale eigenvalue F G As shown below:

[0087]

[0088] Among them, v i Indicates the i-th maximum value in the peak range corresponding to the sample in the grayscale histogram, F G is the average of these n maximum values.

[0089] Calculating shape feature values ​​includes:

[0090] The image is grayed out and segmented into a binary image using the OTSU threshold segmentation algorithm to extract the fruit and vegetable area. The opening operation in the morphological method is used to smooth the contours of the fruit and vegetable area, calculate the projection area of ​​the fruit and vegetable area, and obtain the area of ​​the minimum circumscribed circle of the area. The ratio of the projection area to the area of ​​the minimum circumscribed circle is the shape feature value.

[0091] In this embodiment 2, in order to evaluate the performance of the prediction model, the correlation coefficient and the root mean square error of the model prediction are calculated. The larger the correlation coefficient and the smaller the root mean square error, the more accurate the prediction result.

[0092] Among them, the correlation coefficient R and root mean square error RMSE of the calculation model prediction include:

[0093]

[0094]

[0095] Among them, X represents the true moisture content, Y represents the predicted moisture content, cov represents the covariance, and E is the mathematical expectation.

[0096] In this embodiment 2, the accuracy of the prediction method is measured by relative error, and the relative error is calculated as shown in the following formula:

[0097]

[0098] Where A and B represent the moisture content measured by the dry weighing method and the moisture content measured by visual characteristics, respectively.

[0099] Least squares polynomial curve fitting is a common modeling method. The main idea of ​​the least squares method is to minimize the sum of square errors between the true value and the predicted value by determining the unknown parameters. The calculation formula is shown in equations (1)-(5).

[0100]

[0101]

[0102]

[0103]

[0104] …

[0105]

[0106] Among them, x is a feature value of the carrot image, y i is the actual moisture content of the carrot slices, is the corresponding predicted value. Loss is the square of the result of subtracting the polynomial function from the true function value, which represents the error relationship of the polynomial function. In order to optimize the objective function, the partial derivative of each coefficient is 0, and the required coefficient a can be determined to determine the polynomial function. The characteristic value of the image is associated with the moisture content through polynomial fitting, and the moisture content can be predicted through a certain characteristic value.

[0107] In order to more accurately express the relationship between multiple features, a generalized regression neural network (GRNN) is introduced to calculate the weight of each feature. GRNN is an improvement of radial basis neural network (RBF) with a similar structure. GRNN has strong nonlinear mapping ability and learning speed, which is more advantageous than RBF. When the sample data is small, the prediction effect is very good, and it can also handle unstable data.

[0108] The network structure of GRNN is as follows Figure 4 As shown in Figure 1, it consists of four layers. GRNN adds a summation layer and cancels the weighted connection between the hidden layer and the output layer. The number of nodes in the summation layer is the output dimension plus 1. The output of the summation layer is divided into two parts. The output of the first node is the arithmetic sum of the output of the pattern layer, and the output of the remaining k nodes is the weighted sum of the output of the pattern layer. The calculation method is shown in equations (6) and (7).

[0109]

[0110]

[0111] Among them, P i is the output of the i-th neuron in the pattern layer, and the weighted coefficient y ijis the jth element of the training sample label. The calculation method of the output layer is shown in formula (8).

[0112]

[0113] In this embodiment, the moisture content corresponding to the hue eigenvalue, grayscale eigenvalue and shape eigenvalue is first calculated by polynomial fitting, and then the weight of each feature is calculated by GRNN, so as to finally realize the accurate determination of the moisture content of the carrot slice according to the visual features.

[0114] Example 3

[0115] In this Example 3, a method for rapid determination of moisture content based on visual features of carrots is proposed. The grayscale features, color features and shape features extracted from the image are used, and a moisture content prediction model is established using least squares polynomial fitting and GRNN neural network, and verification and comparison are performed.

[0116] In this Example 3, in order to train the prediction model, sample preparation is first performed.

[0117] In this embodiment, the carrots used were purchased from a certain market. After selecting high-quality samples, the carrots were washed and peeled, and cut into slices with a thickness of 5 mm. After further screening of the carrot slices, a total of 280 experimental samples were prepared, and the hot air drying method was used to dry them for 20 min, 40 min, 60 min, 80 min, 100 min, 120 min and 140 min respectively. The images of the carrot slices after hot air drying were collected, and the moisture content of the samples was immediately measured by the dry weighing method in accordance with the national standard (GB 5009.3-2016), and the calculation was performed using formula (1). Among them, 80% of the samples were used for experimental derivation, and 20% of the samples were used to verify the experimental results.

[0118]

[0119] Where X is the moisture content in the sample, m1 is the mass of the weighing bottle and the sample; m2 is the mass of the weighing bottle and the sample after drying; m3 is the mass of the weighing bottle; and 100 is the unit conversion factor.

[0120] During the drying process of carrots, the color of the samples is constantly changing. Color features are the most widely used visual features in image retrieval. The HSV color model is closer to human perception of color. After converting the image into an HSV image, the hue features of the sample are extracted for statistical analysis. The hue histogram statistics are as follows: Figure 1 As shown, line 1 indicates a moisture content of 9.73%, line 2 indicates a moisture content of 52.13%, line 3 indicates a moisture content of 70.27%, and line 4 indicates a moisture content of 89.48%.

[0121] Different carrot slices have significantly different peak values ​​in the range of hue 2-20, and the higher the moisture content, the higher the peak value in this range. H is the peak value in this range.

[0122] Compared with color images, grayscale images only retain the brightness information of the image, without color information. Grayscale histogram can more intuitively represent the one-dimensional information of the image, and it can accurately reflect the frequency of occurrence of different grayscale values ​​of pixels in the image. After converting the image into a grayscale image, useful grayscale features are extracted for analysis. Figure 2 As shown, line 1 indicates a moisture content of 9.73%, line 2 indicates a moisture content of 52.13%, line 3 indicates a moisture content of 70.27%, and line 4 indicates a moisture content of 89.48%.

[0123] Calculate the grayscale eigenvalue F of the carrot grayscale image G , F G The calculation method is shown in formula 2. Where v i is the i-th maximum value in the peak range corresponding to the sample in the grayscale histogram. In order to reduce the influence of errors, F G Take the average of these 10 largest values.

[0124]

[0125] As water is lost during the drying process, the capillaries of the carrots shrink and curl under stress, causing the carrot slices to shrink and shrivel. The round slices shrink to irregular shapes.

[0126] In order to study the relationship between deformation and moisture content during the drying process of carrots, it is necessary to segment the carrot slices in the image. First, grayscale the image and use the threshold segmentation OTSU method to segment it into a binary image. Then, use the opening operation in the morphological method to smooth the contour of the carrot slices and eliminate small protrusions. Calculate the projection area of ​​the carrot slices after shrinkage, and finally obtain the minimum circumscribed circle and circle area of ​​the closed area. Calculate the shape eigenvalue F C , F C The calculation formula is shown in formula (3). Projected Area is the projected area, S Circle Area is the minimum circumscribed circle area.

[0127]

[0128] Figure 3 The deformation diagram of carrot slices with different moisture contents is shown in Figure 2. Figure 3(a), (b), (c), and (d) are schematic diagrams of the deformation of carrot slices with moisture contents of 9.73%, 52.13%, 70.27%, and 89.48%, respectively. The circle in the figure represents the minimum circumscribed circle of the carrot slice in the image. Figure 3 It can be seen that the higher the moisture content, the less obvious the shrinkage, the closer the shape of the carrot slices is to the circumscribed circle, and F C The closer to 1.

[0129] 2.4 Prediction model design

[0130] Least squares polynomial curve fitting is a common modeling method. The main idea of ​​the least squares method is to minimize the sum of square errors between the true value and the predicted value by determining the unknown parameters. The calculation formula is shown in equations (4)-(8).

[0131]

[0132]

[0133]

[0134]

[0135] …

[0136]

[0137] Among them, x is a feature value of the carrot image, y i is the actual moisture content of the carrot slices, is the corresponding predicted value. Loss is the square of the result of subtracting the polynomial function from the true function value, which represents the error relationship of the polynomial function. In order to optimize the objective function, we calculate the partial derivative of each coefficient to be 0, and the required coefficient a can be determined to determine the polynomial function. The characteristic value of the image is associated with the moisture content through polynomial fitting, and the moisture content can be predicted through a certain characteristic value.

[0138] In order to more accurately express the relationship between multiple features, a generalized regression neural network (GRNN) is introduced to calculate the weight of each feature. GRNN is an improvement of radial basis neural network (RBF) with a similar structure. GRNN has strong nonlinear mapping ability and learning speed, which is more advantageous than RBF. When the sample data is small, the prediction effect is very good, and it can also handle unstable data.

[0139] The network structure of GRNN is as follows Figure 4As shown in Figure 1, it consists of four layers. GRNN adds a summation layer and cancels the weighted connection between the hidden layer and the output layer. The number of nodes in the summation layer is the output dimension plus 1. The output of the summation layer is divided into two parts. The output of the first node is the arithmetic sum of the output of the pattern layer, and the output of the remaining k nodes is the weighted sum of the output of the pattern layer. Its calculation method is shown in equations (11) and (12).

[0140]

[0141]

[0142] Among them, P i is the output of the i-th neuron in the pattern layer, and the weighted coefficient y ij is the jth element of the training sample label. The calculation method of the output layer is shown in formula (13).

[0143]

[0144] First, the eigenvalues ​​F are calculated by polynomial fitting. H 、F G and F C The corresponding moisture content is then calculated through GRNN to calculate the weights of each feature, and finally the moisture content of the carrot slices is accurately determined based on the visual features.

[0145] To evaluate the performance of the model, the correlation coefficient (R) and root mean square error (RMSE) of the model prediction are calculated. The larger the correlation coefficient and the smaller the root mean square error, the more accurate the prediction result. The calculation method is shown in formulas (14) and (15). Where X is the true value, Y is the predicted value, cov represents the covariance, and E is the mathematical expectation. In the experiment, the accuracy of the prediction method is measured by relative error. The relative error calculation method is shown in formula (16). Where X and Y represent the moisture content measured by the dry weighing method and the moisture content measured by visual features, respectively.

[0146] In this embodiment, all experiments are run in a computer with an Intel i5-7300HQ CPU, NVIDIA GTX1060GPU, and 16G memory.

[0147]

[0148]

[0149]

[0150] In this example, in order to verify the accuracy of the proposed method, the relative error between the moisture content measured by the proposed method and the true moisture content was calculated and plotted in a scatter plot, as shown in FIG. Figure 5When the relative error is allowed to be 5%, the accuracy is 66.1%; when the relative error is allowed to be 10%, the accuracy is 85.7%.

[0151] Table 1

[0152]

[0153] As shown in Table 1, the correlation coefficient R between the true moisture content of carrot slices and the moisture content measured by the proposed method is 98.83%, and the RMSE is 0.048. To verify the performance of the proposed method, it is compared with other rapid nondestructive detection methods for carrot moisture content. Compared with the use of spectral features and LS-SVM method, the correlation coefficient R is 3.53% higher and the RMSE is 0.042% lower. Figure 6 As shown, there is a comparison between the actual moisture content in carrot slices and the moisture content predicted by this method.

[0154] In summary, the method proposed in Example 3 is used to detect the moisture content of carrot slices, which realizes real-time non-destructive detection on the basis of reliable accuracy. Compared with other real-time non-destructive detection methods, it has higher measurement accuracy.

[0155] Example 4

[0156] Embodiment 4 of the present invention provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium is used to store computer instructions. When the computer instructions are executed by a processor, the instructions for implementing a method for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process are implemented. The method includes:

[0157] Acquire slice images of fruit and vegetable samples to be tested;

[0158] The trained prediction model is used to process the slice images of the fruit and vegetable samples to be tested to obtain processing results, and the processing results include the moisture content of the fruit and vegetable samples; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0159] Example 5

[0160] Embodiment 5 of the present invention provides a computer program (product), including a computer program, wherein when the computer program is executed on one or more processors, the computer program is used to implement the method for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables as described above, the method comprising:

[0161] Acquire slice images of fruit and vegetable samples to be tested;

[0162] The trained prediction model is used to process the slice images of the fruit and vegetable samples to be tested to obtain processing results, and the processing results include the moisture content of the fruit and vegetable samples; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0163] Example 6

[0164] Embodiment 6 of the present invention provides an electronic device, comprising: a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes the method for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables as described above, the method comprising:

[0165] Acquire slice images of fruit and vegetable samples to be tested;

[0166] The trained prediction model is used to process the slice images of the fruit and vegetable samples to be tested to obtain processing results, and the processing results include the moisture content of the fruit and vegetable samples; wherein the trained prediction model is obtained by training a training set, and the training set includes multiple slice images of fruit and vegetable samples and labels of the true moisture content of the fruit and vegetable samples in the annotated images.

[0167] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0168] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0169] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0170] These computer program instructions can also be loaded onto a computer or other programmable data processing device, and a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0171] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative work on the basis of the technical solution disclosed in the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for detecting the moisture content of fruits and vegetables during the fruit and vegetable drying process, characterized in that: include: Acquire slice images of fruit and vegetable samples to be tested; The trained prediction model is used to process the slice image of the fruit and vegetable sample to be detected to obtain a processing result, which includes the moisture content of the fruit and vegetable sample; wherein the trained prediction model is obtained by training the training set, specifically: Extracting color features of the sliced ​​images of fruit and vegetable samples and calculating hue feature values, wherein calculating the hue feature values ​​comprises: converting the images into HSV images, extracting hue features of the samples for statistical analysis, and obtaining hue histograms, wherein different fruit and vegetable sample slices have different hue peak values, and the higher the moisture content, the higher the hue peak value, and the hue peak value is the hue feature value; Extract the grayscale features of the fruit and vegetable sample slice images and calculate the grayscale feature values; Extracting shape features of fruit and vegetable sample slice images and calculating shape feature values, wherein calculating shape feature values ​​comprises: graying the image, segmenting it into a binary image using a threshold segmentation algorithm OTSU, and extracting fruit and vegetable regions; using an open operation in a morphological method to smooth the contours of the fruit and vegetable regions, calculating the projected area of ​​the fruit and vegetable regions, and obtaining the area of ​​the minimum circumscribed circle of the region, wherein the ratio of the projected area to the area of ​​the minimum circumscribed circle is the shape feature value; The hue eigenvalue, grayscale eigenvalue and shape eigenvalue are associated with the moisture content through polynomial fitting, and the generalized regression neural network GRNN is introduced to calculate the weight of each feature. The least squares polynomial curve fitting is used to optimize the GRNN until the sum of squares of the error between the true value and the predicted value is minimized, and a trained prediction model is obtained. The training set includes a plurality of fruit and vegetable sample slice images and labels of the actual moisture content of the fruit and vegetable samples in the annotated images.

2. The method for detecting moisture content of fruits and vegetables during the fruit and vegetable drying process according to claim 1, characterized in that: Calculating the grayscale eigenvalue includes: converting the image into a grayscale image, analyzing the extracted grayscale features, obtaining a grayscale histogram, and calculating the grayscale eigenvalue F G As shown below: Among them, v i Indicates the i-th maximum value in the peak range corresponding to the sample in the grayscale histogram, F G is the average of these n maximum values.

3. The method for detecting moisture content of fruits and vegetables during the fruit and vegetable drying process according to claim 1, characterized in that: To evaluate the performance of the prediction model, the correlation coefficient and root mean square error of the model prediction were calculated. The larger the correlation coefficient and the smaller the root mean square error, the more accurate the prediction result.

4. The method for detecting moisture content of fruits and vegetables during the fruit and vegetable drying process according to claim 3, characterized in that: Calculating the correlation coefficient R and root mean square error RMSE of the model prediction includes: Among them, X represents the true moisture content, Y represents the predicted moisture content, cov represents the covariance, and E is the mathematical expectation.

5. A system for detecting moisture content of fruits and vegetables during the process of drying fruits and vegetables, characterized in that: include: An acquisition module is used to acquire slice images of fruit and vegetable samples to be tested; The prediction module is used to process the slice image of the fruit and vegetable sample to be detected using the trained prediction model to obtain a processing result, wherein the processing result includes the moisture content of the fruit and vegetable sample; wherein the trained prediction model is obtained by training the training set, specifically: Extracting color features of the sliced ​​images of fruit and vegetable samples and calculating hue feature values, wherein calculating the hue feature values ​​comprises: converting the images into HSV images, extracting hue features of the samples for statistical analysis, and obtaining hue histograms, wherein different fruit and vegetable sample slices have different hue peak values, and the higher the moisture content, the higher the hue peak value, and the hue peak value is the hue feature value; Extract the grayscale features of the sliced ​​images of fruit and vegetable samples and calculate the grayscale feature values; Extracting shape features of fruit and vegetable sample slice images and calculating shape feature values, wherein calculating shape feature values ​​comprises: graying the image, segmenting it into a binary image using a threshold segmentation algorithm OTSU, and extracting fruit and vegetable regions; using an open operation in a morphological method to smooth the contours of the fruit and vegetable regions, calculating the projected area of ​​the fruit and vegetable regions, and obtaining the area of ​​the minimum circumscribed circle of the region, wherein the ratio of the projected area to the area of ​​the minimum circumscribed circle is the shape feature value; The hue eigenvalue, grayscale eigenvalue and shape eigenvalue are associated with the moisture content through polynomial fitting, and the generalized regression neural network GRNN is introduced to calculate the weight of each feature. The least squares polynomial curve fitting is used to optimize the GRNN until the sum of squares of the error between the true value and the predicted value is minimized, and a trained prediction model is obtained. The training set includes a plurality of fruit and vegetable sample slice images and labels of the actual moisture content of the fruit and vegetable samples in the annotated images.

6. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium is used to store computer instructions, which, when executed by a processor, implement instructions for the method for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables as described in any one of claims 1 to 4.

7. An electronic device, characterized in that: include: A processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes the method for detecting the moisture content of fruits and vegetables in the process of drying fruits and vegetables as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Fruit moisture content detection method based on graphic image processing technology

    CN111784650A

  • Kelp water content diagnosis method

    CN112288719A