Tea leaf bud detection method, device, equipment and storage medium

CN116563227BActive Publication Date: 2026-09-11WUHAN POLYTECHNIC UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310431441.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-20
Publication Date
2026-09-11
Estimated Expiration
2043-04-20

AI Technical Summary

Technical Problem

[0005]本发明的主要目的在于提供一种茶叶嫩芽检测方法、装置、设备及存储介质,旨在解决现有技术茶叶自动识别精度低下的技术问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116563227B_ABST
    Figure CN116563227B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of image detection, and discloses a tea bud detection method, device, equipment and storage medium. The method comprises the following steps: acquiring a sample tea image, and constructing a data set according to the sample tea image; labeling the data set to obtain a training set; constructing an initial bud detection model according to the training set; pruning and compressing the initial bud detection model to obtain a target bud detection model; and detecting buds in a tea garden to be detected through the target bud detection model. In the above manner, an anchor-free detection method is adopted, an anchor box does not need to be predefined, the amount of calculation and the amount of hyperparameters are reduced, and the method can better adapt to the condition that tea buds change more in a natural scene. The effective region in the mapping region is directly regarded as a positive sample, and other regions are regarded as negative samples, so that the training speed is accelerated and the memory occupation is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image detection technology, and in particular to a method, apparatus, equipment, and storage medium for detecting tender tea buds. Background Technology

[0002] China's tea culture has a long history. Tea picking is the first task in the tea processing process. Tea picking is seasonal. Although hand-picked tea leaves are of high quality, each hand can only pick one bud at a time, which is time-consuming, labor-intensive, and inefficient, and cannot meet the large demand.

[0003] With the development of technology and people's strict requirements for tea quality, mechanized harvesting has gradually become a development trend in the harvesting industry. Although mechanized harvesting can improve harvesting efficiency to a certain extent, under natural conditions, the color of tea buds changes from yellowish-green to dark green as they grow, making it difficult to distinguish between new buds and old leaves. The buds also have different postures, high density, and can block each other. In addition, mechanized harvesting is affected by weather. These problems make it difficult to conduct comprehensive and effective testing of tea leaves, thus affecting the harvesting results.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide a method, apparatus, equipment, and storage medium for detecting tea buds, aiming to solve the technical problem of low accuracy in automatic tea identification in the prior art.

[0006] To achieve the above objectives, the present invention provides a method for detecting tea buds, the method comprising the following steps:

[0007] Obtain sample tea leaf images and construct a dataset based on the sample tea leaf images;

[0008] The training set is obtained by labeling the dataset.

[0009] An initial bud detection model is constructed based on the training set;

[0010] The initial bud detection model is pruned and compressed to obtain the target bud detection model;

[0011] The target bud detection model is used to detect buds in the tea garden under test.

[0012] Optionally, the step of labeling the dataset to obtain the training set includes:

[0013] The dataset is labeled according to tea bud type using a preset labeling tool to obtain categorized data;

[0014] Data augmentation operations are performed on the classified data to expand the data and obtain a training set.

[0015] Optionally, constructing the initial sprout detection model based on the training set includes:

[0016] The training set is shallowly aggregated using a preset target extraction network to obtain feature map information;

[0017] The convolutional attention mechanism module is used to suppress redundant background noise in the feature map information to obtain denoised feature map information.

[0018] The denoised feature map information is fused using a preset feature pyramid network to obtain the target feature map information;

[0019] An initial bud detection model is constructed based on the target feature map information.

[0020] Optionally, the step of fusing features of the denoised feature map information through a preset feature pyramid network to obtain target feature map information includes:

[0021] The resolution of the denoised feature map information is adjusted by path aggregation blocks to obtain a first feature map, a second feature map, and a third feature map. The first feature map has the lowest resolution, and the third feature map has the highest resolution. The third feature map is used as the reference feature map.

[0022] The first feature map, the second feature map, and the third feature map are connected to obtain the overall view;

[0023] Perform a 3D convolution operation on the overall view to extract scale sequence features;

[0024] The scale sequence features, the first feature map, the second feature map, and the third feature map are concatenated and input into the detection head of the preset detection model to obtain target feature map information.

