Tobacco leaf part identification method, device and equipment and storage medium
Through the method of combining dense neural network and SE attention module with morphological characteristic parameters of tobacco leaves, the problem of low efficiency and accuracy of tobacco leaves is solved, and efficient and accurate automatic recognition is achieved.
Patent Information
- Application Number
- CN202510416713.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, the identification of tobacco leaf parts mainly relies on manual labor, resulting in low recognition rates and inaccurate recognition.
A model based on dense neural network was used to identify the tobacco leaf part by combining the SE attention module and the morphological characteristic parameters of tobacco leaf.
The efficiency and accuracy of tobacco leaf part recognition are improved, the inefficiency of manual recognition is avoided, the utilization of convolutional layers and the retention of core parameters are enhanced, and the recognition accuracy is improved.
Smart Images

Figure CN120260023A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of tobacco leaf position recognition, and particularly relates to a method, device, equipment and storage medium for recognizing the position of tobacco leaves. Background Art
[0002] The tobacco leaf industry is an important part of China's economy. In recent years, with the wave of artificial intelligence technology, cutting-edge technologies such as computer vision, data science and analysis have been successively applied in the tobacco industry to lead the digital transformation. Flue-cured tobacco acquisition is an important component module to ensure the quality of tobacco leaves.
[0003] Currently, the process of identifying the position of tobacco leaves mainly relies on manual operation. Affected by factors such as subjective randomness and uneven levels of workers, the problem of low recognition rate of tobacco leaf grading and inaccurate identification of tobacco leaf positions often occurs. Therefore, how to improve the efficiency and accuracy of tobacco leaf position recognition has become a technical problem to be solved at present. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a method, device, equipment and storage medium for recognizing the position of tobacco leaves, which can recognize the position of tobacco leaves by using a model constructed based on a dense neural network, and improve the efficiency and accuracy of tobacco leaf position recognition. The specific solutions are as follows:
[0005] In the first aspect, the present application provides a method for recognizing the position of tobacco leaves, including:
[0006] Collect target tobacco leaf images, obtain the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and construct a target training set according to the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the leaf tip angle of the target tobacco leaf image, and the target tobacco leaf image includes an image corresponding to a flat tobacco leaf and an image corresponding to a tobacco leaf with folded leaves;
[0007] Add an SE attention module and the tobacco leaf morphological feature parameters to a preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model; the preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network;
[0008] Iteratively train the target tobacco leaf position recognition model according to the target training set, a preset number of training times and a preset learning rate to obtain a corresponding trained tobacco leaf position recognition model;
[0009] Obtain a tobacco leaf image to be recognized, perform background removal on the tobacco leaf image to be recognized to obtain a corresponding processed tobacco leaf image, and use the trained tobacco leaf position recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf position corresponding to the processed tobacco leaf image.
[0010] Optionally, the tobacco leaf morphological feature parameters further include the color proportions corresponding to lemon yellow, orange, reddish brown, cyan, and variegated colors in the target tobacco leaf image, the pixel means, maximum values, minimum values, variances corresponding to the target tobacco leaf image in each target channel, and the length, width, and length-width ratio of the tobacco leaves in the target tobacco leaf image;
[0011] And, the target channels include the R, G, B channels in the RGB color space, the H, S, V channels in the HSV color space, and the L, A, B channels in the LAB color space.
[0012] Optionally, obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes:
[0013] Dividing the gray value range corresponding to the target tobacco leaf image into a target number of discrete levels according to the Otsu method, and obtaining the target probabilities of the appearance of the pixels of each of the discrete levels in the target tobacco leaf image;
[0014] Obtaining an inter-class variance expression based on each of the target probabilities, and determining the gray threshold corresponding to each of the target tobacco leaf images according to the inter-class variance expression;
[0015] Performing binarization processing on the target tobacco leaf image according to the gray threshold, and obtaining the gray map corresponding to each of the target tobacco leaf images according to the corresponding binarization processing result and the OpenCV image algorithm;
[0016] Obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images based on each of the gray maps.
[0017] Optionally, obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes:
[0018] Obtaining the largest circumscribed rectangle corresponding to the tobacco leaves in the gray map, and extracting the gray map according to the largest circumscribed rectangle to obtain an extracted image;
[0019] Determining the target coordinate values corresponding to the four vertices of the extracted image, obtaining the length and width of the tobacco leaves in the gray map according to the target coordinate values, and obtaining the length-width ratio corresponding to the tobacco leaves in the gray map according to the length and width of the tobacco leaves.
[0020] Optionally, obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes:
[0021] The extracted image is segmented into four rectangular regions with the same shape and area based on the length of the tobacco leaves in the extracted image, and a first target rectangular region and a second target rectangular region are determined from the four rectangular regions; wherein, the first target rectangular region and the second target rectangular region are rectangular regions located at both ends of the extracted image;
[0022] Compare the total number of pixels in the first target rectangular region and the second target rectangular region, and determine the target rectangular region with more total pixels as the tip region of the tobacco leaf;
[0023] Determine the tip vertex of the tobacco leaf in the tip region, make a first tangent and a second tangent to the tobacco leaf respectively starting from the tip vertex, and obtain the tip angle according to the slope difference between the slope of the first tangent and the slope of the second tangent.
[0024] Optionally, obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes:
[0025] Use the LAB color space to respectively obtain the regions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaves in the target tobacco leaf image, and calculate the color proportions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaves respectively.
[0026] Optionally, after performing background removal processing on the to-be-recognized tobacco leaf image, it further includes:
[0027] Obtain a first color proportion corresponding to cyan and a second color proportion corresponding to miscellaneous colors in the currently processed tobacco leaf image, determine whether the first color proportion is greater than a preset first proportion threshold, and determine whether the second color proportion is greater than a preset second proportion threshold;
[0028] If the first color proportion is not greater than the preset first proportion threshold and the second color proportion is not greater than the preset second proportion threshold, then jump to the step of using the trained tobacco leaf part recognition model to recognize the processed tobacco leaf image.
[0029] In a second aspect, the present application provides a tobacco leaf part recognition device, including:
[0030] A feature parameter acquisition module, configured to collect target tobacco leaf images, obtain tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and construct a target training set according to the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the tip angle of the target tobacco leaf image, and the target tobacco leaf image includes an image corresponding to a flat tobacco leaf and an image corresponding to a tobacco leaf with folded leaves;
[0031] A feature parameter adding module, which is used to add an SE attention module and the tobacco leaf morphological feature parameters to a preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model; the preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network;
[0032] A model training module, which is used to iteratively train the target tobacco leaf position recognition model according to the target training set, the preset number of training times, and the preset learning rate to obtain a corresponding trained tobacco leaf position recognition model;
[0033] A tobacco leaf position recognition module, which is used to obtain a tobacco leaf image to be recognized, perform background removal processing on the tobacco leaf image to be recognized to obtain a corresponding processed tobacco leaf image, and use the trained tobacco leaf position recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf position corresponding to the processed tobacco leaf image.
[0034] In a third aspect, the present application provides an electronic device, including:
[0035] A memory, which is used to store a computer program;
[0036] A processor, which is used to execute the computer program to implement the foregoing tobacco leaf position recognition method.
[0037] In a fourth aspect, the present application provides a computer-readable storage medium, which is used to store a computer program, and when the computer program is executed by a processor, the foregoing tobacco leaf position recognition method is implemented.
[0038] In this application, first, target tobacco leaf images are collected, and the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images are obtained. Then, a target training set is constructed based on the target tobacco leaf images and the tobacco leaf morphological feature parameters. The tobacco leaf morphological feature parameters include the tip angle of the target tobacco leaf image. The target tobacco leaf images include images corresponding to flat tobacco leaves and images corresponding to tobacco leaves with folded leaves. Then, an SE attention module and the tobacco leaf morphological feature parameters are added to a preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model. The preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network. After that, the target tobacco leaf position recognition model is iteratively trained according to the target training set, a preset number of training times, and a preset learning rate to obtain a corresponding trained tobacco leaf position recognition model. Finally, a tobacco leaf image to be recognized is obtained, the background of the tobacco leaf image to be recognized is removed to obtain a corresponding processed tobacco leaf image, and the trained tobacco leaf position recognition model is used to recognize the processed tobacco leaf image to determine the tobacco leaf position corresponding to the processed tobacco leaf image. It can be seen that in this application, by training a tobacco leaf position recognition model and using the trained tobacco leaf position recognition model to recognize the tobacco leaf position, the manual method of tobacco leaf position recognition is avoided, thus greatly improving the recognition efficiency. By using a dense neural network to construct a tobacco leaf recognition model and adding an SE attention module and tobacco leaf morphology features to the model, each layer in the tobacco leaf position recognition model can accept the multi-scale fusion method output from all previous layers, increasing the utilization of the convolutional layer and avoiding the loss of core parameters, thereby improving the accuracy of tobacco leaf position classification. By using the tobacco leaf morphological features including the tip angle to train the model, the trained model can recognize the tobacco leaf position according to the tip angle of the tobacco leaf, further improving the accuracy of tobacco leaf position recognition. Description of the Drawings
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.
[0040] Figure 1 Flowchart of a method for recognizing the position of tobacco leaves disclosed in this application;
[0041] Figure 2 Schematic diagram of an original tobacco leaf in this application;
[0042] Figure 3 Schematic diagram of the LAB color space structure disclosed in this application;
[0043] Figure 4 A schematic diagram of removing the background of tobacco leaves disclosed in this application;
[0044] Figure 5 A schematic diagram of the Densenet network architecture disclosed in this application;
[0045] Figure 6 A schematic diagram of the structure of the SE attention module disclosed in this application;
[0046] Figure 7 A schematic diagram of the model accuracy disclosed in this application;
[0047] Figure 8 A schematic diagram of extracting the mottled pixels of tobacco leaves disclosed in this application;
[0048] Figure 9 A schematic diagram of a method for determining the leaf tip angle disclosed in this application;
[0049] Figure 10 A schematic diagram of extracting the tobacco leaf image disclosed in this application;
[0050] Figure 11 A schematic diagram of the leaf tip angle disclosed in this application;
[0051] Figure 12 A schematic diagram of the structure of a tobacco leaf part recognition device disclosed in this application;
[0052] Figure 13 A schematic diagram of the structure of an electronic device disclosed in this application. Detailed implementation manners
[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0054] Currently, the process of identifying the tobacco leaf part mainly relies on manual operation, and this method has problems such as low recognition rate of tobacco leaf grading and inaccurate identification of tobacco leaf parts. For this reason, this application provides a method for identifying the tobacco leaf part, which can identify the tobacco leaf part by using a model constructed based on a dense neural network, improving the efficiency and accuracy of tobacco leaf part identification.
[0055] See Figure 1 As shown, an embodiment of the present invention discloses a method for identifying a tobacco leaf part, including:
[0056] Step S11: Collect target tobacco leaf images, obtain the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and construct a target training set based on the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the leaf tip angle of the target tobacco leaf image, and the target tobacco leaf images include images corresponding to flat tobacco leaves and images corresponding to tobacco leaves with folded leaves.
[0057] In this embodiment, the process of collecting target tobacco leaf images can be as follows: Collect and sort out flue-cured tobacco of the same variety at 5 positions, through artificial screening, select representative tobacco leaves at each position, and finally sort out 1000 flue-cured tobacco leaves at each position, a total of 5000 high-definition tobacco leaf image datasets.
[0058] During the actual acquisition of tobacco leaves, first screen out tobacco leaves that do not meet the acquisition requirements, such as green tobacco and miscellaneous tobacco. Green tobacco is that some green parts remain in the vein or leaf meat of the tobacco leaf because it is not completely dried during baking, and miscellaneous tobacco is caused by pests, diseases or over-baking of the tobacco leaf and cannot be used; secondly, identify the position of the tobacco leaf; then, based on the acquisition of the tobacco station, classify the grades according to different positions of the tobacco leaf. Among them, the differences in different positions of the tobacco leaf are shown in Table 1:
[0059] Table 1 Differences in morphological characteristics of different positions of tobacco leaves
[0060] Feature Upper tobacco Middle tobacco Lower tobacco Leaf shape The leaf tip is relatively pointed The leaf tip is conical The leaf tip is relatively blunt Color Red-brown and light-brown The color fades gradually The color fades at one-third of the tobacco leaf Wrinkle The wrinkle is deep, and the wrinkle groove is deep Slightly wrinkled Wrinkled at the leaf tip Leaf vein Relatively thick Moderate Relatively thin
[0061] As can be seen from Table 1 above, the leaf shapes of different tobacco leaf positions are different, especially in terms of length, width, leaf tip angle and color, with relatively large differences.
[0062] It should be noted that for tobacco leaves in the same position, the grade will be reduced by one level for every 50 mm reduction in length; and for injury, damage, and green content rate not greater than the standard and every increase in the specified value, the grade will be downgraded; similarly for the impurity content rate of tobacco leaves; and for the oil content, orange proportion, yellow proportion, etc. of tobacco leaves, the tobacco leaf morphological parameters strictly affect the grade determination of tobacco leaves.
[0063] To further distinguish the positions of tobacco leaves, the position identification of tobacco leaves is usually divided into 5 positions, namely the top leaf, the upper second-crop, the middle leaf, the lower second-crop and the bottom leaf. Among them, the original tobacco leaf images are as Figure 2 shown:
[0064] In this embodiment, first, it is necessary to obtain a target tobacco leaf image, which includes images corresponding to flat tobacco leaves and images corresponding to tobacco leaves with folded leaves. Then, operations such as background removal and grayscale processing are performed on the obtained target tobacco leaf image, and accordingly, the morphological features of the tobacco leaves corresponding to the target tobacco leaf image are obtained. In this embodiment, in addition to the leaf tip angle of the tobacco leaf image, the morphological feature parameters of the tobacco leaf also include: the color ratios corresponding to lemon yellow, orange, reddish brown, cyan, and miscellaneous colors in the target tobacco leaf image, the pixel means, maximum values, minimum values, variances corresponding to the target tobacco leaf image in each target channel, and the length, width, and length-width ratio of the tobacco leaves in the target tobacco leaf image. And the target channels include the R, G, B channels in the RGB (Red, Green, Blue) color space, the H, S, V channels in the HSV (Hue, Saturation, Value) color space, and the L, A, B channels in the LAB color space. That is, to accurately grasp the image color information of the tobacco leaves, the R, G, B, H, S, V, L, A, B channel information of the tobacco leaf image is analyzed using OpenCV, the pixels of 9 channels are extracted, and the corresponding channel means, variances, maximum values, and minimum values are calculated, a total of 36 morphological feature values.
[0065] In this embodiment, obtaining the morphological feature parameters of the tobacco leaves corresponding to each target tobacco leaf image includes: dividing the grayscale value range corresponding to the target tobacco leaf image into a target number of discrete levels according to the maximum inter-class variance method, and obtaining the target probabilities of the pixels in each of the discrete levels in the target tobacco leaf image; obtaining an inter-class variance expression based on each target probability, and determining the grayscale threshold corresponding to each target tobacco leaf image according to the inter-class variance expression; performing binary processing on the target tobacco leaf image according to the grayscale threshold, and obtaining the grayscale image corresponding to each target tobacco leaf image according to the corresponding binary processing result and the OpenCV image algorithm; obtaining the morphological feature parameters of the tobacco leaves corresponding to each target tobacco leaf image based on each grayscale image; it should be noted that the length, width, length-width ratio, and leaf tip angle corresponding to the target tobacco leaf image can be obtained based on the grayscale image; it should be noted that before performing grayscale processing on the target tobacco leaf image, it is also necessary to perform background removal processing on the collected target tobacco leaf image to obtain a target tobacco leaf image that only retains the tobacco leaf part. That is, the above grayscale processing operation is performed on the basis of the target tobacco leaf image that only retains the tobacco leaf part.
[0066] Taking Python as the development language, first, it is necessary to install the Anconda development environment, as well as algorithm packages such as OpenCV and Numpy to meet the model environment requirements. In addition, the color structure of the image corresponding to the target tobacco leaf image is composed of the LAB color space. The LAB color channels are divided into the L luminance channel, the A channel is the red-green ratio, and the B channel is the yellow-blue ratio. The LAB color structure diagram is asFigure 3 As shown, the value range of the L channel is [0, 100], and the value ranges of the A and B channels are both [-128, 128]. Experimental tests are carried out according to the LAB threshold space of the image. Finally, a target tobacco leaf image with only the tobacco leaf part retained in the tobacco leaf image is obtained. The target tobacco leaf image after background removal is as Figure 4 shown, including the background-removed images of the top leaf, the second upper tier, the middle tobacco, the second lower tier, and the bottom leaf, which are 5 parts.
[0067] In this embodiment, the process of obtaining the tobacco leaf morphological feature parameters corresponding to each target tobacco leaf image may specifically include: using the LAB color space to respectively obtain the regions corresponding to lemon yellow, orange yellow, reddish brown, cyan, and miscellaneous colors of the tobacco leaf in the target tobacco leaf image, and calculating the color proportions corresponding to lemon yellow, orange yellow, reddish brown, cyan, and miscellaneous colors of the tobacco leaf. Specifically, when calculating the color proportion of the tobacco leaf, the influence of the area of the black image is reduced as much as possible. Based on the cropped image of the tobacco leaf, three morphological feature values of the length, width, and length-width ratio of the tobacco leaf are obtained. That is, in order to reduce the influence of the black background part, in this embodiment, the proportion of each color is obtained based on the cropped tobacco leaf image with the maximum circumscribed rectangle of the tobacco leaf as the reference. Using the OpenCV image algorithm as a tool, the corresponding lemon yellow, orange yellow, reddish brown, cyan, and miscellaneous colors are intercepted by using the LAB color range threshold, and their color proportions are calculated to obtain 5 tobacco leaf morphological features of color proportions. Taking lemon yellow as an example, the calculation formula is as follows:
[0068] ;
[0069] where, is the proportion of lemon yellow, is the total value of the pixels of lemon yellow, and O is the total value of the pixels of the cropped image.
[0070] In addition to the color proportions of each color of the tobacco leaf in the target tobacco leaf image, this embodiment also needs to obtain the pixel mean, variance, maximum value, and minimum value of the target tobacco leaf image in the target channel, as well as the morphological features such as the length, width, length-width ratio, and leaf tip angle of the tobacco leaf in the target tobacco leaf image. That is, by obtaining 45 morphological features of the target tobacco leaf image, the understanding of the tobacco leaf part by the model can be deepened, thereby improving the accuracy of tobacco leaf part recognition; by collecting the tobacco leaf images corresponding to the folded tobacco leaves, the recognition accuracy of the parts of the tobacco leaves with irregular shapes by the model can be improved to a certain extent; based on the mechanism of the tobacco leaf image, the threshold interval for tobacco leaf background removal is found through the LAB threshold test experiment using OpenCV, avoiding the influence of impurities in the tobacco leaf image on the prediction accuracy and improving the recognition rate; by using the OpenCV image processing tool to extract the morphological features of the tobacco leaf, a total of 45 tobacco leaf morphological features are extracted; providing strong data support for the multi-modal model.
[0071] Step S12: Add an SE attention module and the tobacco leaf morphological feature parameters to the preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model; the preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network.
[0072] Neural network technology occupies an important position in image classification algorithms. With the continuous improvement of convolutional neural network CNN (Convolutional Neural Networks) and recurrent neural network RNN (Recurrent Neural Network) technologies, a large number of experimental attempts are required for the number of layers and width of traditional neural networks. With the advent of the Residual Neural Network Resnet, the problems of gradient explosion and gradient disappearance caused by the increase in the number of neural network layers are solved, the degradation of neural network performance is avoided, and important features in images are better extracted.
[0073] In this example, the architecture of the Densenet dense connection neural network (i.e., dense neural network), a variant of the Resnet residual neural network, is adopted, and improvements are made on this basis, and the attention mechanism module (i.e., SE attention module) is fused to improve the accuracy of tobacco leaf position classification. It should be noted that the advantage of the Densenet dense connection neural network is that each layer can accept the multi-scale fusion method of the outputs from all previous layers, which increases the utilization of convolutional layers and avoids the loss of core parameters; a residual structure module is adopted to effectively alleviate the gradient problem. Among them, the Densenet network architecture is as Figure 5 shown, including multiple convolutional layers. To enhance the dependence relationship between convolutional feature channels, in this embodiment, an SE (Squeeze-and-Excitation) attention mechanism module is added to the Densenet dense connection neural network. In this way, the dependence relationship between convolutional feature channels can be explicitly modeled to improve the quality of the representations generated by the network, enabling the network to learn global information relationships, selectively emphasize features, and suppress useless features. The network schematic diagram of the SE attention module is as Figure 6 shown, including a max pooling layer, an average pooling layer, etc.
[0074] In addition, to further improve the accuracy of the deep learning model, morphological features of tobacco leaves are added to the last layer of the deep learning model, i.e., the initial tobacco leaf position recognition model. In the recognition of the position of tobacco leaves, the length, width, length-width ratio, and leaf tip angle of tobacco leaves are important components of the morphological features of tobacco leaves for distinguishing the positions of tobacco leaves. Since deep learning is less sensitive to the size of tobacco leaves and the leaf tip angle has strong details, in order to better capture the core morphological features when classifying tobacco leaves and improve the recognition rate of the position of tobacco leaves by deep learning, the above-mentioned morphological feature parameters of tobacco leaves are added to the deep learning layer.
[0075] Based on the tobacco leaf position recognition model that fuses the morphological features of tobacco leaves, i.e., the activation function of the target tobacco leaf position recognition model uses the Relu function. The advantage of the Relu function is that it introduces a non-linear transformation, controls the output value between 0 and 1, and can intuitively obtain the similarity of the positions of tobacco leaves. The formula of the Relu function is:
[0076] ;
[0077] Among them, is the output value, x is the input value, is to take the maximum value.
[0078] By using a dense neural network to construct the initial tobacco leaf recognition model and adding the SE attention model and the morphological feature parameters of tobacco leaves to the initial tobacco leaf position recognition model, the problems of gradient explosion and gradient disappearance caused by the increase in the number of neural network layers are solved, the degradation of the performance of the neural network is avoided, and the sensitivity of deep learning to the morphological features of tobacco leaves is deepened, and the accuracy of tobacco leaf position recognition is improved; that is, in the tobacco leaf position recognition algorithm based on the Densenet dense connection neural network, the Transformer attention mechanism and some morphological features of tobacco leaves are added to improve the recognition accuracy of the position of tobacco leaves.
[0079] Step S13: Iteratively train the target tobacco leaf position recognition model according to the target training set, the preset number of training times, and the preset learning rate to obtain the corresponding trained tobacco leaf position recognition model.
[0080] It can be understood that, for the smooth progress of model training, in this embodiment, it is first necessary to build an artificial intelligence environment. Specifically, install Anconda 3.0, use Python as the development language, and install some installation packages such as OpenCV, Torch GPU version, Numpy, and Labelme that can meet the model operation requirements, so that the model versions can be compatible with each other. Use Pycharm as the deep learning development IDE (Integrated Development Environment), and select the virtual environment of Anconda as the model environment in Pycharm.
[0081] In this embodiment, it is necessary to train the target tobacco leaf part recognition model. Perform background removal on the target tobacco leaf image, label it according to the tobacco leaf part, construct a training set, and use the Python development language to build a Densenet and Transformer with the corresponding deep learning algorithm environment to train the model. In a specific implementation, the number of training times can be set to 30, the step size to 16, and the learning rate to 0.0001. Finally, the part recognition rate of the trained tobacco leaf part recognition model is 92.7%. Among them, the line graph showing the accuracy of tobacco leaf part recognition is as Figure 7 shown. The overall recognition accuracy of the model first increases and then stabilizes as the number of training times increases.
[0082] Step S14: Obtain the tobacco leaf image to be recognized, perform background removal on the tobacco leaf image to be recognized to obtain the corresponding processed tobacco leaf image, and use the trained tobacco leaf part recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf part corresponding to the processed tobacco leaf image.
[0083] In this embodiment, after removing the background of the tobacco leaf image to be recognized, it further includes: obtaining the first color proportion corresponding to the cyan and the second color proportion corresponding to the miscellaneous color in the currently processed tobacco leaf image, judging whether the first color proportion is greater than the preset first proportion threshold, and judging whether the second color proportion is greater than the preset second proportion threshold; if the first color proportion is not greater than the preset first proportion threshold and the second color proportion is not greater than the preset second proportion threshold, then jump to the step of using the trained tobacco leaf part recognition model to recognize the processed tobacco leaf image; it can be understood that if any one of the first color proportion or the second color proportion exceeds the corresponding proportion threshold, it is determined that the tobacco leaf corresponding to the currently processed tobacco leaf image does not meet the standard, and the subsequent operation of tobacco leaf part recognition is stopped; it should be noted that the preset first proportion threshold and the preset second proportion threshold in this embodiment can be dynamically set according to the actual acquisition requirements of tobacco leaves, and no specific limitation is made here.
[0084] That is, in this embodiment, the OpenCV image processing algorithm is used to identify the green content rate and impurity content rate in tobacco leaves, and the tobacco leaves that do not meet the purchase requirements are removed, without the need for further identification of the parts of the green and miscellaneous tobacco that do not meet the conditions, thus reducing the model calculation amount. It can be understood that the judgment standard for green and miscellaneous tobacco is that the proportion of the variegated area does not exceed 20%; and the proportion of the green area is about 5% during actual purchase. By further checking the literature, it shows that the variegated area cannot exceed 20%, and there are two cases where the proportion of the green area does not exceed 10% or does not exceed 8%. Therefore, OpenCV is used to extract the green and variegated parts of the tobacco leaves, and calculate the ratio of their pixel values to the total pixel values to screen out the green and miscellaneous tobacco. Among them, the schematic diagram of the threshold extraction of the variegated pixels of the green and miscellaneous tobacco is as Figure 8 shown.
[0085] Thus, it can be seen that in this application, by training the tobacco leaf part recognition model and using the trained tobacco leaf part recognition model to identify the tobacco leaf parts, the method of using manual means to identify the tobacco leaf parts is avoided, thus greatly improving the recognition efficiency; by using a dense neural network to construct the tobacco leaf recognition model and adding an SE attention module and tobacco leaf morphological features to the model, each layer in the tobacco leaf part recognition model can accept the multi-scale fusion method output from all the previous layers, increasing the utilization of the convolutional layer and avoiding the loss of core parameters, thus improving the accuracy of tobacco leaf part classification; by using the tobacco leaf morphological features including the leaf tip angle to train the model, the trained model can identify the tobacco leaf parts according to the leaf tip angle of the tobacco leaf, further improving the accuracy of tobacco leaf part recognition.
[0086] Based on the previous embodiment, this application describes the overall process of identifying the parts of tobacco leaves. Next, this application will elaborate in detail on the operation of extracting the leaf tip angle in the tobacco leaf morphological feature parameters. See Figure 9 shown, this embodiment of the application discloses a method for determining the leaf tip angle, including:
[0087] Step S21, obtain the grayscale image corresponding to the target tobacco leaf image, obtain the largest circumscribed rectangle frame corresponding to the tobacco leaf in the grayscale image, and extract the grayscale image according to the largest circumscribed rectangle frame to obtain the extracted image.
[0088] In this embodiment, first, the target tobacco leaf image after removing the background needs to be grayscaled. The specific process is as follows: The tobacco leaf image after removing the background is binarized by the OTSU maximum inter-class variance method. The assumption of the OTSU algorithm is that there is a threshold TH that divides all the pixels of the image into two categories (less than TH) and (greater than TH). Let the gray value of the image be 1 - m levels, and the pixels with the gray value are , the total number of pixels N and the pixels of each gray level The probability is:
[0089] ;
[0090] Divide it into and Two groups, and the probabilities of the two groups are respectively:
[0091] ;
[0092] ;
[0093] Among them, and are The probabilities of the pixels in the group, and are The probabilities of the pixels in the group;
[0094] The average values and of the two groups are respectively:
[0095] ;
[0096] ;
[0097] The average gray value of the full sampling of the image is:
[0098] ;
[0099] The between-class variance is:
[0100] ;
[0101] Obtain the gray threshold in the tobacco leaf image (the gray level k that can maximize the between-class variance is the OTSU threshold), and use the following formula to keep only the part of 0 and 1 for the pixel points in the image:
[0102] ;
[0103] Use the OpenCV image algorithm to obtain the grayscale image of the tobacco leaf, and based on the maximum circumscribed rectangle of the tobacco leaf, crop the tobacco leaf image. Correspondingly, the process of obtaining the morphological feature parameters of each target tobacco leaf image can specifically include: obtaining the maximum circumscribed rectangle corresponding to the tobacco leaf in the grayscale image, and extracting the grayscale image according to the maximum circumscribed rectangle to obtain the extracted image; determining the target coordinate values corresponding to the four vertices of the extracted image, obtaining the length and width of the tobacco leaf in the grayscale image according to the target coordinate values, and obtaining the aspect ratio corresponding to the tobacco leaf in the grayscale image according to the length and width of the tobacco leaf. The result of the cropped tobacco leaf image is as Figure 10 shown. Let the four cropping coordinate values (i.e., target coordinate values) of the tobacco leaf be , , and . Then the four coordinate values are the lower left, upper left, upper right, and lower right respectively. Among them, the length L, width R, and aspect ratio K of the tobacco leaf are:
[0104] ;
[0105] ;
[0106] ;
[0107] Step S22: Based on the length of the tobacco leaf in the extracted image, divide the extracted image into four rectangular regions with the same shape and area, obtain the tip region of the tobacco leaf from the four rectangular regions, and obtain the tip angle corresponding to the target tobacco leaf image according to the tip region.
[0108] In this embodiment, the process of obtaining the tobacco leaf morphological feature parameters corresponding to each target tobacco leaf image may specifically include: dividing the extracted image into four rectangular regions with the same shape and area based on the length of the tobacco leaf in the extracted image, and determining a first target rectangular region and a second target rectangular region from the four rectangular regions; wherein, the first target rectangular region and the second target rectangular region are rectangular regions located at both ends of the extracted image; comparing the total number of pixels in the first target rectangular region and the second target rectangular region, and determining the target rectangular region with the larger total number of pixels as the tip region of the tobacco leaf; determining the tip vertex of the tobacco leaf in the tip region, making a first tangent and a second tangent to the tobacco leaf respectively with the tip vertex as the starting point, and obtaining the tip angle according to the slope difference between the slope of the first tangent and the slope of the second tangent; specifically, the tip angle of the tobacco leaf is evenly divided into 4 parts with the same length based on the length of the tobacco leaf by using the OpenCV image processing tool, and the total number of pixels in the leftmost segment and the rightmost segment are compared respectively. The segment with the higher total number of pixels is the tip. According to the two tangents made based on the tip part, the angle difference between the slopes of the two tangents is calculated as the tip angle of the tobacco leaf, where the tip angle of the tobacco leaf is as Figure 11 shown.
[0109] It can be seen that in this application, by training the tobacco leaf part recognition model and using the trained tobacco leaf part recognition model to recognize the tobacco leaf part, the manual method for recognizing the tobacco leaf part is avoided, thus greatly improving the recognition efficiency; by using a dense neural network to construct the tobacco leaf recognition model and adding an SE attention module and tobacco leaf morphological features to the model, each layer in the tobacco leaf part recognition model can accept the multi-scale fusion method output from all previous layers, increasing the utilization of the convolutional layer and avoiding the loss of core parameters, thereby improving the accuracy of tobacco leaf part classification; by training the model with the tobacco leaf morphological features including the tip angle, the trained model can recognize the tobacco leaf part according to the tip angle of the tobacco leaf, further improving the accuracy of tobacco leaf part recognition.
[0110] See Figure 12 shown, an embodiment of this application discloses a tobacco leaf part recognition device, including:
[0111] A feature parameter acquisition module 11, configured to collect target tobacco leaf images, obtain the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and construct a target training set according to the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the tip angle of the target tobacco leaf image, and the target tobacco leaf image includes an image corresponding to a flat tobacco leaf and an image corresponding to a tobacco leaf with folded leaves;
[0112] A feature parameter adding module 12, configured to add an SE attention module and the tobacco leaf morphological feature parameters to a preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model; the preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network;
[0113] A model training module 13, configured to iteratively train the target tobacco leaf position recognition model according to the target training set, a preset number of training times, and a preset learning rate to obtain a corresponding trained tobacco leaf position recognition model;
[0114] A tobacco leaf position recognition module 14, configured to obtain a to-be-recognized tobacco leaf image, perform background removal processing on the to-be-recognized tobacco leaf image to obtain a corresponding processed tobacco leaf image, and use the trained tobacco leaf position recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf position corresponding to the processed tobacco leaf image.
[0115] It can be seen that in this application, by training a tobacco leaf position recognition model and using the trained tobacco leaf position recognition model to recognize the tobacco leaf position, the manual method for tobacco leaf position recognition is avoided, thereby greatly improving the recognition efficiency; by using a dense neural network to construct a tobacco leaf recognition model and adding an SE attention module and tobacco leaf morphological features to the model, each layer in the tobacco leaf position recognition model can accept the multi-scale fusion method of the outputs from all previous layers, increasing the utilization of the convolutional layer and avoiding the loss of core parameters, thereby improving the accuracy of tobacco leaf position classification; by using the tobacco leaf morphological features including the leaf tip angle to train the model, the trained model can recognize the tobacco leaf position according to the leaf tip angle of the tobacco leaf, further improving the accuracy of tobacco leaf position recognition.
[0116] In some specific embodiments, the feature parameter acquisition module 11 may specifically include:
[0117] A gray level division unit, configured to divide the gray value range corresponding to the target tobacco leaf image into a target number of discrete levels according to the maximum between-class variance method and obtain the target probabilities of the pixels of each of the discrete levels in the target tobacco leaf image;
[0118] A gray threshold acquisition unit, configured to obtain an inter-class variance expression based on each of the target probabilities and determine the gray threshold corresponding to each of the target tobacco leaf images according to the inter-class variance expression;
[0119] A gray scale image acquisition unit, configured to perform binarization processing on the target tobacco leaf image according to the gray threshold and obtain the gray scale image corresponding to each of the target tobacco leaf images according to the corresponding binarization processing result and the OpenCV image algorithm;
[0120] A feature parameter acquisition unit, configured to obtain the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images based on each of the grayscale images.
[0121] In some specific embodiments, the feature parameter acquisition module 11 may specifically include:
[0122] An image extraction unit, configured to obtain the maximum circumscribed rectangle corresponding to the tobacco leaf in the grayscale image, and extract the grayscale image according to the maximum circumscribed rectangle to obtain an extracted image;
[0123] An aspect ratio acquisition unit, configured to determine the target coordinate values corresponding to the four vertices of the extracted image, obtain the length and width of the tobacco leaf in the grayscale image according to the target coordinate values, and obtain the aspect ratio corresponding to the tobacco leaf in the grayscale image according to the length and width of the tobacco leaf.
[0124] In some specific embodiments, the feature parameter acquisition module 11 may specifically include:
[0125] A region division unit, configured to divide the extracted image into four rectangular regions with the same shape and area based on the length of the tobacco leaf in the extracted image, and determine a first target rectangular region and a second target rectangular region from the four rectangular regions; wherein, the first target rectangular region and the second target rectangular region are rectangular regions located at both ends of the extracted image;
[0126] A leaf tip region determination unit, configured to compare the total number of pixels in the first target rectangular region and the second target rectangular region, and determine the target rectangular region with a larger total number of pixels as the leaf tip region of the tobacco leaf;
[0127] A leaf tip angle acquisition unit, configured to determine the leaf tip vertex of the tobacco leaf in the leaf tip region, make a first tangent line and a second tangent line to the tobacco leaf respectively starting from the leaf tip vertex, and obtain the leaf tip angle according to the slope difference between the slope of the first tangent line and the slope of the second tangent line.
[0128] In some specific embodiments, the feature parameter acquisition module 11 may specifically include:
[0129] A color proportion acquisition module, configured to respectively obtain the regions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaf in the target tobacco leaf image by using the LAB color space, and calculate the color proportions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaf respectively.
[0130] In some specific embodiments, the tobacco leaf part recognition module 14 further includes:
[0131] A threshold judgment unit is configured to obtain a first color proportion corresponding to cyan and a second color proportion corresponding to miscellaneous colors in the processed tobacco leaf image, and judge whether the first color proportion is greater than a preset first proportion threshold and whether the second color proportion is greater than a preset second proportion threshold;
[0132] A step jump unit is configured to, if the first color proportion is not greater than the preset first proportion threshold and the second color proportion is not greater than the preset second proportion threshold, jump to the step of recognizing the processed tobacco leaf image by using the trained tobacco leaf part recognition model.
[0133] Furthermore, an embodiment of the present application also discloses an electronic device. Figure 13 It is a structural diagram of an electronic device 20 shown according to an exemplary embodiment, and the content in the figure should not be regarded as any limitation to the scope of use of the present application.
[0134] Figure 13 This is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the tobacco leaf part recognition method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0135] In this embodiment, the power supply 23 is used to provide working voltages for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and specific limitations are not imposed on it here; the input / output interface 25 is used to obtain external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and specific limitations are not imposed here.
[0136] In addition, as a carrier for resource storage, the memory 22 may be a read-only memory, a random access memory, a disk, or an optical disc, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0137] Among them, the operating system 221 is used to manage and control each hardware device and computer program 222 on the electronic device 20, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the tobacco leaf position recognition method executed by the electronic device 20 disclosed in any of the foregoing embodiments, the computer program 222 can further include computer programs that can be used to complete other specific tasks.
[0138] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the tobacco leaf position recognition method disclosed above. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.
[0139] In this specification, each embodiment is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and reference can be made to the method part for relevant details.
[0140] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0141] The steps of the method or algorithm described in combination with the embodiments disclosed in this article can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0142] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.
[0143] The technical solutions provided in this application have been introduced in detail above. Specific examples are used in this text to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A method for identifying tobacco leaf positions, characterized in that, Including: Collecting target tobacco leaf images, obtaining tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and constructing a target training set according to the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the leaf tip angle of the target tobacco leaf image, and the target tobacco leaf image includes an image corresponding to a flat tobacco leaf and an image corresponding to a tobacco leaf with folded leaves; Adding an SE attention module and the tobacco leaf morphological feature parameters to a preset initial tobacco leaf position recognition model to obtain a corresponding target tobacco leaf position recognition model; the preset initial tobacco leaf position recognition model is a model constructed based on a dense neural network; Iteratively training the target tobacco leaf position recognition model according to the target training set, a preset number of training times, and a preset learning rate to obtain a corresponding trained tobacco leaf position recognition model; Obtaining a tobacco leaf image to be recognized, performing background removal processing on the tobacco leaf image to be recognized to obtain a corresponding processed tobacco leaf image, and using the trained tobacco leaf position recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf position corresponding to the processed tobacco leaf image.
2. The tobacco leaf position recognition method according to claim 1, wherein The tobacco leaf morphological feature parameters further include the color ratios corresponding to lemon yellow, orange, reddish brown, cyan, and miscellaneous colors in the target tobacco leaf image, the pixel mean values, maximum values, minimum values, variances corresponding to the target tobacco leaf image in each target channel, and the length, width, and length-width ratio of the tobacco leaf in the target tobacco leaf image; And the target channels include the R, G, B channels in the RGB color space, the H, S, V channels in the HSV color space, and the L, A, B channels in the LAB color space.
3. The tobacco leaf position recognition method according to claim 2, characterized in that, The obtaining of the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes: Dividing the gray value range corresponding to the target tobacco leaf image into a target number of discrete levels according to the maximum inter-class variance method, and obtaining the target probabilities of the pixels of each of the discrete levels in the target tobacco leaf image; Obtaining an inter-class variance expression based on each of the target probabilities, and determining the gray threshold corresponding to each of the target tobacco leaf images according to the inter-class variance expression; Performing binary processing on the target tobacco leaf image according to the gray threshold, and obtaining a gray image corresponding to each of the target tobacco leaf images according to the corresponding binary processing result and the OpenCV image algorithm; Obtaining the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images based on each of the gray images.
4. The tobacco leaf position identification method according to claim 3, wherein, The obtaining of the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes: Obtaining the maximum circumscribed rectangle corresponding to the tobacco leaf in the gray image, and extracting the gray image according to the maximum circumscribed rectangle to obtain an extracted image; Determining the target coordinate values corresponding to the four vertices of the extracted image, obtaining the length and width of the tobacco leaf in the gray image according to the target coordinate values, and obtaining the length-width ratio corresponding to the tobacco leaf in the gray image according to the length and width of the tobacco leaf.
5. The tobacco leaf position identification method according to claim 4, characterized in that The obtaining of the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes: The extracted image is segmented into four rectangular regions with the same shape and area based on the length of the tobacco leaves in the extracted image, and a first target rectangular region and a second target rectangular region are determined from the four rectangular regions; wherein, the first target rectangular region and the second target rectangular region are rectangular regions located at both ends of the extracted image. Compare the total number of pixels in the first target rectangular region and the second target rectangular region, and determine the target rectangular region with the larger total number of pixels as the tip region of the tobacco leaf. Determine the tip vertex of the tobacco leaf in the tip region, make a first tangent line and a second tangent line to the tobacco leaf respectively starting from the tip vertex, and obtain the tip angle according to the slope difference between the slope of the first tangent line and the slope of the second tangent line.
6. The tobacco leaf position recognition method according to claim 2, wherein The obtaining of the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images includes: Use the LAB color space to respectively obtain the regions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaves in the target tobacco leaf image, and calculate the color proportions corresponding to lemon yellow, orange, reddish brown, cyan and miscellaneous colors of the tobacco leaves respectively.
7. The tobacco leaf position identification method according to any one of claims 1 to 6, characterized in that After the background removal processing of the tobacco leaf image to be recognized, it further includes: Obtain the first color proportion corresponding to cyan and the second color proportion corresponding to miscellaneous colors in the currently processed tobacco leaf image, and judge whether the first color proportion is greater than a preset first proportion threshold, and judge whether the second color proportion is greater than a preset second proportion threshold. If the first color proportion is not greater than the preset first proportion threshold and the second color proportion is not greater than the preset second proportion threshold, then jump to the step of using the trained tobacco leaf part recognition model to recognize the processed tobacco leaf image.
8. An apparatus for identifying tobacco leaf positions, characterized in that, It includes: A feature parameter acquisition module, configured to collect target tobacco leaf images, obtain the tobacco leaf morphological feature parameters corresponding to each of the target tobacco leaf images, and construct a target training set according to the target tobacco leaf images and the tobacco leaf morphological feature parameters; the tobacco leaf morphological feature parameters include the tip angle of the target tobacco leaf image, and the target tobacco leaf image includes images corresponding to flat tobacco leaves and images corresponding to tobacco leaves with folded leaves. A feature parameter addition module, configured to add an SE attention module and the tobacco leaf morphological feature parameters to a preset initial tobacco leaf part recognition model to obtain a corresponding target tobacco leaf part recognition model; the preset initial tobacco leaf part recognition model is a model constructed based on a dense neural network. A model training module, configured to perform iterative training on the target tobacco leaf part recognition model according to the target training set, a preset number of training times, and a preset learning rate to obtain a corresponding trained tobacco leaf part recognition model. A tobacco leaf part recognition module, configured to obtain a tobacco leaf image to be recognized, perform background removal processing on the tobacco leaf image to be recognized to obtain a corresponding processed tobacco leaf image, and use the trained tobacco leaf part recognition model to recognize the processed tobacco leaf image to determine the tobacco leaf part corresponding to the processed tobacco leaf image.
9. An electronic device, characterized in that, It includes: A memory, configured to store a computer program. A processor for executing the computer program to implement the tobacco leaf position identification method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, For storing a computer program which, when executed by a processor, implements the tobacco leaf position identification method according to any one of claims 1 to 7.