A method for rapidly identifying field tobacco leaf curing characteristics

By using Retinex-Gamma joint correction and adaptive Gamma correction modules to homogenize the illumination of tobacco leaf images, and combining this with an improved deep convolutional detection network, the problem of relying on dark box experiments for the discrimination of tobacco leaf curing characteristics in the field and the inability to achieve simultaneous and rapid detection of multiple leaves under complex lighting conditions was solved, thus enabling rapid and accurate discrimination of tobacco leaf curing characteristics in the field.

CN122347801APending Publication Date: 2026-07-07TOBACCO RESEARCH INSTITUTE OF CHINESE ACADEMY OF AGRICULTURAL SCIENCES (QINGZHOU TOBACCO RESEARCH INSTITUTE OF CHINA NATIONAL TOBACCO COMPANY)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TOBACCO RESEARCH INSTITUTE OF CHINESE ACADEMY OF AGRICULTURAL SCIENCES (QINGZHOU TOBACCO RESEARCH INSTITUTE OF CHINA NATIONAL TOBACCO COMPANY)
Filing Date
2026-05-18
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

Current technologies rely on darkroom experiments to determine the curing characteristics of tobacco leaves in the field, which cannot achieve simultaneous and rapid detection of multiple leaves under complex lighting conditions.

Method used

Retinex-Gamma joint correction processing and adaptive Gamma correction module are used to homogenize the illumination of tobacco leaf images. Combined with an improved deep convolutional detection network, the network is trained using a focus loss function and a complete intersection-union loss function through a convolutional block attention module and a small target detection output branch. This enables simultaneous and rapid detection of multiple leaves.

Benefits of technology

The invention enables rapid and accurate identification of the curing characteristics of tobacco leaves in the field under complex lighting conditions, solving the problems of unstable feature distribution and simultaneous detection of multiple leaves caused by changes in lighting conditions in existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122347801A_ABST
    Figure CN122347801A_ABST
Patent Text Reader

Abstract

The present application provides a kind of field tobacco baking characteristic fast identification method, belong to field tobacco baking characteristic fast identification technical field, the present application eliminates illumination drift by carrying out Retinex-Gamma joint correction to field tobacco image, constructs the improved deep convolution detection network containing adaptive Gamma correction learnable module, convolution block attention module and small target detection output branch, using optimal transmission interpolation oversampling balanced training set each category sample distribution, using the joint loss function of complete intersection ratio loss function and focal loss function is iteratively trained, and the optimal network parameter is obtained by cosine annealing learning rate strategy and early stop mechanism, finally field tobacco image is executed multi-blade synchronous detection and artificial intelligence classification, the detection result is output as baking characteristic bad, medium, good three kinds of discrimination conclusions, solve the technical problems that field tobacco baking characteristic discrimination relies on dark box test and cannot realize multi-blade synchronous rapid detection under complex illumination conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the technical field of rapid identification of field tobacco curing characteristics, and specifically relates to a method for rapid identification of field tobacco curing characteristics. Background Technology

[0002] The curing characteristics of tobacco leaves are an important indicator for evaluating the processing suitability of flue-cured tobacco varieties, directly affecting the formulation of curing process parameters and the final formation of tobacco leaf quality. Traditional methods for judging tobacco leaf curing characteristics rely on dark-box experiments, which involve collecting tobacco leaf samples from the field and placing them in a dark, temperature-controlled environment, periodically observing changes in yellowing, browning, and weight, and then grading them according to industry standards. This method has been widely used in flue-cured tobacco breeding evaluation, variety selection in producing areas, and curing process research, and can objectively reflect the intrinsic curing characteristics of tobacco leaves.

[0003] However, the dark-box testing method has inherent technical limitations. First, this method is destructive sampling, requiring physical samples for each identification, and taking at least tens of hours from sampling to obtaining results, which cannot meet the needs of real-time field identification. Second, field tobacco leaf images are affected by different lighting conditions such as sunny days, cloudy days, and mornings and evenings, resulting in significant drift in pixel value distribution. This causes existing image feature-based identification methods to be unstable in feature extraction under cross-time scenarios, leading to a significant decrease in classification accuracy. In addition, existing image recognition methods mostly identify single leaves, making it difficult to simultaneously locate and classify the curing characteristics of multiple tobacco leaves in a single field image.

[0004] In existing technologies, due to the complex and variable lighting conditions in the field, image-based methods for identifying tobacco curing characteristics suffer from technical problems such as unstable feature distribution across lighting conditions and a lack of simultaneous detection capability for multiple leaves. In other words, existing technologies rely on dark-box experiments for determining tobacco curing characteristics in the field and cannot achieve rapid and simultaneous detection of multiple leaves under complex lighting conditions. Summary of the Invention

[0005] In view of this, the present invention provides a method for rapid identification of the curing characteristics of tobacco leaves in the field, which can solve the technical problem in the prior art that the identification of the curing characteristics of tobacco leaves in the field depends on dark box experiments and cannot achieve simultaneous and rapid detection of multiple leaves under complex lighting conditions.

[0006] This invention is implemented as follows: This invention provides a method for rapid identification of the curing characteristics of tobacco leaves in the field, including the following steps:

[0007] Images of upper and middle leaves of flue-cured tobacco were collected in the field under different light conditions, including sunny days, cloudy days, and morning and evening. Corresponding tobacco leaf samples were taken simultaneously for dark box experiments. The degree of yellowing, browning and weight changes were observed every 12 hours. According to the evaluation standard of flue-cured tobacco variety curing characteristics, the curing characteristics were divided into three categories: poor, medium and good. A database of the correspondence between field tobacco leaf images and curing characteristic categories was established.

[0008] Retinex-Gamma joint correction processing is performed on the tobacco leaf images in the field to output an image with uniform illumination. The Gamma correction parameter is adaptively set according to the degree of deviation between the local mean and the neutral gray reference value of the tobacco leaf image in the field. When the local mean is lower than the neutral gray reference value, the Gamma correction parameter takes the first interval, and when the local mean is higher than the neutral gray reference value, the Gamma correction parameter takes the second interval.

[0009] Using a labeling tool, bounding boxes were drawn for each tobacco leaf in the uniformly illuminated image. The coordinates of the center point of the bounding box, the width of the bounding box, the height of the bounding box, and the category label of the baking characteristics were recorded for each tobacco leaf. Poor baking characteristics corresponded to category label 0, medium baking characteristics to category label 1, and good baking characteristics to category label 2. The training set and validation set were divided in an 8:2 ratio. Data augmentation was performed on the training set by applying random rotation, random scaling, random horizontal flipping, brightness adjustment, and contrast adjustment. 512-dimensional feature vectors were extracted from the three classes of samples in the training set, and the Wasserstein-2 distance between the classes was calculated. The class pair with the largest Wasserstein-2 distance was subjected to optimal transfer interpolation oversampling to generate minority class synthetic samples to supplement the training set.

[0010] An improved deep convolutional detection network is constructed: an adaptive Gamma correction module is embedded at the network input. The backbone network retains a 160×160 resolution shallow feature map after the attention module of the convolutional block. The neck network fuses the deep semantic features with the 160×160 resolution shallow feature map after upsampling the deep semantic features through a feature pyramid network. The detection head is set with regression branch, classification branch and small object detection output branch. The initial value of the Gamma parameter of the adaptive Gamma correction module is set to 1.0 and is updated synchronously with the network training gradient as a learnable weight.

[0011] A joint loss function is established, with the regression loss using the full intersection-over-union loss function and the classification loss using the focal loss function. The weighted summation constitutes the total loss. The focal parameter of the focal loss function is set to 2.0, and the class weight factor is adaptively calculated based on the proportion of each class sample in the training set. The training set is input into the improved deep convolutional detection network for iterative training. The learning rate is dynamically adjusted using a cosine annealing learning rate adjustment strategy. The average precision is calculated on the validation set after every 5 training epochs. If the average precision on the validation set does not improve after 10 consecutive training epochs, early stopping is triggered. The parameters of the improved deep convolutional detection network with the highest average precision on the validation set are saved as the optimal network parameters.

