Flue-cured tobacco grading method based on YOLOv5 algorithm

By automatically identifying and grading the color, chroma, and maturity of tobacco leaves using the YOLOv5 algorithm, the problem of relying on manual experience in traditional flue-cured tobacco grading has been solved, achieving efficient and accurate automated tobacco leaf grading.

CN120411537APending Publication Date: 2025-08-01YUNNAN TOBACCO CORP QUJING BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510442485.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

Traditional flue-cured tobacco grading methods rely on manual experience, resulting in inconsistent grading results, low efficiency, difficulty in meeting the needs of large-scale production, and inability to achieve real-time grading and automation.

Method used

A grading method based on the YOLOv5 algorithm is adopted. Through image acquisition and processing, the color, chroma and maturity features of tobacco leaves are automatically extracted. Combined with data augmentation, multi-scale feature fusion, transfer learning and adaptive learning rate adjustment, the automatic identification and grading of tobacco leaf appearance features are realized.

Benefits of technology

It improves grading efficiency and accuracy, realizes automation and intelligence in tobacco leaf grading, reduces computing resource requirements, and improves grading purity and grade qualification rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120411537A_ABST
    Figure CN120411537A_ABST
Patent Text Reader

Abstract

The invention discloses a flue-cured tobacco grading method based on a YOLOv5 algorithm, and the method comprises the steps: S1, collecting the characteristics of five parts of the appearance of tobacco leaves, including the color, chromaticity, tobacco leaf maturity and tobacco leaf identity; s2, establishing a model by using a YOLOv5 algorithm; s3, carrying out weight initialization on the model; s4, training the network; s6, controlling parameters of the model; s7, iteratively training the model; s8, evaluating the performance of the model by using the verification set or the test set; according to the method, the generalization ability and the detail recognition ability of the model are improved through the data enhancement and multi-scale feature fusion technology, the migration learning and adaptive learning rate adjustment strategy is adopted, model training can be accelerated, the classification precision can be improved, and the classification efficiency can be improved. The grading purity and the grade qualification rate of the flue-cured tobacco leaves are greatly improved, through model pruning, quantification and a real-time grading system, the requirement for computing resources is reduced, and automation and intellectualization of the grading task are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of flue-cured tobacco grading, and specifically provides a flue-cured tobacco grading method based on the YOLOv5 algorithm. Background Technique

[0002] The purchase of flue-cured tobacco is an important task in the tobacco leaf production work of the tobacco industry. The purchase work of flue-cured tobacco consists of many links, including grading, classifying, weighing, warehousing, baling, etc. This invention mainly solves the problems existing in the grading process. Flue-cured tobacco grading refers to a process of roughly classifying flue-cured tobacco by comparing it with the standards of flue-cured tobacco purchase samples. Flue-cured tobacco grading is the basis of tobacco leaf purchase. At present, in most tobacco-growing areas, loose tobacco leaves are graded. Usually, the tobacco leaves to be graded are placed on a table and graded by comparing them with flue-cured tobacco samples. The conventional grades are X1F, X2F, X3F, X4F, X1L, X2L, X3L, X4L, CIFC2F, C3F, C4F, C1L, C2L, C3L, C4L, BIF, B2F, B3F, B4F, B1L, B2L, B3L, B4L. The letters B, C, and X represent the upper, middle, and lower parts respectively, and the numbers 1, 2, 3, and 4 in the middle represent the grades. The letter F represents orange-yellow, and the letter L represents lemon-yellow. These three elements of part, grade, and color constitute a grade, and each grade corresponds to a flue-cured tobacco sample. Flue-cured tobacco samples usually consist of 8 to 10 tobacco leaves of the same grade.