[0025] Optionally, constructing the initial sprout detection model based on the target feature map information includes:

[0026] The target feature information is imported into a preset detection model to obtain detection data;

[0027] The optimization weight parameters of the preset detection model are determined based on the detection data and the preset loss function.

[0028] The preset detection model is modified according to the optimized weight parameters to obtain the optimized detection model;

[0029] A validation set is determined based on the training set, and the optimized detection model is validated using the validation set to obtain the initial sprout detection model.

[0030] Optionally, importing the target feature information into a preset detection model to obtain detection data includes:

[0031] The target feature information is imported into the anchorless detection head of the preset detection model to obtain the predicted bounding box of the bud.

[0032] Loss assessment is performed on the predicted bounding box of the bud, and category prediction is performed using a preset category prediction rule to obtain detection data.

[0033] Optionally, the step of pruning and compressing the initial bud detection model to obtain the target bud detection model includes:

[0034] The sprout detection model was trained to be sparse by regularization and then the channels were pruned to obtain a pruned model.

[0035] The pruning weights of the pruning model are adjusted to achieve model compression, resulting in a target bud detection model.

[0036] Furthermore, to achieve the above objectives, the present invention also proposes a tea bud detection device, which includes:

[0037] A dataset construction module is used to acquire sample tea leaf images and construct a dataset based on the sample tea leaf images;

[0038] The data annotation module is used to annotate the dataset to obtain the training set;

[0039] The model building module is used to build an initial sprout detection model based on the training set;

[0040] The pruning and compression module is used to prune and compress the initial bud detection model to obtain the target bud detection model.

[0041] The bud detection module is used to detect buds in the tea garden under test using the target bud detection model.

[0042] In addition, to achieve the above objectives, the present invention also proposes a tea bud detection device, which includes: a memory, a processor, and a tea bud detection program stored in the memory and executable on the processor. The tea bud detection program is configured to implement the steps of the tea bud detection method described above.

[0043] In addition, to achieve the above objectives, the present invention also proposes a storage medium storing a tea bud detection program, wherein when the tea bud detection program is executed by a processor, it implements the steps of the tea bud detection method described above.

[0044] This invention acquires sample tea leaf images and constructs a dataset based on these images; it then labels the dataset to obtain a training set; an initial bud detection model is constructed using the training set; the initial bud detection model is pruned and compressed to obtain a target bud detection model; and the target bud detection model is used to detect buds in the tea garden under test. In this way, by acquiring sample tea leaf images, constructing a dataset, training and labeling it, and then pruning and compressing it, a bud detection model can be obtained, ultimately achieving automatic tea bud detection. The pruning and compression of the model reduces the number of parameters, shortens the model's runtime, and facilitates deployment and application. The use of an anchor-free detection method eliminates the need for predefined anchor boxes, reducing computational load and hyperparameters, and better adapting to the diverse variations in tea buds in natural scenes. By directly treating valid regions within the mapped area as positive samples and others as negative samples, training speed is accelerated and memory usage is reduced. Attached Figure Description

[0045] Figure 1 This is a schematic diagram of the structure of the tea bud detection device in the hardware operating environment involved in the embodiments of the present invention;

[0046] Figure 2 This is a flowchart illustrating the first embodiment of the tea bud detection method of the present invention;

[0047] Figure 3 This is a structural diagram of the initial bud detection model in one embodiment of the tea bud detection method of the present invention;

[0048] Figure 4 This is a flowchart illustrating the second embodiment of the tea bud detection method of the present invention;

[0049] Figure 5 This is a structural diagram of the convolutional attention mechanism in one embodiment of the tea bud detection method of the present invention;

[0050] Figure 6 This is a scale sequence feature pyramid structure diagram in one embodiment of the tea bud detection method of the present invention;

[0051] Figure 7 This is a schematic diagram illustrating an example of the regression target for detecting tea buds using an anchorless frame algorithm in one embodiment of the tea bud detection method of the present invention.

[0052] Figure 8 This is a complete implementation diagram of one embodiment of the tea bud detection method of the present invention;