[0012] Images of tobacco leaves in the field to be judged are acquired, scaled to 640×640 pixels, and the pixel values ​​are normalized to the range of 0 to 1. The images are then input into an improved deep convolutional detection network with optimal network parameters. After feature extraction, multi-scale fusion, and detection head calculation, the candidate bounding box position coordinates and the probability distribution of baking characteristic categories are output. Redundant candidate bounding boxes are removed by non-maximum suppression, and the category label corresponding to the highest probability is taken as the judgment result. The category labels 0, 1, and 2 are output as poor baking characteristics, medium baking characteristics, and good baking characteristics, respectively.

[0013] Specifically, the Retinex-Gamma joint correction process involves: performing Gaussian filtering on the input field tobacco image to estimate the low-frequency light component; adaptively setting the Gamma correction parameter based on the degree to which the local mean of the low-frequency light component deviates from the neutral gray reference value of 128; applying a power function transformation to the low-frequency light component; dividing the input field tobacco image by the low-frequency light component and then multiplying it by the Gamma-corrected light component to output a uniformly illuminated image.

[0014] The core formula for the Retinex-Gamma joint correction process is as follows: ,in To input the pixel values ​​of a field tobacco leaf image, To equalize the image pixel values ​​for illumination, These are the pixel values ​​of the low-frequency illumination component estimated using Gaussian filtering. The maximum pixel value is 255. This is the Gamma correction parameter.

[0015] Specifically, the 512-dimensional feature vector is obtained by flattening the feature map before the last fully connected layer by forward propagating the training set images through the VGG network. The VGG network uses weights pre-trained on the ImageNet dataset.

[0016] Specifically, the optimal transmission interpolation oversampling involves performing semantically consistent interpolation on the minority class sample distribution in the 512-dimensional feature vector space based on the optimal transmission path. After generating a synthetic feature vector, it is mapped back to the image space by the decoder. The decoder is a deconvolutional network symmetrical to the VGG network encoder, and its mapping capability is obtained by joint training with the encoder.

[0017] Specifically, the convolutional block attention module is implemented through a cascaded mechanism of the channel attention module and the spatial attention module: the channel attention module applies global max pooling and global average pooling to the backbone network feature map and then feeds it into a shared multilayer perceptron. The sum is activated by Sigmoid to generate a channel-dimensional weight vector, which is then multiplied channel by channel with the backbone network feature map to output a channel-weighted feature map; the spatial attention module takes the maximum value and the mean value along the channel dimension of the channel-weighted feature map, concatenates them, performs a 7×7 convolution and activates Sigmoid to generate a spatial weight map, and multiplies it element by element to output a spatial weighted feature map.

[0018] The correction formula for the adaptive Gamma correction module is as follows: ,in The adjusted image pixel values ​​output by the adaptive Gamma correction module. To equalize the image pixel values ​​for illumination, The maximum pixel value is 255. For the learnable Gamma parameters in the adaptive Gamma correction module, is a constant coefficient.

[0019] The formula for the complete intersection-union ratio loss function is as follows: ,in To predict the bounding box for the regression branch, For the true bounding box, To predict the Euclidean distance between the center point of the bounding box and the center point of the true bounding box, To cover the diagonal length of the minimum closure region between the predicted bounding box and the true bounding box, This is a measure of aspect ratio consistency. This is the aspect ratio consistency weight parameter.

[0020] The formula for the focus loss function is as follows: ,in To improve the prediction probability of the true class in deep convolutional detection networks, For category weighting factors, To focus parameters, is the modulation factor.

[0021] The formula for the joint loss function is as follows: ,in and These are the loss weight coefficients for regression and classification tasks, respectively. The loss weight coefficients are determined by conducting comparative experiments on multiple candidate values ​​on the validation set and selecting the combination of loss weight coefficients that corresponds to the highest average accuracy.

[0022] The learning rate update formula for the cosine annealing learning rate adjustment strategy is as follows: ,in The initial learning rate, To minimize the learning rate, For the total number of training rounds, This is the current training round.

[0023] The backpropagation parameter update is performed using the Adam optimizer, and the parameter update formula is as follows: The gradient is calculated layer by layer using the chain rule. ,in To improve the deep convolutional detection network Layer parameters, For the first Layer output.

[0024] Specifically, the non-maximum suppression involves sorting candidate bounding boxes from highest to lowest confidence, retaining the candidate bounding box with the highest confidence, and applying confidence decay to candidate bounding boxes whose intersection-union ratio (IU) with the candidate bounding boxes exceeds a set suppression threshold instead of directly deleting them. The suppression threshold is determined experimentally on a validation set containing occluded scenes, with each candidate value in the range of 0.3 to 0.7 having a step size of 0.05.

[0025] The regression branch outputs 12-channel bounding box position parameters after dimensionality reduction through 3 layers of 1×1 convolutions, the classification branch outputs 9-channel baking feature category probability distributions, and the small target detection output branch connects to a 160×160 resolution shallow feature map, targeting pixels with areas smaller than [missing information]. The small-sized tobacco leaf targets provide independent detection output.

[0026] The threshold range of the Gamma correction parameter is determined by iterative search through multiple rounds of comparative experiments on a validation set covering all illumination conditions, with the average accuracy of model detection as the evaluation index. When the local mean is lower than the neutral gray reference value, the Gamma correction parameter is taken as 0.5 to 0.8, and when the local mean is higher than the neutral gray reference value, the Gamma correction parameter is taken as 1.2 to 1.8.

[0027] This invention solves the technical problem that the discrimination of tobacco curing characteristics in the field relies on dark box experiments and cannot achieve simultaneous and rapid detection of multiple leaves under complex lighting conditions by introducing Retinex-Gamma joint correction preprocessing, adaptive Gamma correction learnable module, convolutional block attention module, small target detection output branch, optimal transmission interpolation oversampling and a joint loss function composed of focus loss function and complete cross-union ratio loss function. Retinex-Gamma joint correction eliminates the interference of light drift on feature distribution at the source by separating and adaptively adjusting low-frequency light components, enabling the convolutional kernel to obtain a stable response under different lighting conditions. The adaptive Gamma correction module is trained synchronously with the network as a learnable parameter, further dynamically compensating for residual light differences. The convolutional block attention module, through the cascade mechanism of channel attention and spatial attention, enables the backbone network to actively focus on the leaf texture and color distribution areas, suppressing background interference such as soil and weeds. The small target detection output branch retains a 160×160 resolution shallow feature map, compensating for the loss of feature resolution of small-sized tobacco leaves caused by downsampling, and realizing simultaneous detection of multiple leaves. Optimal transport interpolation oversampling balances samples of each class at the feature distribution level, and the focus loss function further suppresses the majority class prediction bias, improving the discrimination accuracy of various baking characteristics. In summary, this invention solves the technical problem mentioned in the background art that the discrimination of field tobacco leaf baking characteristics relies on dark-box experiments and cannot achieve simultaneous and rapid detection of multiple leaves under complex lighting conditions. Attached Figure Description

[0028] Figure 1 This is a flowchart of the method of the present invention.

[0029] Figure 2 A schematic diagram illustrating the bounding box annotation of an image of tobacco leaves in the field.

[0030] Figure 3 This is a schematic diagram of the branch network structure for the detection head.

[0031] Figure 4 A schematic diagram of an improved deep convolutional network structure.

[0032] Figure 5 This is a schematic diagram of the network structure of the convolutional block attention module.

[0033] Figure 6 This is a schematic diagram of the channel attention module structure.

[0034] Figure 7 This is a schematic diagram of the spatial attention module structure. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.

[0036] like Figure 1 The diagram shows a flowchart of a rapid method for determining the curing characteristics of tobacco leaves in the field, provided by this invention. This method includes the following steps:

[0037] S01. Collect images of the upper and middle leaves of flue-cured tobacco under different light conditions, including sunny days, cloudy days, and morning and evening, in the field. Simultaneously, take corresponding tobacco leaf samples for dark box experiments. Observe the degree of yellowing, browning and weight changes every 12 hours. According to the evaluation standard of flue-cured tobacco variety curing characteristics, divide the curing characteristics into three categories: poor, medium and good. Establish a database of the correspondence between field tobacco leaf images and curing characteristic categories.

[0038] S02. Perform Retinex-Gamma joint correction processing on the tobacco leaf images in the field to output a uniformly illuminated image. Adaptively set the Gamma correction parameter according to the deviation between the local mean and the neutral gray reference value of the tobacco leaf images in the field. When the local mean is lower than the neutral gray reference value, the Gamma correction parameter is set to 0.5 to 0.8. When the local mean is higher than the neutral gray reference value, the Gamma correction parameter is set to 1.2 to 1.8. The threshold range of the Gamma correction parameter is determined by iterative search through multiple rounds of comparative experiments on a validation set covering all illumination conditions, using the average accuracy of model detection as the evaluation index.

