Pot seedling identification method, identification device and storage medium
Through the improved yolov5s network model, combined with the global attention mechanism and Mish activation function, the problem of multi-feature recognition of bowl seedlings is solved, efficient and accurate recognition of bowl seedlings is achieved, and it is suitable for the situation of bowl seedling leaves occlusion, improving the real-time performance of agricultural automation. sex and accuracy.
Patent Information
- Application Number
- CN202410647476.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-20
AI Technical Summary
Existing seedling recognition technology is difficult to effectively identify multiple characteristics of seedlings, resulting in poor recognition results, insufficient real-time performance and accuracy, especially when the leaves are blocked, the recognition error is large, and traditional methods can only detect information about missing seedlings. Accuracy and success rate are lower.
Using the improved yolov5s network model, the separable visual converter module is used to extract the characteristics of the seedling image, combined with the global attention mechanism to fuse the features, and use the Mish activation function and SIoU loss function to identify, predict the type, location and confidence of the seedling, At the same time, the network model is pruned to achieve lightweight, and the Soft-NMS algorithm is used to process occlusion overlapping images.
It achieves multi-feature one-time identification of fruit and vegetable pot seedlings, improves the real-time and accuracy of identification, reduces recognition errors, can effectively deal with leaf occlusion, and improves the overall efficiency and accuracy of pot seedling identification.
Smart Images