[0053] Figure 9 This is a structural block diagram of the first embodiment of the tea bud detection device of the present invention.

[0054] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0055] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0056] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a tea bud detection device in the hardware operating environment of an embodiment of the present invention.

[0057] like Figure 1 As shown, the tea bud detection device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0058] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the tea bud detection device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0059] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a tea bud detection program.

[0060] exist Figure 1In the tea bud detection device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the tea bud detection device of the present invention can be set in the tea bud detection device, and the tea bud detection device calls the tea bud detection program stored in the memory 1005 through the processor 1001 and executes the tea bud detection method provided in the embodiment of the present invention.

[0061] This invention provides a method for detecting tea buds, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of a method for detecting tender tea buds according to the present invention.

[0062] In this embodiment, the method for detecting tea buds includes the following steps:

[0063] Step S10: Obtain sample tea leaf images and construct a dataset based on the sample tea leaf images.

[0064] It should be noted that the execution subject of this embodiment is a smart terminal, which can be a personal computer, tablet computer, server or other device with information processing function. This embodiment does not limit this.

[0065] It should be understood that tea picking is the primary task in the tea processing flow. Tea picking is seasonal, and while hand-picked tea is of high quality, it is time-consuming, labor-intensive, and inefficient, as only one bud can be picked at a time, failing to meet large-scale demand. With technological advancements and increasingly stringent quality requirements, mechanized picking is gradually becoming a trend in the field. While mechanized picking can improve efficiency to some extent, the natural color change of tea buds from yellowish-green to dark green as they grow makes it difficult to distinguish between new and old leaves. The inconsistent postures and high density of buds, along with mutual shading, and weather conditions, all contribute to the difficulty in achieving comprehensive and effective tea bud detection, thus affecting the picking results. Therefore, automated tea picking requires improved accuracy and speed in identification. The solution in this embodiment acquires sample tea images to construct a dataset, trains and labels it, and then performs pruning and compression to obtain a bud detection model, ultimately achieving automatic tea bud detection. Pruning and compression of the model reduces the number of parameters, shortens the model's runtime, and facilitates deployment and application. The detection method employs an anchor-free approach, eliminating the need for predefined anchor boxes, thus reducing computational load and hyperparameter requirements. It is also better suited to the diverse variations in tea buds in natural scenes. Effective regions within the mapped area are directly treated as positive samples, while others are considered negative samples, accelerating training and reducing memory usage.

[0066] In practice, sample tea leaf images refer to sample images used as training data, which can be tea leaf image data of any form. Constructing a dataset based on sample tea leaf images means outputting and organizing the sample tea leaf images to use as the data set as input to the initial bud detection model.

[0067] Step S20: Label the dataset to obtain the training set.

[0068] It should be noted that labeling refers to labeling according to tea bud type, which allows the data in the dataset to be classified, and then data augmentation and expansion can be performed to obtain the training set.

[0069] Furthermore, in order to obtain a training set for model training, step S20 includes: labeling the dataset according to tea bud type using a preset labeling tool to obtain categorical data; performing data augmentation operations on the categorical data to expand the data and obtain a training set.

[0070] It should be understood that, firstly, the color images of the sample tea leaves are labeled according to the tea bud type using the pre-defined labeling tool labelImg. The tea bud types are mainly divided into three types: tea bud, one bud and one leaf, and one bud and two leaves. Then, data augmentation operations such as mirroring, rotation, scaling, random cropping, and brightness adjustment are used to expand the dataset. Finally, the expanded dataset is divided into training set, validation set, and test set.

[0071] In this way, by processing and expanding the dataset, a training set can be obtained, which can make the initial bud detection model more accurate.

[0072] Step S30: Construct an initial bud detection model based on the training set.

[0073] In practice, constructing an initial sprout detection model based on the training set refers to first aggregating shallow feature information of the training set through a target extraction network, then suppressing redundant background noise through a convolutional attention mechanism module, and finally performing feature fusion through a pre-set feature pyramid network. Thus, the initial sprout detection model can be constructed using the target feature map information obtained at the end.