[0039] S03. Using annotation tools, draw bounding boxes for each tobacco leaf in the uniformly illuminated image. Record the center point coordinates, width, height, and baking characteristic category label for each tobacco leaf's bounding box. Poor baking characteristics correspond to category label 0, medium baking characteristics to category label 1, and good baking characteristics to category label 2. Divide the training set and validation set into an 8:2 ratio. Apply random rotation, random scaling, random horizontal flipping, brightness adjustment, and contrast adjustment to the training set for data augmentation. Extract 512-dimensional feature vectors from the three classes of samples in the training set, calculate the Wasserstein-2 distance between classes, and perform optimal transfer interpolation oversampling on the class pair with the largest Wasserstein-2 distance to generate minority class synthetic samples to supplement the training set.

[0040] S04. Constructing an improved deep convolutional detection network: An adaptive Gamma correction module is embedded at the network input. The backbone network retains a 160×160 resolution shallow feature map after the attention module of the convolutional block. The neck network upsamples the deep semantic features through a feature pyramid network and fuses them with the 160×160 resolution shallow feature map. The detection head is set with regression branch, classification branch and small object detection output branch. The initial value of the Gamma parameter of the adaptive Gamma correction module is set to 1.0 and is updated synchronously with the network training gradient as a learnable weight.

[0041] S05. Establish a joint loss function. The regression loss uses the full intersection-over-union loss function, and the classification loss uses the focal loss function. The weighted summation constitutes the total loss. The focal parameter of the focal loss function is set to 2.0, and the class weight factor is adaptively calculated based on the proportion of each class sample in the training set. The loss weight coefficients are determined by conducting comparative experiments on multiple candidate values ​​on the validation set and selecting the combination of loss weight coefficients corresponding to the highest average accuracy. The training set is input into the improved deep convolutional detection network for iterative training. The learning rate is dynamically adjusted using a cosine annealing learning rate adjustment strategy. The average accuracy is calculated on the validation set after every 5 training epochs. If the average accuracy of the validation set does not improve after 10 consecutive training epochs, early stopping is triggered. The parameters of the improved deep convolutional detection network with the highest average accuracy of the validation set are saved as the optimal network parameters.

[0042] S06. Collect field tobacco leaf images to be judged, scale them to 640×640 pixels, and normalize the pixel values ​​to the range of 0 to 1. Then input them into an improved deep convolutional detection network with optimal network parameters. After feature extraction, multi-scale fusion and detection head calculation, output the position coordinates of candidate bounding boxes and the probability distribution of baking characteristic categories. Remove redundant candidate bounding boxes through non-maximum suppression, and take the category label corresponding to the highest probability as the judgment result. Output the category labels 0, 1 and 2 as poor baking characteristics, medium baking characteristics and good baking characteristics, respectively.

[0043] The Retinex-Gamma joint correction processing is based on Retinex theory, which posits that an image is constructed by multiplying the illumination component and the reflection component, with the reflection component carrying the object's true color and texture information. The processing involves: applying Gaussian filtering to the input field tobacco image to estimate the low-frequency illumination component; calculating the local mean and local variance of the low-frequency illumination component; adaptively setting the Gamma correction parameter based on the degree to which the local mean deviates from the neutral gray reference value of 128; applying a power function transformation to the low-frequency illumination component; dividing the input field tobacco image by the low-frequency illumination component; and then multiplying by the Gamma-corrected illumination component to output a uniformly illuminated image. By separating the low-frequency illumination component and the reflection component and adaptively adjusting the low-frequency illumination component, the Retinex-Gamma joint correction processing eliminates feature distribution drift caused by differences in day and night illumination in the field, ensuring stable responses from the convolutional kernel under different illumination conditions. This fundamentally improves the accuracy and stability of the improved deep convolutional detection network on field tobacco images across different time periods. The core formula of the Retinex-Gamma joint correction processing is expressed as follows: ;in Input pixel values ​​of tobacco leaf images in the field, in gray levels. This represents the pixel values ​​of the image after illumination homogenization, expressed in gray levels. These are the pixel values ​​of the low-frequency illumination component estimated by Gaussian filtering, expressed in gray levels. The maximum pixel value is 255, in grayscale levels. This is the Gamma correction parameter, which is dimensionless.

[0044] The neutral gray reference value is 128, and the unit is gray level. The value is based on the midpoint of the gray level dynamic range of 8-bit image from 0 to 255, which is a known value.

[0045] The 512-dimensional feature vector is obtained by forward propagating the training set images through the VGG network and flattening the feature map before the last fully connected layer. The VGG network uses weights pre-trained on the ImageNet dataset.

[0046] The Wasserstein-2 distance is the optimal transmission distance that measures the difference between two probability distributions. It is calculated by finding the minimum cost required to transfer the quality of one distribution to the other, with the cost calculated as the square of the Euclidean distance. Optimal transmission interpolation oversampling uses the optimal transmission path to semantically consistently interpolate the minority class sample distribution in the 512-dimensional feature vector space, generating synthetic feature vectors. These vectors are then mapped back to the image space by the decoder to obtain synthetic minority class samples. The decoder is a deconvolutional network symmetric to the VGG network encoder, and its mapping capability is obtained through joint training with the encoder. The Wasserstein-2 distance perceives the geometric distribution differences of categories in the 512-dimensional feature vector space. Optimal transmission interpolation oversampling fills in the unsampled regions of the minority class feature distribution at the distribution level, ensuring that the category weight factor adjustment of the focus loss function is based on distribution balance. This further suppresses the prediction bias of the improved deep convolutional detection network for the majority class, improving the discrimination accuracy of the baking characteristics of each category.

[0047] The improved deep convolutional detection network is based on the YOLOv8 framework and consists of three parts: a backbone network, a neck network, and a detection head. The backbone network extracts multi-scale features from the illumination homogenized image and retains a 160×160 resolution shallow feature map after the attention module of the convolutional block to carry the fine-grained texture features of small-sized tobacco leaf targets. The neck network upsamples deep semantic features through a feature pyramid network and fuses them with the 160×160 resolution shallow feature map, compensating for the resolution loss of small-sized target features caused by downsampling in the backbone network. The detection head includes a regression branch, a classification branch, and a small target detection output branch. The regression branch uses three layers... After layer-by-layer dimensionality reduction via convolution, the output is a 12-channel bounding box position parameter. The classification branch outputs a 9-channel baking feature class probability distribution. The small object detection output branch connects to a 160×160 resolution shallow feature map, targeting pixels with areas smaller than [missing information]. The small-sized tobacco leaf targets provide independent detection output.

[0048] The convolutional block attention module enhances the ability of deep convolutional detection networks to extract key features of tobacco leaves through a cascaded mechanism of channel attention and spatial attention modules. The channel attention module applies global max pooling and global average pooling to the backbone network feature map, feeds the two results into a shared multilayer perceptron, adds them, and activates them with a sigmoid function to generate a channel-dimensional weight vector. This vector is then multiplied channel-wise by the backbone network feature map to output a channel-weighted feature map, achieving adaptive enhancement of channels containing tobacco leaf color and texture information. The spatial attention module takes the maximum and mean values ​​along the channel dimensions of the channel-weighted feature map, concatenates them, and then... Convolutional processing and sigmoid activation generate a spatial weight map. This spatial weight map is then element-wise multiplied with the channel-weighted feature map to output a spatially weighted feature map. This map locates key spatial response regions of tobacco leaves and suppresses feature responses from background areas such as soil and weeds. The convolutional block attention module enables the backbone network to actively focus on leaf texture and color distribution regions during feature extraction, reducing the impact of background interference on feature representation. This significantly improves the effectiveness and discriminative power of feature representation in multi-background field scenarios.

