Image feature-based green tea fixation degree discrimination method
Through the method of determining the degree of completion based on image features, the problem of rapidity and accuracy of determining the degree of completion during tea completion is solved, and the digital judgment of the process of completing green tea is realized, which reduces costs and improves efficiency, and has the characteristics of intelligence.
Patent Information
- Application Number
- CN202410898372.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-11-15
AI Technical Summary
The existing technology cannot quickly determine the degree of tea completion during the tea completion process by relying on experience or multiple trial and error, resulting in uneven quality, and the near-infrared spectral detection is high in price and cumbersome in operation, which is not conducive to real-time feedback and adjustment.
Using the green tea finishing degree discrimination method based on image features, the decision function is constructed by acquiring and preprocessing the finishing image, and the training sample set is used to establish the finishing degree discrimination model to realize the digital discrimination of the tea finishing degree, including energy definition, energy extraction, and adaptive Filter out background interference, energy attention mechanisms, and data remapping.
It realizes accurate and digital judgment of the degree of green tea during the completion process, reduces costs, improves efficiency, has the characteristics of intelligence, can quickly judge the degree of completion, and improves the quality and production efficiency of tea.
Smart Images

Figure CN118968261A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of intelligent tea processing, in particular to a method for distinguishing the degree of withering of green tea based on image features. Background Art
[0002] Withering is the most important link in green tea production, and the withering status of green tea is mainly monitored manually. The existing tea withering machine mainly controls the temperature, time and leaf amount within a certain range to ensure the withering quality of tea. The drum speed and drum inclination indirectly determine the withering time, and the leaf amount affects the withering temperature and efficiency, so it can also be optimized and controlled from the withering temperature, drum speed, drum inclination and leaf amount. The degree of withering is mainly judged by looking at the color, smelling the aroma and touching the feel. There are problems such as inconsistent judgment standards and strong subjectivity, which leads to uneven quality of withered leaves and reduces economic benefits. Therefore, studying the online monitoring technology of the withering status of green tea is of great significance to promoting the standardization, digitization and intelligence of green tea processing in my country.
[0003] At present, the online monitoring of the green tea withering status is mainly based on the near-infrared spectrum detection of moisture content. For example, CN115610899A discloses an intelligent control method, electronic equipment and storage medium for the tea withering process, which includes tea tenderness grade, constructs a drying model for tea withering, calculates the initial leaf feeding amount and adjusts the withering machine inclination angle, and uses an interval type II fuzzy controller to adjust the leaf feeding amount. CN113424875A discloses an intelligent green tea withering device and a continuous automated processing technology for strip green tea, including a flow control device and a withering mechanism both equipped with a moisture detection mechanism. The invention enables the strip green tea to autonomously judge the degree of withering completion of the tea leaves during the withering process, and autonomously feedback and adjust the withering process parameters according to the degree of withering completion.
[0004] The above technical solutions all use near-infrared spectroscopy to detect the moisture content of tea leaves to achieve feedback control of the tea-withering machine, but near-infrared spectroscopy is expensive, cumbersome to operate, and not conducive to real-time feedback adjustment of the tea-withering machine. In view of the problems or defects of the above-mentioned prior art, there is an urgent need for a method that can accurately judge its state based only on the characteristic information of tea images, which can solve the technical problem that the current tea-withering process mostly relies on experience or multiple trial and error and cannot quickly determine the state of the tea-withering degree in the tea-withering process. Summary of the invention
[0005] The present invention solves the problem that the prior art cannot quickly determine the tea withering process by relying on experience or multiple trials and errors, proposes a method for distinguishing the degree of withering of green tea based on image features, and realizes digital distinction of the degree of withering of green tea during the withering process, which has the characteristics of low cost, high efficiency, and intelligence.
[0006] In order to achieve the above objectives, the following technical solutions are proposed: A method for determining the degree of withering of green tea based on image features comprises the following steps: S1, obtaining a number of images in different time periods; S2, preprocessing the finished images in different time periods to obtain a training sample set; S3, constructing a decision function, and using the training sample set to train to obtain a killing degree discrimination model; S4, obtaining an image of the green tea to be identified, and performing preprocessing on the image of the green tea to be identified in accordance with S2, and then inputting the image into a determination model of the degree of withering of the green tea to obtain the degree of withering of the green tea.
[0007] Tea leaves of different types, tenderness, picking seasons, and times generally have their own fixed and suitable withering states. Extracting useful information from tea images and accurately expressing the image state with a mathematical model are the prerequisites for judging the degree of withering. The acquisition of the mathematical model must be based on the reflection of the state characteristics of the withered tea leaves in the image, and it must also have a certain generalization ability to meet actual production needs. The present invention proposes a method for judging the degree of withering of green tea based on the image characteristics of withered leaves, which mainly includes the following steps: definition of withered leaf energy, energy extraction, adaptive filtering of background interference, energy attention mechanism, data remapping, introduction of a supervision mechanism, training, and judgment of the withering state. The present invention realizes the digital discrimination of the degree of withering in the process of withering of green tea, and has the characteristics of low cost, high efficiency, and intelligence.
[0008] Preferably, S1 specifically includes the following steps: setting image energy and energy extractor, wherein the image energy is defined as the grayscale value corresponding to the pixel points in different color channels in the green image, and the energy extractor traverses all color channels of the entire green image and calculates the number of pixels corresponding to the grayscale value.
[0009] The whiter the single-channel image is, the higher the corresponding total energy is. Energy extraction, as a method to obtain and quantify the original data of the withering image, is a necessary prerequisite for tea state analysis. The designed energy extractor traverses all color channels of the entire image and calculates the number of pixels corresponding to the grayscale value, thereby extracting useful tea information. The energy solution process involves counting the number of pixels corresponding to each grayscale level of 256 in three color channels.
[0010] Preferably, the preprocessing of the finished images in different time periods comprises the following steps: S201, setting an adaptive filter to filter the finished image; S202, introducing an image energy attention mechanism to identify salient features of tea leaves in the withered green image; S203, mapping the finished image using a mapping function to obtain mapping data of a number of finished images in different time periods as a training sample set.
[0011] The present invention adopts an adaptive filtering algorithm to automatically filter out invalid information, uses an energy extractor to extract the complete energy information of each finished image, utilizes the image energy attention mechanism to identify prominent features, and maps the energy data on this basis to generate data points as training data.
[0012] Preferably, S3 specifically includes the following steps: the training sample set is input into the feature trainer, channels of different colors generate trend center data of tea leaf withering energy clustering, a decision function is constructed based on the cluster center distance, and the degree of withering of each monitoring image set is measured through the decision function.
[0013] Preferably, the shooting background of all the finished images is set to white.
[0014] Preferably, the filtering process specifically includes the following steps: comparing the gray levels corresponding to the valley positions in the energy response spectrum formed by different color channels in each image, removing the image information of the background and overlapping shadow areas, and obtaining the image information of the tea area.
[0015] The collected tea images have useless backgrounds and overlapping shadow areas, which will interfere with the analysis results of tea characteristics. For single-channel withering images, two peaks and two troughs can be obtained in the energy distribution image. The first peak corresponds to tea information, and the second peak corresponds to background information; the first trough is the transition area between the overlapping area and the tea information, and the second trough is the transition area between the background and the tea information. The grayscale values corresponding to these two points are the two threshold points. For each image, the corresponding two points are different in position, and an adaptive filter is designed. The principle is to compare the grayscale corresponding to the valley position in the energy response spectrum formed by different color channels in each image.
[0016] Preferably, the working principle of the image energy attention mechanism is as follows: highlighting the color features in the image, and obtaining the grayscale value corresponding to the maximum number of pixels in each channel.
[0017] The data obtained by filtering has a high dimension, which is not convenient for analyzing the characteristics of tea leaves. In order to reduce the dimension of the data and reflect the main features of the data after dimensionality reduction, an image energy attention mechanism is designed. The principle of the attention mechanism is that the more prominent color features in the image are the focus of attention, that is, after energy extraction, what is reflected on the data is the grayscale value corresponding to the maximum number of pixels in each channel.
[0018] Preferably, the variables of the mapping function are the grayscale value and the statistical value of the number of pixels in the corresponding grayscale value. The data obtained from the energy and attention mechanism cannot directly reflect the recognition difference of each image. In order to make the result more intuitive, easy to train and convenient for subsequent processing and analysis, data mapping must be performed. The mapping method is to construct a mapping function f(*), the corresponding variables of which are the grayscale value and the statistical value of the number of pixels in the corresponding grayscale value. The data points of the three channels can be obtained through the mapping function and used as training data.
[0019] Preferably, the construction process of the decision function is as follows: standard cluster centers are obtained by training the fixing images at standard time points or time periods, and the decision function is constructed by the distance values between the three cluster centers corresponding to all training sample sets within the standard fixing time. Standard cluster centers are obtained by training the fixing images at standard time points or time periods, and then the state decision function F(*) is obtained. The decision function is constructed by the distance values between the three cluster centers corresponding to all training samples within the standard fixing time. Fixing images in different time periods can obtain different results. The cluster center data of the monitoring sample is substituted into the decision function to accurately determine whether the gaze state is normal.
[0020] Preferably, the standard cluster center is obtained by calculating the average value based on supervised energy iterative clustering and the idea of k-means cluster center. The algorithm proposed in the present invention is based on supervised energy iterative clustering and the idea of k-means cluster center can realize the feature cluster center by averaging. In order to make the test result more accurate, as many standard images as possible should be obtained during the training process.
[0021] The beneficial effects of the present invention are: The present invention proposes a method for judging the degree of withering of green tea based on withered leaf image features, which mainly comprises the following steps: definition of withered leaf energy, energy extraction, adaptive filtering of background interference, energy attention mechanism, data remapping, introduction of supervision mechanism, training and judgment of withering status; by utilizing a tea withering process control algorithm based on energy attention mechanism and supervised iterative clustering, the technical effect of accurately judging the degree of withering is achieved, and the quality and work efficiency of tea withering are improved.
[0022] The algorithm proposed in the present invention has rotation invariance, and the detection results will not be affected by the difference in angles. It is more robust, and the decision of a single sample on the result is removed. Instead, the characteristics of all samples in a test set are considered to make the result more accurate. Compared with spectroscopy, the use of image information monitoring can significantly reduce costs and can be integrated into automated production lines more quickly and conveniently. Compared with deep learning, the training data set only requires the most suitable sample images for withering, which greatly reduces the need for training data sets, makes it possible to quickly deploy the algorithm, and improves production efficiency. For withering state monitoring, the more samples a test set contains, the less random uncertainty caused by a single sample. A single test sample consists of multiple withering pictures, which reduces the interference of randomness and noise, thereby ensuring the accuracy of withering state monitoring, and can continuously collect image information, with a small amount of calculation, which can meet the needs of online monitoring. The present invention realizes the digital discrimination of the degree of withering in the process of green tea withering, and has the characteristics of low cost, high efficiency, and intelligence. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is the algorithm control flow chart of the present invention.
[0024] Figure 2 These are training sample images collected at different time points.
[0025] Figure 3 This is the adaptive filtering energy distribution curve corresponding to the tea images at different withering time points.
[0026] Figure 4 This is the distribution diagram of energy cluster centers at different fixing times.
[0027] Figure 5 This is a graph showing the energy clustering trend of training samples at different fixing times. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0029] Example: The present invention proposes Figure 1 As shown, this embodiment proposes a method for judging the degree of green tea withering based on the image features of withered leaves, comprising the following steps: Adaptive filtering algorithm is used to automatically filter out invalid information, energy extractor is used to extract complete energy information of each tea-withering image, image energy attention mechanism is used to identify prominent features, and energy data is mapped on this basis to generate data points as training data. Clustering idea is adopted, training data is fed to feature trainer, different color channels generate trend center data of tea-withering energy clustering, corresponding decision function based on cluster center distance is designed, and the degree of withering of each monitoring image set is measured through decision function. The specific steps include: Step 1: Energy definition and energy extractor design. Energy is defined as the grayscale value corresponding to the pixel in different color channels in the image. The whiter the single-channel image, the higher the corresponding total energy. Energy extraction, as a method to obtain and quantify the original data of the withering image, is a necessary prerequisite for tea state analysis. The designed energy extractor traverses all color channels of the entire image and calculates the number of pixels corresponding to the grayscale value, thereby extracting useful tea information. The energy solution process involves counting the number of pixels corresponding to each grayscale level of 256 in the three color channels.
[0030] The mathematical model of energy definition is as follows: Where E R,h∈[0,255] 、E G,h∈[0,255] and E B,h∈[0,255] Respectively represent the energy of different gray levels of color channels R, G, and B in the same image; E R,h∈[0,255] 、N G,h∈[0,255] and N B,h∈[0,255] are different channel energy calculators; n is a constant, n = 1 only when the gray value of the traversed position is equal to the corresponding h; H R (x,y),H G (x,y) and H B (x, y) represents the grayscale value of the R, G, and B color channels corresponding to the loop traversal position; rows is the number of image rows, and cols is the number of image columns. In image analysis, the pixel corresponding to row 0 and column 0 is used as the starting position of the analysis, and the matrix or array in the data calculation field also starts from 0. For consistency, x and y in formulas (1)-(3) also start from 0, which is easy to understand and the elements will not exceed the image size.
[0031] Image energy can be defined as the number of photoelectrons. The more photoelectrons there are, the stronger the energy is. When the energy projected on the tea leaves is equal (the same ambient light), the fewer photons are absorbed by the tea leaves, and the more photons are reflected into the environment. The photons reflected by the tea leaves are captured by the lens. The stronger the energy captured by the camera lens photosensitive chip, the brighter the entire image. On the contrary, when the tea leaves are over-killed, fewer photons are captured on the camera chip, and the entire image becomes darker.
[0032] For a grayscale image, we describe it as bright or dark. Similarly, for a color image, it will show the difference in energy intensity in different color channels. The mathematical expression of light and dark in an image can be assumed to be the average percentage of the grayscale value, that is, the sum of the three different channels of R, G, and B for all pixels. The larger the average percentage, the brighter the corresponding image and the higher the energy. It is obviously not advisable to judge the degree of killing only by the standard of light and dark. If the degree of killing varies greatly, it can be judged, but the accuracy is easily affected by noise. The killing status monitoring is directly based on the concept of mean, which will lead to the loss of detailed feature information, so if you want to increase the accuracy, you need to know the information that can reflect the trend and difference of energy distribution within the grayscale range of killing.
[0033] Step 2: Design of adaptive filter. The collected tea images have useless background and overlapping shadow areas, which will cause certain interference to the tea feature analysis results. For single-channel withering images, two peaks and two troughs can be obtained in the energy distribution image. The first peak corresponds to the tea information, and the second peak corresponds to the background information; the first trough is the transition area between the overlapping area and the tea information, and the second trough is the transition area between the background and the tea information. The grayscale values corresponding to these two points are the two threshold points. The adaptive filter is designed according to the different positions of the two points corresponding to each image. The principle is to compare the grayscale levels corresponding to the valleys in the energy response spectrum formed by different color channels in each image. The mathematical model is as follows: H(x,y)=0.299*H R (x,y)+0.587*H G (x,y)+0.114*H B (x,y) (4) Where H(x,y) represents the gray value after processing; S h Indicates the number of counts corresponding to different gray levels; a is the a mark; H R,h (x,y),H G,h (x,y),H B,h(x, y) represent the grayscale values of the three channels respectively. By taking the x coordinates of the two troughs as the filter thresholds (T1 left threshold and T2 right threshold), the energy spectrum can be divided into three different parts. The useful middle part (between T1 and T2) corresponds to the energy feature information of the tea leaves. The coefficients used in formula (4) are the weights of the influence of different color channels on the grayscale value, which are commonly used weight coefficients for converting RGB images into grayscale images in the field of image processing.
[0034] Images usually contain background information, while tea leaves are the foreground. In order to minimize the impact of background energy on the detection results, background filtering must be performed. The background and foreground (tea leaf information) will form two troughs in the entire energy response spectrum. The background color used in the experiment is white, which has a higher energy response. Usually, areas with more tea leaves will form low grayscale areas, which do not show the true characteristic reflection of tea leaves, so they must be removed.
[0035] Step 3: Image energy attention mechanism. The data obtained by filtering has a high dimension, which is not convenient for analyzing the characteristics of tea leaves. In order to reduce the dimension of the data and reflect the main features of the data after dimensionality reduction, an image energy attention mechanism is designed. The principle of the attention mechanism is that the more prominent color features in the image are the focus of attention, that is, after energy extraction, what is reflected on the data is the grayscale value corresponding to the maximum number of pixels in each channel.
[0036] The mathematical model of the energy concentration mechanism is as follows: Where N ave (R), N ave (G) and N ave (B) is the average count of the attention range of R, G, and B channels.
[0037] The energy concentration attention mechanism is equivalent to the attention mechanism in machine vision. The main goal is to select the information that is more critical to the task analysis from the collected information. For an image, the point that the attention mechanism focuses on is the average grayscale with the largest number of pixels in the grayscale of tea features. In order to reduce the influence of randomness, consider the average value of n grayscales from the maximum point to the left and right to obtain the energy concentration point. The energy concentration mechanism is also a method of data dimensionality reduction. Calculate the sum from –n to n, with a boundary of c. For a tea image with a size of 1920×1080, the number of pixels is 2073, 600, and the total number of features of the three channels is 6220, 800.
[0038] Step 4: Data mapping. The data obtained from the energy and attention mechanisms cannot directly reflect the recognition differences of each image. In order to make the results more intuitive, easy to train, and convenient for subsequent processing and analysis, data mapping must be performed. The mapping method is to construct a mapping function f(*), whose corresponding variables are the grayscale value and the statistical value of the number of pixels in the corresponding grayscale value. The data points of the three channels can be obtained through the mapping function and used as training data.
[0039] The data mapping function is as follows: where x R,G,B and R,G,B Represent the corresponding horizontal and vertical coordinates respectively.
[0040] For different images, the data corresponding to the energy concentration area is different. They can be mapped to a unified range, which can more clearly reflect the differences between each image. This is similar to the normalization process in deep learning. Since the energy distribution curve data is still high-dimensional data, feature remapping realizes the transformation and dimensionality reduction of the data. The values of H, s, and S can be modified accordingly. Set H = 800, s = 700, S = 25000. The purpose is to display the results on a two-dimensional plane for easy and intuitive analysis. The values obtained by the mapping function can be used as x and y values respectively, and the coordinate points in the energy map of each channel of a single sample can be obtained, that is, the training data (x R ,y R ), (x G ,y G ) and (x B ,y B ), compared with the original image with high-dimensional features, a perfect dimensionality reduction is achieved.
[0041] Step 5: Training. The mapping data of different images generated at the same killing time point are input into the classifier. All data in the training contains the killing label. After processing and mapping each sample data, it is drawn in the same image, and the images of each batch of killing mapping are obtained after training.
[0042] Step 6: Construction of decision function and state monitoring. By training the killing images at standard time points or time periods, standard cluster centers are obtained, and then the state decision function F(*) is obtained. The decision function is constructed by the distance values between the three cluster centers corresponding to all training samples within the standard killing time. Killing images in different time periods can get different results. Substitute the cluster center data of the monitoring sample into the decision function to accurately determine whether the gaze state is normal.
[0043] For the training sample, the energy iteration center is: For the energy clustering center of the training sample, the Euclidean distance between the centers of different color channels is: For the test sample, the energy iteration center is: For the energy clustering center of the test sample, the Euclidean distance between the centers of different color channels is: The decision function of the online tea withering status monitoring classifier is: F(*)→ifα*sum S >|sum S -sum M |→monitoringsignal→nomal (21) F(*)→ifα*sum S ≤|sum S -sum M |→monitoringsignal→abnomal (22) Among them C S,R (n), C S,G (n) and C S,B (n) is the standard killing time energy mapping point obtained from the training sample. S,R , C S,G , C S,B is the standard energy cluster center obtained from all training samples. C M,R (n), C M,G (n) and C M,B (n) is the monitoring energy mapping point obtained from all test samples in the test set. M,R , C M,G and C M,B is the monitoring energy cluster center obtained from the test set. ΔC S,(R-G) , ΔC S,(R-B) and ΔC S,(G-B) is the standard energy cluster center distance of the three points. ΔC M,(R-G) , ΔC M,(R-B) , ΔC M,(G-B) is the energy cluster center distance of three-point monitoring. S and sum M is the total distance. α is the weight coefficient.
[0044] The present invention proposes a method for judging the degree of green tea withering based on the image features of withering leaves, which mainly includes the following steps: definition of withering leaf energy, energy extraction, adaptive filtering of background interference, energy attention mechanism, data remapping, introduction of supervision mechanism, training and judgment of withering state. The present invention realizes the digital judgment of the degree of green tea withering in the process of green tea withering, and has the characteristics of low cost, high efficiency and intelligence.
[0045] The algorithm proposed in this invention is based on supervised energy iterative clustering. According to the idea of k-means clustering center, the feature clustering center can be realized by averaging. In order to make the test results more accurate, as many standard images as possible should be obtained during the training process. The error sum of squares (SSE) is used as the objective function to measure the clustering quality: Where dist is the standard Euclidean distance (L2) between two objects in Euclidean space, and K is the number of cluster centers. For the above function, in order to get better cluster centers and minimize SSE, we can minimize the objective function to get the kth centroid. That is, find the derivative of SSE to make it equal to 0, that is, get c k The value of .
[0046] It can be seen from the above formula that the best quality center with the minimum SSE is the average value of all points. Therefore, the more training samples there are, the closer the reference standard data distribution is to the ideal distribution. During the withering monitoring, the number of samples in the set can take 30 or more frames of continuous images in one second, but the deviation caused by randomness is reduced, and the accuracy is improved. The clustering centers of different color channels are the standard points for realizing online withering monitoring. After obtaining the feature clustering center belonging to the corresponding withering time, the obtained clustering center is used to construct a decision function. After the training is completed, at the same withering time, three different standard energy clustering centers of the standard training set are obtained. Online tea withering status monitoring is based on the standard center C(x R ,y R )、C(x G ,y G )、C(x B ,y B) data. The test center cannot completely correspond to the standard center, and there will be some inaccuracies. We can set an error tolerance range according to the needs of actual production. The training samples can adopt interval (online) and continuous (offline) sampling methods. The training uses the standard fixing image as a reference, so only the most suitable fixing sample is needed, which greatly reduces the time for data set preparation and improves the efficiency of practical application. It should be noted here that the main feature of the algorithm is to learn the relative change and trend of energy and the reasonable range of this trend, rather than learning the numerical characteristics of fixing. With the increase of fixing time, the Euclidean distance of the energy clustering centers of the three channels of the training samples with the same fixing time gradually approaches, and the perimeter and area of the triangle formed by these three points tend to gradually shrink. Based on this, by comparing the Euclidean distance samples of the energy clustering centers of the training samples and the test samples, the online monitoring of the fixing degree of tea can be realized.
[0047] The specific application parameters of this embodiment are as follows: 1. Collection of experimental samples, killing conditions and photography methods. The software and hardware environment of the experiment, the programming tool is VisualStudio 2017, the processor used is Intel E5-4650, the graphics card is Nvidia GTX1060, the memory size is DDR316G, and the operating system is Windows 10x64 bit. The camera is a zoom camera with a resolution of 5 million pixels, a frame rate of 60fps, and other parameters of the camera are fixed values. The frame rate of the camera should be as large as possible to reduce latency, and the parameters of the camera must be unified and cannot change with the brightness of the image.
[0048] The collected fresh tea leaves of Wuniuzao and Yingshuang were used for withering, and the experimental withering equipment was a 6CWS-90 oolong tea withering machine. The withering conditions were: temperature 220℃; rotation speed 25 rpm; withering time 2, 4, 6 and 8 minutes. The photography method used a focusing lens. The main components of the photography equipment include a support structure, a lens, a light source, an ambient light shielding structure and a camera. The ambient light shielding structure is made of four black polyethylene tubes.
[0049] Experimental samples with withering time of 2min, 4min, 6min, and 8min were collected respectively. 2800 images were taken as training samples, each containing 700 images, and the corresponding green tea variety was Wuniuzao. Similarly, 1200 images were taken as test samples, each containing 300 images, and the corresponding green tea variety was Yingshuang. Data enhancement technology was used to obtain test samples from 1200 to 3000 images. For the test samples at the four time points, the difference between them and the training results was independently judged, and the accuracy of the designed algorithm was judged based on this. For actual production scenarios, only the images at the ideal withering time points are trained, and their corresponding features can be used as a reference to achieve continuous judgment. The corresponding data of each trained sample needs to be recorded to facilitate subsequent analysis and visualization of the results. The training samples collected at different time points are as follows: Figure 2 shown.
[0050] 2. Verification of image energy trends and changes. Filter the collected samples, and the adaptive filtering energy distribution curves corresponding to tea images at different withering time points are as follows: Figure 3 As shown. On the left and right of each curve, a unique global minimum point can be found. These two points are used as threshold points for adaptive background filtering. The background effect can be removed to the maximum extent, while the energy information of the tea leaves corresponding to the grayscale level in different color channels can be retained to the maximum extent. Since the corresponding data is dimensionless, there is no unit.
[0051] 3. Verification of the trend of energy concentration center changes. After adaptive filtering, the energy data is remapped and the mapping is sent to the trainer to obtain the energy data distribution of the corresponding sample at each moment, such as Figure 4 shown.
[0052] Judging from the distribution of energy clustering points of different color channels, the energy of the blue color channel changes greatly for different withering time points. In order to obtain more stable results, it is best to shield the ambient light and design a multi-angle ring light source for illumination. As the withering time interval increases, the change trend of energy clustering is not linear but nonlinear, which can be explained that the related chemical substances in tea also have similar change trends. When the withering time is 2 minutes, the clustering centers of different color channel energies of different samples corresponding to the same withering time are still relatively scattered. At 8 minutes, the clustering centers of different color channel energies of different samples gradually gather, and the degree of dispersion is significantly reduced. Such changes are in line with the overall trend of tea color changes during actual processing. In general, with the extension of the withering time, the clustering center of the withering leaf energy shows nonlinear aggregation, and the overall trend of change is that it will eventually converge in a fixed area. Controlling the tea withering energy to gather in the required dynamic range is achieved based on the closed-loop control signal.
[0053] 4. Record the characteristic data of each fixing time in detail. Among them, c(r,x), c(r,y), c(g,x), c(g,y), c(b,x), c(b,y), h(r), h(g), h(b), n(r), n(g), and n(b) respectively represent the x and y coordinates of the red energy cluster center, the x and y coordinates of the green energy cluster center, the x and y coordinates of the blue energy cluster center of the training sample tea image, and the x and y coordinates of the different color channel images generated by the attention mechanism. The detailed data are shown in Table 1.
[0054] Table 1 Changes in energy clustering training of tea images at different killing times Based on the energy cluster center distribution data at different killing times, an energy cluster curve that changes over time can be generated, such as Figure 5 shown.
[0055] According to the control equation formula (18), the Euclidean distance between the centers of different color channels can be calculated. The detailed data is shown in Table 2.
[0056] Table 2 Calculation and comparison of cluster data at different killing time time <![CDATA[ΔC S,(R-G) ]]> <![CDATA[ΔC S,(R-B) ]]> <![CDATA[ΔC S,(G-B) ]]> <![CDATA[sum S ]]> 2min 0.25 0.44 0.61 1.30 4min 0.16 0.38 0.50 1.04 6min 0.09 0.30 0.36 0.75 8min 0.04 0.20 0.21 0.45 from Figure 5 It can be seen from Table 2 that as the fixing time increases, the distances between the energy gathering centers of red and blue, red and green, and green and blue gradually get closer. The trend shows a nonlinear relationship, that is, the center distance is not proportional to the same time interval. The data in Table 2 are dimensionless and can be expressed in decimals and integers. The data intuitively reflects that as the fixing time increases, ΔC S,(R-G) , ΔC S,(R-B) , ΔC S,(G-B) 、sum S The change in the corresponding data can be used as the judgment standard as long as it is changed in the same proportion.
[0057] 5. Comparison of algorithms based on withering images. The total number of test samples is 3000, of which 30 are in a group, and a total of 100 are used as test samples. In the experiment, the tea sample corresponding to the 6min training result is set to the ideal withering state. Since the experimental conditions and methods proposed in the present invention are mainly based on image information, they are only compared with the existing image-based analysis methods. The comparison methods are: gray-level co-occurrence matrix (GLCM); oriented grid histogram (HOG); hue, saturation, value (HSV) + support vector machine (SVM); light and dark comparison (LASC); image energy attention mechanism and supervised clustering (IEAMSC) are proposed. The parameters α in the test are 0.2; H=800; S=25000. The differences in principle between the existing method and the current method are as follows: (1) The gray-level co-occurrence matrix can reflect the comprehensive information of the image grayscale direction, adjacent intervals, and change amplitude, and is the basis for analyzing local patterns and their arrangement rules. The disadvantage of GLCM is that the texture features are difficult to accurately reflect the differences between different textures due to the influence of illumination and reflection.
[0058] (2) HOG is a commonly used method in the field of computer vision and pattern recognition to describe local texture features of images. The gradient values in different directions within a certain area of the image are calculated, and then a histogram is obtained, which can represent the characteristics of the analyzed area. Due to the gradient based on HOG, it is very sensitive to noise.
[0059] (3) HSV focuses on color representation. Compared with RGB space, HSV space can intuitively express brightness, hue, and color brightness. Therefore, HSV is convenient for color comparison, but it is sensitive to background changes and easily affected by ambient light.
[0060] (4) LASC directly compares the average grayscale values of the three channels of an image. It is easily affected by the background and overlapping areas, which can easily lead to fluctuations in the results.
[0061] (5) IEAMSC filters out the interference of background and overlapping areas and realizes the recognition of key features through the attention mechanism. Feature clustering ensures the stability under the interference of a single sample.
[0062] The complete comparison results are shown in Table 3. True positive (TP), true negative (TN), false positive (FP) and false negative (FN) accuracy = (TP+TN) / (TP+FP+TN+FN); precision = TP / (TP+FP); recall = TP / (TP+FN). T and F are the predicted results true and false respectively; N and P are the labels of negative and positive respectively; precision is the percentage of positive samples in the total number of predicted positive samples. Recall represents the percentage of positive samples predicted as positive.
[0063] Table 3 Comparison of detection results of different methods based on image information name GLCM+SVM HOG+SVM HSV+SVM LASC IEAMSC Accuracy 74% 61% 66% 54% 95% Accuracy 72% 60% 64% 50% 94% Recall 75% 61% 67% 54% 96% By analyzing the data in Table 3, it can be seen that the algorithm has achieved higher prediction accuracy compared with other methods. The GLCM+SVM test results are wrong. This is because the background information accounts for a large proportion of the features, and the grayscale value difference of the local information of tea leaves at different withering times is small. The HOG+SVM test results are also wrong, because HOG is based on gradient features, and the direction of the tea leaves is random, which leads to errors in gradient information. For HSV+SVM, the grayscale interval needs to be compressed, which will lead to the loss of local information. The background, ambient light and area occupied by the tea leaves in the image have a great influence on LASC. For the IEAMSC test, the results projected the wrong part, which is because the collected image is greatly affected by the ambient light and the data discreteness is more obvious. The tea leaves at 6 minutes and 8 minutes are darker in color and are relatively less affected by the ambient light. Therefore, if conditions permit, it is necessary to shield the ambient light as much as possible and configure a high-brightness multi-angle ring light source.
[0064] Fixed-focus, high FPS lenses can also ensure picture quality. The choice of decision function threshold can be made according to the requirements of different teas and different qualities. It will also affect accuracy, precision and recall. Another factor that may affect the test results is that the tea leaves are heated unevenly in the withering drum, which will cause color differences under the same withering time. In summary, the changing trend of the energy clustering of the training samples is consistent. From the experimental results, compared with other algorithms, the accuracy of the proposed algorithm reaches 94%, and the accuracy is improved. It shows that the algorithm proposed in the present invention has positive guidance and reference significance for the quality control of the withering process of the fully automatic production line.
[0065] 6. Sample verification. The samples of withered leaves with different degrees of withering include images in three states: insufficient withering, moderate withering, and over withering. Each major category contains three subcategories, namely early, middle, and late stages. Each subcategory contains 1,000 images, and there are 9,000 images in the 9 subcategories. There are 20 test sets corresponding to each state, and each test set contains 50 images, with a total of 1,000 images in the same state. The parameters in the test are H=800; s=25000. In the accuracy test, moderate withering (moderate middle) is used as the training sample, and the remaining 8,000 images are used as the test samples. The accuracy statistics of various samples based on algorithm detection are shown in Table 4-7.
[0066] Table 4 Statistics of data accuracy of three states of insufficient finishing Evaluation Early stage Mid-term Later Accuracy 100% 100% 100% Table 5 Statistics of data accuracy of three states of moderate killing Evaluation Early stage Mid-term Later Accuracy 85% 100% 90% Table 6 Statistics of the accuracy of the three states of overkill Evaluation Early stage Mid-term Later Accuracy 100% 100% 100% Table 7 Statistics of average accuracy of nine status data Evaluation Average accuracy Accuracy 97% Through experiments, we found that the misclassification is mainly concentrated in the early and late stages of moderate killing. The misjudgment shows that the samples in the early stage of moderate killing will be judged as insufficient killing, and the number of samples judged as insufficient killing is relatively large. The samples in the late stage of moderate killing will be judged as over-killing. Through testing samples, we found that about 50% of the samples will be judged as over-killing. For the samples that were misjudged in the early and late stages of moderate killing, the main reason for the misclassification is that the extracted feature vectors have a large overlap area with insufficient killing and over-killing respectively. These overlapping areas are difficult to perfectly divide by setting thresholds.
[0067] Of course, the above description is only a specific embodiment of the present invention and is not intended to limit the scope of implementation of the present invention. All equivalent changes or modifications made according to the structure, characteristics and principles described in the patent application scope of the present invention should be included in the patent application scope of the present invention.
[0068] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for determining the degree of green tea withering based on image features, characterized in that: The following steps are involved: S1, obtaining a number of images in different time periods; S2, preprocessing the finished images in different time periods to obtain a training sample set; S3, constructing a decision function, and using the training sample set to train to obtain a killing degree discrimination model; S4, obtaining an image of the green tea to be identified, and performing preprocessing on the image of the green tea to be identified in accordance with S2, and then inputting the image into a determination model of the degree of withering of the green tea to obtain the degree of withering of the green tea.
2. The method for determining the degree of green tea withering based on image features according to claim 1, wherein: The S1 specifically includes the following steps: setting image energy and energy extractor, wherein the image energy is defined as the grayscale value corresponding to the pixel points in different color channels in the green image, and the energy extractor traverses all color channels of the entire green image and calculates the number of pixels corresponding to the grayscale value.
3. The method for determining the degree of green tea withering based on image features according to claim 2 is characterized in that: The preprocessing of the finished images in different time periods comprises the following steps: S201, setting an adaptive filter to filter the finished image; S202, introducing an image energy attention mechanism to identify salient features of tea leaves in the withered green image; S203, mapping the finished image using a mapping function to obtain mapping data of a number of finished images in different time periods as a training sample set.
4. A method for determining the degree of green tea withering based on image features according to any one of claims 1 to 3, characterized in that: The S3 specifically includes the following steps: the training sample set is input into the feature trainer, channels of different colors generate trend center data of tea leaf withering energy clustering, a decision function is constructed based on the cluster center distance, and the degree of withering of each monitoring image set is measured through the decision function.
5. The method for determining the degree of green tea withering based on image features according to claim 3 is characterized in that: The shooting backgrounds of all the finished images are set to white.
6. The method for determining the degree of green tea withering based on image features according to claim 3 is characterized in that: The filtering process specifically includes the following steps: comparing the gray levels corresponding to the valley positions in the energy response spectrum formed by different color channels in each image, removing the image information of the background and overlapping shadow areas, and obtaining the image information of the tea area.
7. The method for determining the degree of green tea withering based on image features according to claim 3 is characterized in that: The working principle of the image energy attention mechanism is as follows: highlight the color features in the image and obtain the grayscale value corresponding to the maximum number of pixels in each channel.
8. A method for determining the degree of green tea withering based on image features according to any one of claims 5 to 7, characterized in that: The variables of the mapping function are the grayscale value and the statistical value of the number of pixels in the corresponding grayscale value.
9. The method for determining the degree of green tea withering based on image features according to claim 4, wherein: The construction process of the decision function is as follows: standard cluster centers are obtained by training the killing images at standard time points or time periods, and the decision function is constructed by the distance values between the three cluster centers corresponding to all training sample sets within the standard killing time.
10. The method for determining the degree of green tea withering based on image features according to claim 9, wherein: The standard cluster center is obtained by calculating the average value based on supervised energy iterative clustering according to the idea of k-means cluster center.
Citation Information
Patent Citations
Virtual simulation monitoring method for green tea fixation process based on digital twinning
CN117452891A
Cited By
Tea processing quality control method and system based on image processing
CN119522991A