[0074] It should be understood that the initial sprout detection model is an anchorless detection model, and the schematic diagram of the initial sprout detection model is shown below. Figure 3 As shown.

[0075] Step S40: Prune and compress the initial bud detection model to obtain the target bud detection model.

[0076] It should be noted that the pruning compression operation refers to first performing regularization, then performing sparsification training, then performing channel pruning, and finally adjusting the pruning weights around the mouth to obtain the final target bud detection model.

[0077] Furthermore, in order to improve the deployment and application capabilities of the model through pruning and compression, step S40 includes: performing sparse training on the bud detection model through regularization and performing channel pruning to obtain a pruned model; adjusting the pruning weights of the pruned model to achieve model compression and obtain the target bud detection model.

[0078] It should be understood that, firstly, sparsity training is performed using the L1 regularization method. An L1 regularization term is added to the γ coefficients of the BN layer in the loss function. When the gradient is backpropagated to update the γ coefficients during sparsification, a large number of γ coefficient values ​​approach 0, thereby achieving the purpose of structural sparsity.

[0079] In practice, channel pruning is then performed on the model. The contribution of each channel is evaluated based on the γ coefficient value of the BN layer. Channels with higher contributions to the network are retained, while those with lower contributions are deleted, based on the pruning ratio and γ coefficient. The loss function of the pruning algorithm is:

[0080]

[0081] Where x and y are the input and output of the training, respectively; W is the training parameter in the network; the second term is the L1 regularization constraint term of the γ coefficient of the BN layer; and λ is the penalty factor.

[0082] It should be noted that the model is fine-tuned at the end. The pruned network is used to adjust the pruned weights, and the compressed model is set as a pre-trained model for a new round of training, thereby solving the problem of excessive loss after model pruning.

[0083] This method enables model pruning and compression, reducing the number of parameters, shortening model runtime, and facilitating deployment and application.

[0084] Step S50: Detect the tender buds of the tea garden to be tested using the target tender bud detection model.

[0085] It should be understood that after the target bud detection model is trained, the image of the tea garden to be tested is then input into the target bud detection model, so that the model can automatically detect buds and label all tea buds in the tea garden to be tested.

[0086] This embodiment acquires sample tea leaf images and constructs a dataset based on these images. The dataset is then labeled to obtain a training set. An initial bud detection model is built using the training set. This initial bud detection model is pruned and compressed to obtain a target bud detection model. The target bud detection model is then used to detect buds in the tea garden under test. This approach achieves automatic tea bud detection by acquiring sample tea leaf images, constructing a dataset, training and labeling it, and then pruning and compressing the model. The pruning and compression of the model reduces the number of parameters, shortens the model's runtime, and facilitates deployment and application. The use of an anchor-free detection method eliminates the need for predefined anchor boxes, reducing computation and hyperparameters, and better adapting to the diverse variations in tea buds in natural scenes. Valid regions within the mapped area are directly treated as positive samples, while others are treated as negative samples, accelerating training and reducing memory usage.

[0087] refer to Figure 4 , Figure 4 This is a flowchart illustrating the second embodiment of a method for detecting tender tea buds according to the present invention.

[0088] Based on the first embodiment described above, the tea bud detection method of this embodiment includes the following in step S30:

[0089] Step S301: Perform shallow feature information aggregation on the training set through a preset target extraction network to obtain feature map information.

[0090] It should be noted that the shallow feature information aggregation of the training set by the preset target extraction network to obtain feature map information refers to BackBone's aggregation of shallow feature information using CSPDarknet53. Using CSPDarknet53 can reduce the computational load of the model and improve the computational speed. The training set is input into this module to extract features, and the three feature maps with different scales obtained according to the last three stages are the feature map information input into the Neck module.

[0091] Step S302: The feature map information is subjected to redundant background noise suppression through the convolutional attention mechanism module to obtain denoised feature map information.

[0092] It should be understood that suppressing redundant background noise through the convolutional attention mechanism module to obtain denoised feature map information means passing the three feature maps in the feature map information through three convolutional attention mechanism modules respectively. This enhances the feature expression ability of tea buds and suppresses redundant background noise without increasing computational cost, ultimately obtaining denoised feature map information. The structure of the convolutional attention mechanism module is as follows: Figure 5 As shown.