[0049] The adaptive Gamma correction module is embedded in the input of the improved deep convolutional detection network. Its Gamma parameter serves as a learnable weight, initially set to 1.0. Through backpropagation, it is updated synchronously with the other parameters of the improved deep convolutional detection network. After dynamically adjusting the contrast of the input illumination homogenized image, the adjusted image is fed into the backbone network. The correction formula for the adaptive Gamma correction module is as follows: ;in These are the adjusted image pixel values ​​output by the adaptive Gamma correction module, in gray levels. This represents the pixel values ​​of the image after illumination homogenization, expressed in gray levels. The maximum pixel value is 255, in grayscale levels. The learnable Gamma parameter in the adaptive Gamma correction module is dimensionless. is a constant coefficient, dimensionless.

[0050] The perfect intersection-over-union (MIU) loss function is used to optimize the bounding box location parameters of the regression branch output, and the formula is expressed as follows: ;in To predict the bounding box for the regression branch, For the true bounding box, and These are the intersection area and union area of ​​the predicted bounding box and the ground truth bounding box, respectively, in units of... , To predict the center point of the bounding box Center point of the actual bounding box The Euclidean distance between them, in pixels (px). The diagonal length of the minimum closure region covering the predicted bounding box and the ground truth bounding box, in pixels (px). The aspect ratio consistency measure is dimensionless, where , To predict the width and height of the bounding box, in pixels (px). , The actual bounding box width and height are in pixels (px). The aspect ratio consistency weight parameter is dimensionless. The full intersection-union ratio loss function provides effective gradients even in densely occluded scenes by simultaneously constraining the intersection-union ratio, center point distance, and aspect ratio consistency. This guides the predicted bounding box to approximate the real bounding box in terms of position, size, and shape, thus improving the bounding box localization accuracy in multi-leaf scenes.

[0051] The focus loss function is used to optimize the probability distribution of the baking feature category output by the classification branch, and its formula is as follows: ;in To improve the prediction probability of the true class in deep convolutional detection networks, dimensionless... , This is a dimensionless class weighting factor, adaptively calculated based on the proportion of samples from each class in the training set. Classes with smaller sample sizes are assigned higher class weighting factors. For the focusing parameter, which is dimensionless, we take 2.0. As the modulation factor, when When the modulation factor approaches 1, it approaches 0, thus reducing the loss contribution of easily classified samples. When the modulation factor is small, it approaches 1, thus preserving the loss contribution of hard-to-classify samples.

[0052] The formula for the joint loss function is as follows: ;in and These are the loss weight coefficients for regression and classification tasks, respectively. They are dimensionless and used to balance the dimensional differences and optimization priorities between the complete intersection-union loss function and the focus loss function.

[0053] The learning rate update formula for the cosine annealing learning rate adjustment strategy is expressed as follows: ;in The initial learning rate is dimensionless. Minimum learning rate, dimensionless. For the total number of training rounds, This is the current training round.

[0054] The formula for updating the backpropagation parameters is expressed as follows: The gradient is calculated layer by layer using the chain rule. ,in To improve the deep convolutional detection network Layer parameters, For the first Layer output, The Adam optimizer is used to update parameters based on the learning rate for the current training round.

[0055] In this process, non-maximum suppression sorts candidate bounding boxes from highest to lowest confidence, retains the candidate bounding box with the highest confidence, and applies confidence decay instead of directly deleting candidate bounding boxes whose intersection-union ratio (IU) with the candidate bounding boxes exceeds a set suppression threshold, in order to retain effective candidate bounding boxes in occluded scenarios. Finally, the position coordinates of the retained candidate bounding boxes and the probability distribution of the baking feature categories are output. The set suppression threshold is determined by conducting experiments on a validation set containing occluded scenarios, testing candidate values ​​in the range of 0.3 to 0.7 with a step size of 0.05, and selecting the value that best balances the false negative rate and the duplicate detection rate.

[0056] Optionally, the present invention also provides a computer-based method for forming a rapid identification system for field tobacco curing characteristics, wherein the computer is equipped with a readable storage medium that stores program instructions, which are used to execute the above-described method when the computer is run.

[0057] The specific implementation of step S01 is as follows: Technicians select representative tobacco fields during the tobacco growing season and systematically collect images of the upper and middle leaves of the flue-cured tobacco. The collection environment covers various lighting conditions, including strong sunlight on sunny days, diffused light on cloudy days, low-angle light in the early morning, and backlight in the evening, ensuring that the dataset fully covers the actual light distribution in the field. The image acquisition equipment is set with a resolution of no less than 3072×4096 pixels, the shooting distance is maintained at 30 to 40 cm, and the tobacco leaf target occupies no less than 60% of the image to ensure the distinguishability of leaf texture details. Simultaneously with image acquisition, corresponding leaf samples are collected from the same plant. These samples are strung together in a dark, room-temperature chamber to conduct a curing characteristic calibration experiment. Every 12 hours, the degree of yellowing, browning, and weight changes are observed and recorded under standard light. The observation period continues until the yellowing or browning process of the leaves tends to stabilize. Based on the industry standard for evaluating the curing characteristics of flue-cured tobacco varieties, and taking into account the three indicators of yellowing rate, browning rate, and water loss rate, the curing characteristics of each batch of samples were classified into three categories: poor, medium, and good. A one-to-one mapping relationship was established with the corresponding field images to form a database of correspondence between field tobacco leaf images and curing characteristic categories, providing a source of supervised labeled samples for subsequent model training.

[0058] The specific implementation of step S02 is as follows: This step performs illumination homogenization processing on the tobacco leaf image in the field based on Retinex theory. Retinex theory states that an image is composed of the product of illumination and reflection components. The reflection component carries the true color and texture information of the object. By estimating and separating the low-frequency illumination component, the stable reflection component can be restored. The specific processing procedure is as follows: First, a Gaussian filter is applied to the input tobacco leaf image in the field to smooth the spatially slowly varying brightness field. The filtering result is used as the low-frequency illumination component. The estimated value is obtained; then the local mean of the low-frequency illumination component is calculated, and the Gamma correction parameter is adaptively set according to the degree to which the local mean deviates from the neutral gray reference value of 128. When the local mean is below 128, the illumination is too dark, and the Gamma correction parameter is set to 0.5 to 0.8 to increase the brightness; when the local mean is above 128, the illumination is too bright, and the Gamma correction parameter is set to 1.2 to 1.8 to suppress the highlights; then a power function transformation is applied to the low-frequency illumination component, and the input image is transformed. Divide by The reflection component is separated and then multiplied by the illumination component after Gamma correction to output an illumination-uniformed image. The core computational relationship is The threshold range of the Gamma correction parameter was determined through multiple rounds of comparative experiments on a validation set covering all lighting conditions, using the average accuracy of the model detection as the evaluation metric. This ensures that the selected parameter range has optimal feature stability for all types of lighting conditions.

[0059] The specific implementation of step S03 is as follows: This step completes the construction of the training dataset and the sample distribution equalization processing. A bounding box is drawn for each tobacco leaf in the uniformly illuminated image using a labeling tool. The center point method is used to record the coordinates of the center point of the bounding box, the width of the bounding box, and the height of the bounding box for each tobacco leaf. Corresponding baking characteristic category labels are assigned: poor baking characteristics are labeled as category label 0, medium baking characteristics as category label 1, and good baking characteristics as category label 2. The training set and validation set are divided in an 8:2 ratio. Random rotation (reference range -15° to +15°), random scaling (reference magnification 0.8 to 1.2x), random horizontal flipping, brightness adjustment (reference range ±20%), and contrast adjustment (reference range ±15%) are applied to the training set to augment the data, thereby expanding sample diversity and improving the model's adaptability to differences in field shooting angles. To address the potential imbalance in the number of samples across the three classes, a VGG network pre-trained on the ImageNet dataset is used for forward propagation of the training set images. The feature maps before the last fully connected layer are flattened to obtain a 512-dimensional feature vector for each image. The Wasserstein-2 distance between each pair of the three classes is calculated, using the square of the Euclidean distance as the cost to measure the optimal transmission cost between two probability distributions. The minority class in the class pair with the largest Wasserstein-2 distance is selected for optimal transmission interpolation oversampling: based on the optimal transmission path, semantically consistent interpolation is performed on the minority class sample distribution in the 512-dimensional feature vector space to generate a synthetic feature vector. This synthetic feature vector is then mapped back to the image space using a deconvolutional decoder symmetric to the VGG network encoder, yielding synthetic minority class samples. These samples are then added to the training set to balance the distribution of samples across all classes.

