A non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves
Through image acquisition and deep learning technology, the HSV color space and a dual-branch CNN network structure are used to perform non-destructive detection of the chlorophyll and carotenoid content in fresh tobacco leaves, which solves the problems of time-consuming detection and sample destruction, and achieves fast and accurate pigment content prediction.
Patent Information
- Application Number
- CN202511005494.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-22
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-07-22
AI Technical Summary
The existing technology for detecting the chlorophyll and carotenoid content in fresh tobacco leaves is time-consuming and destroys the samples, which cannot meet the needs of rapid detection.
Abstract: Fresh tobacco leaves are detected by scanning the image acquisition darkroom and industrial area array camera. RGB images of fresh tobacco leaves are collected. HSV color space processing and a dual-branch CNN network structure are used for non-destructive inspection. Channel attention, spatial attention and cross attention modules are combined, and Grad-CAM technology is used for visualization analysis.
It achieves rapid and accurate prediction of the pigment content of fresh tobacco leaves, avoids sample damage, and shortens the detection time from 48 hours to seconds, meeting the needs of real-time production monitoring.
Smart Images

Figure CN120510153B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image data processing, and in particular relates to a non-destructive detection method for chlorophyll and carotenoid contents in tobacco leaves. Background Art
[0002] Fresh tobacco quality is a comprehensive characteristic of fresh tobacco leaves. Chlorophyll and carotenoids, as key pigment components, are crucial for photosynthesis, metabolism, and the formation of aroma precursors. During the curing and baking process, the content of these pigments directly affects the color and yellowing characteristics of the tobacco leaves and serves as the primary reference for water color determination. Traditional testing methods rely primarily on physical and chemical experiments, such as the ethanol extraction method, which involves soaking fresh tobacco leaves in 95% ethanol for 48 hours. The absorbance at a specific wavelength is then measured using a spectrophotometer to calculate the pigment content. However, traditional testing techniques have significant drawbacks. First, the experimental process requires destroying the tobacco leaf sample, making it impossible to perform repeated testing or subsequent processing on the same sample. Second, the testing cycle can take over 48 hours, making it inadequate for rapid testing in tobacco production. Furthermore, the experimental process requires the use of large amounts of organic solvents, which not only increases material costs but also poses environmental risks. With the advancement of image processing technology, machine vision has found widespread application in agriculture, such as identifying crop maturity and predicting plant pigment content. Researchers both domestically and internationally have attempted to apply machine vision technology to tobacco leaf feature extraction and composition prediction. However, existing research has primarily focused on predictive models for single components. Simultaneous non-destructive testing of multiple pigment components in fresh tobacco leaves still faces challenges in accuracy and real-time performance. Specifically, existing technologies for measuring chlorophyll and carotenoid content in fresh tobacco leaves are time-consuming and sample-damaging. Summary of the Invention
[0003] In view of this, the present invention provides a non-destructive detection method for the chlorophyll and carotenoid content in tobacco leaves, which can solve the technical problems in the prior art that the detection of chlorophyll and carotenoid content in fresh tobacco leaves is time-consuming and destroys samples.
[0004] The present invention is implemented as follows: The present invention provides a non-destructive detection method for the chlorophyll and carotenoid content in tobacco leaves, comprising: constructing an image acquisition darkroom, using an industrial area array camera configured with an array LED light source to collect RGB images of fresh tobacco leaves; converting the RGB images of fresh tobacco leaves into an HSV color space, performing mask threshold segmentation, opening and closing operations, contour extraction, and rotation correction to obtain a single corrected RGB image of fresh tobacco leaves; constructing a dual-branch CNN network structure, wherein the first branch is used to predict the chlorophyll content, and the second branch is used to predict the carotenoid content, and each branch comprises two groups of convolutional layers, a batch normalization layer, and a ReLU activation function. The two branches are integrated with channel attention module and spatial attention module, and a cross attention module is set between the two branches. A single rectified fresh tobacco leaf RGB image is adjusted to a fixed pixel size as the network input, and the optimizer is used to train the dual-branch CNN network structure. The performance of the dual-branch CNN network structure is evaluated by three indicators: determination coefficient, root mean square error, and relative analysis error. The Grad-CAM technology is used to visualize the prediction results of each branch of the dual-branch CNN network structure, and the heat map of the chlorophyll branch attention area and the carotenoid branch attention area are obtained as the detection results.
[0005] Among them, the size of the image acquisition darkroom is 100×100×100 cm, the pixel of the industrial area array camera is 20 million, and the power of the array LED light source is 12 watts.
[0006] Among them, the hue threshold range is set to 27-125 in the HSV color space, the saturation threshold is set to 14, and the lightness threshold is set to 27.
[0007] Among them, in the dual-branch CNN network structure, the number of output channels of the two branches are 32 and 64 respectively.
[0008] Among them, the channel attention module is a network module that extracts channel features in parallel through global average pooling and global maximum pooling, fuses them after processing by a multi-layer perceptron, and adaptively enhances the spectral channel weights related to pigment content.
[0009] Among them, the spatial attention module is a network module that generates a two-dimensional feature map through maximum pooling and average pooling operations on the channel dimension, and then obtains a spatial weight matrix through convolution processing to enhance the characteristics of pigment concentration-sensitive areas in the leaves.
[0010] Among them, the cross-attention module is a network module that establishes a dynamic interactive relationship between the chlorophyll branch and the carotenoid branch. The features of one branch are used as queries to retrieve the key-value pairs of the other branch. The weights are calculated by scaling the dot product attention to capture the physiological correlation between the two pigments.
[0011] Among them, Grad-CAM technology is a gradient-weighted class activation mapping, which generates a heat map by analyzing the gradient information of the prediction result of the last convolution output of the convolutional neural network to show the degree of attention the network pays to the key areas of the image.
[0012] Among them, the dual-branch CNN network structure consists of two convolutional neural network branches with independent parameters. After processing by the attention module, the spatial resolution is reduced to 14×14. The adaptive average pooling layer uniformly adjusts the feature map to 7×7 and is processed by a multi-layer perceptron regression head. Each regression head contains a fully connected layer with Dropout regularization.
[0013] Among them, before the training of the dual-branch CNN network structure, the chlorophyll content and carotenoid content of fresh tobacco leaves were obtained through the ethanol extraction method. The ethanol extraction method was to use 95% ethanol to soak fresh tobacco leaves for 48 hours, and use a spectrophotometer to measure the absorbance at wavelengths of 470 nanometers, 649 nanometers and 665 nanometers to calculate the chlorophyll content and carotenoid content.
[0014] This method uses an industrial area scan camera to capture RGB images of fresh tobacco leaves, combines image preprocessing with the HSV color space, and constructs a dual-branch CNN network structure with a multi-attention mechanism, achieving rapid and accurate prediction of the pigment content of fresh tobacco leaves. This method successfully addresses the core challenges of traditional detection technologies. First, the non-destructive testing method of optical imaging completely avoids sample destruction, preserving the integrity of the tobacco leaves and enabling the same sample to be used for subsequent processing or multiple tests. Second, through end-to-end prediction using a deep learning model, the detection time is reduced from 48 hours with traditional methods to seconds, significantly improving detection efficiency and meeting the needs of real-time production monitoring. Through an innovative dual-branch network structure and hybrid attention mechanism, this method specifically extracts features related to chlorophyll and carotenoid content, achieving simultaneous and accurate prediction of both pigments. Furthermore, Grad-CAM visualization technology enhances the model's interpretability and verifies that the model's attention area aligns with the physiological characteristics of pigment distribution. This method addresses the technical challenges of existing techniques for the time-consuming and sample-damaging detection of chlorophyll and carotenoid content in fresh tobacco leaves, providing reliable technical support for the non-destructive and rapid detection of pigment content in fresh tobacco leaves. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is a flow chart of pigment extraction of the present invention;
[0016] Figure 2 The image acquisition device of the present invention;
[0017] Figure 3 This is a flowchart of image data preprocessing of the present invention;
[0018] Figure 4 Schematic diagram of tobacco leaf preprocessing images of the present invention, where (a) is the original tobacco leaf image, (b) is the mask threshold segmentation image, (c) is the masked color image, (d) is the filtered image after opening and closing operations, and (e) is a single corrected image;
[0019] Figure 5 Schematic diagram of the channel attention mechanism of the present invention;
[0020] Figure 6 Schematic diagram of the spatial attention mechanism of the present invention;
[0021] Figure 7 Schematic diagram of the channel-spatial hybrid attention module of the present invention;
[0022] Figure 8 Schematic diagram of the cross-attention mechanism of the present invention, where (a) is the chlorophyll branch cross-attention module, and (b) is the carotenoid branch cross-attention module;
[0023] Figure 9 Schematic diagram of the network structure of the present invention;
[0024] Figure 10 This is a schematic diagram of the chlorophyll branch focus area of the present invention;
[0025] Figure 11 This is a schematic diagram of the carotenoid branch focus area of the present invention;
[0026] Figure 12 is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, 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 with reference to the accompanying drawings in the embodiments of the present invention.
[0028] like Figure 12 FIG. 1 is a flow chart of a non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves provided by the present invention. The method comprises the following steps:
[0029] The specific implementation of the above steps is described in detail below.
[0030] The specific implementation of step S01 involves establishing a standard image acquisition environment to ensure stable and interference-free images of fresh tobacco leaves. First, a darkroom measuring 100 × 100 × 100 cm is designed. It is made of opaque material and coated with a matte black interior to reduce light reflection. Two 12-watt array-type LED white light sources with a color temperature of 5000K are fixed to the top of the darkroom. The light sources are 60 cm vertically from the imaging platform, and 40 cm apart to ensure uniform light distribution. Next, a horizontal imaging platform is installed in the center of the darkroom. The platform surface is coated with a pure black background material to absorb excess light and enhance the contrast between the tobacco leaves and the background. Finally, a 20-megapixel industrial area scan camera (MV-CS200-10GM) is mounted 50 cm above the imaging platform. The camera is equipped with an MVL-KF3524M-25MP lens with a focal length of 35 mm and an aperture of F3.5. During image acquisition, two fresh tobacco leaves of identical appearance were placed on the imaging platform. The camera control software was used to adjust the exposure time to 15 milliseconds, the gain to 0, and the white balance to ensure accurate color reproduction. This step, by creating a stable lighting environment and standardized shooting parameters, provides a high-quality and consistent data source for subsequent image processing and deep learning model construction.
[0031] The specific implementation of step S02 involves performing a series of processing on the collected RGB image of fresh tobacco leaves to isolate the tobacco leaf regions and perform spatial correction. First, the original RGB image is converted to the HSV color space using a color space conversion function. The HSV model represents color characteristics using three channels: hue, saturation, and lightness. This model more closely aligns with human color perception and facilitates the extraction of color regions. Mask threshold parameters are then set based on the color characteristics of the fresh tobacco leaves. After multiple experiments, the hue threshold range was determined to be 27 to 125, the saturation threshold to be greater than or equal to 14, and the lightness threshold to be greater than or equal to 27. These thresholds are then used to binarize the HSV image, assigning a value of 1 to pixels that meet the criteria and 0 to the remaining pixels, thereby generating a preliminary binary mask of the tobacco leaf regions. To improve mask quality, an opening operation with a 5×5 circular kernel as the structuring element is performed, iterated five times, to eliminate artifacts between veins. A closing operation with a 5×5 rectangular kernel as the structuring element is performed, iterated three times, to fill in edge gaps. A median filter with a window size of 15 is applied to smooth the mask boundaries. The target contours are then extracted using the Canny edge detection algorithm. The contour retrieval mode RETR_EXTERNAL is used to extract only the outermost contours. Area threshold filtering is applied to retain contours larger than 500 pixels. These contours are sorted in descending order by area, with the top two digits representing the valid tobacco leaf region. Finally, the parameters of the minimum bounding rectangle (MBR) for each target contour are calculated, including the center point coordinates, width, height, and rotation angle. This angle information is used to perform an affine transformation on the original image to correct the orientation of the tobacco leaf's principal axis, outputting a single, corrected RGB image of the fresh tobacco leaf. This step uses image processing techniques to accurately segment the target tobacco leaf region and perform angle correction, providing standardized input data for the deep learning model.
[0032] The specific implementation of step S03 involves designing and building a two-branch hybrid attention convolutional neural network capable of simultaneously predicting chlorophyll and carotenoid content. First, the overall network architecture is designed, employing a parallel two-branch structure, with each branch responsible for predicting chlorophyll and carotenoid content. Next, an initial feature extraction module is constructed. The two branches have identical structures but independent parameters. Each branch contains two sets of convolutional layers: the first set has 32 output channels, and the second set has 64 output channels. Each convolutional layer uses a 3×3 convolution kernel with 1 padding, followed by a batch normalization layer, a Reluctant Unit (ReLU) activation function, and a max pooling layer with a kernel size of 2 and a stride of 2. This gradually reduces the spatial resolution of the input image from 224×224 to 56×56. Next, a channel attention module is introduced in each branch, employing a compression-excitation network architecture. Global average pooling and global max pooling are performed on the feature maps to extract channel-level descriptors. These descriptors are processed and fused using a shared multilayer perceptron. The weights of different channels are adaptively adjusted to enhance the response of feature channels related to pigment content. A spatial attention module is also introduced, performing max and average pooling operations on the channel dimension to concatenate and generate a two-dimensional feature descriptor. This is then processed with a 7×7 convolution kernel to generate a spatial weight matrix, highlighting features in areas sensitive to pigment concentration within the leaf. A cross-attention module is then designed to establish an information exchange mechanism between the two branches. The features of one branch are used as query vectors, and the features of the other branch as key-value pairs. Weight coefficients are calculated using scaled dot-product attention, achieving cross-branch feature enhancement and capturing the physiological association between chlorophyll and carotenoids. Finally, within each branch, deeper convolutional layers are implemented, including convolutional modules with 128 and 256 output channels and pooling layers. This reduces the spatial resolution of the feature map to 14×14. The feature map is then resized to a uniform 7×7 size using an adaptive average pooling layer. After flattening, it is processed by a fully connected neural network, and each branch outputs a corresponding pigment content prediction value. This dual-branch architecture and multi-attention mechanism enable the accurate extraction and prediction of features related to different pigment contents in tobacco leaf images.
[0033] The specific embodiment of step S04 is to obtain the actual pigment content of tobacco leaves as neural network training labels by chemical analysis means. First, a six-point sampling method is adopted to cut samples from different positions of fresh tobacco leaves, avoiding the main leaf veins. Each sample weighs about 0.2 grams, and after chopping and mixing, it is placed in a reagent tube. Then 95% ethanol is added as an extraction solvent, the volume is adjusted to 25 milliliters, and after sealing, it is placed in a light-shielding, closed environment and soaked for 48 hours to ensure that chlorophyll and carotenoids are fully dissolved. After the leaves turn white completely, the extract is taken out and the absorbance at 470 nanometers, 649 nanometers and 665 nanometers is measured using a spectrophotometer. Then, based on the Lambert-Beer law, chlorophyll a, chlorophyll b and total chlorophyll content are calculated. The calculation formula adopts an internationally accepted pigment determination formula. By measuring the wavelength absorbance, multiplying it by the empirical coefficient of the corresponding pigment, then dividing it by the sample fresh weight and the extract volume, the content of each pigment is obtained. Similarly, carotenoid content is calculated by subtracting the chlorophyll interference at 470 nm from the absorbance at that wavelength and multiplying it by a conversion factor. The resulting chlorophyll and carotenoid content data serves as training labels for the deep learning model, establishing a mapping between image features and pigment content. This step uses standard chemical analysis methods to obtain accurate pigment content data, providing reliable supervised learning targets for the neural network.
[0034] Step S05 involves training and optimizing a two-branch convolutional neural network to establish a mapping relationship between fresh tobacco leaf images and pigment content. First, the single rectified fresh tobacco leaf RGB image obtained in step S02 is resized to a uniform size of 224×224 pixels using bilinear interpolation. The image is then normalized by subtracting the mean μ = [0.485, 0.456, 0.406] from each pixel's RGB channel and dividing it by the standard deviation σ = [0.229, 0.224, 0.225] to eliminate lighting variations and accelerate model convergence. All samples are then randomly divided into training and test sets in a 3:1 ratio. The training set is used for network parameter optimization, while the test set is used to evaluate model generalization performance. The network training parameters are then set, using the Adam optimizer. The initial learning rate is set to 0.001, the momentum parameters β1 = 0.9, β2 = 0.999, the weight decay coefficient is 0.0001, the batch size is 64, and the mean squared error function is used as the loss function. An early stopping strategy is also implemented, stopping training when the validation loss fails to decrease for 10 consecutive rounds. During training, each batch of data first passes through the initial convolutional layer of the two-branch CNN network constructed in step S03 to extract basic features. Key features are then enhanced through the channel attention module and the spatial attention module. Information exchange between the two branches is then achieved through the cross-attention module. Finally, the predicted values for chlorophyll and carotenoids are output through subsequent convolutional and fully connected layers. This step iteratively optimizes the network parameters to achieve a precise mapping from RGB images to pigment content, providing a computational foundation for nondestructive testing.
[0035] The specific implementation method of step S06 is to adopt multiple scientific indicators to evaluate the model prediction performance to ensure the reliability of the method. First, the coefficient of determination is calculated. This index represents the degree of fit between the model prediction value and the actual value. By calculating the ratio of the sum of squares of the difference between the predicted value and the actual value and the sum of squares of the difference between the actual value and the mean value, and deducting this ratio from 1, the closer the coefficient of determination is to 1, the better the model fitting effect. Then the root mean square error is calculated. This index directly reflects the average deviation size of the predicted value and the actual value. By calculating the square root of the mean value of the sum of squares of the difference between the predicted value and the actual value, the root mean square error is smaller, and the prediction accuracy is higher. Finally, the relative analysis error is calculated. This index is the ratio of the prediction set standard deviation to the root mean square error. By calculating the square root of the square root of the square of the difference between the actual value and the mean value divided by the square root of the square of the difference between the predicted value and the actual value, the relative analysis error is greater than 2, indicating that the model has good prediction performance. When the relative analysis error is greater than 3, the model prediction performance is excellent. In the model evaluation process, the three indices are calculated for the two prediction tasks of chlorophyll and carotenoid respectively to comprehensively judge the overall performance of the model. This step quantifies the model prediction accuracy through standardized evaluation indicators, providing a scientific basis for the practicality of the method.
[0036] Step S07 is implemented by visually analyzing the model's decision-making process using Grad-CAM technology to verify the validity of the method. First, fresh tobacco leaf images from the test set are fed into a trained two-branch CNN network. The feature map output by the model at the last convolutional layer is recorded. The feature map has dimensions of 256×14×14. The gradient of the chlorophyll prediction value with respect to this feature map is then calculated. The gradient has the same dimensions as the feature map, reflecting the influence of different spatial location features on the prediction result. Global average pooling is then performed on the gradients of each channel to obtain 256 channel weight coefficients, representing the importance of each channel to the prediction result. The channel weights are then multiplied by the feature map and summed over the channel dimension to obtain an initial 14×14 activation map. Negative responses are then filtered using a ReLU function, retaining regions that contribute positively to the prediction. Finally, the activation map is upsampled to the original image size of 224×224, normalized, and converted into a heatmap for display overlaid with the original image. Similarly, the same steps are performed for the carotenoid prediction branch to obtain the corresponding heatmap. By analyzing the spatial distribution differences between the two heatmaps, we can observe that the model focuses on leaf regions enriched in chlorophyll and carotenoids, respectively, validating the rationale behind the model's predictions. For chlorophyll predictions, the heatmap typically responds strongly at the leaf base and around the main vein, corresponding to physiologically high chlorophyll content. For carotenoid predictions, the heatmap responds most strongly at the leaf tip and margin, corresponding to locations where carotenoids preferentially accumulate under stress conditions. This step enhances the interpretability of the model through visualization techniques, validating its ability to make predictions based on the pigment distribution characteristics of different tobacco leaf regions.
[0037] The detailed neural network structure and dataset construction process are as follows: The constructed two-branch hybrid attention convolutional neural network adopts a parallel two-branch architecture, with each branch independently responsible for predicting the content of a specific pigment. The network input is a 224×224×3 RGB image tensor. The initial feature extraction module of each branch consists of two sets of convolutional layers: the first set is Conv(3×3, 32)+BN+ReLU+MaxPool(2×2), and the second set is Conv(3×3, 64)+BN+ReLU+MaxPool(2×2), which reduces the feature map size to 56×56×64. The channel attention module adopts the SE-Net architecture with a compression ratio of 16, consisting of global pooling, a fully connected layer, and a sigmoid activation function. The spatial attention module uses a 7×7 convolution kernel to generate a spatial weight map. The cross-attention module between the two branches uses a multi-head self-attention mechanism with 8 heads and an internal dimension of 64. The attention weights are calculated via scaled dot products. After the cross-attention layer, the feature map size is reduced to 14×14×256 through two sets of convolutional layers: Conv(3×3, 128)+BN+ReLU+MaxPool(2×2) and Conv(3×3, 256)+BN+ReLU+MaxPool(2×2). Finally, adaptive average pooling is performed to obtain a 7×7×256 feature map, which is flattened into a 12544-dimensional vector. The output is a single numerical value of the pigment content prediction through a three-layer fully connected network: FC(12544, 256)+Dropout(0.5)+ReLU, FC(256, 128)+Dropout(0.3)+ReLU, and FC(128, 1). During the dataset construction process, 300 leaves from the middle part of Yunyan 87 were first collected and RGB images were acquired using a darkroom camera system. Then, an image processing process was used to extract individual leaf images. The pigment content of each leaf was then obtained as a label using ethanol extraction. Finally, the samples were randomly divided into a training set of 225 leaves and a test set of 75 leaves in a 3:1 ratio. The training set was used for model parameter optimization, and the test set was used to evaluate generalization performance.
[0038] Specifically, the core technology of this invention lies in establishing a mapping relationship between RGB images of fresh tobacco leaves and their pigment content, and improving prediction accuracy through network structure optimization and an attention mechanism. Its working principle can be divided into three key steps: image acquisition and preprocessing, network structure design, and integration of the attention mechanism.
[0039] During image acquisition and preprocessing, this method utilizes a standardized image acquisition environment, employing a 100×100×100 cm darkroom, a 20-megapixel industrial area array camera, and a 12-watt array LED light source to ensure consistent image acquisition conditions. To improve image processing efficiency, RGB images are converted to the HSV color space, and hue, saturation, and brightness thresholds are set for precise segmentation. Standardized leaf images are generated through opening and closing operations, contour extraction, and rotation correction, providing a unified input format for subsequent analysis.
[0040] The core innovation of this invention lies in the network architecture design, which utilizes a dual-branch CNN structure to predict chlorophyll and carotenoid content separately. This design reflects the biological relationship between these two pigments, which are both related and distinct, and can capture both common and specific information. Each branch initially comprises two sets of convolutional layers, a batch normalization layer, a ReLU activation function, and a max pooling layer, gradually reducing the spatial resolution of the feature map. After processing through deeper convolutional modules, the predicted value is output through adaptive average pooling and a multi-layer perceptron regression head.
[0041] The fusion of attention mechanisms is key to improving model performance. This paper integrates three attention mechanisms: a channel attention module extracts channel features through global average pooling and max pooling, enhancing the spectral channel weights related to pigment content; a spatial attention module generates a spatial weight matrix to highlight pigment-sensitive areas in the leaf; and a cross-attention module establishes dynamic interactions between the two branches to capture the physiological correlation between the two pigments. This multi-layered attention mechanism enables the model to enhance key features from different dimensions, improving prediction accuracy.
[0042] Trained with the Adam optimizer, a learning rate of 0.001, and a batch size of 64, the model was able to effectively learn the complex mapping relationship between images and pigment content. The application of Grad-CAM technology further verified that the model's focus area was consistent with the actual pigment distribution, demonstrating the physiological rationality of the prediction results and providing a scientific basis for the model's application.
[0043] A specific embodiment 1 of the present invention is provided below. The specific implementation of each step in this embodiment 1 is described in detail as follows.
[0044] The specific implementation of step S01 involves establishing a standard image acquisition environment to ensure stable and interference-free images of fresh tobacco leaves. First, a darkroom measuring 100 × 100 × 100 cm is designed. It is made of opaque material and coated with a matte black interior to reduce light reflection. Two 12-watt array-type LED white light sources with a color temperature of 5000K are fixed to the top of the darkroom. The light sources are 60 cm vertically from the imaging platform, and 40 cm apart to ensure uniform light distribution. Next, a horizontal imaging platform is installed in the center of the darkroom. The platform surface is coated with a pure black background material to absorb excess light and enhance the contrast between the tobacco leaves and the background. Finally, a 20-megapixel industrial area scan camera (MV-CS200-10GM) is mounted 50 cm above the imaging platform. The camera is equipped with an MVL-KF3524M-25MP lens with a focal length of 35 mm and an aperture of F3.5. During image acquisition, two fresh tobacco leaves of identical appearance were placed on the imaging platform. The camera control software was used to adjust the exposure time to 15 milliseconds, the gain to 0, and the white balance to ensure accurate color reproduction. This step, by creating a stable lighting environment and standardized shooting parameters, provides a high-quality and consistent data source for subsequent image processing and deep learning model construction.
[0045] The specific implementation of step S02 is to perform a series of processing on the collected RGB image of fresh tobacco leaves, separate the tobacco leaf areas, and perform spatial correction. First, the original RGB image is converted to the HSV color space using a color space conversion function. The HSV model represents color characteristics using three channels: hue, saturation, and lightness. This model is more consistent with the way humans perceive color and facilitates the extraction of color areas. Then, based on the color characteristics of the fresh tobacco leaves, the mask threshold parameters are set. After multiple experiments, it was determined that the hue threshold range is 27 to 125, the saturation threshold is greater than or equal to 14, and the lightness threshold is greater than or equal to 27. The mathematical expression for the mask binarization process is:
[0046] ;
[0047] Where, The mask binary image is at coordinate The pixel value at ; The hue channel in the HSV color space is at coordinates The value at The saturation channel in the HSV color space is at coordinates The value at The coordinates of the lightness channel in the HSV color space are The value at .
[0048] Then use the opening and closing operation to process the binary mask. The mathematical expression of the opening operation is:
[0049] ;
[0050] Where, is the mask image after the opening operation; is the original mask binary image; As the structural element, a 5×5 circular kernel is used; Indicates corrosion operation; represents the expansion operation; Indicates the opening operation, which is performed iteratively 5 times.
[0051] The mathematical expression of the closing operation is:
[0052] ;
[0053] Where, is the mask image after closing operation; is the mask image after the opening operation; As the structural element, a 5×5 rectangular kernel is used; represents the expansion operation; Indicates corrosion operation; Represents a closing operation, which is performed iteratively 3 times.
[0054] Then apply a median filter to smooth the boundaries:
[0055] ;
[0056] Where, is the filtered mask image; is the mask image after closing operation; is the filter window, with a size of 15×15 pixels; Represents the median operation.
[0057] The Canny edge detection algorithm is then used to extract the contours. The area threshold of the extracted contours is set to 500 pixels, and contours with an area smaller than the threshold are filtered out. The minimum bounding rectangle parameters are calculated for the retained contours, including the center point. ,width ,high and rotation angle Finally, an affine transformation is performed on the original image based on the rotation angle to correct the main axis of the tobacco leaf. This step uses image processing technology to accurately segment the target tobacco leaf area and perform angle correction, providing standardized input data for the deep learning model.
[0058] The specific implementation of step S03 is to design and build a dual-branch hybrid attention convolutional neural network that can simultaneously predict the content of chlorophyll and carotenoids. First, the overall architecture of the network is designed, and a parallel dual-branch structure is adopted. Each branch is responsible for predicting the content of chlorophyll and carotenoids. Then the initial feature extraction module is constructed. The two branches have the same structure but independent parameters. Each branch contains two groups of convolutional layers. The first group has 32 output channels, and the second group has 64 output channels. Each group of convolutional layers uses a 3×3 convolution kernel and a padding of 1. It is followed by a batch normalization layer, a ReLU activation function, and a maximum pooling layer with a kernel size of 2 and a stride of 2, which gradually reduces the spatial resolution of the input image from 224×224 to 56×56. Then, a channel attention module is introduced in each branch to perform attention on the feature map F∈ Perform global average pooling and global maximum pooling operations to extract channel-level descriptors. The mathematical expression of the channel attention module is:
[0059] ;
[0060] ;
[0061] ;
[0062] ;
[0063] ;
[0064] ;
[0065] Where, is the c-th channel of the feature map F; is the channel descriptor after average pooling; is the channel descriptor after maximum pooling; and is the weight matrix of the multilayer perceptron, r is the compression ratio, and its value is 16; is the ReLU activation function; is the Sigmoid activation function; is the channel attention weight; is the weighted feature map.
[0066] At the same time, the spatial attention module is introduced to perform maximum pooling and average pooling operations on the channel dimension and concatenate to generate a two-dimensional feature descriptor. The mathematical expression of the spatial attention module is:
[0067] ;
[0068] ;
[0069] ;
[0070] ;
[0071] ;
[0072] Where, is the channel average pooling result; is the channel maximum pooling result; is the splicing feature; Represents a 7×7 convolution operation; is the Sigmoid activation function; is the spatial attention weight matrix; is the weighted feature map.
[0073] Then we design a cross-attention module to establish an information interaction mechanism between the two branches. The mathematical expression of the cross-attention module is:
[0074] ;
[0075] ;
[0076] ;
[0077] ;
[0078] ;
[0079] Where, and These are the features of chlorophyll and carotenoid branches after channel spatial attention processing; 、 and is the projection matrix; 、 and are query, key, and value matrices respectively; is the scaling factor, which is the square root of the feature dimension; is the attention mapping result; The output features of the chlorophyll branch after incorporating the carotenoid branch information. Similarly, the carotenoid branch also incorporates the chlorophyll branch information through the cross-attention mechanism. The expression is similar to the above, with the variable labels swapped.
[0080] Finally, deeper convolutional layers are added within each branch, including convolutional modules with 128 and 256 output channels and pooling layers. This reduces the spatial resolution of the feature map to 14×14. Adaptive average pooling layers resize the feature map to a uniform 7×7 size. After flattening, the map is processed by a fully connected neural network, and each branch outputs its corresponding pigment content prediction. This step, through the design of a dual-branch architecture and a multi-attention mechanism, enables the precise extraction and prediction of features related to different pigment contents in tobacco leaf images.
[0081] The specific implementation method of step S04 is to obtain the actual pigment content of tobacco leaves as neural network training labels through chemical analysis. First, a six-point sampling method is used to cut samples from different positions of fresh tobacco leaves, avoiding the main veins. Each sample weighs about 0.2 grams, and is cut into pieces and mixed before being placed in a reagent tube. Then 95% ethanol is added as the extraction solvent, and the volume is adjusted to 25 milliliters. After sealing, it is placed in a light-shielded, closed environment for soaking and extraction for 48 hours to ensure that chlorophyll and carotenoids are fully dissolved. After the leaves are completely white, the extract is taken out and the absorbance values at wavelengths of 470 nanometers, 649 nanometers and 665 nanometers are measured using a spectrophotometer. Then, based on the Lambert-Beer law, the chlorophyll a, chlorophyll b and total chlorophyll contents are calculated. The calculation formula is:
[0082] ;
[0083] ;
[0084] ;
[0085] ;
[0086] Where, 、 、 are the absorbance values of the spectrophotometer at 470 nm, 649 nm, and 665 nm, respectively; is the volume of the extract in milliliters; is the fresh weight of the fresh tobacco leaf sample, in grams. Constants 13.95, 6.88, 24.96, 7.32, and 0.27 are empirical constants determined based on the molar extinction coefficients of different pigments at different wavelengths. The resulting chlorophyll and carotenoid content data serve as training labels for the deep learning model, establishing a mapping between image features and pigment content. This step uses standard chemical analysis methods to obtain accurate pigment content data, providing reliable supervised learning targets for the neural network.
[0087] The specific implementation of step S05 is to train and optimize a two-branch convolutional neural network to establish a mapping relationship between the fresh tobacco leaf image and the pigment content. First, the single rectified fresh tobacco leaf RGB image obtained in step S02 is resized to a uniform size of 224×224 pixels using a bilinear interpolation method. Then, the image is pre-processed by standardization. The mathematical expression is:
[0088] ;
[0089] Where, is the resized image; is the mean of the three RGB channels; is the standard deviation of the RGB three channels; is the normalized image.
[0090] Then all samples are randomly divided into training set and test set in a ratio of 3:1. The training set is used for network parameter optimization, and the test set is used to evaluate the generalization performance of the model. Then the network training parameters are set, and the Adam optimizer is selected. The initial learning rate is set to 0.001 and the momentum parameter is set to 0. , The weight decay coefficient is 0.0001, the batch size is 64, and the mean squared error function is used as the loss function. An early stopping strategy is also set, and training is terminated when the validation loss does not decrease for 10 consecutive rounds. During training, each batch of data first passes through the initial convolutional layer of the two-branch CNN network constructed in step S03 to extract basic features. Then, key features are enhanced through the channel attention module and the spatial attention module. The cross attention module then enables information exchange between the two branches. Finally, the predicted values of chlorophyll and carotenoids are output through subsequent convolutional layers and fully connected layers. This step iteratively optimizes the network parameters to achieve a precise mapping from RGB images to pigment content, providing a computational foundation for non-destructive testing.
[0091] The specific implementation of step S06 is to use multiple scientific indicators to evaluate the model prediction performance to ensure the reliability of the method. First, calculate the coefficient of determination, which is expressed as:
[0092] ;
[0093] Where, is the actual value of the i-th sample; is the predicted value of the i-th sample; is the average of the actual values; is the number of samples. The closer the coefficient of determination is to 1, the better the model fit is.
[0094] Then calculate the root mean square error, the expression is:
[0095] ;
[0096] Where, the variables have the same meanings as above. The smaller the root mean square error, the higher the prediction accuracy.
[0097] Finally, the relative analysis error is calculated and the expression is:
[0098] ;
[0099] Where, the variables have the same meanings as above. A relative analytical error greater than 2 indicates good model prediction performance, while a relative analytical error greater than 3 indicates excellent model prediction performance. During model evaluation, the three metrics above were calculated for both the chlorophyll and carotenoid prediction tasks to comprehensively assess the overall model performance. This step quantifies the model's prediction accuracy through standardized evaluation metrics, providing a scientific basis for the method's practicality.
[0100] The specific implementation of step S07 uses Grad-CAM technology to visualize and analyze the model's decision-making process to verify the rationality of the method. First, the fresh tobacco leaf images in the test set are input into the trained two-branch CNN network. The feature map output by the model at the last convolutional layer is recorded. The feature map dimension is 256×14×14. The gradient of the predicted value with respect to this feature map is then calculated. The gradient expression is:
[0101] ;
[0102] Where, is the predicted value; is the value of the kth channel of the feature map at position (i, j).
[0103] Then perform a global average pooling operation on the gradient of each channel to obtain the channel weight coefficient, which is expressed as:
[0104] ;
[0105] Where, is the weight coefficient of the kth channel; and are the height and width of the feature map, respectively.
[0106] The channel weight is then multiplied by the feature map and summed over the channel dimension to obtain the initial activation map, which is expressed as:
[0107] ;
[0108] Where, is the initial activation map; is the kth channel of the feature map; is the total number of channels.
[0109] Then, the negative response is filtered out by the ReLU function, retaining the areas that contribute positively to the prediction. The expression is:
[0110] ;
[0111] Where, is the activation map after filtering; represents the rectified linear unit function, defined as .
[0112] Finally, the activation map is upsampled to the original image size, and the expression is:
[0113] ;
[0114] Where, is the activation map after upsampling; represents the bicubic interpolation upsampling function; and are the height and width of the original image respectively.
[0115] After normalization, it is converted into a heat map, and the expression is:
[0116] ;
[0117] ;
[0118] ;
[0119] Where, is the normalized activation map; is the activation map after Gaussian filtering smoothing, is the Gaussian kernel, is 1.5; is the pseudo color mapping function; is the original image; For the final visualization result; It is the transparency parameter and its value is 0.5.
[0120] By analyzing the spatial distribution differences between the two heatmaps, we can observe that the model focuses on leaf regions enriched in chlorophyll and carotenoids, respectively, validating the rationale behind the model's predictions. For chlorophyll predictions, the heatmap typically responds strongly at the leaf base and around the main vein, corresponding to physiologically high chlorophyll content. For carotenoid predictions, the heatmap responds most strongly at the leaf tip and margin, corresponding to locations where carotenoids preferentially accumulate under stress conditions. This step enhances the interpretability of the model through visualization techniques, validating its ability to make predictions based on the pigment distribution characteristics of different tobacco leaf regions.
[0121] In order to better understand and implement the present invention, Example 2 of a specific application scenario of the present invention is provided below: In a tobacco leaf curing experiment conducted at the tobacco station in Sibao Town, Liancheng County, Longyan City, Fujian Province, researchers used the method of the present invention to conduct non-destructive detection of the chlorophyll and carotenoid content in fresh tobacco leaves of the Yunyan 87 variety from May to June 2024. The specific implementation process is as follows.
[0122] First, the researchers built a standardized image acquisition system. Figure 2 As shown, a 100 × 100 × 100 cm darkroom was constructed from high-quality plywood, with the interior coated in matte black to eliminate reflections. Two 12-watt array LED white light sources with a color temperature of 5000K were installed in the center of the darkroom's top, 40 cm apart and 60 cm vertically from the filming platform. A 60 × 60 cm matte black filming platform was placed in the center of the darkroom. A Hikvision MV-CS200-10GM industrial area scan camera equipped with a Hikvision MVL-KF3524M-25MP lens was mounted 50 cm above the platform. The camera parameters were set to: 20 megapixel resolution, 15 millisecond exposure time, 0 gain, F / 3.5 aperture, and automatic white balance calibration. During the acquisition process, two fresh tobacco leaves with similar morphology were selected each time and placed on the shooting platform. The shooting was triggered by the camera control software to obtain the initial RGB image with an image resolution of 5472×3648 pixels and a lossless PNG format. A total of 300 images of the middle leaves of Yunyan 87 were collected.
[0123] Secondly, the researchers preprocessed the acquired RGB images. Figure 3 The image data preprocessing process shown in the figure is to write a Python script and implement the image processing process based on the OpenCV library, including: converting the RGB image to the HSV color space; setting the segmentation threshold, that is, the hue range is 27-125, the saturation threshold is 14, and the lightness threshold is 27; generating a binary mask image; using the opening operation with a 5×5 circular kernel as the structural element (5 iterations) and the closing operation with a 5×5 rectangular kernel as the structural element (3 iterations), combined with the median filter with a window size of 15 to optimize the mask; using the Canny edge detection algorithm combined with contour retrieval to extract the tobacco leaf area, with the area threshold set to 500 pixels; calculating the minimum bounding rectangle parameters of the tobacco leaf contour, and performing affine transformation on the original image according to the rotation angle; cropping and saving the corrected single tobacco leaf image as an independent file, and adjusting it to a uniform size of 224×224 pixels. Figure 4Images from each stage of tobacco leaf preprocessing are presented, including the original leaf image, the masked threshold segmentation image, the masked color image, the filtered image after opening and closing operations, and a single rectified image. After preprocessing, the researchers obtained 300 standardized fresh tobacco leaf image samples, each of which was assigned a unique identification code to facilitate subsequent association with chemical analysis data.
[0124] At the same time, the researchers used ethanol extraction method to determine the pigment content of the corresponding tobacco leaf samples. Figure 1 The pigment extraction process shown uses a six-point sampling method. Approximately 0.2 grams of sample are collected from different locations on each tobacco leaf (avoiding the main veins). The sample is mixed and placed in a reagent tube. 25 ml of 95% ethanol is added, sealed, and allowed to soak in the dark for 48 hours. After the sample has completely faded, the absorbance of the extract is measured at wavelengths of 470 nm, 649 nm, and 665 nm using a UV-1800 UV-visible spectrophotometer. Chlorophyll a, chlorophyll b, total chlorophyll, and carotenoid contents are calculated using formulas. Chlorophyll content for all samples ranged from 1037 to 3856 mg / L, and carotenoid content ranged from 142 to 498 mg / L. Table 1 shows the pigment content results for some samples.
[0125] Table 1 Results of pigment content determination of some fresh tobacco leaf samples
[0126]
[0127] Next, the researchers set out to build a dual-branch hybrid attention convolutional neural network model. Figure 5 The channel attention mechanism shown, Figure 6 The spatial attention mechanism shown, Figure 7 The channel-spatial hybrid attention module shown and Figure 8 The cross attention mechanism shown in (a) and (b) is based on Figure 9The network structure shown in the figure uses the TensorFlow 2.4 framework and Python 3.7 programming language. The researchers designed a network called "Dual Branch Tobacco Network The neural network structure of "WithAttention" is as follows: the input layer receives a 224×224×3 RGB image; the initial feature extraction module contains two sets of convolutional layers, the first set has 32 output channels, and the second set has 64 output channels. Each set is followed by a batch normalization layer, a ReLU activation function, and a 2×2 max pooling layer. Then, a channel attention module and a spatial attention module are added to enhance the response of key features. A cross attention module is set between the two prediction branches to achieve information exchange. The image is further processed by a deep convolutional module, which includes two sets of convolutional layers with 128 and 256 channels and a pooling layer. Adaptive average pooling is used to resize the feature map to 7×7 size. After flattening, it passes through a three-layer fully connected network (with dimensions of 12544→256→128→1, respectively). Each hidden layer is configured with Dropout regularization (ratios of 0.5 and 0.3, respectively) and ReLU activation function, and finally outputs the predicted values of chlorophyll and carotenoid content, respectively.
[0128] To verify the effectiveness of different attention mechanism combinations, the researchers designed 8 sets of comparative experiments, as shown in Table 2.
[0129] Table 2 Different network configuration combinations
[0130]
[0131] The researchers randomly divided 300 samples into a training set (225) and a test set (75) in a ratio of 3:1, and used the Adam optimizer (learning rate 0.001) to train each network model. The batch size was set to 64, the training cycle was 200 rounds, and the early stopping strategy was used to avoid overfitting. After the training of each model was completed, the researchers used the coefficient of determination ( The model performance was evaluated using three indicators: root mean square error (RMSE) and relative analytical error (RPD), and the results are shown in Table 3.
[0132] Table 3 Comparison of model prediction performance of different network configurations (test set)
[0133]
[0134] As can be seen from Table 3, the Net6 model integrating serial channel-spatial attention and cross attention achieved the best results in predicting chlorophyll and carotenoid content. The predicted carotenoids were 0.895, RMSE was 143.697 mg / L, and RPD was 3.045. The results were compared with the traditional deep learning model, as shown in Table 4.
[0135] Table 4 Performance comparison between the proposed model and the classic deep learning model (test set)
[0136]
[0137] To verify the rationality of the model's predictions, the researchers used Grad-CAM technology to generate heat maps and analyze the tobacco leaf areas that the model focused on. Figure 10 The heat map of the chlorophyll branch focus area is displayed. It can be observed that the model mainly focuses on the leaf base and the area around the main vein when predicting the chlorophyll content, which is consistent with the actual distribution pattern of chlorophyll in tobacco leaves. Figure 11 A heatmap of the carotenoid branch's focus areas is displayed, demonstrating that the model primarily focuses on the leaf tip and margin when predicting carotenoid content, consistent with the physiological distribution of carotenoids in tobacco leaves. Table 5 shows the Grad-CAM heatmap analysis results for some samples. The distribution of heatmap values allows for a visual observation of the leaf regions that the model focuses on when predicting different pigment contents.
[0138] Table 5 Grad-CAM heat map analysis of some samples
[0139]
[0140] To further analyze the prediction effect of tobacco leaves of different maturity levels, the researchers divided the samples in the test set into three maturity levels according to their chlorophyll content: low maturity (chlorophyll content > 3000 mg / L), medium maturity (chlorophyll content 2000-3000 mg / L) and high maturity (chlorophyll content <2000 mg / L). The prediction performance of each level is shown in Table 6.
[0141] Table 6 Prediction performance of tobacco leaves at different maturity levels
[0142]
[0143] In this embodiment, the correlation between the fresh tobacco leaf area extracted by image segmentation and the actual measured value is shown in Table 7, which verifies the accuracy of the image processing method.
[0144] Table 7 Correlation between the area extracted by image segmentation and the actual measured value
[0145]
[0146] In this example, researchers achieved real-time monitoring of the tobacco leaf curing process for 93 tobacco leaf samples during the curing process. They first acquired RGB images of fresh tobacco leaves at different curing time points. After preprocessing, these images were fed into a trained two-branch attention network model to predict chlorophyll and carotenoid content in real time. The predicted results guided temperature and humidity control during the curing process. The predicted pigment content at different curing time points is shown in Table 8.
[0147] Table 8 Prediction of pigment content changes during tobacco leaf curing (partial data)
[0148]
[0149] Finally, the researchers conducted a comparative analysis of the traditional pigment content determination method and the method of the present invention. The traditional physical and chemical method for determining the content of chlorophyll and carotenoids mainly uses ethanol extraction combined with ultraviolet-visible spectrophotometry. It requires steps such as sample collection, pretreatment, solvent extraction, and absorbance measurement. The entire process takes about 50 to 60 hours, costs about 15 yuan per sample, and will destroy the integrity of the sample. The method of the present invention is based on RGB images and deep learning technology. After obtaining the standardized image, the pigment content of a single sample is predicted in only 0.3 seconds, without destroying the sample, and the cost per sample is reduced to about 0.5 yuan. In terms of accuracy, the traditional method has a measurement error of about 5% to 8% due to operational errors and sample heterogeneity, while the prediction error of the method of the present invention on the test set is about 6.8% to 7.4%. The accuracy is comparable but the efficiency is greatly improved. The method of the present invention can also achieve real-time monitoring during the baking process, while traditional methods are difficult to meet real-time requirements. In terms of promotion and application, the method of the present invention has been tested on a small scale in the tobacco leaf curing production at the tobacco station in Sibao Town, Liancheng County. By real-time monitoring of changes in chlorophyll and carotenoid content and guiding the adjustment of baking temperature and humidity parameters, the quality score of flue-cured tobacco was improved by an average of 5.2%, the baking energy consumption was reduced by 4.8%, and the curing baking time was shortened by 4.3%.
[0150] In summary, the method of the present invention realizes the rapid and non-destructive detection of chlorophyll and carotenoid content in fresh tobacco leaves by constructing a standardized image acquisition system, optimizing the image processing process, and designing a dual-branch hybrid attention convolutional neural network. Compared with traditional physical and chemical methods, it significantly improves the detection efficiency and economy while maintaining considerable measurement accuracy, providing technical support for the refined management of tobacco production.
[0151] It should be noted that the variables involved in the present invention are explained in detail as shown in Table 9(a) and Table 9(b) below.
[0152] Table 9(a) Variable Explanation Table
[0153]
[0154] Table 9(b) Variable Explanation Table
[0155]
[0156] The above description is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with this technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered by the scope of protection of the present invention.
Claims
1. A non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves, characterized in that: include: An image acquisition darkroom was constructed, and RGB images of fresh tobacco leaves were captured using an industrial area array camera equipped with an array LED light source. The RGB images were converted to the HSV color space, and mask threshold segmentation, opening and closing operations, contour extraction, and rotation correction were performed to obtain a single corrected RGB image of the fresh tobacco leaves. A two-branch CNN network structure was constructed, with the first branch used to predict chlorophyll content and the second branch used to predict carotenoid content. Each branch consisted of two sets of convolutional layers, a batch normalization layer, a ReLU activation function, and a maximum pooling layer. Both branches integrated a channel attention module and a spatial attention module, and a cross attention module was set between the two branches. A single rectified fresh tobacco leaf RGB image was resized to a fixed pixel size as network input, and an optimizer was used to train a two-branch CNN network structure. The performance of the two-branch CNN network structure was evaluated using three metrics: coefficient of determination, root mean square error, and relative analytical error. Grad-CAM technology was used to visualize the prediction results of each branch of the two-branch CNN network structure, generating heat maps of the chlorophyll branch's area of interest and the carotenoid branch's area of interest as detection results. The channel attention module is a network module that extracts channel features in parallel through global average pooling and global maximum pooling, fuses them after processing by a multi-layer perceptron, and adaptively enhances the spectral channel weights related to pigment content; The spatial attention module is a network module that generates a two-dimensional feature map through maximum pooling and average pooling operations on the channel dimension, and then obtains a spatial weight matrix through convolution processing to enhance the characteristics of pigment concentration-sensitive areas in the leaves; The cross-attention module is a network module that establishes a dynamic interactive relationship between the chlorophyll branch and the carotenoid branch. The features of one branch are used as queries to retrieve the key-value pairs of the other branch. The weights are calculated by scaling the dot product attention to capture the physiological correlation between the two pigments.
2. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 1, characterized in that: The size of the image acquisition darkroom is 100×100×100 cm, the industrial area array camera has 20 million pixels, and the array LED light source has a power of 12 watts.
3. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 2, characterized in that: In the HSV color space, the hue threshold range is set to 27-125, the saturation threshold is set to 14, and the lightness threshold is set to 27.
4. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 3, characterized in that: In the dual-branch CNN network structure, the number of output channels of the two branches are 32 and 64 respectively.
5. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 4, characterized in that: Grad-CAM technology is a gradient-weighted class activation mapping technology that generates a heat map by analyzing the gradient information of the prediction result of the last convolutional layer of the convolutional neural network to show the degree of attention paid by the network to the key areas of the image.
6. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 5, characterized in that: The dual-branch CNN network structure consists of two convolutional neural network branches with independent parameters. After processing by the attention module, the spatial resolution is reduced to 14×14. The adaptive average pooling layer uniformly adjusts the feature map to 7×7 and processes it through a multi-layer perceptron regression head. Each regression head contains a fully connected layer with Dropout regularization.
7. The non-destructive detection method for chlorophyll and carotenoid content in tobacco leaves according to claim 6, characterized in that: Before training the dual-branch CNN network structure, the chlorophyll content and carotenoid content of fresh tobacco leaves were obtained through the ethanol extraction method. The ethanol extraction method was to use 95% ethanol to extract fresh tobacco leaves for 48 hours, and the wavelength absorbance was measured by a spectrophotometer to calculate the chlorophyll content and carotenoid content.