[0093] Step S303: Perform feature fusion on the denoised feature map information through a preset feature pyramid network to obtain target feature map information.

[0094] In specific implementation, the denoised feature map information is fused using a preset feature pyramid network to obtain the target feature map information. This means that the three obtained feature maps (denoised feature map information) are then used to replace the original feature pyramid through a scale sequence feature pyramid network for multi-feature fusion, thereby enhancing the semantic information of small target samples. The resulting three-layer feature map is input into the Head module to obtain the target feature map information. The schematic diagram of the preset feature pyramid network (scale sequence feature pyramid network) is shown below. Figure 6 As shown.

[0095] Furthermore, to accurately and quickly obtain the target feature map information, step S303 includes: adjusting the resolution of the denoised feature map information through path aggregation blocks to obtain a first feature map, a second feature map, and a third feature map, wherein the first feature map has the lowest resolution and the third feature map has the highest resolution, and the third feature map is used as the reference feature map; concatenating the first feature map, the second feature map, and the third feature map to obtain an overall view; performing a 3D convolution operation on the overall view to extract scale sequence features; and inputting the scale sequence features, the first feature map, the second feature map, and the third feature map in concatenation into the detection head of a preset detection model to obtain the target feature map information.

[0096] It should be noted that, firstly, the three input feature maps are aggregated through a path block to obtain feature maps of three scales, P3, P4, and P5, corresponding to the first, second, and third feature maps respectively, with P5 having the lowest resolution and P3 the highest. Then, using P3 as a baseline, P4 and P5 are resized and downsampled to the same resolution as P3. Finally, these three feature maps are concatenated to generate an overall view, as shown below:

[0097]

[0098] Where P i The path aggregation block is the first i A pyramid feature map at different levels.

[0099] The overall view is a 4D tensor (level, width, height, channel). The level of the overall view represents the numbering of different levels in the feature pyramid, which can be viewed as the time axis in a 3D convolution. Therefore, this overall view is used to extract scale sequence features S through a 3D convolution operation. 2 :

[0100]

[0101] in It is a 3D convolution-based scale sequence module, consisting of 3D convolutional layers, 3D batch normalization layers, and the LeakyReLU activation function. The scale sequence features extracted from the overall view have the same width, height, and number of channels as the P3 feature map.

[0102] Finally, feature maps P5 and P4 are directly input into the detection head for detection; P3 is concatenated with the scale sequence features and input into the detection head to obtain the target feature map information. The concatenation formula is:

[0103]

[0104] In this way, a convolutional attention mechanism is employed to enhance the network's feature representation capabilities by sequentially generating attention feature maps in both channel and spatial dimensions, without incurring additional costs. A scale-sequence feature pyramid is used to fuse language-rich feature maps, enhancing the semantic information of few-sample features and improving the network's detection accuracy.

[0105] Step S304: Construct an initial bud detection model based on the target feature map information.

[0106] It should be noted that after obtaining the target feature map information, the initial sprout detection model can be trained and adjusted using the target feature map information to obtain the initial sprout detection model.

[0107] Furthermore, in order to accurately construct the initial sprout detection model, step S304 includes: importing the target feature information into a preset detection model to obtain detection data; determining the optimization weight parameters of the preset detection model based on the detection data and a preset loss function; modifying the preset detection model according to the optimization weight parameters to obtain an optimized detection model; determining a validation set based on the training set, and validating the optimized detection model through the validation set to obtain the initial sprout detection model.

[0108] It should be understood that the initial detection model is also an anchorless model, and the detection data refers to the predicted bounding box of the sprout obtained by importing the target feature information, and then performing category prediction.

[0109] In practical implementation, the preset loss function refers to evaluating the loss of bounding box prediction. The bounding box loss is defined as SDIoU, and the calculation formula is as follows:

[0110]

[0111] Where C represents the sum of the squares of the lengths of the smallest region that can cover the predicted box and the ground truth box, I represents the square of the diagonal length of the overlapping region of the predicted box and the ground truth box, S represents the sum of the squares of the Euclidean distances of the non-overlapping regions, and ρ represents the positive trade-off value that favors the overlapping region.