[0003] As an important cash crop, the quality grading of flue-cured tobacco directly affects the quality and market value of tobacco products. Traditional flue-cured tobacco grading methods mainly rely on manual experience, and grade by visually observing and manually measuring the appearance indexes of tobacco leaves such as color, chroma, maturity, and identity. However, manual grading of tobacco leaves depends on the experience and subjective judgment of graders, and is easily affected by factors such as fatigue and emotions, resulting in inconsistent grading results; traditional tobacco leaf grading uses manual grading, which requires a large amount of human resources, high training costs, and slow manual grading speed, making it difficult to meet the needs of large-scale production. The appearance indexes of tobacco leaves (such as color, chroma, maturity, etc.) are difficult to be accurately quantified manually, resulting in unclear grading standards and affecting the scientificity and fairness of grading; moreover, traditional grading methods cannot achieve real-time grading and automated processing, and it is difficult to seamlessly connect with the automated equipment of modern tobacco production lines, restricting the improvement of production efficiency. Summary of the Invention

[0004] The purpose of the present invention is to provide a flue-cured tobacco grading method based on the YOLOv5 algorithm to solve the problems raised in the above background technique.

[0005] To achieve the above purpose, a flue-cured tobacco grading method based on the YOLOv5 algorithm includes the following steps:

[0006] S1. Collect the appearance characteristics of five parts of tobacco leaves, including color, chroma, maturity of tobacco leaves, and identity of tobacco leaves;

[0007] S2. Use the YOLOv5 algorithm to build a model;

[0008] S3. Initialize the weights of the model;

[0009] S4. Train the network;

[0010] S5. Evaluate the performance of the YOLOv5 flue-cured tobacco grading model;

[0011] S6. Control the parameters of the model;

[0012] S7. Iteratively train the model;

[0013] S8. Use the validation set or test set to evaluate the performance of the model;

[0014] S9. Use the trained YOLOV5 model to perform object detection tasks. By inputting an image, output the location and category of the object.

[0015] Preferably, in step S1, when collecting the appearance indexes of tobacco leaves, a data augmentation technique is used to preprocess the image, including image rotation, image scaling, image flipping, image scaling, image translation, image cropping, color adjustment, and noise addition.

[0016] Preferably, in step S2, when using the YOLOv5 algorithm to build a model, a multi-scale feature fusion mechanism is introduced.

[0017] Preferably, in step S3, when initializing the weights of the model, a transfer learning technique is adopted. The weights of the pre-trained YOLOv5 model are used as the initial values and fine-tuned in combination with the characteristics of the flue-cured tobacco grading task.

[0018] Preferably, in step S4, when training the network, an adaptive learning rate adjustment strategy is adopted. The learning rate is dynamically adjusted according to the loss change during the training process, including adjusting the learning rate based on the cosine function. Adjusting the learning rate based on the cosine function makes the network converge more stably by gradually decreasing the learning rate during the training process.

[0019] Preferably, in step S6, when controlling the parameters of the model, model pruning and quantization techniques are adopted to remove redundant neurons and parameters, reducing the computational complexity and storage requirements of the model.

[0020] Preferably, in step S7, when iteratively training the model, a custom loss function is adopted. Combining the characteristics of the tobacco leaf grading task, different weights are assigned to the errors of color, chroma, and maturity indexes.

[0021] Preferably, in step S8, when evaluating the model performance using the validation set or the test set, the model integration technology is adopted to integrate multiple trained YOLOv5 models.

[0022] Preferably, in step S9, when using the trained YOLOv5 model to perform the target detection task, it is deployed to a real-time grading system, and tobacco leaf images are obtained in real time through a camera or an image acquisition device, and the grading results are output.

[0023] Preferably, the performance of the YOLOv5 flue-cured tobacco grading model is evaluated through general object detection metrics and grading task-specific metrics. The general object detection metrics include precision, recall, average precision (AP), and mean average precision (mAP); the grading task-specific metrics include grading accuracy and confusion matrix.

[0024] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0025] 1. The present invention applies computer vision technology. Through image acquisition and processing, features such as the color, chroma, maturity of tobacco leaves, and the identity of tobacco leaves are automatically extracted, providing an objective and quantitative basis for grading; through the deep learning algorithm (YOLO algorithm), the automatic recognition and grading of the appearance features of tobacco leaves can be realized, improving the grading efficiency and accuracy.