[0060] The specific implementation of step S04 is as follows: This step constructs an improved deep convolutional detection network based on the YOLOv8 framework. The network consists of three parts: a backbone network, a neck network, and a detection head. An adaptive Gamma correction module is embedded at the network input. The core formula of the module is... ,in To enable the learningable Gamma parameter, an initial value of 1.0 is set, and it is updated synchronously with the network training via backpropagation gradients, achieving dynamic contrast adjustment of the input image with uniform illumination. The backbone network retains a 160×160 resolution shallow feature map after the convolutional block attention module. The convolutional block attention module operates through a cascaded mechanism of channel attention and spatial attention modules: the channel attention module applies global max pooling and global average pooling to the backbone network feature map, respectively. The two results are fed into a shared multilayer perceptron, summed, and activated by a sigmoid function to generate a channel-dimensional weight vector, which is multiplied channel-wise with the feature map to output a channel-weighted feature map. The spatial attention module takes the maximum and mean values ​​along the channel dimensions of the channel-weighted feature map and concatenates them. After a 7×7 convolution and sigmoid activation, a spatial weight map is generated, which is multiplied element-wise with the channel-weighted feature map to output a spatial weighted feature map. This allows the backbone network to focus on the leaf texture and color distribution areas, suppressing the feature responses of background areas such as soil and weeds. The neck network upsamples deep semantic features through a feature pyramid network and fuses them with a 160×160 resolution shallow feature map to compensate for the resolution loss of small-sized target features caused by downsampling. The detection head includes a regression branch, a classification branch, and a small target detection output branch: the regression branch outputs 12-channel bounding box position parameters after layer-by-layer dimensionality reduction using 3 layers of 1×1 convolutions; the classification branch outputs a 9-channel baking feature category probability distribution; and the small target detection output branch connects to the 160×160 resolution shallow feature map, targeting targets with pixel areas smaller than [missing information]. The small-sized tobacco leaf targets provide independent detection output.

[0061] The specific implementation of step S05 is as follows: This step establishes the joint loss function and completes iterative network training. The joint loss function is composed of a weighted sum of the complete intersection-over-union loss function and the focal loss function, as shown in the formula: Weighting coefficient and The optimal combination is determined by conducting comparative experiments on multiple candidate values ​​on the validation set and selecting the combination with the highest average precision. The formula for the perfect intersection-union loss function is as follows: By simultaneously constraining three metrics—intersection over union (IoU), center point distance, and aspect ratio consistency—it can still provide effective gradients even in densely occluded scenes. The focus loss function formula is as follows: Focus parameters Set it to 2.0, category weight factor The modulation factor is adaptively calculated based on the proportion of samples in each category of the training set, with higher weights assigned to categories with smaller sample sizes. exist The learning rate approaches 0 when it is close to 1, thus reducing the loss contribution of easily classified samples. The training process employs a cosine annealing learning rate adjustment strategy, with an initial learning rate... Minimum learning rate Total training rounds Every 5 training epochs, the average precision is calculated on the validation set. If the average precision on the validation set does not improve after 10 consecutive training epochs, an early stopping mechanism is triggered, and the network parameters with the highest average precision on the validation set are saved as the optimal network parameters. Parameter updates use the Adam optimizer, calculating the gradient of each layer's parameters layer by layer according to the chain rule and performing updates accordingly. The learnable Gamma parameter of the adaptive Gamma correction module is updated synchronously with the gradients of the other network parameters.

[0062] The specific implementation of step S06 is as follows: This step completes the inference and discrimination of the field tobacco leaf curing characteristics and outputs the results. Images of the field tobacco leaves to be discriminated are acquired, scaled to 640×640 pixels, and the pixel values ​​are normalized to the range of 0 to 1. These images are then input into an improved deep convolutional detection network loaded with optimal network parameters. The images are sequentially processed through dynamic contrast adjustment by an adaptive Gamma correction module, multi-scale feature extraction of the backbone network (including key region enhancement by the convolutional block attention module), feature pyramid fusion of the neck network, and parallel computation of the three detection branches. The output includes the position coordinates of all candidate bounding boxes and the corresponding probability distribution of the curing characteristic category. Post-processing for candidate bounding boxes involves non-maximum suppression: Candidate boxes are sorted from highest to lowest confidence. Instead of direct deletion, confidence decay is applied to candidate boxes with an intersection-union ratio (IU) exceeding a set suppression threshold, thus preserving valid candidate boxes in occluded scenarios. The suppression threshold is set by experimenting with candidate values ​​in the range of 0.3 to 0.7 on a validation set containing occluded scenarios, using a step size of 0.05. The value corresponding to the optimal combination of false negative and duplicate detection rates is selected, with a reference value of 0.5. Finally, the category label corresponding to the highest probability in each retained box is taken as the discrimination result. The category labels 0, 1, and 2 are decoded and output as poor baking characteristics, medium baking characteristics, and good baking characteristics, respectively, achieving simultaneous, lossless, and rapid discrimination of multiple tobacco leaves in the field.

[0063] It's important to note that the first key technical approach is the dual illumination compensation mechanism of Retinex-Gamma joint correction and adaptive Gamma correction module. Retinex theory separates low-frequency illumination components through Gaussian filtering, removing brightness inhomogeneities from the reflection component in the image. This ensures that tobacco leaf images acquired under different lighting conditions exhibit consistent reflection component levels after processing, suppressing the interference of illumination drift on the convolutional kernel response from the source. Building upon this, the Gamma parameter is set as a learnable weight and optimized synchronously with network training. This allows the network to further fine-tune residual illumination differences based on the statistical characteristics of specific datasets, overcoming the limitation of fixed preprocessing parameters failing to adapt to changes in data distribution.

[0064] The second key technical approach is a collaborative feature enhancement mechanism that combines convolutional block attention modules with high-resolution shallow feature map preservation. The convolutional block attention module, through the cascading of channel attention and spatial attention, guides the backbone network to focus feature extraction resources on leaf texture and color distribution areas. This actively suppresses background interference such as soil and weeds at the feature map level, improving the effectiveness of feature representation in determining baking characteristics. By preserving 160×160 resolution shallow feature maps and fusing them with deep semantic features through the neck network, fine-grained texture information of small-sized tobacco leaves is retained after multi-scale fusion, providing sufficient local spatial information for the small target detection output branch.

[0065] The third key technical approach is a joint sample equalization mechanism combining optimal transport interpolation oversampling and a focus loss function. Optimal transport interpolation oversampling, at the geometric level of the 512-dimensional feature vector space, interpolates and completes the unsampled regions of the minority class distribution based on the optimal transport path, thus balancing the feature distribution of each class in the training set. The modulation factor of the focus loss function further suppresses the loss contribution of easily classified majority class samples at the gradient level, forcing the network to focus on difficult-to-classify samples. Both mechanisms synergistically suppress majority class prediction bias at the data distribution and gradient optimization levels, respectively, balancing the network's ability to discriminate the baking characteristics of each class.

[0066] The synergistic effect of the three technical approaches is reflected in the following aspects: the illumination compensation mechanism provides statistically stable input for subsequent feature extraction, enabling the attention allocation of the convolutional block attention module to be based on reliable features; the feature enhancement mechanism provides a more discriminative feature representation for the gradient of the classification loss, allowing the class weight adjustment function of the focus loss function to be fully utilized; and the sample balancing mechanism ensures that the feature extraction capability improvement brought about by the above two technical approaches can be evenly applied to each class, rather than being offset by the prediction bias caused by sample imbalance. Together, the three aspects guarantee the method's discrimination accuracy and stability for various baking characteristics in complex field scenarios.

[0067] It should be noted that this invention also solves the following technical problem: This invention also addresses the insufficient detection capability of small-sized tobacco leaves in multi-leaf field scenarios. Under actual field shooting conditions, tobacco leaves often overlap, and their projected areas in the image differ significantly, with pixel areas lower than [the required area]. Small-sized tobacco leaf targets suffer severe feature resolution loss after multiple downsampling in the backbone network, making it difficult for traditional detection heads to provide effective localization and classification outputs. This invention addresses this issue by retaining a 160×160 resolution shallow feature map after the attention module in the convolutional block of the backbone network, and then fusing it with deep semantic features in the neck network before introducing it into a small target detection output branch. This allows small-sized tobacco leaf targets to be detected independently without compressing fine-grained texture information, solving the problem of missed detections due to resolution loss in small-sized targets. Simultaneously, this invention also solves the technical problem of degraded bounding box localization accuracy in densely occluded scenes. When multiple tobacco leaves are densely distributed in an image and occlude each other, the predicted bounding box and the ground truth bounding box may not intersect. In this case, the gradient of the traditional intersection-union loss function tends to vanish, failing to provide an effective localization optimization signal for the network. This invention employs the full intersection-union loss function. By introducing a center point distance penalty term and aspect ratio consistency constraints, it can still generate effective gradients when the bounding boxes do not intersect. At the same time, it constrains the predicted boxes to simultaneously approximate the real annotations in three dimensions: position, size, and shape, which significantly improves the localization accuracy of multi-leaf bounding boxes in densely occluded scenes.