[0112] It should be noted that after obtaining the optimized weight parameters, the preset detection model can be optimized and modified by optimizing the weight parameters to obtain the optimized detection model. Then, it can be validated by combining the validation set determined by the training set, and the validated model can be used as the initial sprout detection model.

[0113] In this way, the initial prediction model can be optimized based on the validation set and the loss function.

[0114] Furthermore, in order to obtain detection data, the step of importing the target feature information into a preset detection model to obtain detection data includes: importing the target feature information into the anchorless detection head of the preset detection model to obtain the sprout prediction bounding box; performing loss evaluation on the sprout prediction bounding box and using a preset category prediction rule to perform category prediction to obtain detection data.

[0115] It should be understood that the anchorless bounding box detection head contains two parallel branches: a regression branch and a classification branch. The regression branch predicts the bounding box of the tea buds, dividing the three feature maps into S×S grids of different densities. The relationship between pixels, corner points, and bounding boxes is as follows:

[0116]

[0117] Where i is the scale, x and y are pixels; (x1, y1) and (x2, y2) are the coordinates of the top-left and bottom-right corners of the small square containing the pixel. L (i)* T (i)* R represents the distance from (x2, y2) to the left and top edges of the bounding box. (i)* B (i)* This represents the distance from (x1, y1) to the right and bottom of the bounding box.

[0118] On each feature map, the network directly generates predicted bounding boxes based on the pixels and the corner points of the small squares. The prediction formula is:

[0119]

[0120] Where i is the scale; σ represents the logistic regression function; p0 and p1 represent the distances from the bottom right corner of the small square predicted by the network to the left and top boundaries, respectively; and p2 and p3 represent the distances from the top left corner of the small square of the network fishbone to the right and bottom boundaries, respectively.

[0121] Finally, multi-class logistic regression is used to predict the categories, yielding the detection data, such as... Figure 7 This is a schematic diagram illustrating an example of the anchorless bounding box algorithm for detecting the regression target of tea buds. The complete implementation flow of this embodiment is now shown below. Figure 8 As shown.

[0122] This approach enables bounding box prediction and regression prediction using an anchorless detection head. The anchorless detection method eliminates the need for predefined anchor boxes, reducing computational load and hyperparameter requirements, and is better suited to the varied conditions of tea buds in natural scenes. Valid regions within the mapped area are directly treated as positive samples, while others are considered negative samples, accelerating training and reducing memory usage.

[0123] This embodiment uses a pre-defined target extraction network to aggregate shallow feature information from the training set, obtaining feature map information. A convolutional attention mechanism module is then used to suppress redundant background noise in the feature map information, resulting in denoised feature map information. A pre-defined feature pyramid network is then used to fuse the denoised feature map information, yielding target feature map information. An initial sprout detection model is then constructed based on the target feature map information. In this way, the convolutional attention mechanism enhances the network's feature representation ability by sequentially generating attention feature map information in both channel and spatial dimensions without incurring additional costs. The use of a scale-sequence feature pyramid, fusing linguistically rich feature maps, enhances the semantic information of small sample features, improving the network's detection accuracy.

[0124] Furthermore, this embodiment of the invention also proposes a storage medium storing a tea bud detection program, which, when executed by a processor, implements the steps of the tea bud detection method described above.

[0125] Since this storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be elaborated here.

[0126] Reference Figure 9 , Figure 9 This is a structural block diagram of the first embodiment of the tea bud detection device of the present invention.

[0127] like Figure 9 As shown, the tea bud detection device proposed in this embodiment of the invention includes:

[0128] The dataset construction module 10 is used to acquire sample tea leaf images and construct a dataset based on the sample tea leaf images.

[0129] The data annotation module 20 is used to annotate the dataset to obtain a training set.

[0130] The model building module 30 is used to build an initial bud detection model based on the training set.

[0131] The pruning and compression module 40 is used to prune and compress the initial bud detection model to obtain the target bud detection model.