[0026] 2. The present invention improves the generalization ability and detail recognition ability of the model through data augmentation and multi-scale feature fusion technology, and adopts transfer learning and adaptive learning rate adjustment strategies, which can accelerate model training and improve grading accuracy, greatly improving the grading purity of flue-cured tobacco leaves and the qualification rate of tobacco leaf grades. Through model pruning, quantization, and real-time grading system, the computing resource requirements are reduced, and the automation and intelligence of the grading task are realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is the process flow chart of the steps of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0028] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0029] Please refer to Figure 1 , the present invention provides a technical solution: a flue-cured tobacco grading method based on the YOLOv5 algorithm, which is characterized by including the following steps:

[0030] S1. Collect the appearance characteristics of five parts of tobacco leaves, including color, chroma, maturity of tobacco leaves, and the identity of tobacco leaves. The grading is further subdivided within the already grouped categories according to quality factors such as the maturity of tobacco leaves, leaf structure, identity, oil content, chroma, length, and damage. Among them, maturity refers to the degree of growth and maturity of tobacco leaves, with different manifestations in different stages from under-ripe, moderately ripe, ripe to fully ripe. Tobacco leaves with appropriate maturity have better quality. Leaf structure is used to judge whether it is loose, moderately loose or slightly dense, etc., reflecting the tightness of the arrangement of leaf cells. The identity of tobacco leaves is the comprehensive state of the thickness and density of the leaves, etc., with different grades such as thin, slightly thin, medium, slightly thick, and thick. Oil content is to observe the amount of oily substances on the surface of tobacco leaves. For example, tobacco leaves with high oil content will show a certain sense of oiliness on the appearance, and can be divided into different levels such as much, having, slightly having, and little. Chroma reflects the intensity and vividness of the color of tobacco leaves, such as chroma levels of strong, medium, weak, and light. Length is to measure the actual length of the tobacco leaf from the leaf stalk to the leaf tip, and there are corresponding requirements for length in different grades. Damage is to check the damaged situation of tobacco leaves caused by pests, diseases, mechanical damage, etc., and is measured by the percentage of the leaf area. Comprehensive determination is to combine the results of grouping and grading, and determine the specific flue-cured tobacco grade by referring to the flue-cured tobacco grade standards formulated by the state or the industry, so as to complete the grading work. For example, after a certain flue-cured tobacco is judged to be in the middle leaf group, orange-yellow, with a maturity of ripe, and the leaf structure is loose, etc., and each quality factor meets the corresponding grade requirements, its specific grade is finally determined for subsequent transactions, processing, etc. When collecting the appearance indicators of tobacco leaves, data augmentation techniques are used to preprocess the images, including image rotation, image scaling, image flipping, image scaling, image translation, image cropping, color adjustment, and noise addition;

[0031] It should be noted that in image rotation, the image is rotated at a random angle, and the rotation angle range is set between ±30° and ±90°. The formula: For a two-dimensional image point (x, y), the rotation transformation formula is:

[0032]

[0033] where θ is the rotation angle, and x' and y' are the coordinates of the rotated image;

[0034] In image flipping, the image is flipped horizontally or vertically. The formula is:

[0035] Horizontal flipping: x' = W - x, where W is the width of the image and x is the abscissa of the original image;

[0036] Vertical flipping: y' = H - y, where H is the height of the image and y is the ordinate of the image;

[0037] In image scaling, an image is enlarged or reduced, maintaining the aspect ratio of the original image;

[0038] Formula: The scaling operation is achieved by multiplying the image coordinates by the scaling factor s:

[0039] x'=s×x,y'=s×y,

[0040] Where s is the scaling factor, x, y are the original image coordinates, and x', y' are the scaled image coordinates;

[0041] In image translation, the image is translated horizontally or vertically. The translation transformation formula is:

[0042] x'=x+t x , y'=y+t y ,

[0043] Among them, t x and t y are the translation amounts in the horizontal and vertical directions respectively;

[0044] In image cropping, a sub-region is cropped from any position of the image. The formula is: Cropping is usually defined by setting a cropping box: [x1, y1; x2, y2] represents the coordinates of the upper left corner and lower right corner of the cropped area. The cropped image contains the pixels between the area [x1, y1] and [x2, y2].

[0045] In color adjustment, the brightness, contrast, saturation, and hue of an image are randomly adjusted. Formula: Assuming that the color values of the image are in RGB space, color adjustment can be achieved in the following ways:

[0046] Brightness adjustment: I , =I+ΔI brightness ;

[0047] Contrast adjustment: I , =αI+β; where α is the contrast factor and β is the offset;

[0048] Saturation adjustment: I , =I×ΔI saturation ;

[0049] Tone Adjustment: I , =I+ΔI hue These adjustments are random and will occur within a certain range;

[0050] In noise addition, random noise is added to the image, such as Gaussian noise. The formula is: Gaussian noise is expressed as:

[0051]

[0052] Among them, is Gaussian noise with a mean of 0 and a variance of σ 2 , and I' is the image with added noise.

[0053] S2. Establish a model using the YOLOv5 algorithm. When establishing the model using the YOLOv5 algorithm, introduce a multi-scale feature fusion mechanism.

[0054] It should be noted that YOLOv5 is a model based on a deep convolutional neural network (CNN). The multi-scale feature fusion process includes the following steps:

[0055] Step 1: Extract multi-layer features, including shallow feature maps and deep feature maps;

[0056] Step 2: Fuse features of different scales. The fusion methods include feature concatenation, weighted fusion, and feature pyramid network. In feature concatenation, feature maps of different scales are concatenated in the channel dimension to obtain a feature map with more information. Assuming feature map A comes from the shallow layer and feature map B comes from the deep layer, a new feature map F can be obtained after concatenation concat = [F A , F B ; In weighted fusion, assuming F A and F B are feature maps from two different scales, the feature map after weighted fusion can be expressed as:

[0057] F fusion = αF A + (1 - α)F B ,

[0058] where α is a hyperparameter that controls the fusion ratio;

[0059] In the feature pyramid network (FPN), the fusion of feature maps is carried out through a top-down path. Assuming F t represents the feature map of layer l, the process of FPN includes:

[0060] Top-down: Upsample the high-level feature map:

[0061]

[0062] Fusion: Weightedly fuse the upsampled high-level feature map with the low-level feature map:

[0063]

[0064] Bottom-up: Downsample the low-level feature map and fuse it with the feature maps of other layers;

[0065] Step 3: In multi-scale feature fusion, use upsampling and downsampling operations to adjust the sizes of feature maps at different scales for alignment and fusion. Upsampling: Enlarge the low-level feature map through an interpolation method (such as bilinear interpolation) to match it with the high-level feature map. Downsampling: Shrink the high-level feature map through a pooling operation (such as max pooling or average pooling) to match it with the low-level feature map.

[0066] S3. Initialize the weights of the model. When initializing the weights of the model, adopt transfer learning technology, use the pre-trained YOLOv5 model weights as the initial values, and perform fine-tuning in combination with the characteristics of the flue-cured tobacco grading task.

[0067] It should be noted that specifically: Select a suitable pre-trained YOLOv5 model, load the pre-trained weights of the YOLOv5 model, use the weights pre-trained on a large dataset (such as COCO) to provide a good initialization for subsequent fine-tuning; Prepare the flue-cured tobacco grading dataset, and adjust the last few layers of the model according to the task characteristics of flue-cured tobacco grading to adapt to the output of the new task; Since YOLOv5 already has a good initial weight, when performing fine-tuning, it is not necessary to make excessive adjustments to all parameters. Usually, we will freeze some network layers (especially the lower layers), only train the last few layers, or choose to freeze the back feature extraction part and only fine-tune the detection head, and a relatively low learning rate can be set to ensure that the fine-tuning of the model does not damage the pre-trained weights; After completing the above settings, the model can be trained. During the training process, the flue-cured tobacco grading dataset needs to be used and it is ensured that the data is loaded correctly. Usually, a suitable loss function (for example, the built-in loss function of YOLOv5) is used and training is carried out according to the task; During the training process, monitor indicators such as the loss function, mAP (mean Average Precision), accuracy, and recall rate. By checking these indicators, the training effect of the model can be judged, and hyperparameters such as the learning rate and batch size can be adjusted if necessary.

[0068] S4. Train the network. When training the network, adopt an adaptive learning rate adjustment strategy, dynamically adjust the learning rate according to the loss change during the training process, including adjusting the learning rate based on the cosine function. Adjusting the learning rate based on the cosine function is to make the network converge more stably by gradually reducing the learning rate during the training process.

[0069] It should be noted that cosine annealing refers to controlling the decay curve of the learning rate through the cosine function. The learning rate gradually decreases from the initial value, and the formula is:

[0070]

[0071] where: η(t) represents the learning rate at the t-th time step during the training process; η maxis the initial learning rate; η min is the minimum learning rate at the end of training (usually set to a small value, such as 10 -6 ); T is the total number of training epochs or steps; t is the current training progress (usually a proportion of the number of training steps). At the beginning of training, the learning rate is large, and as training progresses, the learning rate gradually decreases according to a cosine curve. In this way, the network can quickly adjust parameters in the initial stage, while in the later stage, the network is allowed to perform more delicate optimization.

[0072] S5. Evaluate the performance of the YOLOv5 flue-cured tobacco grading model;

[0073] It should be noted that in this embodiment, the performance of the YOLOv5 flue-cured tobacco grading model is evaluated through general object detection metrics and grading task-specific metrics. The general object detection metrics include precision, recall, average precision (AP), and mean average precision (mAP); the grading task-specific metrics include grading accuracy and confusion matrix. The precision refers to the proportion of the number of samples correctly predicted by the model as a certain grade to the total number of samples predicted by the model as that grade; the calculation formula is: Precision = TP / (TP + FP), where TP (True Positives) is the number of true positives, that is, the number of samples correctly predicted by the model as a certain grade; FP (False Positives) is the number of false positives, that is, the number of samples wrongly predicted by the model as a certain grade. The recall refers to the proportion of the number of samples correctly predicted by the model as a certain grade to the total number of samples actually belonging to that grade; the calculation formula is: Recall = TP / (TP + FN), where FN (False Negatives) is the number of false negatives, that is, the number of samples of this grade wrongly predicted by the model as other grades; the average precision and mean average precision. The average precision is calculated by the area under the precision-recall curve for each grade; the mean average precision is the average of the APs of all grades;

[0074] S6. Control the parameters of the model. When controlling the parameters of the model, model pruning and quantization techniques are adopted to remove redundant neurons and parameters, reducing the computational complexity and storage requirements of the model.

[0075] It should be noted that the specific operation is as follows. First, train a complete model to evaluate the importance of each weight or neuron in the network. Smaller weights usually correspond to less important connections because they have less impact on the model output. By analyzing the absolute values of the weights, the parameters to be pruned can be determined. The gradient information of the parameters can also be used as a basis for importance evaluation. Parameters with smaller gradients indicate that they have less impact on the loss function. The activation values of neurons reflect the activity of neurons under specific inputs. Low activation values may mean that the neurons have less impact on the prediction. According to the evaluation results, redundant neurons or weights in the network are removed through unstructured pruning, and individual connections with small weight values are removed without affecting the overall structure of the network. After pruning, the model may lose some accuracy. Therefore, it is necessary to fine-tune the pruned model and retrain the model to restore the accuracy. Pruning is an iterative process and can be performed multiple times for pruning and fine-tuning to gradually remove more redundant parts while maintaining the performance of the model.

[0076] S7. Iteratively train the model. When iteratively training the model, a custom loss function is adopted, and different weights are assigned to the errors of color, chroma, and maturity indicators in combination with the characteristics of the tobacco leaf grading task.

[0077] It should be noted that tobacco leaf grading needs to comprehensively consider multi-dimensional features such as color, chroma, and maturity to accurately evaluate the quality grade of each tobacco leaf. Different indicators may have different importance. Assuming the goal is to predict multiple features (color, chroma, and maturity) of each tobacco leaf through the model and compare them with the true annotation values, the loss function can be written as:

[0078] L = ω1·L color + ω2·L chroma + ω3·L maturity ,

[0079] where L color is the loss of the color indicator, which may be the mean squared error (MSE) based on pixel values or the difference in color space (such as RGB, Lab); L chroma is the loss of the chroma indicator, which usually involves the brightness and saturation of colors; L maturity is the loss of the maturity indicator, which usually involves measuring the dryness and wetness of tobacco leaves and the grading of maturity (such as the regression loss of maturity grades); the weights ω1, ω2, ω3 are used to control the contributions of different indicators to the total loss. By adjusting the weights, the model can pay more attention to certain indicators during the training process, thereby achieving the optimization goal.

[0080] S8. Use the validation set or test set to evaluate the performance of the model. When using the validation set or test set to evaluate the model performance, the model integration technology is adopted to integrate multiple trained YOLOv5 models.

[0081] It should be noted that...

[0082] S9. Use the trained YOLOV5 model to perform object detection tasks. By inputting images, the positions and categories of the objects are output. When using the trained YOLOv5 model to perform object detection tasks, deploy it to a real-time grading system, and obtain tobacco leaf images in real time through a camera or an image acquisition device, and output the grading results.

[0083] It should be noted that multiple YOLOv5 models are trained and each model is evaluated. Each individual YOLOv5 model is evaluated on the validation set or the test set, and the output results of each model are weighted averaged by the weighted average method.

[0084] In summary, the data augmentation and multi-scale feature fusion technologies of the present invention improve the generalization ability and detail recognition ability of the model. By adopting transfer learning and an adaptive learning rate adjustment strategy, the model training can be accelerated and the grading accuracy can be improved, greatly improving the grading purity of flue-cured tobacco leaves and the qualification rate of tobacco leaf grades. Through model pruning, quantization, and a real-time grading system, the computing resource requirements are reduced, and the automation and intelligence of the grading task are realized.

[0085] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it can be understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A flue-cured tobacco grading method based on the YOLOv5 algorithm, characterized in that, It includes the following steps: S1. Collect the appearance characteristics of five parts of tobacco leaves, including color, chroma, maturity of tobacco leaves, and tobacco leaf identity; S2. Establish a model using the YOLOv5 algorithm; S3. Initialize the weights of the model; S4. Train the network; S5. Evaluate the performance of the YOLOv5 flue-cured tobacco grading model; S6. Control the parameters of the model; S7. Iteratively train the model; S8. Use the validation set or test set to evaluate the performance of the model; S9. Use the trained YOLOV5 model to perform object detection tasks. By inputting an image, output the position and category of the object.

2. The flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, wherein In step S1, when collecting the appearance indexes of tobacco leaves, data augmentation techniques are used to preprocess the images, including image rotation, image scaling, image flipping, image scaling, image translation, image cropping, color adjustment, and noise addition.

3. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S2, when establishing a model using the YOLOv5 algorithm, a multi-scale feature fusion mechanism is introduced.

4. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S3, when initializing the weights of the model, transfer learning technology is adopted. Use the weights of the pre-trained YOLOv5 model as the initial value and fine-tune it in combination with the characteristics of the flue-cured tobacco grading task.

5. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S4, when training the network, an adaptive learning rate adjustment strategy is adopted. Dynamically adjust the learning rate according to the loss change during the training process, including adjusting the learning rate based on the cosine function. Adjusting the learning rate based on the cosine function makes the network converge more stably by gradually decreasing the learning rate during the training process.

6. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S6, when controlling the parameters of the model, model pruning and quantization techniques are adopted to remove redundant neurons and parameters, reducing the computational complexity and storage requirements of the model.

7. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S7, when iteratively training the model, a custom loss function is adopted. Combining the characteristics of the tobacco leaf grading task, different weights are assigned to the errors of color, chroma, and maturity indexes.

8. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, In step S8, when using the validation set or test set to evaluate the model performance, model integration technology is adopted to integrate multiple trained YOLOv5 models.

9. The flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, wherein In step S9, when using the trained YOLOv5 model to perform object detection tasks, it is deployed to a real-time grading system. Real-time obtain tobacco leaf images through a camera or image acquisition device and output the grading results.

10. A flue-cured tobacco grading method based on the YOLOv5 algorithm according to claim 1, characterized in that, The evaluation of the performance of the YOLOv5 flue-cured tobacco grading model is through general object detection metrics and grading task-specific metrics. The general object detection metrics include precision, recall, average precision, and mean average precision; the grading task-specific metrics include grading accuracy and confusion matrix.