[0068] Specifically, the principle of this invention is as follows: the solution to the above-mentioned technical problems can be solved by the following logically consistent technical chain. The essence of field illumination variation is the spatial non-uniformity of low-frequency illumination components in the image. Retinex theory decomposes the image into the product of illumination and reflection components. After estimating the low-frequency illumination components through Gaussian filtering, an adaptive power function transformation is applied to them, which can map images under different illumination conditions to similar brightness distribution ranges, thereby ensuring the statistical stability of the feature vectors extracted by subsequent convolutional kernels. Based on this, the Gamma parameter is set as a learnable weight and simultaneously optimized through backpropagation, enabling the network to further finely adjust residual illumination differences for specific data distributions, compensating for the lack of generalization of fixed preprocessing parameters. The convolutional block attention module guides the feature extraction process to concentrate on the tobacco leaf area through dual weighting of channel and spatial dimensions, reducing the contamination of feature expression by background pixels. This logically aligns with the physical fact that the baking characteristics are determined by the color and texture of the leaf itself. By preserving high-resolution shallow feature maps and fusing them with deep semantic features in the neck network, fine-grained texture information is retained while introducing global semantic context, providing a sufficient feature foundation for multi-leaf synchronous localization and classification. Optimal transport interpolation oversampling completes the minority class distribution at the feature space geometric structure level, while the modulation factor of the focal loss function suppresses easily classifiable samples at the gradient level. The synergistic effect of these two methods makes the network's ability to discriminate various baking characteristics tend to be balanced. The overall scheme is logically rigorous, and the functions of each module are complementary.

[0069] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.

[0070] The specific implementation method of step S01 is as follows: In the field, original images of the upper and middle leaves of flue-cured tobacco are collected under different light conditions such as sunny days, cloudy days, and morning and evening. Simultaneously, corresponding leaf samples are placed in a dark box for controlled experiments. The degree of yellowing, browning and weight change of the samples are recorded every 12 hours. According to the evaluation standard of flue-cured tobacco variety curing characteristics, the curing characteristics are divided into three categories: poor, medium and good. A database of the correspondence between field tobacco leaf images and curing characteristic categories is established.

[0071] The specific implementation of step S02 is as follows: Retinex-gamma joint correction processing is applied to the input field tobacco leaf image to output an image with uniform illumination. This processing is based on Retinex theory, which posits that an image is composed of the product of illumination and reflection components, with the reflection component carrying the true color and texture information of the object. The processing procedure is as follows: First, a Gaussian filter is applied to the input field tobacco leaf image to estimate the low-frequency illumination component. Then, the local mean of the low-frequency illumination component is calculated, and the gamma correction parameters are adaptively set based on the degree to which the local mean deviates from the neutral gray reference value of 128. When the local average is below 128 Take values ​​between 0.5 and 0.8, when the local mean is higher than 128. Using a value between 1.2 and 1.8, the final output is a uniformly illuminated image, expressed by the following formula:

[0072] ;

[0073] In the formula, Input pixel values ​​of tobacco leaf images in the field, in gray levels. The pixel values ​​of the image are used to equalize the illumination, and the unit is gray level. These are the pixel values ​​of the low-frequency illumination component estimated by Gaussian filtering, in gray levels. Maximum pixel value: 255, in grayscale levels. The gamma correction parameter is dimensionless and adaptively selected based on the deviation of the local mean from 128. The threshold range was determined through iterative search using multiple rounds of comparative experiments on a validation set covering all lighting conditions, with the average accuracy of model detection as the evaluation metric.

[0074] The specific implementation of step S03 is as follows: A bounding box is drawn for each tobacco leaf in the uniformly illuminated image using a labeling tool. The coordinates of the center point, width, height, and baking characteristic category label of the bounding box are recorded. Poor baking characteristics correspond to label 0, medium baking characteristics to label 1, and good baking characteristics to label 2. The training set and validation set are divided in an 8:2 ratio. Random rotation, random scaling, random horizontal flipping, brightness adjustment, and contrast adjustment are applied to the training set for data augmentation. Subsequently, 512-dimensional feature vectors are extracted from the three classes of samples in the training set. These feature vectors are obtained by forward propagation of a VGG network pre-trained on the ImageNet dataset and flattening the feature map before the last fully connected layer. The feature vector of each sample is denoted as . ,in For sample number index, , This represents the total number of samples in the training set. Calculate the Wasserstein-2 distance between classes, and perform optimal transport interpolation oversampling on the class pair with the largest distance. (Two classes) and The Wasserstein-2 distance formula between the characteristic distributions is expressed as follows:

[0075] ;

[0076] In the formula, , Categories With category Probability distribution in a 512-dimensional feature space For joint distribution, The marginal distributions are respectively and The set of all joint distributions For category The 512-dimensional feature vector of a certain sample, dimensionless For category The 512-dimensional feature vector of a certain sample, dimensionless for and The Euclidean distance between them is dimensionless. To normalize the baseline distance, the empirical value is taken as the mean of the Euclidean distances between the feature vectors of all samples in the training set, which is dimensionless. For category With category The Wasserstein-2 distance between feature distributions is dimensionless. For the class pair with the largest Wasserstein-2 distance, semantically consistent interpolation is performed on the minority class samples in the 512-dimensional feature vector space according to the optimal transmission path. After generating a synthetic feature vector, it is mapped back to the image space by the deconvolutional network decoder, which is symmetric to the VGG network encoder, and the resulting synthetic minority class samples are added to the training set.

[0077] The specific implementation of step S04 is as follows: An improved deep convolutional detection network is constructed based on the YOLOv8 framework, comprising a backbone network, a neck network, and a detection head. An adaptive gamma correction module is embedded at the network input, which can learn gamma parameters. The initial value is set to 1.0, and the gradient is updated synchronously with the other parameters of the network. The correction formula is expressed as follows:

[0078] ;

[0079] In the formula, These are the adjusted image pixel values ​​output by the adaptive gamma correction module, in gray levels. The pixel values ​​of the image are used to equalize the illumination, and the unit is gray level. Maximum pixel value: 255, in grayscale levels. The learnable gamma parameter in the adaptive gamma correction module is dimensionless and initialized to 1.0. This is a constant coefficient, dimensionless, with a default value of 1.0. The backbone network retains a 160×160 resolution shallow feature map after the attention module in the convolutional block. The neck network upsamples deep semantic features through a feature pyramid network and fuses them with this shallow feature map. The detection head has regression, classification, and small object detection output branches. The small object detection output branch connects to the 160×160 resolution shallow feature map, targeting objects with pixel areas smaller than... The small-sized tobacco leaf targets provide independent detection output.

[0080] The specific implementation of step S05 is as follows: A joint loss function is established, with the regression loss using the perfect intersection-over-union loss function and the classification loss using the focus loss function. The weighted summation constitutes the total loss, as expressed in the following formula:

[0081] ;

[0082] In the formula, Total loss, dimensionless The regression task loss weight coefficients are dimensionless. The weights for the classification task loss are dimensionless. For complete intersection and union ratio loss, dimensionless The loss is a focal loss and is dimensionless. and The optimal combination is determined by conducting comparative experiments on multiple candidate values ​​on the validation set and selecting the combination with the highest mean accuracy. The Complete Intersection Over Union (CIO) loss function is expressed as follows:

[0083] ;