[0132] The bud detection module 50 is used to detect buds in the tea garden to be tested using the target bud detection model.

[0133] This embodiment acquires sample tea leaf images and constructs a dataset based on these images. The dataset is then labeled to obtain a training set. An initial bud detection model is built using the training set. This initial bud detection model is pruned and compressed to obtain a target bud detection model. The target bud detection model is then used to detect buds in the tea garden under test. This approach achieves automatic tea bud detection by acquiring sample tea leaf images, constructing a dataset, training and labeling it, and then pruning and compressing the model. The pruning and compression of the model reduces the number of parameters, shortens the model's runtime, and facilitates deployment and application. The use of an anchor-free detection method eliminates the need for predefined anchor boxes, reducing computation and hyperparameters, and better adapting to the diverse variations in tea buds in natural scenes. Valid regions within the mapped area are directly treated as positive samples, while others are treated as negative samples, accelerating training and reducing memory usage.

[0134] In one embodiment, the data annotation module 20 is further configured to annotate the dataset according to tea bud type using a preset annotation tool to obtain categorized data; and to perform data augmentation operations on the categorized data to expand the data and obtain a training set.

[0135] In one embodiment, the model building module 30 is further configured to aggregate shallow feature information of the training set through a preset target extraction network to obtain feature map information; suppress redundant background noise of the feature map information through a convolutional attention mechanism module to obtain denoised feature map information; perform feature fusion on the denoised feature map information through a preset feature pyramid network to obtain target feature map information; and construct an initial bud detection model based on the target feature map information.

[0136] In one embodiment, the model building module 30 is further configured to adjust the resolution of the denoised feature map information through path aggregation blocks to obtain a first feature map, a second feature map, and a third feature map, wherein the first feature map has the lowest resolution and the third feature map has the highest resolution, and the third feature map is used as a reference feature map; the first feature map, the second feature map, and the third feature map are connected to obtain an overall view; a 3D convolution operation is performed on the overall view to extract scale sequence features; the scale sequence features, the first feature map, the second feature map, and the third feature map are concatenated and input into the detection head of a preset detection model to obtain target feature map information.

[0137] In one embodiment, the model building module 30 is further configured to import the target feature information into a preset detection model to obtain detection data; determine the optimization weight parameters of the preset detection model based on the detection data and a preset loss function; modify the preset detection model based on the optimization weight parameters to obtain an optimized detection model; determine a validation set based on the training set, and validate the optimized detection model using the validation set to obtain an initial sprout detection model.

[0138] In one embodiment, the model building module 30 is further configured to import target feature information into the anchorless detection head of the preset detection model to obtain the sprout prediction bounding box; perform loss evaluation on the sprout prediction bounding box and perform category prediction using a preset category prediction rule to obtain detection data.

[0139] In one embodiment, the pruning compression module 40 is further configured to perform sparsity training on the bud detection model through regularization and perform channel pruning to obtain a pruned model; and to adjust the pruning weights of the pruned model to achieve model compression and obtain the target bud detection model.

[0140] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.

[0141] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0142] In addition, for technical details not described in detail in this embodiment, please refer to the tea bud detection method provided in any embodiment of the present invention, which will not be repeated here.

[0143] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0144] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0145] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0146] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A method of detecting tea leaf buds, characterized by, The method for detecting tea buds includes: Obtain sample tea leaf images and construct a dataset based on the sample tea leaf images; The training set is obtained by labeling the dataset. An initial bud detection model is constructed based on the training set; The initial bud detection model is pruned and compressed to obtain the target bud detection model; The target bud detection model is used to detect buds in the tea garden under test. The step of constructing an initial sprout detection model based on the training set includes: The training set is shallowly aggregated using a preset target extraction network to obtain feature map information; The convolutional attention mechanism module is used to suppress redundant background noise in the feature map information to obtain denoised feature map information. The denoised feature map information is fused using a preset feature pyramid network to obtain the target feature map information; An initial bud detection model is constructed based on the target feature map information; The step of fusing the denoised feature map information through a preset feature pyramid network to obtain the target feature map information includes: The resolution of the denoised feature map information is adjusted by path aggregation blocks to obtain a first feature map, a second feature map, and a third feature map. The first feature map has the lowest resolution, and the third feature map has the highest resolution. The third feature map is used as the reference feature map. The first feature map, the second feature map, and the third feature map are connected to obtain the overall view; Perform a 3D convolution operation on the overall view to extract scale sequence features; The scale sequence features, the first feature map, the second feature map, and the third feature map are input into the detection head of the preset detection model to obtain target feature map information; The step of inputting the scale sequence features, the first feature map, the second feature map, and the third feature map into the detection head of a preset detection model to obtain target feature map information includes: The second feature map and the third feature map are directly input into the detection head for detection. The first feature map is concatenated with the scale sequence features extracted from the overall view and input into the detection head to obtain the target feature map information.

