An image vision-based tea quality automatic grading method
Patent Information
- Application Number
- CN202611483304.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-22
- Publication Date
- 2026-10-30
AI Technical Summary
但在未分拣茶叶连续输送场景中,多片茶叶常存在交叠、卷曲、堆积、茶梗穿插和碎茶混杂,普通视觉模型难以充分提取交叠条状结构、边界接触和断裂端特征
(1)本发明将未分拣待分级茶叶形成连续薄层茶叶流,将茶叶流段编号、茶叶流运行位置和标准茶叶图像流段进行绑定,使图像识别结果能够对应到输送带上的具体茶叶流段,从而实现茶叶生产线在线初分级与后续分拣处理的连续衔接。
Smart Images

Figure CN122999558A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tea quality testing technology, and in particular to an automatic tea quality grading method based on image vision. Background Technology
[0002] Tea quality grading typically relies on manual evaluation, with evaluators determining the grade based on the tea's color, shape, integrity, cleanliness, and the presence of impurities. However, this manual method is susceptible to factors such as experience, lighting conditions, batch size, and sample spreading conditions, making it unsuitable for the consistent grading requirements of continuous production lines.
[0003] Existing image-based visual grading methods can acquire tea images using industrial cameras and determine grading based on color, texture, edge, or deep learning features. However, in scenarios involving continuous transport of unsorted tea leaves, multiple tea leaves often overlap, curl, pile up, have interwoven stems, and are mixed with broken tea. Ordinary visual models struggle to fully extract features such as overlapping strip structures, boundary contacts, and broken ends.
[0004] Existing methods mostly focus on image grade recognition, failing to effectively link the tea flow section location, target grade, and diversion processing station, making it difficult to directly complete online initial grading and sorting processing on the production line.
[0005] Therefore, how to provide an automatic tea quality grading method based on image vision is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] One objective of this invention is to propose an automatic tea quality grading method based on image vision. This invention utilizes an improved RepViT visual network, silent reactivation channel calculation, and overlapping strip structure sampling to complete image recognition, target grade determination, and diversion processing of unsorted tea flow segments. It has the advantages of strong grading continuity, low computational load at the edge end, and strong ability to recognize overlapping tea leaves.
[0007] An automatic tea quality grading method based on image vision according to an embodiment of the present invention includes the following steps: Unsorted tea leaves awaiting grading are fed into a conveyor belt, where a continuous thin layer of tea leaves is formed by a spreading mechanism. The position of the tea leaves at the testing station is recorded. Images of a continuous thin layer of tea leaves are acquired, and the acquired images are corrected and scaled to generate standard tea leaf image segments. Standard tea image streams are input into an improved RepViT visual network to extract initial quality features that reflect changes in tea color, edge variation, and local texture. During the initial quality feature extraction process, silent reactivation channel calculation is performed. Regularly calculated features participate in spatial mixing, while silent features enter channel interaction via bypass. Reactivation quality features are generated based on abnormal appearance responses. During the reactivation quality feature extraction process, overlapping strip structure skeleton boundary coupling sampling is performed. Based on the local morphological continuity and appearance mutation information, an irregular sampling path is constructed to extract the quality features of the overlapping structure along the strip visible structure formed by the overlapping of multiple tea leaves, the boundary contact area and the fracture end area. Based on the reactivation quality characteristics and the overlapping structure quality characteristics, a comprehensive quality characteristic of tea is generated, and the target grade of tea in the tea image stream segment is determined according to the comprehensive quality characteristic of tea. Grading control instructions are generated based on the target grade of the tea and the location of the tea flow, and the corresponding tea flow segment enters the processing station that matches the target grade of the tea.
[0008] Optionally, feeding the unsorted tea leaves to be graded into the conveyor belt specifically includes: Unsorted tea leaves awaiting grading are fed into the feeding area of the conveyor belt through the inlet, and then spread laterally according to the width of the conveyor belt. Adjust the distance between the paving component and the conveyor belt bearing surface of the paving mechanism to the preset tea layer thickness. The paving component is used to level the unsorted tea leaves that have been spread laterally, generating a continuous thin layer of tea leaves. The displacement pulses of the conveyor belt are collected, and the continuous thin-layer tea flow is divided into segments according to the displacement pulses to generate tea flow segment numbers. Establish a correspondence between the tea flow section number and the conveyor belt displacement value; When a continuous thin layer of tea leaves enters the detection station, the conveyor belt displacement value corresponding to the tea leaf flow segment number and the coordinates of the detection station are read to generate the running position of the tea leaf flow in the detection station. The running location is bound to the tea flow segment number to generate tea flow segment location data.
[0009] Optionally, the image acquisition of the continuous thin-layer tea leaf flow specifically includes: Based on the location data of the tea flow segment, the industrial camera at the detection station is triggered to acquire the original tea image of the continuous thin layer of tea flow; Cropping the corresponding tea flow segment region from the original tea image according to the tea flow segment number; Distortion correction, brightness normalization, white balance correction, and color correction are performed on the tea leaf flow section area to generate a corrected image; The scale of the corrected image is unified according to the input size of the improved RepViT visual network. The scale-unified corrected image is then bound to the tea leaf segment number to generate a standard tea leaf image segment.
[0010] Optionally, the improved RepViT visual network specifically includes: The RepViT lightweight visual network is used as the main body for tea image feature extraction, and the image embedding, staged feature extraction, spatial blending, channel interaction and grade output processes in the RepViT lightweight visual network are retained. The input features are divided into constant features and silent features. The constant features are spatially mixed, and the silent features are bypassed and passed. The processed constant features and silent features are then sent into the channel interaction process. An irregular sampling path is generated based on the center trend, boundary contact and fracture end information of the overlapping strip structure. Feature sampling is performed along the irregular sampling path, and the sampled features are sent into the channel interaction process. The target grade of tea is generated through the grade output process.
[0011] Optionally, the extraction of initial quality features reflecting changes in tea color, edge variations, and local texture specifically includes: Standard tea image streams are input into the image embedding process of the improved RepViT visual network, and convolutional mapping is performed to generate shallow image features. Perform local color difference operation on shallow image features to generate color change features; Spatial gradient operations are performed on shallow image features to generate edge variation features; Perform neighborhood response statistical operations on shallow image features to generate local texture change features; Color variation features, edge variation features, and local texture variation features are input into the shallow spatial blending process to generate initial quality features.
[0012] Optionally, the silent reactivation channel calculation during the initial quality feature extraction process specifically includes: The initial quality features are split into multiple single-channel feature maps according to channels; For each single-channel feature map, calculate the difference statistics between adjacent pixels and the discrete statistics of the neighborhood response, and generate the channel activity value based on the difference statistics between adjacent pixels and the discrete statistics of the neighborhood response; The constant and silent characteristics are determined based on the sorting results of all channel activity values; Perform depthwise convolution processing on frequently computed features, and retain the original channel feature values and skip depthwise convolution processing for silent features; The commonly computed features after depthwise convolution and the silent features after skipping depthwise convolution are merged in the original channel order, and pointwise convolution is performed to generate channel interaction features. For channels whose interaction features originate from silent features, recalculate the channel activity value. Then, incorporate the channels whose recalculated channel activity values meet the reactivation conditions into the frequently calculated features in subsequent calculations to generate reactivation quality features.
[0013] Optionally, the overlapping strip-shaped skeleton boundary coupling sampling specifically includes: Directional extension detection is performed on the neighborhood features of the reactivation quality features, and the spatial location of the continuous response is recorded as local morphological continuity information. Response difference detection is performed on the neighborhood features of the reactivation quality features, and the spatial location of the response mutation is recorded as appearance mutation information; Spatial locations that satisfy the condition of continuous extension are selected from the local morphological continuity information as the locations of the overlapping strip-shaped structure skeleton; Search for abrupt changes in appearance on both sides of the overlapping strip-shaped skeleton, and use the searched spatial locations as boundary coupling sampling locations; Search for abrupt changes in appearance at the extended ends of the overlapping strip-shaped skeleton, and use the searched spatial locations as end sampling locations; Irregular sampling paths are constructed according to the spatial connection order of the overlapping strip-shaped skeleton positions, boundary coupling sampling positions, and end sampling positions. Read the feature values in the reactivated quality features along the irregular sampling path to generate overlapping structure quality features.
[0014] Optionally, the extraction of overlapping structural quality features specifically includes: Read the feature values corresponding to the positions of the overlapping strip-shaped structure skeleton according to the irregular sampling path, and generate strip-shaped visible structure features; Read the feature values corresponding to the boundary coupling sampling positions according to the irregular sampling path, and generate boundary contact features; Read the feature values corresponding to the end sampling positions according to the irregular sampling path to generate fracture end features; The visible strip structure features, boundary contact features, and fracture end features are arranged in the order of irregular sampling paths, and channel mixing processing is performed to generate overlapping structural quality features.
[0015] Optionally, the target grade of tea in the tea image stream segment based on the comprehensive quality characteristics judgment standard for tea specifically includes: The reactivated quality features and overlapping structural quality features are merged according to the channel direction, and channel compression processing is performed to generate comprehensive tea quality features. Global pooling is applied to the comprehensive quality characteristics of tea to generate segment grade vectors. Input the flow segment grade vector into a fully connected classification operation to generate a grade probability vector; The grade corresponding to the highest probability value in the grade probability vector is selected as the target grade of tea in the standard tea image stream segment.
[0016] Optionally, the specific steps for the corresponding tea flow segment to enter the processing station matching the target grade of the tea include: Read the target grade of tea, tea flow segment number, and tea flow segment location data; Determine the corresponding processing station based on the target grade of the tea; The trigger time for the tea flow segment to reach the corresponding processing station is calculated based on the location data of the tea flow segment and the location of the corresponding processing station. Generate hierarchical control instructions at the trigger moment; The flow control mechanism is controlled according to the hierarchical control instructions to guide the corresponding tea flow segment to the corresponding processing station.
[0017] The beneficial effects of this invention are: (1) The present invention forms a continuous thin layer of tea flow from unsorted tea leaves to be graded, and binds the tea flow segment number, the tea flow running position and the standard tea image flow segment, so that the image recognition result can be matched with the specific tea flow segment on the conveyor belt, thereby realizing the continuous connection between online initial grading and subsequent sorting processing of tea production line.
[0018] (2) In the improved RepViT visual network, the present invention sets up silent reactivation channel calculation, judges the channel activity status, enables some feature channels to skip spatial calculation, and re-enters subsequent calculation after abnormal appearance response, which reduces the redundant calculation amount when grading continuous tea images and improves the adaptability of edge deployment.
[0019] (3) In the process of reactivating quality feature extraction, the present invention performs boundary coupling sampling of overlapping strip structure skeleton, extracts quality features of overlapping structure along the visible strip structure formed by multiple overlapping tea leaves, boundary contact area and fracture end area, and improves the ability to identify overlapping tea leaves, interlacing tea stems, mixed broken tea leaves and fracture end appearance. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is a flowchart of an automatic tea quality grading method based on image vision proposed in this invention; Figure 2 This is a schematic diagram of the silent reactivation channel calculation for an automatic tea quality grading method based on image vision proposed in this invention. Figure 3 This is a heatmap analysis image of tea sorting for an automatic tea quality grading method based on image vision proposed in this invention. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0022] refer to Figures 1-2 An automatic tea quality grading method based on image vision includes the following steps: Unsorted tea leaves awaiting grading are fed into a conveyor belt, where a continuous thin layer of tea leaves is formed by a spreading mechanism. The position of the tea leaves at the testing station is recorded. Images of a continuous thin layer of tea leaves are acquired, and the acquired images are corrected and scaled to generate standard tea leaf image segments. Standard tea image streams are input into an improved RepViT visual network to extract initial quality features that reflect changes in tea color, edge variation, and local texture. During the initial quality feature extraction process, silent reactivation channel calculation is performed. Regularly calculated features participate in spatial mixing, while silent features enter channel interaction via bypass. Reactivation quality features are generated based on abnormal appearance responses. During the reactivation quality feature extraction process, overlapping strip structure skeleton boundary coupling sampling is performed. Based on the local morphological continuity and appearance mutation information, an irregular sampling path is constructed to extract the quality features of the overlapping structure along the strip visible structure formed by the overlapping of multiple tea leaves, the boundary contact area and the fracture end area. Based on the reactivation quality characteristics and the overlapping structure quality characteristics, a comprehensive quality characteristic of tea is generated, and the target grade of tea in the tea image stream segment is determined according to the comprehensive quality characteristic of tea. Grading control instructions are generated based on the target grade of the tea and the location of the tea flow, and the corresponding tea flow segment enters the processing station that matches the target grade of the tea.
[0023] In this embodiment, feeding the unsorted tea leaves awaiting grading into the conveyor belt specifically includes: Unsorted tea leaves awaiting grading are fed into the feeding area of the conveyor belt through the inlet. The unsorted tea leaves are then spread laterally along the width of the conveyor belt. The width of the conveyor belt is set to 600mm, the conveying speed is set to 0.20m / s, the inlet is located above the starting end of the conveyor belt, and the inlet outlet width is set to 500mm. The unsorted tea leaves awaiting grading are fed into the feeding area of the conveyor belt via a vibrating feeder. The vibration frequency of the vibrating feeder is set to 35Hz, and the lateral spreading direction is perpendicular to the running direction of the conveyor belt. The spacing between the paving component and the conveyor belt bearing surface of the paving mechanism is adjusted to the preset tea layer thickness. The paving component is used to level the unsorted tea leaves that have been spread laterally, generating a continuous thin layer of tea leaves. The paving component uses a flexible scraper. The spacing between the lower edge of the flexible scraper and the conveyor belt bearing surface is set to 12mm. The preset tea layer thickness is set to 12mm. The flexible scraper is arranged along the width direction of the conveyor belt. The angle between the flexible scraper and the running direction of the conveyor belt is set to 85°. The lateral coverage width of the continuous thin layer of tea leaves is set to 480mm. The displacement pulses of the conveyor belt are collected, and the continuous thin layer of tea leaves is divided into segments according to the displacement pulses, generating tea leaf segment numbers. The conveyor belt displacement pulses are collected by an incremental encoder installed on the drive roller of the conveyor belt. The resolution of the incremental encoder is set to 2000P / R, and the circumference of the drive roller is set to 300mm. The continuous thin layer of tea leaves is divided into segments with a fixed segment length of 50mm, and tea leaf segment numbers are generated according to the order in which the tea leaves enter the detection station. Establish a correspondence between the tea flow segment number and the conveyor belt displacement value; take the conveyor belt displacement value when the front end of the tea flow segment enters the entrance line of the detection station as the starting displacement value of the tea flow segment, and take the conveyor belt displacement value when the rear end of the tea flow segment leaves the entrance line of the detection station as the ending displacement value of the tea flow segment. Write the tea flow segment number, starting displacement value and ending displacement value into the tea flow segment position table. When a continuous thin layer of tea leaves enters the detection station, the conveyor belt displacement value corresponding to the tea leaf segment number and the detection station coordinates are read to generate the running position of the tea leaf flow in the detection station. The detection station coordinates take the projection point of the industrial camera optical axis on the conveyor belt bearing surface as the coordinate origin, the conveyor belt running direction as the longitudinal coordinate axis, and the conveyor belt width direction as the transverse coordinate axis. The longitudinal position is calculated based on the starting displacement value corresponding to the tea leaf segment number and the current conveyor belt displacement value, and the transverse position is converted based on the transverse pixel coordinates in the acquired image. The running position is bound to the tea flow segment number to generate tea flow segment position data. The tea flow segment position data includes the tea flow segment number, detection station coordinates, starting displacement value, ending displacement value, entry time to detection station, exit time from detection station and corresponding image number. The tea flow segment position data is written into the position data table according to the tea flow segment number.
[0024] In this embodiment, image acquisition of a continuous thin-layer tea leaf stream specifically includes: Based on the location data of the tea flow section, the industrial camera at the detection station is triggered to acquire the original tea image of the continuous thin layer of tea flow; the industrial camera is a global shutter industrial camera with a frame rate set to 60fps. The industrial camera is installed directly above the conveyor belt bearing surface, and the optical axis of the industrial camera is perpendicular to the conveyor belt bearing surface. The detection station is illuminated by a white LED surface light source. According to the tea flow segment number, the corresponding tea flow segment area is cropped from the original tea image; the vertical pixel range of the tea flow segment in the original tea image is determined according to the tea flow segment position data, and the effective conveying area in the original tea image is retained according to the width direction of the conveyor belt, and the rectangular image area corresponding to the tea flow segment number is cropped. Distortion correction, brightness normalization, white balance correction, and color correction are performed on the tea leaf flow section area to generate a corrected image. Distortion correction uses the camera intrinsic parameter matrix and distortion coefficients for anti-distortion mapping. Brightness normalization adjusts the average brightness of the tea leaf flow section area to 128. White balance correction uses the gray world algorithm. Color correction uses a three-dimensional lookup table corresponding to the 24-color standard color card. The scale of the corrected image is unified according to the input size of the improved RepViT visual network. The scale-unified corrected image is then bound to the tea leaf segment number to generate a standard tea leaf image segment.
[0025] In this embodiment, the improved RepViT visual network specifically includes: The RepViT lightweight visual network is used as the main body for tea image feature extraction, retaining the image embedding, staged feature extraction, spatial blending, channel interaction, and grade output processes in the RepViT lightweight visual network. The RepViT lightweight visual network adopts the RepViT-M1.1 structure. The image embedding process uses convolution operation with a stride of 2 to generate initial features, the spatial blending process uses depthwise convolution operation, the channel interaction process uses pointwise convolution operation, and the grade output process uses global average pooling and fully connected classification operation. The output dimension is set to 5, corresponding to special grade, first grade, second grade, third grade, and unqualified. The input features are divided into constant features and silent features. The constant features are spatially mixed, and the silent features are passed by a bypass. The processed constant features and silent features are then fed into the channel interaction process. The constant features are entered into a 3×3 depthwise convolution, and the silent features are passed by a bypass through an identity mapping. The constant features and silent features are concatenated according to the original channel order and then entered into a pointwise convolution. An irregular sampling path is generated based on the center trend, boundary contact, and fracture end information of the overlapping strip structure. Feature sampling is performed along the irregular sampling path, and the sampled features are sent into the channel interaction process. In the third feature stage, an irregular sampling path is introduced. The sampling path consists of the center trend position, boundary contact position, and fracture end position. The sampled features are arranged in the order of center trend features, boundary contact features, and fracture end features, and are mapped to the number of output channels of the third feature stage through pointwise convolution. The target grade of tea is generated through the grade output process. The grade output process performs global average pooling on the 7×7 feature map output from the last feature stage to obtain a one-dimensional feature vector. The one-dimensional feature vector is input into a fully connected classification layer to generate a 5-dimensional grade probability vector. The grade corresponding to the dimension with the largest value in the 5-dimensional grade probability vector is taken as the target grade of tea.
[0026] In this embodiment, extracting the initial quality characteristics reflecting changes in tea color, edge variation, and local texture specifically includes: Standard tea image streams are input into the image embedding process of the improved RepViT visual network, and convolutional mapping is performed to generate shallow image features; the convolutional mapping uses a kernel size of 3×3 and a stride of 2. Local color difference operation is performed on shallow image features to generate color change features; neighborhood mean is calculated for the mapping features corresponding to the red, green and blue channels in the shallow image features respectively, the neighborhood window size is set to 3×3, and the difference between the feature value at the center position and the neighborhood mean is used as the local color difference result; Spatial gradient operations are performed on shallow image features to generate edge change features. The spatial gradient operation uses the Sobel operator to calculate the horizontal and vertical gradients respectively, and the absolute values of the horizontal and vertical gradients are added together. Neighborhood response statistical operations are performed on shallow image features to generate local texture change features. The neighborhood response statistical operation uses a 5×5 neighborhood window to calculate the mean and standard deviation of the feature response in the neighborhood corresponding to each spatial location. The mean and standard deviation are concatenated and then mapped by a 1×1 convolution. Color variation features, edge variation features, and local texture variation features are input into a shallow spatial blending process to generate initial quality features. The color variation features, edge variation features, and local texture variation features are then concatenated according to the channel direction. The concatenated features are then processed by 3×3 depthwise convolution and 1×1 pointwise convolution.
[0027] In this embodiment, the silent reactivation channel calculation during the initial quality feature extraction process specifically includes: The initial quality features are split into multiple single-channel feature maps according to channels; For each single-channel feature map, calculate the neighbor pixel difference statistics and the neighborhood response discrete statistics, and generate the channel activity value based on the neighbor pixel difference statistics and the neighborhood response discrete statistics. The neighbor pixel difference statistics are the sum of the mean absolute values of the differences between horizontal and vertical neighbor pixels in the single-channel feature map. The neighborhood response discrete statistics are the mean of the variance of the feature values in the sliding neighborhood of the single-channel feature map. The channel activity value is the weighted sum of the neighbor pixel difference statistics and the neighborhood response discrete statistics. The frequently calculated features and silent features are determined based on the ranking of all channel activity values; the single-channel feature maps corresponding to the top 50% of channels are used as frequently calculated features, and the single-channel feature maps corresponding to the remaining channels are used as silent features. For frequently computed features, perform depthwise convolution processing; for silent features, retain the original channel feature values and skip depthwise convolution processing. For frequently computed features, perform 3×3 depthwise convolution processing; for silent features, do not perform convolution kernel operations; and the feature values of silent features at the same spatial coordinates remain unchanged. The frequently computed features after depthwise convolution and the silent features after skipping depthwise convolution are merged in the original channel order, and pointwise convolution is performed to generate channel interaction features. The order of the frequently computed features and silent features is restored according to the channel number of the initial quality features, and the pointwise convolution uses 1×1 convolution. For channels derived from silent features in the channel interaction features, the channel activity value is recalculated. Channels whose recalculated channel activity value meets the reactivation condition are incorporated into the frequently calculated features in the subsequent calculation to generate reactivation quality features. For channels derived from silent features, the channel activity value is recalculated in the same way as the initial channel activity value. The average value of the recalculated channel activity value is used as the reactivation threshold. Channels whose channel activity value is greater than the reactivation threshold are incorporated into the frequently calculated features in the next silent reactivation channel calculation.
[0028] In this embodiment, the boundary coupling sampling of the overlapping strip-shaped skeleton specifically includes: Directional extension detection is performed on the neighborhood features of the reactivation quality features, and the spatial locations with continuous responses are recorded as local morphological continuity information. The reactivation quality features are averaged by channel to obtain a two-dimensional response map. The two-dimensional response map is normalized, and a 3×3 neighborhood is set at each spatial location. The response difference between adjacent locations is calculated along eight directions: horizontal, vertical, the two diagonals, and the opposite direction. When the response difference of three consecutive locations is less than 0.15, the corresponding spatial location and direction number are recorded as local morphological continuity information. Response difference detection is performed on the neighborhood features of the reactivated quality features, and the spatial location of the response change is recorded as appearance change information. In the two-dimensional response map, a 3×3 neighborhood is set for each spatial location, and the absolute value of the response difference between the center location and the 8 adjacent locations in the neighborhood is calculated. Spatial locations with the maximum response difference greater than 0.25 are recorded as appearance change information. Select spatial locations that meet the continuous extension condition from the local morphological continuity information as the locations of the overlapping strip structure skeleton; connect local morphological continuity information with the same directional number and continuous spatial distance, and when the connection length reaches 5 spatial locations, use the connected position sequence as the locations of the overlapping strip structure skeleton. Search for appearance change information on both sides of the overlapping strip structure skeleton position, and use the searched spatial position as the boundary coupling sampling position; for each spatial position in the overlapping strip structure skeleton position, search for 3 spatial positions on each side along the direction perpendicular to the corresponding direction number, and use the spatial position corresponding to the first appearance change information in the search range as the boundary coupling sampling position. Search for appearance mutation information at the extended end of the overlapping strip structure skeleton, and use the searched spatial position as the end sampling position; use the first and last ends of the overlapping strip structure skeleton as the extended ends, and search for 4 spatial positions outward along the skeleton extension direction, and use the spatial position corresponding to the appearance mutation information with the largest response difference within the search range as the end sampling position. Irregular sampling paths are constructed according to the spatial connection order of the overlapping strip-shaped skeleton positions, boundary coupling sampling positions, and end sampling positions. The irregular sampling paths are arranged in the order of the first end sampling position, the overlapping strip-shaped skeleton positions, the two side boundary coupling sampling positions, and the last end sampling position, with repeated spatial positions in the path retained once. Read the feature values in the reactivation quality feature along the irregular sampling path to generate the overlapping structure quality feature; read the corresponding channel vector from the reactivation quality feature according to the spatial position in the irregular sampling path, concatenate the read channel vectors in the path order, and map them into the overlapping structure quality feature with the same number of channels as the reactivation quality feature through 1×1 convolution.
[0029] In this embodiment, extracting the quality features of overlapping structures specifically includes: The feature values corresponding to the positions of the overlapping strip-shaped skeleton are read according to the irregular sampling path to generate visible strip-shaped structural features; the number of overlapping strip-shaped skeleton positions is uniformly 8; when the actual number of skeleton positions is less than 8, the end positions are repeated according to the skeleton extension direction to make up for it; when the actual number of skeleton positions is more than 8, 8 positions are selected at equal intervals according to the skeleton extension direction; the channel vectors corresponding to the 8 positions are read from the reactivation quality features and arranged according to the skeleton extension direction to form visible strip-shaped structural features; Read the feature values corresponding to the boundary coupling sampling positions according to the irregular sampling path to generate boundary contact features; read the channel vectors corresponding to the left and right boundary coupling sampling positions for each skeleton position; when no boundary coupling sampling position is found, read the channel vectors corresponding to the adjacent skeleton positions; arrange the channel vectors on the left and right sides according to the skeleton extension direction to form boundary contact features; Read the feature values corresponding to the end sampling positions according to the irregular sampling path to generate fracture end features; the end sampling positions include the first end sampling position and the last end sampling position; read the channel vectors corresponding to the first end sampling position and the last end sampling position respectively from the reactivation quality features, and arrange them in the order of first end first and last end as fracture end features; The visible strip structure features, boundary contact features, and fracture end features are arranged in the order of irregular sampling paths, and channel blending is performed to generate overlapping structural quality features. The channel blending process uses a 1×1 convolution mapping method on the spliced features.
[0030] In this embodiment, the target grade of tea in the tea image stream segment, based on the comprehensive quality characteristics judgment standard for tea, specifically includes: The reactivated quality features and overlapping structure quality features are merged according to the channel direction, and channel compression processing is performed to generate comprehensive tea quality features; the channel compression processing uses 1×1 convolution. Global pooling is applied to the comprehensive quality characteristics of tea to generate segment grade vectors. The global pooling process uses global average pooling to average the spatial response of each channel in the comprehensive quality characteristics of tea. Input the flow segment grade vector into a fully connected classification operation to generate a grade probability vector; set the output dimension to 5, with the 5 output dimensions corresponding to special grade, first grade, second grade, third grade and unqualified, respectively; The grade corresponding to the highest probability value in the grade probability vector is selected as the target grade of tea in the standard tea image stream; Softmax normalization is performed on the output of the fully connected classification operation to obtain a 5-dimensional grade probability vector.
[0031] In this embodiment, the specific steps for the tea flow segment to enter the processing station matching the target grade of the tea include: Read the target grade of tea, tea flow segment number, and tea flow segment location data; The corresponding processing station is determined based on the target grade of the tea. The target grade of the tea is the initial visual grading result of the production line, and it is used to perform preliminary sorting of unsorted tea awaiting grading. The processing station is set as a sorting station, which is divided into five sorting stations according to the subsequent processing method: the first sorting station, the second sorting station, the third sorting station, the fourth sorting station, and the fifth sorting station. The first sorting station receives the tea stream determined to be of the highest grade and is connected to a high-grade tea temporary storage container. The second sorting station receives the tea stream determined to be of the first grade and is connected to a first-grade tea temporary storage container. The third sorting station receives the tea stream determined to be of the second grade and is connected to a re-screening inlet. The fourth sorting station receives the tea stream determined to be of the third grade and is connected to a destemming screening inlet. The fifth sorting station receives the tea stream determined to be unqualified and is connected to a rejection collection container or a manual verification station. The trigger time for the tea flow segment to reach the corresponding processing station is calculated based on the location data of the tea flow segment and the location of the corresponding processing station. Generate hierarchical control instructions at the trigger moment; The flow control mechanism is controlled according to the hierarchical control instructions to guide the corresponding tea flow segment to the corresponding processing station.
[0032] Example 1: To verify the feasibility of this invention in practice, it was applied to the online initial grading stage of a continuous tea processing line. The material to be processed was a dry tea mixture that had not been manually subdivided. The mixture contained relatively intact tea strips, broken tea, short stems, yellow leaves, scorched edges, and a small amount of impurities. This type of material does not flow flat on the conveyor belt but passes through the detection station in a thin layer. In some areas, multiple tea leaves may be curled and overlapping, tea stems may be pressed down, broken pieces may accumulate, and boundaries may be obscured. Traditional manual sampling methods can only judge local samples and cannot directly correlate the identification results to specific tea flow segments on the conveyor belt. Although conventional visual models can output image grades, when there are many overlapping strip structures, boundary contact areas, and broken end areas, they easily confuse normal curled tea strips with tea stems and broken tea accumulations, leading to instability in subsequent sorting processing.
[0033] In this embodiment, unsorted tea leaves awaiting grading enter the conveyor belt feeding area through the inlet. After being leveled by the spreading mechanism, they form a continuous thin layer of tea leaves. An incremental encoder is connected to the conveyor belt's drive roller. The control unit divides the continuous thin layer of tea leaves into segments based on displacement pulses and generates a segment number for each segment. When a tea leaf segment enters the detection station, an industrial camera triggers acquisition based on the segment's position data, obtaining the original tea leaf image. After distortion correction, brightness normalization, white balance correction, color correction, and scale unification, the acquired image is bound to the tea leaf segment number to form a standard tea leaf image segment. Thus, a definite correspondence is established between the detected object in the image and the material segment on the conveyor belt, providing a positional basis for subsequent grading control commands.
[0034] After inputting a standard tea leaf image stream into the improved RepViT visual network, shallow image features are first obtained through image embedding. Then, initial quality features are formed from three aspects: color variation, edge variation, and local texture variation. For the initial quality features, this invention performs silent reactivation channel calculation: each channel first obtains its activity value based on the difference statistics of adjacent pixels and the discrete statistics of the neighborhood response. Channels with higher activity values participate in depthwise convolution, while channels with lower activity values skip depthwise convolution and retain their original channel feature values. Subsequently, all channels enter pointwise convolution in their original order. After channel interaction, channels derived from silent features recalculate their channel activity values, and channels that meet the reactivation condition are incorporated into subsequent frequently calculated features. This process reduces redundant spatial computation in areas with a large amount of normal tea leaf texture and restores more channels to participate in computation when tea stems, broken pieces, scorched edges, and abnormal color spots appear.
[0035] Based on the reactivation quality features, this invention performs boundary coupling sampling of overlapping strip-shaped structure skeletons. The process does not require identifying single tea leaf instances, but rather performs directional extension detection and response difference detection on the visible strip-shaped structures formed by multiple overlapping tea leaves. Locations with continuous responses are recorded as local morphological continuity information, and locations with abrupt responses are recorded as appearance abruptness information. Subsequently, the positions of the overlapping strip-shaped structure skeletons are determined from the local morphological continuity information. Appearance abruptness locations are searched on both sides of the skeleton as boundary coupling sampling locations, and appearance abruptness locations are searched at the extended ends of the skeleton as end sampling locations. These skeleton positions, boundary coupling sampling locations, and end sampling locations form an irregular sampling path according to their spatial connection order. The network reads the corresponding feature values from the reactivation quality features along this path to form the overlapping structure quality features. This processing method can capture the continuity of the strip-shaped structure, changes in boundary contact, and the appearance of the broken ends even when the overlapping tea leaves are not segmented.
[0036] like Figure 3As shown, four feature visualizations are used to demonstrate the focus areas of the improved RepViT visual network in the tea image grading process. The top left image shows the visualization results of the visible strip structure features, mainly displaying the response areas generated by the model along the elongated strip structures formed by the overlapping of multiple tea leaves. This is used to observe the model's extraction of the continuous shape, curling direction, and overlapping strips of the tea leaves. The top right image shows the visualization results of the boundary contact features, mainly displaying the response areas at the edges of the tea leaves, overlapping contact points, areas covered by tea stems, and locations of abrupt changes in appearance. This is used to observe the model's extraction of boundary changes and contact areas. The bottom left image shows the visualization results of the broken end features, mainly displaying the response positions of the broken tea ends, fragmented ends, short stem ends, and foreign object edge termination areas. This is used to observe the model's extraction of local end features that affect the integrity and purity of the tea leaves. The bottom right image shows the visualization results of the comprehensive area of interest. This image is formed by channel mixing of the visible strip structure features, boundary contact features, and broken end features, and is used to demonstrate the key areas that the model focuses on when determining the target grade of the tea. The purpose of setting up a comprehensive area of interest map is to demonstrate that the model does not judge based on a single color or a single edge, but rather incorporates overlapping strip structures, boundary contact states, and fracture end states into the grade determination.
[0037] The comprehensive quality characteristics of tea are obtained by merging and compressing the reactivated quality characteristics and overlapping structure quality characteristics channels, and then obtaining the grade probability vector through global pooling and fully connected classification operations. The category with the highest grade probability is taken as the target grade of tea. It should be noted that this target grade of tea is the initial online visual grading result of the production line, used to guide the diversion execution mechanism to complete the preliminary sorting of the unsorted tea flow segment, and does not replace the final manual evaluation. The control terminal calculates the trigger time based on the target grade of tea and the position data of the tea flow segment, and sends a grading control command to the air blowing nozzle array or diversion baffle, so that the corresponding tea flow segment enters the matching processing station. The tea flow segment judged as high grade enters the temporary storage station, the tea flow segment judged as medium grade enters the re-screening station, and the tea flow segment judged as low grade or unqualified enters the destemming, rejection or manual review station.
[0038] Table 1: Comparison of the Implementation Effects of Different Visual Grading Methods for Tea
[0039] As can be seen from Table 1, the method of the present invention is superior to manual sampling grading, conventional CNN visual grading and original RepViT visual grading in terms of accuracy of segment grading, diversion matching rate and non-qualified segment omission rate.
[0040] Manual sampling grading is affected by personnel experience and sampling range, making it impossible to establish stable judgments for every segment of material in a continuous tea flow, resulting in a low flow matching rate. While conventional CNN visual grading achieves automatic recognition, it is insufficient in representing overlapping tea leaves, broken tea aggregates, and fractured areas, thus exhibiting significant fluctuations in misclassification of adjacent grades and missed classifications of substandard products. The original RepViT visual grading has low inference time, but lacks a sampling mechanism for overlapping strip structures of tea leaves, and has limited ability to distinguish between tea stem pressing and boundary contact areas.
[0041] The method of this invention reduces redundant space calculations by silently reactivating channel calculations and enhances the quality representation of overlapping and end regions by coupling sampling of overlapping strip-shaped skeleton boundaries. While reducing inference time to 10.8ms, it increases the accuracy of flow segment classification to 96.3% and reduces the rate of missing non-compliant flow segments to 1.6%, indicating that this invention can balance online classification speed, classification stability, and subsequent diversion processing reliability.
[0042] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. An automatic tea quality grading method based on image vision, characterized in that, Includes the following steps: Unsorted tea leaves awaiting grading are fed into a conveyor belt, where a continuous thin layer of tea leaves is formed by a spreading mechanism. The position of the tea leaves at the testing station is recorded. Images of a continuous thin layer of tea leaves are acquired, and the acquired images are corrected and scaled to generate standard tea leaf image segments. Standard tea image streams are input into an improved RepViT visual network to extract initial quality features that reflect changes in tea color, edge, and local texture. During the initial quality feature extraction process, silent reactivation channel calculation is performed. Regularly calculated features participate in spatial mixing, while silent features enter channel interaction via bypass. Reactivation quality features are generated based on abnormal appearance responses. During the reactivation quality feature extraction process, overlapping strip structure skeleton boundary coupling sampling is performed. Based on the local morphological continuity and appearance mutation information, an irregular sampling path is constructed to extract the quality features of the overlapping structure along the strip visible structure formed by the overlapping of multiple tea leaves, the boundary contact area and the fracture end area. Based on the reactivation quality characteristics and the overlapping structure quality characteristics, a comprehensive quality characteristic of tea is generated, and the target grade of tea in the tea image stream segment is determined according to the comprehensive quality characteristic of tea. Grading control instructions are generated based on the target grade of the tea and the location of the tea flow, and the corresponding tea flow segment enters the processing station that matches the target grade of the tea.
2. The automatic tea quality grading method based on image vision according to claim 1, characterized in that, The process of feeding unsorted, ungraded tea leaves into the conveyor belt specifically includes: Unsorted tea leaves awaiting grading are introduced into the feeding area of the conveyor belt through the inlet, and then spread laterally according to the width of the conveyor belt. Adjust the distance between the paving component and the conveyor belt bearing surface of the paving mechanism to the preset tea layer thickness. The paving component is used to level the unsorted tea leaves that have been spread laterally, generating a continuous thin layer of tea leaves. The displacement pulses of the conveyor belt are collected, and the continuous thin-layer tea flow is divided into segments according to the displacement pulses to generate tea flow segment numbers. Establish a correspondence between the tea flow section number and the conveyor belt displacement value; When a continuous thin layer of tea leaves enters the detection station, the conveyor belt displacement value corresponding to the tea leaf flow segment number and the coordinates of the detection station are read to generate the running position of the tea leaf flow in the detection station. The running location is bound to the tea flow segment number to generate tea flow segment location data.
3. The automatic tea quality grading method based on image vision according to claim 2, characterized in that, The image acquisition of the continuous thin-layer tea leaf flow specifically includes: Based on the location data of the tea flow segment, the industrial camera at the detection station is triggered to acquire the original tea image of the continuous thin layer of tea flow; Cropping the corresponding tea flow segment region from the original tea image according to the tea flow segment number; Distortion correction, brightness normalization, white balance correction, and color correction are performed on the tea leaf flow section area to generate a corrected image; The scale of the corrected image is unified according to the input size of the improved RepViT visual network. The scale-unified corrected image is then bound to the tea leaf segment number to generate a standard tea leaf image segment.
4. The automatic tea quality grading method based on image vision according to claim 3, characterized in that, The improved RepViT visual network specifically includes: The RepViT lightweight visual network is used as the main body for tea image feature extraction, and the image embedding, staged feature extraction, spatial blending, channel interaction and grade output processes in the RepViT lightweight visual network are retained. The input features are divided into constant features and silent features. The constant features are spatially mixed, and the silent features are bypassed and passed. The processed constant features and silent features are then sent into the channel interaction process. An irregular sampling path is generated based on the center trend, boundary contact and fracture end information of the overlapping strip structure. Feature sampling is performed along the irregular sampling path, and the sampled features are sent into the channel interaction process. The target grade of tea is generated through the grade output process.
5. The automatic tea quality grading method based on image vision according to claim 4, characterized in that, The extraction of initial quality characteristics reflecting changes in tea color, edge texture, and local texture specifically includes: Standard tea image streams are input into the image embedding process of the improved RepViT visual network, and convolutional mapping is performed to generate shallow image features. Perform local color difference operation on shallow image features to generate color change features; Spatial gradient operations are performed on shallow image features to generate edge variation features; Perform neighborhood response statistical operations on shallow image features to generate local texture variation features; Color variation features, edge variation features, and local texture variation features are input into the shallow spatial blending process to generate initial quality features.
6. The automatic tea quality grading method based on image vision according to claim 5, characterized in that, The specific steps of performing silent reactivation channel calculation during the initial quality feature extraction process include: The initial quality features are split into multiple single-channel feature maps according to channels; For each single-channel feature map, calculate the difference statistics of adjacent pixels and the discrete statistics of the neighborhood response, and generate the channel activity value based on the difference statistics of adjacent pixels and the discrete statistics of the neighborhood response; The constant and silent characteristics are determined based on the sorting results of all channel activity values; Perform depthwise convolution processing on frequently computed features, and retain the original channel feature values and skip depthwise convolution processing for silent features; The commonly computed features after depthwise convolution and the silent features after skipping depthwise convolution are merged in the original channel order, and pointwise convolution is performed to generate channel interaction features. For channels whose interaction features originate from silent features, recalculate the channel activity value. Then, incorporate the channels whose recalculated channel activity values meet the reactivation conditions into the frequently calculated features in subsequent calculations to generate reactivation quality features.
7. The automatic tea quality grading method based on image vision according to claim 6, characterized in that, The overlapping strip-shaped skeleton boundary coupling sampling specifically includes: Directional extension detection is performed on the neighborhood features of the reactivation quality features, and the spatial location of the continuous response is recorded as local morphological continuity information. Response difference detection is performed on the neighborhood features of the reactivation quality features, and the spatial location of the response mutation is recorded as appearance mutation information. Spatial locations that satisfy the condition of continuous extension are selected from the local morphological continuity information as the locations of the overlapping strip-shaped structure skeleton; Search for abrupt changes in appearance on both sides of the overlapping strip-shaped skeleton, and use the searched spatial locations as boundary coupling sampling locations; Search for abrupt changes in appearance at the extended ends of the overlapping strip-shaped skeleton, and use the searched spatial locations as end sampling locations; Irregular sampling paths are constructed according to the spatial connection order of the overlapping strip-shaped skeleton positions, boundary coupling sampling positions, and end sampling positions. Read the feature values in the reactivated quality features along the irregular sampling path to generate overlapping structure quality features.
8. The automatic tea quality grading method based on image vision according to claim 7, characterized in that, The extraction of quality features of overlapping structures specifically includes: Read the feature values corresponding to the positions of the overlapping strip-shaped structure skeleton according to the irregular sampling path, and generate strip-shaped visible structure features; Read the feature values corresponding to the boundary coupling sampling positions according to the irregular sampling path, and generate boundary contact features; Read the feature values corresponding to the end sampling positions according to the irregular sampling path to generate fracture end features; The visible strip structure features, boundary contact features, and fracture end features are arranged in the order of irregular sampling paths, and channel mixing processing is performed to generate overlapping structural quality features.
9. The automatic tea quality grading method based on image vision according to claim 8, characterized in that, The target grade of tea in the tea image stream segment, based on the comprehensive quality characteristics of tea, specifically includes: The reactivated quality features and overlapping structural quality features are merged according to the channel direction, and channel compression processing is performed to generate comprehensive tea quality features. Global pooling is applied to the comprehensive quality characteristics of tea to generate segment grade vectors. Input the flow segment grade vector into a fully connected classification operation to generate a grade probability vector; The grade corresponding to the highest probability value in the grade probability vector is selected as the target grade of tea in the standard tea image stream segment.
10. The automatic tea quality grading method based on image vision according to claim 9, characterized in that, The specific steps for the corresponding tea flow segment to enter the processing station matching the target grade of the tea include: Read the target grade of tea, tea flow segment number, and tea flow segment location data; Determine the corresponding processing station based on the target grade of the tea; The trigger time for the tea flow segment to reach the corresponding processing station is calculated based on the location data of the tea flow segment and the location of the corresponding processing station. Generate hierarchical control instructions at the trigger moment; The flow control mechanism is controlled according to the hierarchical control instructions to guide the corresponding tea flow segment to the corresponding processing station.