[0084] In the formula, To predict bounding boxes For the true bounding box The area of ​​their intersection is expressed in units of 1. The area of ​​the union of the two is given by the unit . To predict the center point of the bounding box Center point of the actual bounding box The Euclidean distance between them, in pixels (px) The diagonal length of the minimum closure region covering the predicted bounding box and the ground truth bounding box, in pixels (px); aspect ratio consistency metric. , dimensionless, of which , To predict the width and height of the bounding box, in pixels (px). , The actual bounding box width and height are in pixels (px); aspect ratio consistency weight parameter. Dimensionless. The formula for the focus loss function is as follows:

[0085] ;

[0086] In the formula, Let be the network's predicted probability of the true class, which is dimensionless. This is a category weighting factor, dimensionless, adaptively calculated based on the proportion of samples from each category in the training set, with higher weights assigned to categories with smaller sample sizes. The focusing parameter is dimensionless and is set to 2.0; the modulation factor... exist When the value approaches 1, it tends to approach 0 to reduce the loss contribution of easily classified samples. When the value is small, it approaches 1 to preserve the loss contribution of hard-to-classify samples. During training, a cosine annealing learning rate adjustment strategy is used, and the learning rate update formula is expressed as follows:

[0087] ;

[0088] In the formula, For the first Learning rate per round, dimensionless The initial learning rate is [value], which is the default value. Dimensionless The minimum learning rate is set to [default value]. Dimensionless This represents the total number of training rounds, defaulting to 150. This refers to the current training epoch. The parameter update formula is expressed as follows:

[0089] ;

[0090] In the formula, For the first Layer network parameters at the 1st The value of the round is dimensionless. For the first Layer network parameters at the 1st The update value for each round is dimensionless. Total loss For the Layer parameters The partial derivatives of are dimensionless and are calculated layer by layer using the chain rule, specifically as follows: ,in For the first The layer output is dimensionless; parameter updates are performed using the Adam optimizer. The mean precision is calculated on the validation set after every 5 training epochs. Early stopping is triggered if the mean precision on the validation set fails to improve after 10 consecutive training epochs. The network parameters with the highest mean precision on the validation set are saved as the optimal network parameters.

[0091] The specific implementation of step S06 is as follows: Acquire field tobacco leaf images to be judged, scale them to 640×640 pixels, and normalize the pixel values ​​to the range of 0 to 1. Then, input an improved deep convolutional detection network loaded with optimal network parameters. After feature extraction, multi-scale fusion, and detection head calculation, output the position coordinates of candidate bounding boxes and the probability distribution of baking characteristic categories. Redundant candidate bounding boxes are removed by non-maximum suppression, and the category label corresponding to the highest probability is taken as the judgment result. Category labels 0, 1, and 2 are output as poor baking characteristics, medium baking characteristics, and good baking characteristics, respectively. Non-maximum suppression sorts candidate bounding boxes from high to low confidence, retaining the candidate bounding box with the highest confidence. For candidate bounding boxes with an intersection-union ratio exceeding the suppression threshold, confidence decay is applied instead of direct deletion to retain effective candidate bounding boxes in occluded scenarios. The suppression threshold is determined by experimenting with candidate values ​​in the range of 0.3 to 0.7 on a validation set containing occluded scenarios, with a step size of 0.05, and selecting the value corresponding to the optimal combination of false negative rate and duplicate detection rate.

[0092] To better understand and implement this invention, the following is a specific application scenario of the invention, Example 2: To verify the effect of the invention, technicians set up a test environment, selected field tobacco leaves from a major flue-cured tobacco producing area as the data source, and collected field images of the upper and middle leaves of flue-cured tobacco. The collection period covered three typical light periods: 07:00 to 08:00 in the morning, 11:00 to 13:00 at noon, and 17:00 to 18:00 in the evening. It also included three weather conditions: sunny, cloudy, and overcast. A total of 1860 field tobacco leaf images were collected, each image containing 1 to 7 tobacco leaf targets, for a total of 7432 tobacco leaf targets labeled. Simultaneously with image acquisition, technicians collected corresponding leaf samples from the same plant and conducted baking characteristic calibration experiments in a dark, room-temperature chamber at 12-hour intervals. The observations were conducted continuously for 96 hours. The baking characteristic category was determined based on the yellowing rate, browning rate, and water loss rate. The number of samples in the three categories of poor, medium, and good baking characteristics were 1682, 3104, and 2646, respectively. The number of samples in each category is shown in Table 1.

[0093] Table 1. Distribution of Sample Quantities for Tobacco Leaf Curing Characteristics

[0094]

[0095] As shown in Table 1, there is a significant imbalance among the three types of samples, with the sample with poor baking characteristics accounting for the lowest proportion, providing a practical operational scenario for subsequent optimal transmission interpolation oversampling.

[0096] Technicians used annotation tools to draw bounding boxes for each tobacco leaf in the uniformly illuminated image. They recorded the coordinates of the bounding box's center point, width, and height using the center-point method, and assigned corresponding category labels, such as... Figure 3 The diagram shows the bounding box annotation results of tobacco leaf images in the field. The training set consisted of 1488 images, and the validation set consisted of 372 images, divided at an 8:2 ratio. Data augmentation was performed on the training set using random rotation (±15°), random scaling (0.8 to 1.2 times), random horizontal flipping, brightness adjustment (±20%), and contrast adjustment (±15%), expanding the total number of training samples to 5950. Subsequently, a pre-trained VGG network was used to extract the 512-dimensional feature vectors of each sample in the training set, and the Wasserstein-2 distance between categories was calculated. The results showed that the Wasserstein-2 distance was largest between the category with poor baking characteristics and the category with medium baking characteristics. Optimal transport interpolation oversampling was performed on the category with poor baking characteristics, generating 1422 synthetic samples to supplement the training set, thus balancing the total number of samples in the three categories. The number of samples in each category after oversampling is shown in Table 2.

[0097] Table 2. Number of samples in each category of the training set after oversampling.

[0098]

[0099] Improved deep convolutional detection networks are built on the YOLOv8 framework, such as... Figure 4 The diagram shows an improved deep convolutional network structure. An adaptive Gamma correction module is embedded at the network input, with the learnable Gamma parameter initially set to 1.0. The backbone network retains a 160×160 resolution shallow feature map after the attention module in the convolutional block, as shown below. Figure 5 The diagram shows a schematic of the network structure of the convolutional block attention module. Figure 6 The diagram shows the structure of the channel attention module, as follows: Figure 7 The diagram shows the spatial attention module structure; the neck network upsamples deep semantic features through a feature pyramid network and fuses them with a 160×160 resolution shallow feature map; the detection head is configured with a regression branch (12-channel bounding box position parameters), a classification branch (9-channel category probability distribution), and a small object detection output branch (accessing the 160×160 resolution shallow feature map), as shown below. Figure 3 The diagram shows the branch network structure of the detection head.

[0100] The joint loss function is composed of a weighted sum of the full intersection-over-union loss function and the focal loss function. and The candidate value combinations were determined through comparative experiments on the validation set, and the final result was selected. , Focus loss function focusing parameters The value is set to 2.0, and the class weight factor is adaptively calculated based on the proportion of samples in each class after oversampling; the cosine annealing learning rate adjustment strategy parameter is set to... , , The Adam optimizer is used to perform parameter updates. The mean accuracy is calculated on the validation set after every 5 training epochs. If the mean accuracy on the validation set does not improve after 10 consecutive training epochs, an early stop is triggered. Finally, an early stop is triggered on the 128th training epoch, and the optimal network parameters corresponding to the 118th training epoch are saved. At this time, the mean accuracy on the validation set is 0.913.

[0101] To verify the actual discrimination capability in the field, technicians collected 240 images of tobacco leaves to be discriminated against in tobacco fields that did not overlap with the training set. The collection time covered three time periods: early morning, noon, and evening. After scaling the images to 640×640 pixels and normalizing them to the range of 0 to 1, they were input into an improved deep convolutional detection network with optimal network parameters. After removing redundant candidate bounding boxes through non-maximum suppression (the suppression threshold was determined to be 0.50 through stepwise experiments), the location coordinates and baking characteristics of each tobacco leaf target were output. The discrimination accuracy of each category is shown in Table 3.

[0102] Table 3. Precision of Baking Characteristics for Each Category

[0103]

[0104] As shown in Table 3, the average accuracy of the three baking characteristics all exceeded 0.89, and the overall average accuracy reached 0.913. The accuracy of the poor baking characteristics category was significantly improved after oversampling equalization. The discrimination accuracy of the three categories was relatively close, which confirms the effectiveness of the optimal transmission interpolation oversampling and focus loss function in coordinating the equalization of sample distribution.

