Method and device for detecting number of leaves, electronic equipment and storage medium
By combining multiple detection methods and a quantitative regression model to detect the number of rice seedling leaves, the problem of low detection accuracy caused by overlapping or occlusion of leaves was solved, and higher detection accuracy was achieved.
Patent Information
- Application Number
- CN202211214592.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-09-30
AI Technical Summary
Existing object detection or semantic segmentation models suffer from low accuracy in detecting the number of leaves during rice seedling growth due to overlapping or occlusion of leaves.
At least two detection methods (such as leaf tip target detection model, leaf semantic segmentation model and skeleton extraction processing) are used to detect different parts of the leaf in the target image, and the number of leaves is calculated by combining the numerical regression model.
It improves the accuracy of leaf number detection, effectively handles situations where leaves overlap or obstruct each other, and reduces missed detections.
Smart Images

Figure CN115512270B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of video processing, in particular to a leaf number detection method, a leaf number detection method, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Seedlings are the source of food, medicine, fiber, fuel and other materials, and are therefore crucial to human survival. In view of this, seedlings should be thoroughly understood, and the number of leaves should be monitored to determine their growth. Taking rice seedlings as an example, during rice seedling inspection, the number of green leaves of rice seedlings is an important indicator for seedling inspection, and regular detection and statistics can help understand the growth and development progress of rice and the group development dynamics, providing scientific management basis for large-scale rice production. Under the new situation of food security, it is particularly important to monitor rice seedling conditions and ensure high and stable rice yields.
[0003] At the present stage, in the field of intelligent video algorithm, the counting means is usually to use a pre-trained target detection or semantic segmentation model to detect whether the image contains a target object and count the number. This method is simple in logic, but as the rice seedlings grow and develop, the leaves gradually become lush, and the situation of leaf overlap or occlusion is easy to occur. Simple target detection or semantic segmentation cannot detect the overlapping or occluded parts, resulting in a large number of missed detections and a very low detection accuracy of the model. SUMMARY
[0004] The embodiments of the present application provide a leaf number detection method, device, electronic device and storage medium to solve the problem that as the rice seedlings grow and develop, the leaves gradually become lush, and the situation of leaf overlap or occlusion is easy to occur. Simple target detection or semantic segmentation cannot detect the overlapping or occluded parts, resulting in a large number of missed detections and a very low detection accuracy of the model.
[0005] The embodiments of the present application disclose a leaf number detection method, which comprises:
[0006] Obtaining a target image obtained by shooting a target plant;
[0007] Detecting different parts of the leaves of the target plant in the target image by using at least two detection methods to obtain at least two first leaf numbers of the target plant;
[0008] Inputting the at least two first leaf numbers into a quantity regression model to obtain a target leaf number of the target plant; wherein the quantity regression model is trained according to at least two second leaf numbers, and the at least two second leaf numbers are obtained by detecting different parts of the leaves of a plant in a sample image by using at least two detection methods.
[0009] Optionally, the at least two detection methods are used to detect different parts of the leaf of the target plant in the target image, and at least two first leaf quantities of the target plant are obtained, comprising:
[0010] At least two of the leaf tip target detection model, the leaf semantic segmentation model, and the skeleton extraction process are used to detect different parts of the leaf of the target plant in the target image, and at least two first leaf quantities of the target plant are obtained.
[0011] The leaf tip target detection model and the leaf semantic segmentation model are trained according to the sample image.
[0012] Optionally, the leaf semantic segmentation model is used to detect the leaf quantity of the target plant in the target image, and a first leaf quantity of the target plant is obtained, comprising:
[0013] The pixel quantity corresponding to the leaf region of a single leaf is obtained.
[0014] The target image is converted into a binary image; wherein the leaf region in the binary image is displayed as a first pixel value, and other regions in the binary image except the leaf region are displayed as a second pixel value.
[0015] The total pixel quantity of the first pixel value in the binary image is determined.
[0016] The ratio of the total pixel quantity to the pixel quantity is taken as the first leaf quantity of the target plant.
[0017] Optionally, the skeleton extraction process is used to detect the leaf quantity of the target plant in the target image, and a first leaf quantity of the target plant is obtained, comprising:
[0018] The target image is converted into a binary image.
[0019] The pixels of the first pixel value in the binary image are eroded to obtain a skeleton formed by a single first pixel value.
[0020] The pixels in the skeleton are fitted to obtain a straight line.
[0021] The number of straight lines is taken as the first leaf quantity of the target plant.
[0022] Optionally, before the target image is input into the leaf tip target detection model, the method further comprises:
[0023] A sample image obtained by photographing a plant is obtained; wherein the sample image has a reference leaf tip bounding box corresponding to the leaf of the plant.
[0024] input the sample image into a leaf tip target detection model to be trained to obtain a detection result;
[0025] Based on the detection result and the reference leaf tip bounding box, the leaf tip target detection model to be trained is trained to obtain a trained leaf tip target detection model.
[0026] Optionally, before the target image is input into the leaf blade semantic segmentation model, the method further comprises:
[0027] A sample image obtained by photographing a plant is acquired, wherein the sample image has a reference pixel label corresponding to a leaf blade on the plant.
[0028] The sample image is input into a leaf tip target detection model to be trained to obtain a detection result.
[0029] Based on the detection result and the reference pixel label, the leaf blade semantic segmentation model is trained to obtain a trained leaf blade semantic segmentation model.
[0030] Optionally, before the at least two first leaf blade numbers are input into the quantity regression model, the method further comprises:
[0031] A sample image obtained by photographing a plant is acquired, wherein the sample image has a reference leaf blade number of a leaf blade on the plant.
[0032] Different parts of the leaf blade of the plant in the sample image are detected by using at least two detection methods to obtain at least two second leaf blade numbers of the target plant.
[0033] The at least two second leaf blade numbers are input into a quantity regression model to be trained to obtain a detection result.
[0034] Based on the detection result and the reference leaf blade number, the quantity regression model to be trained is trained to obtain a trained quantity regression model.
[0035] The embodiment of the application further discloses a leaf blade number detection device, comprising:
[0036] An image acquisition module is configured to acquire a target image obtained by photographing a target plant.
[0037] A first leaf blade number detection module is configured to detect different parts of a leaf blade of the target plant in the target image by using at least two detection methods to obtain at least two first leaf blade numbers of the target plant.
[0038] The target leaf quantity detection module is configured to input at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant, wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by detecting different parts of leaves of a plant in a sample image by using at least two detection manners.
[0039] Optionally, the first leaf quantity detection module comprises:
[0040] The first leaf quantity detection sub-module is configured to detect different parts of leaves of the target plant in the target image by using at least two detection manners including a leaf tip target detection model, a leaf semantic segmentation model and a skeleton extraction process to obtain at least two first leaf quantities of the target plant.
[0041] The leaf tip target detection model and the leaf semantic segmentation model are trained according to the sample image, respectively.
[0042] Optionally, the first leaf quantity detection sub-module comprises:
[0043] The pixel quantity acquisition unit is configured to acquire a pixel quantity corresponding to a leaf region of a single leaf;
[0044] The image conversion unit is configured to convert the target image into a binary image, wherein the leaf region in the binary image is displayed as a first pixel value, and other regions except the leaf region in the binary image are displayed as a second pixel value;
[0045] The pixel quantity determination unit is configured to determine a total pixel quantity of the first pixel value in the binary image;
[0046] The first leaf quantity determination unit is configured to take a ratio of the total pixel quantity to the pixel quantity as the first leaf quantity of the target plant.
[0047] Optionally, the first leaf quantity detection sub-module comprises:
[0048] The image conversion unit is configured to convert the target image into a binary image;
[0049] The pixel erosion unit is configured to perform erosion processing on pixels of the first pixel value in the binary image to obtain a skeleton formed by single pixels of the first pixel value;
[0050] The straight line fitting unit is configured to fit pixels in the skeleton to obtain a straight line;
[0051] The first leaf quantity determination unit is configured to take a number of the straight line as the first leaf quantity of the target plant.
[0052] Optionally, further comprising:
[0053] An image acquisition submodule is configured to acquire a sample image obtained by photographing a plant, wherein the sample image has a reference leaf tip bounding box corresponding to a leaf on the plant.
[0054] A result detection submodule is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0055] A model training submodule is configured to train the leaf tip target detection model to be trained based on the detection result and the reference leaf tip bounding box to obtain a trained leaf tip target detection model.
[0056] Optionally, further comprising:
[0057] An image acquisition submodule is configured to acquire a sample image obtained by photographing a plant, wherein the sample image has a reference pixel label corresponding to a leaf on the plant.
[0058] A result detection submodule is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0059] A model training submodule is configured to train the leaf tip target detection model to be trained based on the detection result and the reference pixel label to obtain a trained leaf tip target detection model.
[0060] Optionally, further comprising:
[0061] An image acquisition submodule is configured to acquire a sample image obtained by photographing a plant, wherein the sample image has a reference pixel label corresponding to a leaf on the plant.
[0062] A result detection submodule is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0063] A model training submodule is configured to train the leaf tip target detection model to be trained based on the detection result and the reference pixel label to obtain a trained leaf tip target detection model.
[0064] The embodiment of the present application further discloses an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete the communication among each other through the communication bus.
[0065] The memory is used to store a computer program.
[0066] The processor is used for implementing the method according to the embodiments of the present application when executing the program stored on the memory.
[0067] The embodiments of the present application also disclose a computer readable storage medium, which stores instructions, and when the instructions are executed by one or more processors, the processors execute the method according to the embodiments of the present application.
[0068] The embodiments of the present application have the following advantages: a target image obtained by photographing a target plant is acquired, different parts of leaves of the target plant in the target image are detected by using at least two detection modes, at least two first leaf quantities of the target plant are obtained, and the at least two first leaf quantities are input into a quantity regression model to obtain a target leaf quantity of the target plant. In the embodiments of the present application, different parts of leaves on the target plant are detected by using at least two detection modes to obtain at least two first leaf quantities, and then the target leaf quantity of the target plant is calculated based on the at least two first leaf quantities by using the quantity regression model, so that the leaf quantity of the target plant is detected in multiple dimensions, and the detection accuracy of the leaf quantity is improved. The problem that the detection accuracy of the model is very low due to a large amount of missed detection caused by the fact that simple target detection or semantic segmentation cannot detect overlapping or shielding parts because leaves of the rice seedlings are gradually lush and overlapping or shielding of the leaves easily occurs as the rice seedlings develop and grow is solved. BRIEF DESCRIPTION OF DRAWINGS
[0069] Figure 1 is a schematic diagram of a leaf quantity statistical scheme provided in the prior art;
[0070] Figure 2 is a step flowchart of a leaf quantity detection method provided in the embodiments of the present application;
[0071] Figure 3 is a step flowchart of model pre-training provided in the embodiments of the present application;
[0072] Figure 4 is a schematic diagram of a rotated target detection result provided in the embodiments of the present application;
[0073] Figure 5 is a step flowchart of leaf quantity detection provided in the embodiments of the present application;
[0074] Figure 6 is a structural block diagram of a leaf quantity detection device provided in the embodiments of the present application;
[0075] Figure 7 is a block diagram of an electronic device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0076] In order to make the above objectives, characteristics and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0077] Seedlings are the source of food, medicine, fiber, fuel, etc., and are therefore crucial to human survival. In view of this, the seedlings should be thoroughly understood, and the number of leaves should be monitored to determine other growth conditions. Taking rice seedlings as an example, when the rice seedling condition is investigated, the number of green leaves of the rice seedlings is an important indicator for investigating the seedling condition, and regular detection and statistics can timely understand the growth and development progress and population development dynamics of the rice, thereby providing a scientific management basis for large-area production of the rice. Under the new situation of food security, it is particularly important to do a good job in monitoring the rice seedling condition and ensure high and stable yield of the rice.
[0078] At the present stage, there are mainly two kinds of counting means in the field of intelligent video algorithm. The first kind is to use a pre-trained target detection or semantic segmentation model to detect whether the image contains a target object and count the number. Referring to Figure 1 , a schematic diagram of a leaf number counting scheme in the prior art is shown, a leaf detection model is trained through a labeled data set, and then the image is directly input into the trained leaf target detection model, and the number of plant leaves in the image is output. This method has simple logic, but as the rice seedlings grow and develop, the leaves gradually become lush, and the situation of leaf overlap or occlusion is likely to occur. Simple target detection or semantic segmentation cannot detect the overlapping or occluded parts, resulting in a large number of missed detections and a very low detection accuracy of the model.
[0079] The second kind is to use a target detection model + probability density map to count, which first locates the ear position through target detection, generates a detection density map, and combines it with an artificially labeled actual density map to perform regression training, thereby obtaining an ear counting network based on density map regression. This method is mainly applied to scenes where the target object and the background have large differences, such as ear counting. In this scene, the ear and the leaf have obvious color, shape and posture differences, and are easy to distinguish, and the ear itself is not easy to be occluded. However, in this scene, when counting the number of green leaves, it is difficult to distinguish between the leaves due to their high similarity, and the accuracy of the generated detection density map is low, thereby resulting in poor performance of the trained model. Moreover, both of these two methods only collect the features of a single part of the leaf as parameters to estimate the target number, without considering the growth conditions of multiple parts of the rice leaf as a whole, and collecting parameters from multiple dimensions for calculation.
[0080] Based on this, the present application provides a leaf number detection method, device, electronic equipment and storage medium in the embodiments of the present application to solve the above technical problems.
[0081] Referring to Figure 2 , a step flowchart of a leaf number detection method provided in the embodiments of the present application is shown, which can specifically include the following steps:
[0082] Step 201: obtaining a target image obtained by photographing a target plant.
[0083] The target plant is a plant seedling in a growth stage, for example, a rice seedling, a wheat seedling, etc., and the embodiments of the present application do not limit the target plant. The target plant can be vertically photographed from top to bottom, or can be photographed from other directions, such as side shooting, which can be set according to actual conditions, and the embodiments of the present application do not limit this.
[0084] Specifically, the target plant in the growth stage can be photographed at intervals for a preset time to obtain a target image, so as to detect the number of leaves of the target plant through the target image, thereby continuously monitoring the growth of the target plant.
[0085] Step 202: detecting different parts of the leaves of the target plant in the target image by using at least two detection methods to obtain at least two first leaf numbers of the target plant.
[0086] The detection method is a method for detecting the number of leaves of the target plant. Different detection methods can detect the number of leaves of the target plant from different dimensions (angles), for example, different detection methods are used to detect different parts (such as leaf tips, leaf areas, and skeleton numbers) of the leaves of the target plant. The detection method can include a leaf tip target detection model, a leaf semantic segmentation model, and a skeleton extraction process, and the embodiments of the present application do not limit the detection method.
[0087] Specifically, after obtaining the target image, the number of leaves of the target plant can be detected by two or more detection methods, thereby obtaining two or more first leaf numbers, and each first leaf number is obtained by detecting different parts (such as leaf tips, leaf areas, and skeleton numbers) of the leaves of the target plant by different detection methods.
[0088] Step 203: inputting the at least two first leaf numbers into a quantity regression model to obtain a target leaf number of the target plant.
[0089] The quantity regression model is trained according to at least two second leaf numbers, and the at least two second leaf numbers are obtained by detecting different parts of the leaves of a plant in a sample image by using at least two detection methods.
[0090] Specifically, after the number of leaves of the target plant in the target image is detected by at least two detection methods respectively, at least two first leaf numbers of the target plant are obtained, and then the at least two first leaf numbers are input into a quantity regression model to obtain the target leaf number of the target plant, that is, the final leaf number is detected.
[0091] In the embodiment of the application, different parts of the leaves on the target plant are detected by at least two detection methods to obtain at least two first leaf numbers, and then the target leaf number of the target plant is calculated based on the at least two first leaf numbers by a quantity regression model, so that the number of leaves of the target plant is detected in multiple dimensions, and the detection accuracy of the number of leaves is improved. With the growth of rice seedlings, the leaves gradually grow lush, and the situation of leaf overlap or shielding is prone to occur. Simple target detection or semantic segmentation cannot detect the overlapping or shielding part, resulting in a large amount of missed detection and low detection accuracy of the model.
[0092] On the basis of the above-mentioned embodiment, a variant embodiment of the above-mentioned embodiment is proposed. It should be noted that, in order to make the description brief, only the differences between the variant embodiment and the above-mentioned embodiment are described in the variant embodiment.
[0093] In an optional embodiment of the application, the step 202 comprises: detecting different parts of the leaves of the target plant in the target image by at least two of a leaf tip target detection model, a leaf semantic segmentation model and a skeleton extraction process to obtain at least two first leaf numbers of the target plant.
[0094] The leaf tip target detection model and the leaf semantic segmentation model are trained according to sample images respectively.
[0095] The leaf tip target detection model is a model for target detection of the leaf tip of the leaf. The number of leaf tips detected by the leaf tip target detection model is the first leaf number output by the leaf tip target detection model. In addition, the leaf tip target detection model can also be a leaf tip rotation target detection. For a leaf tip in a non-horizontal direction, the rotation target detection has higher accuracy than the traditional target detection.
[0096] The leaf semantic segmentation model is a model for detecting the number of leaves by the area of the leaves in the target image. The number obtained by dividing the total area of the detected leaves by the area of a single leaf is the first leaf number output by the leaf semantic segmentation model. The skeleton extraction process is a way to determine the number of leaves by extracting the skeleton of each leaf. The number of skeletons obtained by extracting the skeleton of each leaf is the first leaf number output by the skeleton extraction.
[0097] However, as the rice seedlings grow, the leaves gradually become lush, and the situation of leaf overlap or shielding is prone to occur. Purely using the above method to detect the number of leaves cannot detect the overlapping or shielding part, resulting in a large number of missed detections, and the detection accuracy of the model is very low.
[0098] Therefore, in the embodiment of the present application, the first leaf number of the target plant is detected by at least two of the above methods, and at least two first leaf numbers are input into a quantity regression model to detect the leaf number of the target plant from multiple dimensions of leaf tip, leaf area and leaf skeleton, thereby improving the detection accuracy of the leaf number. The problem of low detection accuracy of the model caused by a large number of missed detections due to the fact that pure target detection or semantic segmentation cannot detect the overlapping or shielding part as the rice seedlings grow and the leaves gradually become lush.
[0099] In an optional embodiment of the present application, the leaf semantic segmentation model is used to detect the number of leaves of the target plant in the target image to obtain the first leaf number of the target plant, comprising: obtaining the pixel number corresponding to the leaf area of a single leaf; converting the target image into a binary image; wherein the leaf area in the binary image is displayed as a first pixel value, and other areas in the binary image except the leaf area are displayed as a second pixel value; determining the total pixel number of the first pixel value in the binary image; and taking the ratio of the total pixel number to the pixel number as the first leaf number of the target plant.
[0100] The binary image is a binary mask image, which is a binary image obtained by segmenting a target area according to the pixel value of the image. In the mask image, the pixel value of the target area is different from that of other areas, so that the target area in the mask image can be distinguished.
[0101] Specifically, the pixel number of the leaf area of a single leaf, i.e. the area of a single leaf LeafperArea (the average value of the area of a single leaf can be taken), is obtained.
[0102] The leaf area of the leaf in the target image is taken as the target area, and its pixel value is adjusted to a first pixel value. The pixel value of other areas in the target image except the leaf area is adjusted to a second pixel value. The first pixel value and the second pixel value are different. A leaf mask image (binary image) is generated. The pixel value of the leaf area in the binary image is different from that of other areas, which is used to indicate the area where the leaf area in the binary image is located. In the case of rice seedlings, the leaves are green, which is different from the color of other areas in the image. Therefore, the leaves can be taken as the target area, and the pixel value is adjusted to black pixels, and the remaining areas are white pixels to obtain a binary image.
[0103] Then the total pixel number of the first pixel value in the binary image is determined, that is, the total area of the leaf region in the binary image is determined, and the ratio of the total pixel number to the pixel number, that is, the total area of the leaf region divided by the area of a single leaf Area, is obtained to obtain the first leaf number Num output by the leaf semantic segmentation model. The specific calculation method is as follows:
[0104]
[0105] In an optional embodiment of the embodiment of the application, the number of leaves of the target plant in the target image is detected by using the skeleton extraction processing to obtain the first leaf number of the target plant, comprising: converting the target image into a binary image; performing erosion processing on the pixels of the first pixel value in the binary image to obtain a skeleton formed by the pixels of the single first pixel value; fitting the pixels in the skeleton to obtain a straight line; and taking the number of the straight line as the first leaf number of the target plant.
[0106] Wherein, the step of converting the target image into a binary image is the same as the step of converting the target image into a binary image in the leaf semantic segmentation model, which is not described here. In addition, when the leaf semantic segmentation model and the skeleton extraction processing are used to detect the first leaf number of the target plant at the same time, the skeleton extraction processing can directly use the binary image inferred in the leaf semantic segmentation model.
[0107] Specifically, after obtaining the binary image, the pixels of the first pixel value in the binary image are subjected to erosion processing, and the pixels of the first pixel value are constantly reduced until the width of all the first pixel value regions is reduced to 1 pixel skeleton, and then the skeleton is subjected to image straight line fitting (for example, least square fitting, cv2.fitLine function based on opencv, etc.) to fit each skeleton into a straight line, and the number of straight lines in the image is counted by straight line detection, so that the number of skeletons of all leaves is obtained, and the first leaf number is determined.
[0108] In the embodiment of the application, when the coincidence degree of two leaf tips is high, the leaf tip target detection model may cause missed recognition. The skeleton extraction processing can corrode the leaf object into a line segment, and can corrode the two leaves with high coincidence degree into two intersecting line segments, which can better count the number of leaves.
[0109] In an optional embodiment of the embodiment of the present application, before the target image is input into the leaf tip target detection model, the method further comprises: obtaining a sample image of a plant; wherein the sample image has a reference leaf tip bounding box corresponding to a leaf on the plant; inputting the sample image into a leaf tip target detection model to be trained to obtain a detection result; and training the leaf tip target detection model to be trained based on the detection result and the reference leaf tip bounding box to obtain a trained leaf tip target detection model.
[0110] The reference leaf tip bounding box is a true leaf tip bounding box previously annotated in the sample image, and is used for reference for the leaf tip bounding box detected by the leaf tip target detection model.
[0111] Specifically, before the first leaf quantity of the target plant in the target image is determined by the leaf tip target detection model, the leaf tip target detection model to be trained needs to be trained in advance to obtain a trained leaf tip target detection model, so as to determine the first leaf quantity in the target image.
[0112] The leaf tip target detection model to be trained is trained as follows: first, the sample image is input into the leaf tip target detection model to be trained to obtain a detection result, i.e., a leaf tip bounding box detected by the leaf tip target detection model; then, a loss value of the leaf tip bounding box and a reference leaf tip bounding box is calculated based on a preset loss function; when the loss value is less than a preset threshold or the loss value converges, it is determined that the training of the leaf tip target detection model is completed; otherwise, the leaf tip target detection model to be trained is continuously trained by using the sample image.
[0113] In an optional embodiment of the embodiment of the present application, before the target image is input into the leaf blade semantic segmentation model, the method further comprises: obtaining a sample image of a plant; wherein the sample image has a reference pixel annotation corresponding to a leaf blade on the plant; inputting the sample image into a leaf blade semantic segmentation model to be trained to obtain a detection result; and training the leaf blade semantic segmentation model based on the detection result and the reference pixel annotation to obtain a trained leaf blade semantic segmentation model.
[0114] The reference pixel annotation is a pixel annotation previously performed on a leaf blade region in the sample image, and is used for reference for a leaf blade region detected by the leaf blade semantic segmentation model.
[0115] Specifically, before the first leaf quantity of the target plant in the target image is determined by the leaf blade semantic segmentation model, the leaf blade semantic segmentation model to be trained needs to be trained in advance to obtain a trained leaf blade semantic segmentation model, so as to determine the first leaf quantity in the target image.
[0116] The leaf semantic segmentation model to be trained is trained. Specifically, the sample image is first input into the leaf semantic segmentation model to be trained to obtain a detection result, that is, pixel annotation of the leaf region by the leaf semantic segmentation model, and then a loss value of the pixel annotation region and the reference pixel annotation region is calculated based on a preset loss function. When the loss value is less than a preset threshold or the loss value converges, it is determined that the training of the leaf semantic segmentation model is completed, otherwise the training of the leaf semantic segmentation model to be trained is continued by using the sample image.
[0117] In an optional embodiment of the embodiment of the application, before the at least two first leaf quantity input values are input into the quantity regression model, the method further comprises: obtaining a sample image obtained by photographing a plant; wherein the sample image has a reference leaf quantity of the leaves of the plant; using at least two detection methods to detect different parts of the leaves of the plant in the sample image to obtain at least two second leaf quantities of the target plant; inputting the at least two second leaf quantities into the quantity regression model to be trained to obtain a detection result; and training the quantity regression model to be trained based on the detection result and the reference leaf quantity to obtain a trained quantity regression model.
[0118] The reference leaf quantity is the leaf quantity of the plant in the sample image, and is used to refer to the leaf quantity output by the quantity regression model.
[0119] Specifically, before the target leaf quantity of the target plant in the target image is determined by the quantity regression model, the quantity regression model to be trained needs to be trained in advance to obtain a trained quantity regression model, so as to determine the target leaf quantity in the target image.
[0120] The quantity regression model to be trained is trained. Specifically, the leaf quantity of the plant in the sample image is first detected by using at least two detection methods to obtain at least two second leaf quantities of the target plant, and then the at least two second leaf quantities are input into the leaf semantic segmentation model to be trained to obtain a detection result (the leaf quantity of the plant), and then a loss value of the leaf quantity and the reference leaf quantity is calculated based on a preset loss function. When the loss value is less than a preset threshold or the loss value converges, it is determined that the training of the quantity regression model is completed, otherwise the training of the quantity regression model to be trained is continued by using the sample image.
[0121] In order to better understand the embodiments in the application, the following will be exemplarily described by taking the leaf quantity detection of rice seedlings as an example. Referring to Figure 3 , a step flowchart of model pre-training provided in the embodiment of the application is shown, for details, please refer to the following steps 1 to 7:
[0122] Step one: take pictures of rice seedlings from the angle of vertical downward shooting, obtain a batch of rice seedling pictures (sample images) as a data set DataSet, and use a labeling tool (roLabelling) to label the leaf tip part of the rice seedlings in DataSet to obtain a training data set TrainData1.
[0123] Step two: train the target detection model through TrainData1 to obtain a rice seedling leaf tip rotation target detection model ModelA (leaf tip target detection model). The model can detect the leaf tip part existing in the picture. Referring to Figure 4 , a schematic diagram of a rotation target detection result provided in an embodiment of the present application is shown, and the leaf tip part existing in the image is detected by the leaf tip target detection model.
[0124] Step three: for the data set DataSet collected in step one, the leaf part in the picture is pixel-level labeled (only contains the leaf part, does not include the connecting part of the leaf and the rhizome) by a labeling tool to obtain a training data set TrainData2. TrainData2 is trained using a semantic segmentation model to obtain a semantic segmentation model ModelB (leaf blade semantic segmentation model) for the green leaf blade part of the rice seedling. The model can detect the whole green leaf, and compared with ModelA, the green leaf object that is not detected due to missed identification can be better detected.
[0125] Step four: for each picture in the data set DataSet (a new data set can also be re-collected), first use the leaf tip rotation target detection model ModelA in step two to calculate the number of all detected leaf tip objects, denoted as the green leaf number Num1.
[0126] Step five: according to step four, the green leaf blade semantic segmentation model ModelB in step three is used to infer the picture to obtain a pixel point set Set1 that meets the characteristics of the green leaf of the rice seedling, and the total area Area of the detected green leaf part of the rice seedling is calculated as the number of pixels of the set Set1. Finally, the total area Area is divided by the area of a single green leaf blade LeafperArea (the average value of the area of a single green leaf can be obtained according to experience) to obtain the green leaf number Num2.
[0127] The calculation formula is:
[0128]
[0129] Step six: after the inference of the semantic segmentation model ModelB, the original image can be converted into a binary image (the green leaf part of the rice seedling is white pixel, and the rest is black pixel). For the white pixel part (herein, the entire leaf part of the green leaf, excluding the rhizome) in the obtained binary image, the white pixel is continuously reduced using the erosion operation until the width of all white parts is reduced to 1 pixel skeleton. For the white pixel after the completion of the erosion, the image straight line fitting (in this example, the cv2.fitLine function based on opencv can be used) is performed to fit each skeleton into a straight line, and the number of straight lines in the image is counted through straight line detection (in this example, the Hough transform can be used), so that the number of green leaf skeletons, denoted as the green leaf number Num3, is obtained. When the coincidence degree of the tips of two leaves is high, the use of the leaf tip rotating target detection model ModelA may cause a missed identification. However, the use of the green leaf skeleton extraction can corrode the green leaf object into a white-like line segment, and can corrode the two green leaves with a high coincidence degree into two intersecting line segments, so that the number of green leaves can be better counted.
[0130] Step seven: finally, the actual number of green leaves in the picture is counted manually, denoted as Num4. Then, for N pictures in the data set DataSet, N groups (Num1, Num2, Num3, Num4) of parameter sets Set2 are obtained, and the set is used as a training set TrainData3 for training the final green leaf number regression model ModelC (number regression model).
[0131] Reference Figure 5 A step flow chart of the leaf number detection provided in the embodiment of the application is shown. For the rice seedling whose green leaf number needs to be calculated, the picture is first taken at a vertical downward angle, and then the green leaf number Num1', the green leaf number Num2' calculated by the inference of the semantic segmentation model ModelB, and the green leaf number Num3' obtained by the skeleton extraction method are obtained by the inference of the leaf tip rotating target detection model ModelA. Finally, Num1', Num2', and Num3' are used as parameters to infer the final green leaf number regression model ModeC to obtain the final green leaf number GreenleafNum.
[0132] In the embodiment of the application, three different green leaf number parameters obtained by the leaf tip target detection, the green leaf area estimation method, and the green leaf skeleton extraction method are used together with the actual leaf number in the taken picture as parameters for the prediction regression model training, so as to obtain the regression model of the green leaf number of the rice seedling. The leaf tip target detection, the green leaf area estimation method, the green leaf skeleton extraction method, and the regression model can be used to predict the final green leaf number of the rice seedling, and the detection accuracy of the leaf number is improved.
[0133] The simple target detection or semantic segmentation model mentioned in the background art cannot solve the problems of leaf overlap and occlusion, and the method based on ear counting has low detection accuracy in the green leaf counting scene.
[0134] The embodiments of the present application have the following advantages:
[0135] 1. Support for automatically counting the number of green leaves of rice using intelligent video technology.
[0136] 2. Multiple scenarios can be used and applied to identify objects that are dense and highly similar, and will not appear to be unable to distinguish due to the high similarity of green leaf objects.
[0137] 3. For vertically downward images, the detection of non-horizontal leaf tip objects has high accuracy.
[0138] 4. The number of statistics is accurate, and can solve the problem of missing counting caused by the large concentration of target objects and mutual occlusion. (1) Leaf tip rotation target detection. For non-horizontal leaf tips, using rotation target detection has higher accuracy than traditional target detection; (2) Self-created green leaf skeleton extraction method. For scenes with high green leaf overlap, the green leaf skeleton is extracted as multiple intersecting line segments, and then the straight line simulation and straight line detection method is used for counting, making the statistics more accurate.
[0139] 5. Collection parameters can be collected and estimated according to multiple dimensions such as the number of leaf tips, leaf area, and skeleton quantity of the leaf, and the green leaf quantity is estimated by combining the parameters, which is more in line with the actual situation than the existing technology which only estimates the green leaf quantity from a single dimensional feature.
[0140] It should be noted that for the method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited by the action order described, because according to the embodiments of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.
[0141] Referring to Figure 6 , a structure block diagram of a leaf quantity detection device provided in an embodiment of the present application is shown, which can specifically include the following modules:
[0142] An image acquisition module 601 is configured to acquire a target image of a target plant obtained by shooting;
[0143] A first leaf quantity detection module 602 is configured to use at least two detection methods to detect different parts of the leaves of the target plant in the target image, and obtain at least two first leaf quantities of the target plant.
[0144] The target leaf quantity detection module 603 is configured to input at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant, wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by detecting different parts of leaves of a plant in a sample image by using at least two detection manners.
[0145] Optionally, the first leaf quantity detection module comprises:
[0146] The first leaf quantity detection sub-module is configured to detect different parts of leaves of the target plant in the target image by using at least two detection manners of a leaf tip target detection model, a leaf semantic segmentation model and a skeleton extraction process to obtain at least two first leaf quantities of the target plant.
[0147] The leaf tip target detection model and the leaf semantic segmentation model are trained according to the sample image respectively.
[0148] Optionally, the first leaf quantity detection sub-module comprises:
[0149] The pixel quantity acquisition unit is configured to acquire a pixel quantity corresponding to a leaf region of a single leaf;
[0150] The image conversion unit is configured to convert the target image into a binary image, wherein the leaf region in the binary image is displayed as a first pixel value, and other regions except the leaf region in the binary image are displayed as a second pixel value;
[0151] The pixel quantity determination unit is configured to determine a total pixel quantity of the first pixel value in the binary image;
[0152] The first leaf quantity determination unit is configured to take a ratio of the total pixel quantity to the pixel quantity as the first leaf quantity of the target plant.
[0153] Optionally, the first leaf quantity detection sub-module comprises:
[0154] The image conversion unit is configured to convert the target image into a binary image;
[0155] The pixel erosion unit is configured to perform erosion processing on pixels of the first pixel value in the binary image to obtain a skeleton formed by single pixels of the first pixel value;
[0156] The straight line fitting unit is configured to fit pixels in the skeleton to obtain a straight line;
[0157] The first leaf quantity determination unit is configured to determine the number of the straight lines as the first leaf quantity of the target plant.
[0158] Optionally, the method further comprises:
[0159] The image acquisition sub-module is configured to acquire a sample image obtained by photographing a plant; the sample image has a reference leaf tip bounding box corresponding to a leaf on the plant.
[0160] The result detection sub-module is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0161] The model training sub-module is configured to train the leaf tip target detection model to be trained based on the detection result and the reference leaf tip bounding box to obtain a trained leaf tip target detection model.
[0162] Optionally, the method further comprises:
[0163] The image acquisition sub-module is configured to acquire a sample image obtained by photographing a plant; the sample image has a reference leaf tip bounding box corresponding to a leaf on the plant.
[0164] The result detection sub-module is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0165] The model training sub-module is configured to train the leaf tip target detection model to be trained based on the detection result and the reference leaf tip bounding box to obtain a trained leaf tip target detection model.
[0166] Optionally, the method further comprises:
[0167] The image acquisition sub-module is configured to acquire a sample image obtained by photographing a plant; the sample image has a reference leaf tip bounding box corresponding to a leaf on the plant.
[0168] The result detection sub-module is configured to input the sample image into a leaf tip target detection model to be trained to obtain a detection result.
[0169] The model training sub-module is configured to train the leaf tip target detection model to be trained based on the detection result and the reference leaf tip bounding box to obtain a trained leaf tip target detection model.
[0170] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the method embodiment.
[0171] In addition, the embodiment of the present application further provides an electronic device, comprising a processor, a memory, a computer program stored in the memory and executable on the processor, the computer program, when executed by the processor, implements each process of the data acquisition method embodiment and achieves the same technical effects. To avoid repetition, details are not described here.
[0172] The embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium stores a computer program, the computer program, when executed by the processor, implements each process of the data acquisition method embodiment and achieves the same technical effects. To avoid repetition, details are not described here. The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0173] Figure 7 A hardware structure diagram of an electronic device for implementing various embodiments of the present application.
[0174] The electronic device 700 includes, but is not limited to, a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, a processor 710, and a power supply 711, etc. Those skilled in the art can understand that the electronic device 700 can include more or less components, or combine some components, or arrange different components. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc. Figure 7 The electronic device structure shown in the above table does not constitute a limitation on the electronic device, and the electronic device can include more or less components than the diagram, or combine some components, or arrange different components. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc.
[0175] It should be understood that, in the embodiments of the present application, the radio frequency unit 701 can be used for receiving and sending signals in the process of information transmission or conversation. Specifically, after receiving the downlink data from the base station, the processor 710 processes it. In addition, the uplink data is sent to the base station. Generally, the radio frequency unit 701 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 701 can also communicate with the network and other devices through a wireless communication system.
[0176] The electronic device provides wireless broadband Internet access for users through the network module 702, such as helping users to send and receive emails, browse web pages and access streaming media, etc.
[0177] The audio output unit 703 can convert audio data, which is received by the radio frequency unit 701 or the network module 702 or stored in the memory 709, into an audio signal and output as sound. Also, the audio output unit 703 can provide an audio output related to a particular function performed by the electronic device 700 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 703 includes a speaker, a buzzer, and a receiver, etc.
[0178] The input unit 704 is used to receive audio or video signals. The input unit 704 can include a graphics processor (GPU) 7041 and a microphone 7042. The graphics processor 7041 processes image data of a still picture or a video obtained by an image capture device (e.g., a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 706. The image frame processed by the graphics processor 7041 can be stored in the memory 709 (or other storage medium) or transmitted via the radio frequency unit 701 or the network module 702. The microphone 7042 can receive sound and can process such sound as audio data. The processed audio data can be converted into a format transmittable to a mobile communication base station via the radio frequency unit 701 in the case of a telephone call mode.
[0179] The electronic device 700 further includes at least one sensor 705, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 7061 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 7061 and / or the backlight when the electronic device 700 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when at rest, which can be used to identify the electronic device posture (such as screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, knock), etc. The sensor 705 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described here.
[0180] The display unit 706 is used to display information input by a user or information provided to a user. The display unit 706 can include a display panel 7061, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
[0181] The user input unit 707 can be used to receive inputted numerical or character information, and to generate key signal inputs related to user settings and function controls of the electronic device. Specifically, the user input unit 707 includes a touch panel 7071 and other input devices 7072. The touch panel 7071, also called a touch screen, can collect a user's touch operation (such as a user's operation on or near the touch panel 7071 using a finger, a stylus, or any suitable object or accessory) on or near the touch panel 7071. The touch panel 7071 can include two parts, a touch detection device and a touch controller. The touch detection device detects a user's touch position and detects a signal resulting from the touch operation, and transmits the signal to the touch controller. The touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 710, and receives commands from the processor 710 and executes them. In addition, the touch panel 7071 can be implemented in various types such as a resistive type, a capacitive type, an infrared type, and a surface acoustic wave type. In addition to the touch panel 7071, the user input unit 707 can include other input devices 7072. Specifically, the other input devices 7072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc., without being limited thereto.
[0182] Further, the touch panel 7071 can be overlaid on the display panel 7061, and when the touch panel 7071 detects a touch operation on or near it, it transmits it to the processor 710 to determine the type of touch event, and then the processor 710 provides a corresponding visual output on the display panel 7061 according to the type of touch event. Although in the above description, the touch panel 7071 and the display panel 7061 are implemented as two independent components to realize the input and output functions of the electronic device, in some embodiments, the touch panel 7071 and the display panel 7061 can be integrated to realize the input and output functions of the electronic device, without being limited thereto. Figure 7
[0183] The interface unit 708 is an interface for connecting an external device to the electronic device 700. For example, the external device can include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input / output (I / O) port, a video I / O port, an earphone port, etc. The interface unit 707 can be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 700, or can be used to transmit data between the electronic device 700 and the external device.
[0184] The memory 709 is used to store software programs and various data. The memory 709 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs (such as a sound playing function, an image playing function, etc.) required by at least one function, etc.; and the data storage area can store data (such as audio data, a phone book, etc.) created according to the use of the mobile phone, etc. In addition, the memory 709 can include a high-speed random access memory, and can also include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0185] The processor 710 is the control center of the electronic device, connects all parts of the electronic device through various interfaces and lines, executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 709 and calling data stored in the memory 709, and thus monitors the whole electronic device. The processor 710 can include one or more processing units; preferably, the processor 710 can integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 710.
[0186] The electronic device 700 can also include a power supply 711 (such as a battery) for supplying power to various components; preferably, the power supply 711 can be logically connected to the processor 710 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management, etc. through the power management system.
[0187] In addition, the electronic device 700 includes some functional modules which are not shown and will not be described herein.
[0188] It should be noted that in this document, the term "comprising" or "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of additional identical elements in the process, method, article, or device including the element.
[0189] Those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device) execute the method described in each embodiment of the present application.
[0190] The embodiments of the present application are described above with reference to the drawings; however, the present application is not limited to the specific embodiments described above, and the specific embodiments described above are merely illustrative rather than restrictive, and a person of ordinary skill in the art can make many forms under the inspiration of the present application without departing from the purpose of the present application and the scope protected by the claims.
[0191] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solutions. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0192] Those of ordinary skill in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.
[0193] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0194] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0195] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit.
[0196] If the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the prior art that essentially contributes or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, and various program code storage media.
[0197] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A leaf number detection method characterized by, The method comprises: obtaining a target image of a target plant; using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; inputting the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant; wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by using at least two detection methods to detect different parts of the leaves of a plant in a sample image.
2. The method of claim 1, wherein, The method comprises: using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; wherein the leaf tip target detection model and the leaf semantic segmentation model are trained according to the sample image.
3. The method of claim 2, wherein, The method comprises: obtaining a target image of a target plant; using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; inputting the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant; wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by using at least two detection methods to detect different parts of the leaves of a plant in a sample image. The method comprises:
4. The method of claim 3, wherein, using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; wherein the leaf tip target detection model and the leaf semantic segmentation model are trained according to the sample image. The method comprises: obtaining a target image of a target plant; using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; 5. The method of claim 2, wherein, inputting the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant; wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by using at least two detection methods to detect different parts of the leaves of a plant in a sample image. The method comprises: obtaining a target image of a target plant; using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; 6. The method of claim 2, wherein, inputting the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant; wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by using at least two detection methods to detect different parts of the leaves of a plant in a sample image. The method comprises: obtaining a target image of a target plant; using at least two detection methods to detect different parts of the leaves of the target plant in the target image, obtaining at least two first leaf quantities of the target plant; inputting the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant; wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by using at least two detection methods to detect different parts of the leaves of a plant in a sample image. Based on the detection result and the reference pixel label, the leaf semantic segmentation model is trained to obtain a trained leaf semantic segmentation model.
7. The method of claim 1, wherein, Before the at least two first leaf quantity inputs are input into the quantity regression model, the method further comprises: obtaining a sample image obtained by photographing a plant, wherein the sample image has a reference leaf quantity of leaves on the plant; detecting different parts of leaves of the plant in the sample image by using at least two detection methods to obtain at least two second leaf quantities of the target plant; inputting the at least two second leaf quantities into the quantity regression model to be trained to obtain a detection result; based on the detection result and the reference leaf quantity, the quantity regression model to be trained is trained to obtain a trained quantity regression model.
8. A leaf number detection device, characterized by, comprises: an image acquisition module configured to acquire a target image of a target plant; a first leaf quantity detection module configured to detect different parts of leaves of the target plant in the target image by using at least two detection methods to obtain at least two first leaf quantities of the target plant; a target leaf quantity detection module configured to input the at least two first leaf quantities into a quantity regression model to obtain a target leaf quantity of the target plant, wherein the quantity regression model is trained according to at least two second leaf quantities, and the at least two second leaf quantities are obtained by detecting different parts of leaves of a plant in a sample image by using at least two detection methods.
9. An electronic device, comprising: comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus; the memory is used to store a computer program; the processor is used to execute the program stored on the memory, and realizes the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, instructions stored thereon, when executed by one or more processors, cause the processors to perform the method of any one of claims 1-7.
Citation Information
Patent Citations
Blade counting method based on Swinin-Transform
CN114913426A
System, device, method and program for measurement of leaf area index
WO2012073507A1