2. The method of claim 1, wherein, The step of labeling the dataset to obtain the training set includes: The dataset is labeled according to tea bud type using a preset labeling tool to obtain categorized data; Data augmentation operations are performed on the classified data to expand the data and obtain a training set.

3. The method of claim 1, wherein, The step of constructing an initial sprout detection model based on the target feature map information includes: The target feature information is imported into a preset detection model to obtain detection data; The optimization weight parameters of the preset detection model are determined based on the detection data and the preset loss function. The preset detection model is modified according to the optimized weight parameters to obtain the optimized detection model; A validation set is determined based on the training set, and the optimized detection model is validated using the validation set to obtain the initial sprout detection model.

4. The method of claim 3, wherein, The step of importing the target feature information into a preset detection model to obtain detection data includes: The target feature information is imported into the anchorless detection head of the preset detection model to obtain the predicted bounding box of the bud. Loss assessment is performed on the predicted bounding box of the bud, and category prediction is performed using a preset category prediction rule to obtain detection data.

5. The method of claim 1, wherein, The step of pruning and compressing the initial bud detection model to obtain the target bud detection model includes: The sprout detection model was trained to be sparse by regularization and then the channels were pruned to obtain a pruned model. The pruning weights of the pruning model are adjusted to compress the model and obtain the target bud detection model.

6. A tea shoot detection apparatus characterized by comprising: The tea bud detection device includes: A dataset construction module is used to acquire sample tea leaf images and construct a dataset based on the sample tea leaf images; The data annotation module is used to annotate the dataset to obtain the training set; The model building module is used to build an initial sprout detection model based on the training set; The pruning and compression module is used to prune and compress the initial bud detection model to obtain the target bud detection model. The bud detection module is used to detect buds in the tea garden under test using the target bud detection model. The model building module is further configured to aggregate shallow feature information of the training set through a preset target extraction network to obtain feature map information; suppress redundant background noise of the feature map information through a convolutional attention mechanism module to obtain denoised feature map information; perform feature fusion on the denoised feature map information through a preset feature pyramid network to obtain target feature map information; and construct an initial sprout detection model based on the target feature map information. The model construction module is further configured to adjust the resolution of the denoised feature map information through path aggregation blocks to obtain a first feature map, a second feature map, and a third feature map, wherein the first feature map has the lowest resolution and the third feature map has the highest resolution, and the third feature map is used as the reference feature map; the first feature map, the second feature map, and the third feature map are concatenated to obtain an overall view; a 3D convolution operation is performed on the overall view to extract scale sequence features; the scale sequence features, the first feature map, the second feature map, and the third feature map are input into the detection head of a preset detection model to obtain target feature map information; the step of inputting the scale sequence features, the first feature map, the second feature map, and the third feature map into the detection head of the preset detection model to obtain target feature map information includes: directly inputting the second feature map and the third feature map into the detection head for detection, and concatenating the first feature map with the scale sequence features extracted from the overall view and inputting them into the detection head to obtain target feature map information.

7. A tea shoot detection apparatus characterized by comprising: The device includes: a memory, a processor, and a tea bud detection program stored in the memory and executable on the processor, the tea bud detection program being configured to implement the tea bud detection method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium stores a tea bud detection program, which, when executed by a processor, implements the tea bud detection method as described in any one of claims 1 to 5.