Figure CN118675044A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of agricultural automation, and in particular to a seedling identification method, an identification device and a storage medium. Background Art
[0002] In the process of automatic transplanting of fruit and vegetable seedlings, it is necessary to screen out the empty seedlings, injured seedlings and miscellaneous seedlings in the seedling tray. Currently, the following methods are used to identify seedlings in pots:
[0003] 1) Image detection method, which collects seedling images in pots, uses image pixels to calculate, analyzes and processes the seedling images in pots, and detects empty or injured seedlings in pots. However, leaves of adjacent seedlings in pots cover each other, so it is difficult to evaluate the growth of individual seedlings using top-view images, and specific information cannot be effectively identified, resulting in poor recognition effect.
[0004] 2) Sensor detection method, which uses a variety of sensors, such as high-definition cameras, infrared sensors and ultrasonic sensors, to identify the characteristics of seedlings in pots. Among them, the high-definition camera is used to collect image data of the seedlings in pots, the infrared sensor is used to detect the temperature of the seedlings in pots, and the ultrasonic sensor is used to detect the thickness and shape of the seedlings in pots, and then the data of multiple sensors are fused and analyzed to realize automatic detection and identification of seedlings in pots. This method has a simple detection principle and low cost, but it can only detect the missing seedling information, and is greatly affected by the size of the seedlings in pots, growth position, uprightness, adjacent hole seedlings, etc., and the detection accuracy of this method is not high, and the recognition success rate is low.
[0005] 3) Machine vision detection method, which uses image processing technology to separate the seedlings from the background, and then extracts a variety of information about the stems, leaves, and body of the seedlings. However, due to the complex field environment, lighting, vibration, and individual differences in seedlings, etc., all affect the machine vision detection effect. Therefore, this method has high requirements for the selected features, and different features have a greater impact on the test results.
[0006] Moreover, the above-mentioned existing recognition methods all judge and identify a certain feature of the seedlings in the pot, such as detecting whether the hole is a hole, identifying miscellaneous seedlings, or judging whether the seedlings are injured, etc., and cannot judge and identify multiple features of the seedlings in the pot, resulting in low operating efficiency and serious impact on real-time performance. Summary of the invention
[0007] The purpose of the embodiments of the present invention is to provide a method, an identification device and a storage medium for identifying seedlings in pots, so as to partially solve the above-mentioned technical problems.
[0008] In order to achieve the above-mentioned purpose, in a first aspect, an embodiment of the present invention provides a method for identifying seedlings in a pot, which comprises: collecting images of seedlings in a pot and establishing a seedling data set, wherein the seedlings in a pot include conventional seedlings, empty seedlings, mixed seedlings and injured seedlings, and the seedling data set includes images of seedlings in a pot related to different growth factors and / or interference factors under the different seedling types; labeling samples of the seedling data set to prepare sample labels for identifying the seedlings in a pot; improving a yolov5s network model, inputting the labeled samples into the improved yolov5s network model for training, so as to output corresponding types of seedling identification for different seedling identification tasks. Results; wherein the improved yolov5s network model includes a backbone network, a fusion network and a prediction network which are sequentially connected from the input end to the output end, and the improved yolov5s network model includes: a separable visual converter module is used for the backbone network to extract multiple characteristics of the seedling image; a global attention mechanism is used for the fusion network to perform feature fusion on multiple features of the extracted seedlings; a Mish activation function and a SIoU loss function are used for the prediction network to perform different recognition tasks based on the fused features to predict the type, position and confidence of the seedling under the recognition task.
[0009] Optionally, the improved yolov5s network model also includes: pruning the fusion network of the yolov5s network model to make the improved yolov5s network model lightweight.
[0010] Optionally, the pruning of the fusion network in the improved yolov5s network model includes: sorting the contribution of each layer in the fusion network to the yolov5s network model, performing intra-layer channel pruning on each sorted layer, and determining the compression ratio of each layer; based on the determined compression ratio of each layer, re-evaluating the contribution of each layer to the yolov5s network model, and selecting the layer with the largest contribution for final pruning.
[0011] Optionally, the improving the yolov5s network model also includes: using a Soft-NMS algorithm for the prediction network to identify potted seedling images containing occlusion overlap in the data set.
[0012] In a second aspect, an embodiment of the present invention provides a seedling identification device in a pot, the seedling identification device comprising: an establishment unit, used to collect images of seedlings in a pot, and establish a seedling data set, wherein the seedlings in a pot include conventional seedlings, empty seedlings, mixed seedlings and injured seedlings, and the seedling data set includes seedling images of different seedling types in a pot related to different growth factors and / or interference factors; a labeling unit, used to label samples of the seedling data set, and prepare sample labels for identifying the seedlings in the pot; an improvement unit, used to improve a yolov5s network model, input the labeled samples into the improved yolov5s network model for training, so as to output corresponding categories for different seedling identification tasks. type of seedling recognition results; wherein the improved yolov5s network model includes a backbone network, a fusion network and a prediction network connected in sequence from the input end to the output end, and the improved yolov5s network model includes: a separable visual converter module is used for the backbone network to extract multiple characteristics of the seedling image; a global attention mechanism is used for the fusion network to perform feature fusion on multiple features of the extracted seedlings; a Mish activation function and a SIoU loss function are used for the prediction network to perform different recognition tasks based on the fused features to predict the type, position and confidence of the seedling under the recognition task.
[0013] Optionally, the improvement unit is also used to: prune the fusion network in the improved yolov5s network model to make the improved yolov5s network model lightweight.
[0014] Optionally, the improvement unit is used to prune the fusion network in the improved yolov5s network model, including: sorting the contribution of the yolov5s network model according to each layer in the fusion network; performing intra-layer channel pruning on each sorted layer to determine the compression ratio of each layer; based on the determined compression ratio of each layer, re-evaluating the contribution of each layer to the yolov5s network model, and selecting the layer with the largest contribution for final pruning.
[0015] Optionally, the improvement unit is further used to: the prediction network also includes a Soft-NMS algorithm for identifying the seedling images in the pot containing occlusion overlap in the data set.
[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory storing a program that can be run on a processor; and the processor, which is configured to implement the seedling identification method described in any one of the first aspects when executing the program.
[0017] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the seedling identification method described in any one of the first aspects of the present application.
[0018] Through the above technical scheme, by collecting images of seedlings in pots and performing recognition training based on the improved yolov5s network model, it is possible to detect and identify fruit and vegetable seedlings of different types and with different characteristics at one time, realize multi-feature recognition of fruit and vegetable seedlings in pots, and improve the real-time and accuracy of fruit and vegetable seedling recognition.
[0019] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific implementations, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:
[0021] Figure 1 is a schematic flow chart of a seedling identification method according to an exemplary embodiment;
[0022] Figure 2 is a schematic diagram of an image data set of tomato seedlings according to an exemplary embodiment;
[0023] Figure 3 is a structural schematic diagram of a yolov5s network model according to an exemplary embodiment;
[0024] Figure 4 It is a schematic block diagram of a seedling identification device in a pot according to an exemplary implementation. DETAILED DESCRIPTION
[0025] The specific implementation of the embodiment of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the embodiment of the present invention, and is not used to limit the embodiment of the present invention.
[0026] Figure 1 FIG. 1 is a flow chart of a seedling identification method according to an exemplary embodiment. Figure 1 As shown, the identification method includes:
[0027] Step S110, collecting images of seedlings in pots and establishing a seedlings in pots dataset.
[0028] For example, the embodiment of the present invention adopts machine learning for the identification of pot seedlings, especially in supervised machine learning, and an image set containing pot seedlings is usually established. In the embodiment of the present invention, the acquired image set is an image of pot seedlings. Among them, the types of pot seedlings can include empty seedlings, mixed seedlings, injured seedlings and regular seedlings. And each type of pot seedlings includes pot seedlings related to the growth factors and / or interference factors of the pot seedlings themselves. Specifically, empty seedlings include conventional empty seedlings, pot seedlings disturbed by neighboring seedling leaves, disturbed by light, disturbed by shadows and disturbed by matrix; normal seedlings include conventional normal seedlings, pot seedlings disturbed by neighboring seedling leaves, light, shadows and matrix, and pot seedlings with only stems and deviated from the center; mixed seedlings include conventional mixed seedlings, disturbed by neighboring seedling leaves, light, shadows and matrix, deviated from the center and coexisting normal seedlings and mixed seedlings in holes; injured seedlings include pot seedlings with only stems, twisted stems, weak growth and less than 3 leaves. In addition, in order to ensure uniform distribution of the data set and one-to-one correspondence between data and labels, the image set is usually randomly divided according to a certain ratio, including a training set (ratio of 80%), a validation set (ratio of 10%) and a test set (ratio of 10%). Among them, the images in the training set are used to estimate the model to obtain a detection model suitable for pot seedling recognition. The images in the validation set are used to adjust the hyperparameters of the model (such as learning rate, regularization parameters, etc.) and perform model selection (such as selecting different model structures or feature combinations). By evaluating the model on the validation set, the best hyperparameter combination can be selected and the model can be prevented from overfitting on the training set, thereby improving the generalization ability of the model. In addition, the validation set can also be used to promptly discover problems with the model or parameters, such as divergence of the model on the validation set, strange results, etc. At this time, the training can be terminated in time, the parameters can be adjusted again or the model can be adjusted. Through the evaluation of the validation set, different models can be compared and the best model can be selected. The images in the test set are used to test the accuracy of the trained model, that is, to test the recognition and detection ability of the model. It should be noted that the embodiment of the present invention does not limit the division ratio, and those skilled in the art can also flexibly configure the ratio of the two according to actual training and testing needs without making too many restrictions here.
[0029] Step S120, labeling samples of the seedlings in pots dataset, and generating sample labels for identifying the seedlings in pots.
[0030] For example, the embodiment of the present invention can use LabelImg software to mark the acupuncture points of all empty seedlings, mixed seedlings, injured seedlings and regular seedlings in the training set, and at the same time make sample labels so that the labeled training set can be input into the yolov5s network model for recognition training.
[0031] Step S130, improving the yolov5s network model, inputting the labeled samples into the improved yolov5s network model for training, so as to output corresponding types of seedling recognition results for different seedling recognition tasks.
[0032] For example, the embodiment of the present invention adopts the yolov5s network model, which has a depth of 0.33, a width of 0.5, and 191 layers. Since the number of parameters and volume of the yolov5s network model are relatively small, the size of the network model is only about 14M, which is more conducive to recognition detection in agricultural production. In the recognition training, the basic parameters for the training can be set to obtain the training results for the yolov5s network model based on the set basic parameters. The basic parameters used for training can include the input image size, the initial learning rate, the weight decay value, and the number of training images for each batch. For example, the size of each input image can be set to 640×640, the initial learning rate is 0.001, and the poly decay strategy is used to update the learning rate of the gradient descent method. The weight decay is set to 0.0005, and 10 images are trained in each batch. By setting reasonable basic parameters for training, the yolov5s network model can be better trained to prevent overfitting in model training, thereby obtaining a detection model that is more suitable for fruit and vegetable seedling identification.
[0033] The present invention improves the yolov5s network model so that the improved yolov5s network model is suitable for effectively identifying various seedling images in pots. The improved yolov5s network model is further introduced in detail below in conjunction with the accompanying drawings.
[0034] like Figure 3As shown, the structure of the yolov5s network model usually includes Backbone network, Neck network and Prediction network from the input end to the output end. Among them, the Backbone network is the backbone network, which refers to the network for extracting features, used to extract feature information in the image data set. The Neck network is the fusion network, located between the Backbone network and the Prediction network, which can better integrate the features extracted by the Backbone network and improve the robustness of the yolov5s network model. The Prediction network is the prediction network, which refers to obtaining the network output and predicting using the extracted features. In addition to the above main structures, the Focus structure and CSP structure are generally introduced in the yolov5s network model. Among them, the Focus structure is located in the Backbone network, and the original 608*608*3 image is first converted into a feature map of 304*304*12 by slicing operation, and then a convolution operation of 32 convolution kernels is performed, and finally becomes a feature map of 304*304*32, reducing the information loss of downsampling. The CSP structure includes a CSP1_X structure and a CSP2_X structure, wherein the CSP1_X structure is applied to the Backbone, and the CSP2_X structure is applied to the Neck. The improvement of the yolov5s network in the embodiment of the present invention is mainly aimed at the Backbone network, the Neck network and the Prediction network.
[0035] Specifically, for the Backbone network, the embodiment of the present invention replaces its last layer with a separable vision transformer block (Separable Vision Transformer Block, SepViT Block), which can balance the computational cost and computational accuracy, enhance the feature extraction capability of the yolov5s network model, and optimize the global information relationship of the network. SepViTBlock includes Depthwise Self-Attention (DWA) and Pointwise Self-Attention (PWA) to reduce the amount of calculation to achieve local information communication and global information interaction in the window. First, a window division is performed on the input feature map, each window can be regarded as an input channel of the feature map, and different windows contain different information. In the embodiment of the present invention, a window token (Window Token) is created for each window as a global representation for modeling attention relationships in the PWA module. Then, deep self-attention DWA is performed on all pixel instructions in each window and their corresponding window instructions to fuse the spatial information in each channel. Secondly, after the DWA operation is completed, PWA constructs window interactions to obtain the final feature map. Specifically, the feature map and window instructions are first extracted from the DWA, and then the window instructions are used to model the attention relationship between windows, thereby generating an attention map. At the same time, the window dimensions are globally weighted to calculate the final output.
[0036] For the Neck network, the embodiment of the present invention introduces the global attention mechanism GAM, so that the yolov5s network model can pay more attention to the global dimensional features. GAM is used to strengthen the connection between space and channel to reduce missed detection and false detection of tomato seedlings. Specifically, first, it is necessary to determine the adding position of the global attention mechanism. Since the attention mechanism has the feature of plug-and-play, it can be added to any position in the yolov5s network structure. Secondly, according to the determined adding position, a GAM module is established, and then the established GAM module is added to the determined position.
[0037] For the Prediction network, the embodiment of the present invention introduces the Mish function and the SIOU loss function. Among them, the Mish activation function, which is a nonlinear activation function, maps the user input to [-1, 1]. The Mish function can improve the training efficiency of the model and the generalization ability of the model, so that the model can better produce the expected output results when it is input with the same type of error data. In the existing loss functions, such as GIoU, DIoU, CIoU, etc., the direction between the real box and the predicted box is not considered, resulting in a slow convergence speed. In this regard, the embodiment of the present invention adds the SIoU loss function, including angle loss, distance loss, shape loss and IoU loss, to further improve the convergence speed, while improving the accuracy of prediction and recognition of fruit and vegetable seedlings.
[0038] In addition, the improvement of the yolov5s network model in the embodiment of the present invention is not limited to the above aspects. For example, the Mosaic data enhancement method can also be used to improve the small object detection performance, and the random scaling increases the small target to improve the network robustness, and the best candidate frame in different training sets can be adaptively calculated. The Mosaic data enhancement method of this embodiment may include randomly scaling, randomly cropping, and randomly arranging the picture before splicing. For example, four pictures can be randomly read from the data set at a time. Secondly, the four pictures are flipped (the original picture is flipped left and right), scaled (the original picture is scaled in size), and the color gamut is changed (the brightness, saturation, and hue of the original picture are changed). Finally, the four pictures are combined into one picture, and some useless frames are filtered out.
[0039] It can be seen from the embodiments of the present invention that by improving the yolov5s network model, the improved network model can pay more attention to global dimensional features, improve the model convergence speed and the accuracy of fruit and vegetable seedling recognition, so that different categories of fruit and vegetable seedlings can be detected and identified at one time, and multi-feature recognition of fruit and vegetable seedlings can be realized, thereby improving the real-time and accuracy of fruit and vegetable seedling recognition.
[0040] In a preferred embodiment, the method of acquiring images of seedlings in pots and establishing a seedling data set includes: collecting images of seedlings in pots corresponding to different environmental parameters captured by a camera to obtain image sample data of the seedlings in pots; and preprocessing and amplifying the image sample data of the seedlings in pots to generate an image set of the seedlings in pots.
[0041] For example, taking greenhouse plug tray tomatoes as an example, the image sample data collected by the embodiment of the present invention is greenhouse plug tray tomato seedlings with a seedling age of 7-20 days after germination, wherein the plug tray matrix is ordinary soil, and the seedlings are planted in plug trays with 128 holes and 50 holes, and standard sizes of 540mm*280mm and 530mm*270mm. The camera used to collect the image sample data is Canon D1200, and its image resolution is 1920*1080. In order to restore the diversity of real sample data and ensure the reliability of recognition and detection, the embodiment of the present invention collects images of different categories of fruit and vegetable seedlings, such as Figure 2 As shown in the figure, taking tomato seedlings in pots as an example, there are four categories: empty seedlings, injured seedlings, mixed seedlings and regular seedlings. By collecting data from different categories of tomato seedlings in pots under different viewing angles, different lighting conditions, and seedling leaves crossing the boundary, we can obtain image sample data under different interference conditions as much as possible.
[0042] After the image sample data is initially obtained, the image sample data needs to be further preprocessed. The preprocessing referred to in the present invention refers to enhancing and improving the quality of the image. For example, the brightness, contrast, sharpness and denoising of the image sample data of the fruit and vegetable seedlings can be adjusted, and the image can also be smoothed or enhanced by image filtering. The amplification of the image sample data is also called data enhancement, which refers to making limited data produce the value equivalent to more data without substantially increasing the data. For example, the amplification method can include horizontal mirroring, rotation transformation, image misalignment and color transformation. Among them, horizontal mirroring is also called horizontal flipping, and the image sample data obtained after mirroring is in a symmetrical form with the original image sample data. Rotation transformation is to rotate the original image sample data at a random angle to obtain the rotated image sample data. Image misalignment is also called oblique shearing, which is a non-vertical projection of the image on the projection plane, so that the graphics in the image are distorted in the horizontal or vertical direction. By preprocessing and amplifying the image sample data of the fruit and vegetable seedlings, it can be ensured that the number of samples used for model training is sufficient, and the training effect is more prominent and accurate.
[0043] It should be noted that the embodiments of the present invention are not limited to the preprocessing and amplification methods mentioned above. Those skilled in the art can flexibly select other different preprocessing and amplification methods according to actual needs to obtain sufficient and high-quality image sample data to facilitate subsequent model training and recognition.
[0044] In a preferred embodiment, the improved yolov5s network model further includes: pruning the fusion network of the yolov5s network model to make the improved yolov5s network model lightweight.
[0045] More preferably, the pruning of the fusion network in the improved yolov5s network model includes: sorting the contribution of the yolov5s network model according to each layer in the fusion network; performing intra-layer channel pruning on each sorted layer to determine the compression ratio of each layer; based on the determined compression ratio of each layer, re-evaluating the contribution of each layer to the yolov5s network model, and selecting the layer with the largest contribution for final pruning.
[0046] For example, after the above-mentioned embodiments improve each network of the yolov5s network model, although the improved yolov5s network model has been optimized in terms of memory usage, parameter quantity and calculation amount, there are still redundant parts. In view of this, the embodiment of the present invention preferably prunes the fusion network. Specifically, the improved yolov5s target detection network is first trained. Secondly, the contribution of each layer in the fusion network to the number of floating point operations per second (FLOPs) of the model is arranged in order. Then, a layer is selected from the rearranged layers for intra-layer channel pruning, wherein the structure after the pruned model in the previous step and the Loss state vector are introduced in each step of the intra-layer pruning process to determine the appropriate compression ratio for each layer. Finally, the compression contribution of each layer to the FLOPs of the model under this ratio is re-evaluated, and the layer with the largest contribution is selected for final pruning, thereby generating a compressed fusion network to achieve compression of the improved yolov5s.
[0047] In the embodiment of the present invention, yolov5s is compressed by pruning the fused network, so that the model can be stored and deployed on edge devices with limited resources, thereby effectively streamlining the model. At the same time, performance-aware global channel pruning is used to perform lightweight pruning operations on the network model, so that the network model has a significant reduction in parameter quantity, GFLOPs and model size, but the recognition accuracy and recall rate will not change significantly. The layers that have no obvious compression effect but are detrimental to the model performance are retained, thereby ensuring a better balance between the model compression ratio and the model performance.
[0048] In a preferred embodiment, the improving the yolov5s network model further includes: using a Soft-NMS algorithm for the prediction network to identify the seedling images in the data set that contain occlusion overlap.
[0049] For example, during the growth of fruit and vegetable seedlings in the plug tray, there will be mutual occlusion. If the existing NMS algorithm is used, since the target frames of the two mutually occluding fruit and vegetable seedlings are close to each other, there will be frames with lower scores that will be deleted due to excessive overlapping area, resulting in missed detection, i.e., non-maximum suppression. Therefore, the embodiment of the present invention adopts the Soft-NMS algorithm to address the problem of missed detection caused by adjacent seedlings tossing each other. Specifically, find the candidate frame with the highest confidence, recorded as Box A, keep the confidence of Box A unchanged, calculate the IoU value of Box A and all other candidate frames, and then use the calculated IoU value to pass through the f function, such as the IoU function, to update the confidence values of the remaining candidate frames, and then repeat the above process until the confidence values of all remaining candidate frames are updated, and finally filter out the retained candidate frames as the output of Nms according to the confidence threshold value. It can be seen that the Soft-NMS in the embodiment of the present invention adds an IoU function on the basis of the traditional NMS, which is mainly used to suppress the confidence of each candidate box, so that the candidate box with originally low confidence will have its updated confidence value lower than the confidence threshold after being suppressed by the IoU function, while the candidate box with originally high confidence will still have its updated confidence higher (higher than the confidence threshold) after being suppressed by the IoU function, and thus will be finally retained. In a preferred embodiment, the recognition method further includes: after identifying the type of the seedling, based on the quality requirements set for different types of the seedling, outputting an image of the seedling that meets the set quality requirements.
[0050] In a preferred embodiment, after obtaining the recognition result of the seedling type, the seedling identification method further includes: obtaining a manual recognition result for the recognition task; comparing the recognition result of the seedling type obtained based on the improved yolov5s network model with the manual recognition result, and adjusting the parameters of the yolov5s network model according to the comparison result.
[0051] In the embodiment of the present invention, by comparing and verifying the detection results with the manual recognition results, the network model can be adjusted and optimized according to the comparison results to improve the accuracy of seedling identification in pots.
[0052] In the present invention, for the recognition task of pot seedlings, it can be, for example, to identify different types of pot seedlings such as miscellaneous seedlings, empty seedlings, injured seedlings and conventional seedlings at one time, and then the conventional seedlings contained therein can be screened, and the miscellaneous seedlings, empty seedlings and injured seedlings in the plug tray can be removed. Further, in order to accurately output fruit and vegetable pot seedlings that meet the requirements, the recognition task can also output fruit and vegetable pot seedlings that meet the corresponding quality level based on the features extracted from the image. Taking the conventional seedlings of tomato pot seedlings as an example, after outputting the pot seedling type as a conventional seedling, first, the uprightness of the conventional seedlings is judged, and the conventional seedlings whose uprightness meets the preset requirements are determined as qualified products. Further, the conventional seedlings that are qualified products are graded based on their strength, for example, they can be divided into weak seedlings level 1, strong seedlings level 2, etc. Finally, the conventional seedlings of strong seedlings level 2 that meet the quality requirements are output, and their position coordinates in the plug tray are output, so that agricultural operators can accurately obtain the corresponding conventional seedlings.
[0053] The embodiment of the present invention can output fruit and vegetable seedlings that meet quality requirements at one time, which is convenient for agricultural workers to take corresponding measures for fruit and vegetable seedlings of different qualities, and is beneficial to the planting management of fruit and vegetable seedlings.
[0054] In summary, the method for identifying seedlings in pots provided by the embodiment of the present invention has the following advantages:
[0055] 1) Realize multi-feature recognition of fruit and vegetable seedlings, identify different types of seedlings at one time, and improve the real-time and accuracy of fruit and vegetable seedling recognition;
[0056] 2) It can effectively identify the situation where the leaves of seedlings in pots block each other, reduce recognition errors, and avoid missed detection;
[0057] 3) By improving the yolov5s network model, focusing on the global dimensional features, increasing the convergence speed of the model, reducing the complexity of the model, and further improving the accuracy of fruit and vegetable seedling recognition
[0058] Correspondingly, such as Figure 4As shown, the embodiment of the present invention further provides a seedling identification device 400, and the seedling identification device 400 includes: an establishment unit 410, which is used to collect images of seedlings in pots and establish a seedling data set, wherein the types of seedlings in pots include conventional seedlings, empty seedlings, mixed seedlings and injured seedlings, and the seedling data set includes seedling images of pots under different seedling types and related to different growth factors and / or interference factors; a labeling unit 420, which is used to label samples of the seedling data set and prepare sample labels for identifying the seedlings in pots; an improvement unit 430, which is used to improve the yolov5s network model, and input the labeled samples into the improved yolov5s network model for training, so as to identify different seedlings in pots. The improved yolov5s network model includes a backbone network, a fusion network and a prediction network which are sequentially connected from the input end to the output end, and the improved yolov5s network model includes: a separable visual converter module is used for the backbone network to extract multiple characteristics of the seedling image; a global attention mechanism is used for the fusion network to perform feature fusion on multiple features of the extracted seedlings; a Mish activation function and a SIoU loss function are used for the prediction network to perform different recognition tasks based on the fused features to predict the type, position and confidence of the seedling under the recognition task.
[0059] In a preferred embodiment, the identification device is also used to prune the fusion network in the yolov5s network model, which includes: sorting the contribution of the yolov5s network model according to each layer in the fusion network; performing intra-layer channel pruning on each sorted layer to determine the compression ratio of each layer; based on the determined compression ratio of each layer, re-evaluating the contribution of each layer to the yolov5s network model, and selecting the layer with the largest contribution for final pruning.
[0060] In a preferred embodiment, the improvement unit is also used to: prune the fusion network in the improved yolov5s network model to make the improved yolov5s network model lightweight.
[0061] In a preferred embodiment, the improvement unit is used to prune the fusion network in the improved yolov5s network model, including: sorting the contribution of the yolov5s network model according to each layer in the fusion network; performing intra-layer channel pruning on each sorted layer to determine the compression ratio of each layer; based on the determined compression ratio of each layer, re-evaluating the contribution of each layer to the yolov5s network model, and selecting the layer with the largest contribution for final pruning.
[0062] In a preferred embodiment, the improvement unit is further used for: the prediction network also includes a Soft-NMS algorithm for identifying the seedling images in the pot containing occlusion overlap in the data set.
[0063] Correspondingly, an embodiment of the present invention further provides an electronic device, comprising: a memory storing a program that can be run on a processor; and the processor, which is configured to implement the seedling identification method described in the above embodiment when executing the program.
[0064] An embodiment of the present invention further provides a machine-readable storage medium, on which instructions are stored, and the instructions are used to enable a machine to execute the method for identifying seedlings in pots described in the above embodiment of the present application.
[0065] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the seedlings can be identified by adjusting the kernel parameters.
[0066] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0067] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0068] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0069] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0070] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0071] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0072] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0073] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0074] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0075] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for identifying seedlings in pots, It is characterized in that The seedling identification method comprises: Collecting images of seedlings in pots to establish a seedling data set, wherein the seedlings in pots include conventional seedlings, empty seedlings, mixed seedlings and injured seedlings, and the seedling data set includes images of seedlings in pots related to different growth factors and / or interference factors under the different seedling types; Annotating samples of the seedlings in pots dataset to generate sample labels for identifying the seedlings in pots; Improve the yolov5s network model, input the labeled samples into the improved yolov5s network model for training, so as to output the corresponding types of seedling recognition results for different seedling recognition tasks; Among them, the improved yolov5s network model includes a backbone network, a fusion network and a prediction network connected in sequence from the input end to the output end, and the improved yolov5s network model includes: a separable visual converter module is used for the backbone network, which is used to extract multiple characteristics of the seedling image; a global attention mechanism is used for the fusion network, which is used to perform feature fusion on multiple features of the extracted seedlings; a Mish activation function and a SIoU loss function are used for the prediction network, which are used to perform different recognition tasks based on the fused features to predict the type, position and confidence of the seedling under the recognition task.
2. The seedling identification method according to claim 1, It is characterized in that The improved yolov5s network model also includes: pruning the fusion network of the yolov5s network model to make the improved yolov5s network model lightweight.
3. The seedling identification method according to claim 2, It is characterized in that The fusion network in the improved yolov5s network model after pruning includes: Sorting the contribution of the yolov5s network model according to each layer in the fusion network; Perform intra-layer channel pruning on each layer after sorting to determine the compression ratio of each layer; Based on the determined compression ratio of each layer, the contribution of each layer to the yolov5s network model is re-evaluated, and the layer with the largest contribution is selected for final pruning.
4. The seedling identification method according to claim 1, It is characterized in that The improved yolov5s network model also includes: The Soft-NMS algorithm is used for the prediction network to identify the seedling images in the pot containing occlusion overlap in the data set.
5. A seedling identification device, It is characterized in that The seedling identification device comprises: An establishing unit is used to collect images of seedlings in pots and establish a seedling data set, wherein the seedlings in pots include conventional seedlings, empty seedlings, mixed seedlings and injured seedlings, and the seedling data set includes images of seedlings in pots under the different seedling types and related to different growth factors and / or interference factors; A labeling unit, used to label samples of the seedlings in pots data set and to generate sample labels for identifying the seedlings in pots; An improvement unit is used to improve the yolov5s network model, input the labeled samples into the improved yolov5s network model for training, so as to output corresponding types of seedling recognition results for different seedling recognition tasks; Among them, the improved yolov5s network model includes a backbone network, a fusion network and a prediction network connected in sequence from the input end to the output end, and the improvement unit is used to: adopt a separable visual converter module for the backbone network, which is used to extract multiple characteristics of the seedling image; adopt a global attention mechanism for the fusion network, which is used to perform feature fusion on multiple features of the extracted seedlings; adopt a Mish activation function and a SIoU loss function for the prediction network, which is used to perform different recognition tasks based on the fused features to predict the type, position and confidence of the seedling under the recognition task.
6. The seedling identification device according to claim 5, It is characterized in that The improvement unit is also used for: pruning the fusion network in the improved yolov5s network model to make the improved yolov5s network model lightweight.
7. The seedling identification device according to claim 6, It is characterized in that The improvement unit is used to prune the fusion network in the improved yolov5s network model, including: Sorting the contribution of the yolov5s network model according to each layer in the fusion network; Perform intra-layer channel pruning on each layer after sorting to determine the compression ratio of each layer; Based on the determined compression ratio of each layer, the contribution of each layer to the yolov5s network model is re-evaluated, and the layer with the largest contribution is selected for final pruning.
8. The seedling identification device according to claim 5, It is characterized in that The improvement unit is also used for: The prediction network also includes a Soft-NMS algorithm for identifying potted seedling images containing occlusion overlap in the data set.
9. An electronic device, It is characterized in that The electronic device comprises: a memory storing a program that can be executed on the processor; and The processor is configured to implement the seedling identification method described in any one of claims 1 to 4 when executing the program.
10. A machine-readable storage medium having instructions stored thereon, the instructions being used to enable a machine to execute the seedling identification method described in any one of claims 1 to 4 of the present application.
Citation Information
Cited By
Method and device for identifying malignant cells
CN119399755A