[0105] Compared to traditional dark-box testing methods, this invention brings the following technological advancements: Traditional dark-box testing relies on destructive sampling, consuming physical samples for each assessment and requiring tens of hours of observation. In contrast, this invention transforms the baking characteristic discrimination process into an image feature extraction and classification inference problem. Through end-to-end processing of field illumination homogenization images using convolutional neural networks, the inference time for each image is reduced to the millisecond level, achieving a fundamental shift from destructive sampling to non-contact, non-destructive discrimination. Furthermore, traditional image recognition methods suffer from unstable classification accuracy due to feature distribution drift caused by illumination variations across different time periods in the field. This invention employs dual illumination compensation—Retinex-Gamma joint correction and adaptive Gamma correction learnable module—to stabilize the response of the convolutional kernel under different illumination conditions, thus eliminating the influence of illumination drift at the feature statistics level. Traditional methods typically discriminate based on single leaves, failing to process multiple leaves simultaneously in an image. This invention, by preserving high-resolution shallow feature maps and introducing a small target detection output branch, achieves simultaneous localization and baking characteristic classification of multiple leaves, breaking through the efficiency bottleneck of single-leaf discrimination and providing a technical foundation for statistical analysis of the baking characteristic distribution of tobacco plants.

[0106] It should be noted that the variables involved in this invention are explained in detail in Table 4.

[0107] Table 4. Variable Explanation Table

[0108]

[0109] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for rapid identification of the curing characteristics of tobacco leaves in the field, characterized in that, Includes the following steps: Images of upper and middle leaves of flue-cured tobacco were collected in the field under different light conditions, including sunny days, cloudy days, and morning and evening. Corresponding tobacco leaf samples were taken simultaneously for dark box experiments. The degree of yellowing, browning and weight changes were observed every 12 hours. According to the evaluation standard of flue-cured tobacco variety curing characteristics, the curing characteristics were divided into three categories: poor, medium and good. A database of the correspondence between field tobacco leaf images and curing characteristic categories was established. Retinex-Gamma joint correction processing is performed on the tobacco leaf images in the field to output an image with uniform illumination; the Gamma correction parameters are adaptively set according to the degree of deviation between the local mean and the neutral gray reference value of the tobacco leaf images in the field. Using a labeling tool, bounding boxes were drawn for each tobacco leaf in the uniformly illuminated image. The coordinates of the center point of the bounding box, the width of the bounding box, the height of the bounding box, and the category label of the baking characteristics were recorded for each tobacco leaf. Poor baking characteristics corresponded to category label 0, medium baking characteristics to category label 1, and good baking characteristics to category label 2. The training set and validation set were divided in an 8:2 ratio. Data augmentation was performed on the training set by applying random rotation, random scaling, random horizontal flipping, brightness adjustment, and contrast adjustment. 512-dimensional feature vectors were extracted from the three classes of samples in the training set, and the Wasserstein-2 distance between the classes was calculated. The class pair with the largest Wasserstein-2 distance was subjected to optimal transfer interpolation oversampling to generate minority class synthetic samples to supplement the training set. An improved deep convolutional detection network is constructed: an adaptive Gamma correction module is embedded at the network input, the backbone network retains a 160×160 resolution shallow feature map after the convolutional block attention module, the neck network upsamples the deep semantic features through the feature pyramid network and fuses them with the 160×160 resolution shallow feature map, and the detection head is set with regression branch, classification branch and small target detection output branch. A joint loss function is established, with the regression loss using the full intersection-over-union loss function and the classification loss using the focus loss function. The weighted summation constitutes the total loss. The focus parameter of the focus loss function is set to 2.0, and the class weight factor is adaptively calculated based on the proportion of each class sample in the training set. The training set is input into the improved deep convolutional detection network for iterative training, and the parameters of the improved deep convolutional detection network that have the highest mean average accuracy on the validation set are saved as the optimal network parameters. Images of tobacco leaves in the field to be judged are acquired, scaled to 640×640 pixels, and the pixel values ​​are normalized to the range of 0 to 1. The images are then input into an improved deep convolutional detection network with optimal network parameters. After feature extraction, multi-scale fusion, and detection head calculation, the candidate bounding box position coordinates and the probability distribution of baking characteristic categories are output. Redundant candidate bounding boxes are removed by non-maximum suppression, and the category label corresponding to the highest probability is taken as the judgment result. The category labels 0, 1, and 2 are output as poor baking characteristics, medium baking characteristics, and good baking characteristics, respectively.

2. The method for rapid identification of field tobacco curing characteristics according to claim 1, characterized in that, The Retinex-Gamma joint correction process specifically involves: performing Gaussian filtering on the input field tobacco image to estimate the low-frequency light component; adaptively setting the Gamma correction parameter based on the degree to which the local mean of the low-frequency light component deviates from the neutral gray reference value of 128; applying a power function transformation to the low-frequency light component; dividing the input field tobacco image by the low-frequency light component and then multiplying it by the Gamma-corrected light component to output a uniformly illuminated image.

3. The method for rapid identification of field tobacco curing characteristics according to claim 2, characterized in that, The core formula for the Retinex-Gamma joint correction process is: ,in To input the pixel values ​​of a field tobacco leaf image, To equalize the image pixel values ​​for illumination, These are the pixel values ​​of the low-frequency illumination component estimated using Gaussian filtering. The maximum pixel value is 255. This is the Gamma correction parameter.

4. The method for rapid identification of field tobacco curing characteristics according to claim 3, characterized in that, The 512-dimensional feature vector is obtained by flattening the feature map before the last fully connected layer by forward propagating the training set images through the VGG network. The VGG network uses weights pre-trained on the ImageNet dataset.

5. The method for rapid identification of field tobacco curing characteristics according to claim 4, characterized in that, The optimal transmission interpolation oversampling specifically involves performing semantically consistent interpolation on the minority class sample distribution in the 512-dimensional feature vector space based on the optimal transmission path. After generating a synthetic feature vector, it is mapped back to the image space through a decoder. The decoder is a deconvolutional network symmetrical to the VGG network encoder, and its mapping capability is obtained by joint training with the encoder.

6. The method for rapid determination of field tobacco curing characteristics according to claim 5, characterized in that, The convolutional block attention module is specifically implemented through a cascaded mechanism of channel attention module and spatial attention module: the channel attention module applies global max pooling and global average pooling to the backbone network feature map and then feeds it into a shared multilayer perceptron. The sum is activated by Sigmoid to generate a channel-dimensional weight vector, which is then multiplied channel by channel with the backbone network feature map to output a channel-weighted feature map; the spatial attention module takes the maximum value and the mean value along the channel dimension of the channel-weighted feature map, concatenates them, performs a 7×7 convolution and activates Sigmoid to generate a spatial weight map, and multiplies it element by element to output a spatial weighted feature map.

7. The method for rapid determination of field tobacco curing characteristics according to claim 6, characterized in that, The correction formula of the adaptive Gamma correction module is as follows: ,in The adjusted image pixel values ​​output by the adaptive Gamma correction module. To equalize the image pixel values ​​for illumination, The maximum pixel value is 255. For the learnable Gamma parameters in the adaptive Gamma correction module, is a constant coefficient.

8. The method for rapid determination of field tobacco curing characteristics according to claim 7, characterized in that, The formula for the complete cross-union ratio loss function is as follows: ,in To predict the bounding box for the regression branch, For the true bounding box, To predict the Euclidean distance between the center point of the bounding box and the center point of the true bounding box, To cover the diagonal length of the minimum closure region between the predicted bounding box and the true bounding box, This is a measure of aspect ratio consistency. This is the aspect ratio consistency weight parameter.

9. The method for rapid determination of field tobacco curing characteristics according to claim 8, characterized in that, The formula for the focus loss function is as follows: ,in To improve the prediction probability of the true class in deep convolutional detection networks, For category weighting factors, To focus parameters, is the modulation factor.

10. The method for rapid identification of field tobacco curing characteristics according to claim 9, characterized in that, The formula for the joint loss function is as follows: ,in and These are the loss weight coefficients for regression and classification tasks, respectively. The loss weight coefficients are determined by conducting comparative experiments on multiple candidate values ​​on the validation set and selecting the combination of loss weight coefficients that corresponds to the highest average accuracy.