Soybean terminal bud detection model training method, device, equipment and medium

By constructing a soybean terminal bud detection data set and using the adaptive region enhancement loss function training model, the problem of low soybean terminal bud detection accuracy in the existing technology is solved, the detection accuracy and generalization are improved, and the damage to soybean plants is reduced. .

CN118537665BActive Publication Date: 2024-10-11NANJING AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411009980.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-11
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

Existing soybean top bud detection technology cannot accurately detect soybean top buds, resulting in automated top removal technology causing damage to other branches and leaves of soybean plants, affecting soybean yield and economic benefits.

Method used

By constructing a soybean terminal bud detection data set and detection model, the adaptive region enhancement loss function is used to train the model to improve detection accuracy and generalization.

Benefits of technology

The soybean detection model improves the detection ability of soybean terminal buds that are small in size and easily blended with the background, enhances detection accuracy and generalization, and reduces damage to soybean plants.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118537665B_ABST
    Figure CN118537665B_ABST
Patent Text Reader

Abstract

The present invention discloses a soybean terminal bud detection model training method, device, equipment and medium. A soybean terminal bud detection data set including a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image is constructed; a soybean detection model is constructed; a detection prediction result corresponding to the soybean terminal bud image is obtained based on the soybean terminal bud detection model in the training process; an intersection-and-union ratio corresponding to the soybean terminal bud image is determined based on the detection prediction result corresponding to the soybean terminal bud image and the soybean terminal bud detection label; a target area and a background area corresponding to the soybean terminal bud image are determined; an adaptive regional enhancement loss function is generated based on the intersection-and-union ratio corresponding to the soybean terminal bud image and the feature difference between the target area and the background area corresponding to the soybean terminal bud image; and parameters of the soybean terminal bud detection model in the training process are adjusted based on the adaptive regional enhancement loss function. The present invention can improve the detection accuracy and generalization of the soybean detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a soybean terminal bud detection model training method, device, equipment and medium. Background Art

[0002] Soybean is one of the most important crops in my country. Soybean is usually toppled and pinched to control the growth of the main stem of the bean plant, thereby increasing soybean yield. Among them, soybean terminal bud detection is an important step in soybean topping.

[0003] At present, the automated soybean topping technology relies on the soybean apical bud detection technology. However, due to the irregular shape, small size and easy blending with the background of soybean apical buds, the existing soybean apical bud detection technology cannot accurately detect the soybean apical buds. As a result, the automated topping technology will cause damage to other branches and leaves of the soybean plant, affecting soybean yield and economic benefits. Summary of the invention

[0004] The present invention provides a soybean terminal bud detection model training method, device, equipment and medium to solve the problem of low detection accuracy of the soybean detection model and improve the detection accuracy and generalization of the soybean detection model.

[0005] According to one aspect of the present invention, a soybean terminal bud detection model training method is provided, comprising:

[0006] Construct a soybean terminal bud detection dataset, which includes soybean terminal bud images and soybean terminal bud detection labels corresponding to the soybean terminal bud images;

[0007] Construct soybean detection model;

[0008] A soybean detection model is trained based on a soybean apical bud detection dataset to obtain a trained soybean apical bud detection model. During the training process: the soybean apical bud detection model in the training process is used to predict the soybean apical bud image to obtain a detection prediction result corresponding to the soybean apical bud image; based on the detection prediction result corresponding to the soybean apical bud image and the soybean apical bud detection label, the intersection-over-union ratio corresponding to the soybean apical bud image is determined; based on the soybean apical bud detection label corresponding to the soybean apical bud image, the target area and background area corresponding to the soybean apical bud image are determined; based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image, an adaptive regional enhancement loss function is generated; and based on the adaptive regional enhancement loss function, parameters of the soybean apical bud detection model in the training process are adjusted.

[0009] According to another aspect of the present invention, a soybean terminal bud detection method is provided, comprising:

[0010] Acquire the image of soybean terminal bud to be detected;

[0011] The soybean apical bud image to be detected is input into a trained soybean detection model to obtain a soybean detection result; wherein the soybean detection model is obtained based on the soybean apical bud detection model training method of the present invention.

[0012] According to another aspect of the present invention, a soybean terminal bud detection model training device is provided, comprising:

[0013] A soybean terminal bud detection data set construction module is used to construct a soybean terminal bud detection data set, and the soybean terminal bud detection data set includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image;

[0014] A soybean detection model building module, used to build a soybean detection model;

[0015] The soybean detection model training module is used to train the soybean detection model based on the soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: the soybean apical bud detection model in the training process is used to predict and process the soybean apical bud image to obtain the detection prediction result corresponding to the soybean apical bud image; based on the detection prediction result corresponding to the soybean apical bud image and the soybean apical bud detection label, the intersection-over-union ratio corresponding to the soybean apical bud image is determined; based on the soybean apical bud detection label corresponding to the soybean apical bud image, the target area and background area corresponding to the soybean apical bud image are determined; based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image, an adaptive regional enhancement loss function is generated; based on the adaptive regional enhancement loss function, the parameters of the soybean apical bud detection model in the training process are adjusted.

[0016] According to another aspect of the present invention, a soybean terminal bud detection device is provided, comprising:

[0017] A module for acquiring an image of the soybean terminal bud to be detected, used for acquiring an image of the soybean terminal bud to be detected;

[0018] The soybean detection result determination module is used to input the soybean terminal bud image to be detected into the trained soybean detection model to obtain the soybean detection result; wherein the soybean detection model is obtained based on the soybean terminal bud detection model training method of the present invention.

[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0020] at least one processor; and

[0021] a memory communicatively connected to at least one processor; wherein,

[0022] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the soybean apical bud detection model training method of the present invention.

[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to implement the soybean terminal bud detection model training method or soybean terminal bud detection method of the present invention when executed by a processor.

[0024] According to another aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the computer program implements the soybean terminal bud detection model training method or the soybean terminal bud detection method according to the present invention.

[0025] The technical solution of the present invention determines the target area and background area corresponding to the soybean apical bud image based on the soybean apical bud detection label corresponding to the soybean apical bud image; generates an adaptive regional enhancement loss function based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image. The adaptive regional enhancement loss function can adaptively adjust the loss function according to the feature difference between the target area and the background area corresponding to the soybean apical bud image, solves the problem of low detection accuracy of the soybean detection model, improves the detection ability of the soybean detection model for soybean apical buds that are small in size and easy to merge with the background, and also improves the generalization of the soybean detection model.

[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0028] Figure 1 This is a flow chart of a soybean terminal bud detection model training method provided in Example 1 of the present invention;

[0029] Figure 2 This is a flow chart of a soybean terminal bud detection model training method provided in Embodiment 2 of the present invention;

[0030] Figure 3It is a structural schematic diagram of a soybean terminal bud detection model provided in the second embodiment of the present invention;

[0031] Figure 4 is a flow chart of a soybean terminal bud detection method provided in Embodiment 3 of the present invention;

[0032] Figure 5 It is a structural schematic diagram of a soybean terminal bud detection model training device provided by the fourth embodiment of the present invention;

[0033] Figure 6 It is a structural schematic diagram of a soybean terminal bud detection device provided in Embodiment 5 of the present invention;

[0034] Figure 7 It is a structural schematic diagram of an electronic device for implementing the soybean terminal bud detection model training method or soybean terminal bud detection method of an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] Embodiment 1

[0038] Figure 1It is a flow chart of a soybean apical bud detection model training method provided in Example 1 of the present invention. This embodiment can be applicable to the situation of automatically detecting soybean apical buds in soybean apical bud images. The method can be executed by a soybean apical bud detection model training device. The soybean apical bud detection model training device can be implemented in the form of hardware and / or software. The soybean apical bud detection model training device can be configured in electronic devices such as computers and servers.

[0039] In this embodiment, the soybean terminal bud detection model is a model based on learning (e.g., machine learning and deep learning), and is used to detect soybean terminal buds in a soybean terminal bud image. The soybean terminal bud image includes a picture of at least one soybean plant. It should be noted that the soybean plant may not have a soybean terminal bud, or may have one or more soybean terminal buds.

[0040] like Figure 1 As shown, the method includes:

[0041] S110, constructing a soybean terminal bud detection dataset, where the soybean terminal bud detection dataset includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image.

[0042] In this embodiment, the soybean terminal bud detection data set is a data set used to train the soybean terminal bud detection model. Each soybean terminal bud image in the soybean terminal bud detection data set corresponds to a soybean terminal bud detection label. The soybean terminal bud detection label includes one or more annotation boxes and a category label corresponding to each annotation box. Each annotation box surrounds a soybean terminal bud. Each annotation box represents the position and size of a soybean terminal bud in the soybean terminal bud image. The category label represents the category of the soybean terminal bud presented in the image area surrounded by the annotation box. The category label includes but is not limited to color labels, symbol labels and text labels. Exemplarily, the category label is a text label "soybean terminal bud". In some embodiments, the category labels corresponding to multiple annotation boxes in the same soybean terminal bud detection label are different, so as to distinguish different soybean terminal bud individuals to which the soybean terminal buds respectively surrounded by multiple annotation boxes belong.

[0043] Specifically, in the process of constructing a soybean apical bud detection dataset, the soybean apical bud image can be acquired in real time based on a camera device, or an image of at least one soybean plant pre-stored on a local or server can be called to obtain a soybean apical bud image. Exemplarily, the camera device includes but is not limited to a closed-circuit television camera, a webcam, and a drone camera; by setting annotation frames respectively for the image area representing each soybean apical bud in the soybean apical bud image, a soybean apical bud detection label corresponding to the soybean apical bud image is obtained. Exemplarily, by importing the soybean apical bud image into a target annotation application or calling a target annotation toolkit, the soybean apical bud image is manually annotated to obtain a soybean apical bud detection label corresponding to the soybean apical bud image; by collecting multiple soybean apical bud images and the soybean apical bud detection labels corresponding to the soybean apical bud images, a soybean apical bud detection dataset is obtained. Optionally, soybean apical bud images under different soybean maturity, lighting conditions and background conditions are obtained, and soybean apical bud detection labels corresponding to the soybean apical bud images are determined; an initial soybean apical bud detection dataset is formed based on multiple soybean apical bud images and the soybean apical bud detection labels corresponding to the multiple soybean apical bud images respectively; data enhancement processing is performed on the initial soybean apical bud detection dataset based on a generative adversarial network and / or a traditional image enhancement algorithm to obtain a soybean apical bud detection dataset.

[0044] In this embodiment, the soybean terminal bud images in the initial soybean terminal bud detection data set are all real images. Soybean maturity is data used to characterize the maturity of soybeans. Exemplarily, soybean maturity can be determined based on the Green Normalized Difference Vegetation Index (GNDVI). Lighting conditions include but are not limited to light intensity, light source position, and light color. Background conditions are areas or elements that are not related to the soybean terminal bud. For example, background conditions include but are not limited to the morphology of other parts of the plant where the soybean terminal bud is located.

[0045] Specifically, by calling the real soybean apical bud images under different soybean maturity, lighting conditions and background conditions from the local or server, or under different soybean maturity, lighting conditions and background conditions, the real soybean apical bud images are collected based on the camera device, so as to obtain the soybean apical bud images. Exemplarily, at different growth stages of soybean plants, under various weather conditions, the top of each soybean plant is photographed from the distant view and the close view, the front light and the back light respectively based on the camera device at different time periods of the day, and the shooting distance ranges from 0.1 meters to 1.5 meters, so as to obtain multiple real soybean apical bud images. By annotating the real soybean apical bud images, the soybean apical bud detection labels corresponding to the real soybean apical bud images are obtained. By combining each real soybean apical bud image and the soybean apical bud detection label corresponding to the real soybean apical bud image into a real sample data item, and by collecting multiple real sample data items, an initial soybean apical bud detection data set is obtained.

[0046] In some embodiments, the initial soybean apical bud detection dataset is data enhanced based on a traditional image enhancement algorithm to obtain additional sample data items. Exemplarily, the traditional image enhancement algorithm includes but is not limited to image rotation, flipping and scaling. In some embodiments, the initial soybean apical bud detection dataset is data enhanced based on a generative adversarial network: the initial soybean apical bud detection dataset is input into a generative adversarial network to generate additional sample data items. In some embodiments, the initial soybean apical bud detection dataset is data enhanced based on a traditional image enhancement algorithm (or a generative adversarial network) to obtain initial additional sample data items, and the initial additional sample data items are data enhanced based on a generative adversarial network (or a traditional image enhancement algorithm) to obtain additional sample data items. This embodiment does not limit this. The soybean apical bud detection dataset is obtained by collecting real sample data items and additional sample data items. Exemplarily, in the soybean apical bud detection dataset, the number of additional sample data items is 10 times the number of real sample data items.

[0047] The technical solution of this embodiment can increase the diversity of the soybean terminal bud detection data set by performing data enhancement processing on the initial soybean terminal bud detection data set, which helps to improve the robustness of the soybean terminal bud detection model and avoid overfitting.

[0048] S120. Construct a soybean detection model.

[0049] Specifically, based on one or more machine learning models and / or deep learning models, a model structure of a soybean detection model is constructed to obtain a soybean detection model, wherein the model structure includes one or more of a model architecture (e.g., a combination of machine learning models and / or deep learning models), a convolution kernel size, a number of channels, an activation function, etc. Exemplarily, it is assumed that the model architecture of the soybean detection model is a deep learning model YOLO (You Only Look Once) v8.

[0050] S130. Train a soybean detection model based on a soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: perform prediction processing on the soybean apical bud image based on the soybean apical bud detection model during the training process to obtain a detection prediction result corresponding to the soybean apical bud image; determine an intersection-over-union ratio corresponding to the soybean apical bud image based on the detection prediction result corresponding to the soybean apical bud image and a soybean apical bud detection label; determine a target area and a background area corresponding to the soybean apical bud image based on the soybean apical bud detection label corresponding to the soybean apical bud image; generate an adaptive regional enhancement loss function based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image; and adjust parameters of the soybean apical bud detection model during the training process based on the adaptive regional enhancement loss function.

[0051] Specifically, by inputting the soybean terminal bud image into the soybean terminal bud detection model in the training process, the soybean terminal bud detection model performs prediction processing on the soybean terminal bud image to obtain the detection prediction result corresponding to the soybean terminal bud image, wherein the detection prediction result includes one or more prediction annotation boxes and the category label corresponding to each prediction annotation box. For each soybean terminal bud image, the prediction annotation box in the detection prediction result corresponding to the soybean terminal bud image and the annotation box in the soybean terminal bud detection label corresponding to the soybean terminal bud image are input into the intersection-and-union ratio function for calculation to obtain the intersection-and-union ratio corresponding to the soybean terminal bud image. Exemplarily, the intersection-and-union ratio function is expressed as ,in, Represents the predicted annotation box With callout box The intersection area of Represents the predicted annotation box With callout box The union area of ​​.

[0052] The target area is the image area that characterizes the soybean terminal buds, and the background area is the image area that does not characterize the soybean terminal buds. For each soybean terminal bud image, the image area surrounded by the annotation frame in the soybean terminal bud detection label corresponding to the soybean terminal bud image is determined as the target area corresponding to the soybean terminal bud image, and the image area not surrounded by the annotation frame in the soybean terminal bud detection label corresponding to the soybean terminal bud image is determined as the background area corresponding to the soybean terminal bud image. Exemplarily, assuming that the soybean terminal bud detection label includes two annotation frames, the image areas surrounded by the two annotation frames are all target areas, and the image areas outside the two annotation frames are all background areas.

[0053] The Adaptive Region-Enhanced Loss (ARE Loss) is used to characterize the degree of difference between the soybean bud detection label and the detection prediction result corresponding to the soybean bud image. For each soybean bud image, the target region feature vector is obtained by extracting features of the target region corresponding to the soybean bud image, and the background region feature vector is obtained by extracting features of the background region corresponding to the soybean bud image. The feature difference between the target region and the background region corresponding to the soybean bud image is obtained by inputting the target region feature vector and the background region feature vector into the feature distance function for calculation. Exemplarily, the feature distance function is the L2 norm.

[0054] Based on the preset combination relationship, the intersection-and-union ratio corresponding to the soybean terminal bud image is combined with the feature difference between the target area and the background area corresponding to the soybean terminal bud image to obtain an adaptive regional enhancement loss function. Wherein, the preset combination relationship includes but is not limited to an additive relationship, a subtractive relationship, and an exponential relationship. Optionally, the intersection-and-union ratio loss term is determined based on a preset value and the intersection-and-union ratio corresponding to the soybean terminal bud image; the power term of the exponential function is determined based on the first preset parameter and the feature difference, and the corresponding exponential function is obtained based on the power term; the regional enhancement factor is determined based on the exponential function and the second preset parameter; the adaptive regional enhancement loss function is determined based on the intersection-and-union ratio loss term and the regional enhancement factor.

[0055] Specifically, the intersection-and-union loss term is a data item in the adaptive region enhancement loss function that characterizes the similarity between the predicted annotation box and the annotation box. The preset value is a constant in the intersection-and-union loss term that is in a subtractive relationship with the intersection-and-union ratio. The intersection-and-union loss term is obtained by performing a subtraction process between the calculated preset value and the intersection-and-union ratio corresponding to the soybean apical bud image. For example, assuming that the preset value is a constant 1, the intersection-and-union loss term is expressed as .

[0056] The regional enhancement factor is the bias data item corresponding to the intersection-and-union ratio loss item in the adaptive regional enhancement loss function, which is used to strengthen the soybean detection model's attention to the surrounding areas of the target area. The first preset parameter is a parameter used to adjust the degree of influence of the feature difference on the regional enhancement factor. The power term of the exponential function is obtained by multiplying the opposite of the first preset parameter with the feature difference, and an exponential operation is performed based on the power term to obtain an exponential function. The second preset parameter is a parameter used to adjust the degree of influence of the regional enhancement factor on the adaptive regional enhancement loss function. The regional enhancement factor is obtained by multiplying the second preset parameter with the exponential function corresponding to the power term. Exemplarily, the regional enhancement factor is expressed as ,in, Characterizing the first preset parameter, Characterizing the second preset parameter, Characterize feature differences. By summing the intersection-over-union loss term and the regional enhancement factor, an adaptive regional enhancement loss function is obtained. For example, the adaptive regional enhancement loss function is expressed as: .

[0057] It should be noted that the larger the first preset parameter is, the more significant the feature difference is, and the more significant the adjustment of the adaptive regional enhancement loss function by the regional enhancement factor is, which can prevent the soybean detection model from paying too much attention to the small or insignificant feature differences between the target area and the background area. The larger the second preset parameter is, the more helpful it is to improve the detection performance of the soybean detection model when the background is complex or the contrast between the target area and the background area is not high.

[0058] The technical solution of this embodiment determines the power term of the exponential function based on the first preset parameter and the feature difference, and obtains the corresponding exponential function based on the power term; determines the regional enhancement factor based on the exponential function and the second preset parameter, and sets the regional enhancement factor in the adaptive regional enhancement loss function. This can improve the sensitivity of the adaptive regional enhancement loss function to details, especially when the contrast between the target area and the background area is not obvious, which helps to improve the detection ability of the soybean apical bud detection model for soybean apical buds that are small in size and easy to blend with the background.

[0059] In the case that the soybean terminal bud detection model during the training process does not meet the end training condition, the model parameters of the soybean terminal bud detection model are adjusted based on the adaptive regional enhancement loss function so that the value of the adaptive regional enhancement loss function gradually decreases until the soybean terminal bud detection model during the training process meets the end training condition. The model parameters include but are not limited to learning rate, optimizer, regularization and batch size. The end training condition is a condition for determining to stop training the soybean terminal bud detection model, wherein the end training condition can be the value of the adaptive regional enhancement loss function and / or the convergence of the average detection accuracy and reaching a fixed number of training rounds, etc., which is not limited in this embodiment.

[0060] In some embodiments, the soybean terminal bud detection data set is divided to obtain a training set and a validation set, an adaptive regional enhancement loss function is determined based on the training set, and the average detection accuracy of the soybean terminal bud detection model during the training process is determined based on the validation set, so as to obtain the performance change of the soybean terminal bud detection model during the training process and prevent overfitting. Exemplarily, the optimizer is set to an adaptive moment estimation weight decay (Adaptive Moment Estimation with Weight Decay, AdamW) optimizer, and the cosine annealing strategy is used to adjust the learning rate. In some embodiments, an early stopping mechanism is set based on the average detection accuracy determined by the validation set, which helps to achieve fast and stable convergence. It can be understood that within a preset number of training rounds, when the improved accuracy of the average detection accuracy determined based on the validation set is less than a preset improved accuracy threshold (for example, the preset improved accuracy threshold is 0.01%), it can be considered that when the average detection accuracy determined based on the validation set converges, the training is stopped to avoid overfitting.

[0061] In some embodiments, after obtaining a trained soybean apical bud detection model, optionally, a test data set is obtained, the test data set including soybean apical bud images and soybean apical bud detection labels corresponding to the soybean apical bud images; multiple soybean apical bud images in the test data set are predicted and processed based on the trained soybean apical bud detection model to obtain detection prediction results corresponding to the multiple soybean apical bud images in the test data set; based on the soybean apical bud detection labels and detection prediction results respectively corresponding to the multiple soybean apical bud images in the test data set, an evaluation index of the soybean apical bud detection model is determined; if the evaluation index does not meet the preset index threshold, the soybean apical bud detection data set is updated, and the soybean apical bud detection model is continued to be trained based on the updated soybean apical bud detection data set.

[0062] In this embodiment, the test data set is a data set used to perform performance testing on the trained soybean bud detection model. It should be noted that the soybean bud images in the test data set do not exist in the soybean bud detection data set, which helps to verify the generalization ability of the trained soybean bud detection model on unseen soybean bud images.

[0063] Specifically, by inputting multiple soybean bud images in the test data set into the trained soybean bud detection model, the soybean bud detection model performs prediction processing on the multiple soybean bud images input respectively, and obtains the detection prediction results corresponding to each input soybean bud image. By inputting the detection prediction results corresponding to the multiple soybean bud images in the test data set and the soybean bud detection labels respectively into the evaluation index function for calculation, the evaluation index corresponding to the test data set is obtained, wherein the evaluation index is used to characterize the detection accuracy of the soybean bud detection model, and exemplary, the evaluation index includes but is not limited to the recall rate and the average precision.

[0064] The preset indicator threshold is a pre-set evaluation indicator used to determine whether it is necessary to continue training the soybean terminal bud detection model. It is understandable that the preset indicator threshold can be set based on the soybean terminal bud task requirements and expectations. It should be noted that each evaluation indicator corresponds to a preset indicator threshold. For example, the preset indicator threshold corresponding to the recall rate is 0.8, and the preset indicator threshold corresponding to the average precision is 85%.

[0065] If any evaluation index obtained based on the test data set does not meet the preset index threshold corresponding to the evaluation index, it can be considered that the trained soybean apical bud detection model does not achieve the expected detection performance, and the soybean apical bud detection data set is updated by acquiring a new soybean apical bud image and a soybean apical bud detection label corresponding to the new soybean apical bud image. In some embodiments, optionally, the soybean apical bud detection label includes multiple type sub-labels; accordingly, for each type sub-label, based on the soybean apical bud detection label corresponding to the soybean apical bud image of the type sub-label in the test data set and the detection prediction result, the evaluation index corresponding to the soybean apical bud detection model and the type sub-label is determined; if the evaluation index corresponding to any type sub-label does not meet the preset index threshold corresponding to the evaluation index, a new soybean apical bud image belonging to the type sub-label that does not meet the preset index threshold and a soybean apical bud detection label corresponding to the new soybean apical bud image are acquired, and the soybean apical bud detection data set is updated. Exemplarily, the type sub-labels include but are not limited to soybean maturity sub-labels, light condition sub-labels, background condition sub-labels, the number of apical buds of the same soybean plant label, and the soybean apical bud size grade label. Among them, the soybean bud detection dataset can be updated based on data enhancement algorithms (e.g., generative adversarial networks and traditional image enhancement algorithms).

[0066] Based on the updated soybean terminal bud detection data set, the trained soybean detection model is fine-tuned to obtain an optimized soybean terminal bud detection model. During the fine-tuning training process: based on the soybean terminal bud detection model in the fine-tuning training process, the soybean terminal bud image in the updated soybean terminal bud detection data set is predicted and processed to obtain the detection prediction result corresponding to the soybean terminal bud image; based on the detection prediction result corresponding to the soybean terminal bud image and the soybean terminal bud detection label, the target loss function is determined; based on the target loss function, the parameters of the soybean terminal bud detection model in the training process are adjusted. Among them, the target loss function is used to characterize the degree of difference between the soybean terminal bud detection label corresponding to the soybean terminal bud image and the detection prediction result. The target loss function can be an adaptive region enhancement loss function, or it can be one or more combinations of loss functions such as an intersection loss function, a cross entropy loss function, and a dice loss function. This embodiment does not limit this.

[0067] The technical solution of this embodiment can further improve the detection accuracy of the soybean detection model by fine-tuning the soybean detection model trained based on the soybean apical bud detection data set.

[0068] In some embodiments, by adjusting the model structure of the soybean bud detection model (for example, adding a fully connected layer) and optimizing training parameters (for example, learning rate), the soybean detection model is fine-tuned and trained based on an unupdated soybean bud detection dataset to obtain an optimized soybean bud detection model.

[0069] The technical solution of this embodiment determines the target area and background area corresponding to the soybean apical bud image based on the soybean apical bud detection label corresponding to the soybean apical bud image; generates an adaptive regional enhancement loss function based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image. The adaptive regional enhancement loss function can adaptively adjust the loss function according to the feature difference between the target area and the background area corresponding to the soybean apical bud image, which solves the problem of low detection accuracy of the soybean detection model, improves the detection ability of the soybean detection model for soybean apical buds that are small in size and easy to blend with the background, and also improves the generalization of the soybean detection model.

[0070] Embodiment 2

[0071] Figure 2 1 is a flowchart of a soybean apical bud detection model training method provided by the second embodiment of the present invention. The technical solution of the embodiment of the present invention is improved on the basis of the above embodiment. The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here. Figure 2 As shown, the method includes:

[0072] S210, constructing a soybean terminal bud detection dataset, where the soybean terminal bud detection dataset includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image.

[0073] S220, constructing a soybean detection model; the soybean detection model includes a backbone network module, a neck network module and a head network module; the backbone network module includes multiple convolutional layers, and at least some of the convolutional layers in the backbone network module are group convolutional layers; the neck network module includes a feature pyramid network module and a context enhancement module.

[0074] Among them, the backbone network module is used to extract features from the soybean apical bud image to obtain a feature map; the neck network module is used to perform multi-scale feature fusion on the feature map; among them, the feature pyramid network module is used to extract feature maps of multiple scales; the context enhancement module is used to obtain context information based on a feature map of at least one scale, and enhance the feature maps of multiple scales based on the context information; the head network module is used to output the detection prediction results.

[0075] In this embodiment, the model structure of the soybean detection model is improved based on the target detection model YOLOv8, wherein the soybean detection model replaces the ordinary convolution layer in the YOLOv8 model with a depthwise separable convolution layer or a group convolution layer on the basis of YOLOv8. It should be noted that at least one convolution layer in the soybean detection model is a group convolution layer, and the convolution layers other than the group convolution layer are depthwise separable convolution layers. Compared with the depthwise separable convolution layer, the group convolution layer can avoid the decrease in accuracy caused by the decomposition operation. The head network module of the soybean detection model is the same as the head network module of YOLOv8.

[0076] Specifically, each group of convolutional layers in the soybean detection model divides the input feature map of the group of convolutional layers into multiple groups by channel, and each group contains the same number of channels. Exemplarily, the input feature map of a group of convolutional layers in the soybean detection model includes 256 channels, then the group of convolutional layers divides the input feature map into 32 groups by channel, and each group has 8 channels. The convolution kernel corresponding to each group of channels divided by the group of convolutional layers is convolved only with the channels in the group to obtain the convolution results corresponding to each group of channels. The output feature map corresponding to the group of convolutional layers is obtained by superimposing the convolution results corresponding to multiple groups of channels in the channel dimension. Among them, the output feature map corresponding to each group of convolutional layers is activated and mapped by a nonlinear activation function to enhance the expression ability. Exemplarily, the nonlinear activation function is a linear rectification function (RectifiedLinear Unit, ReLU).

[0077] The backbone network module of the soybean detection model extracts features from the input soybean apical bud image to obtain a backbone network output feature map. The backbone network module transmits the backbone network output feature map to the neck network module. The feature pyramid network module includes a downsampling branch and an upsampling branch, wherein the number of downsampling modules in the downsampling branch is the same as the number of upsampling modules in the upsampling branch, each downsampling module is horizontally connected to an upsampling module, each downsampling module extracts a feature map of a scale, each upsampling module fuses at least one input feature map of the upsampling module, and upsamples the fused feature map to obtain the output feature map of the upsampling module. The input end of the context enhancement module is connected to the output end of at least one downsampling module, and the context enhancement module performs context information enhancement processing on the input feature map of at least one scale to obtain at least one context enhanced feature map of the scale. For each scale of the context enhanced feature map, the context enhanced feature map is input into a downsampling module whose scale of the input feature map is the scale of the context enhanced feature map to enhance the context information contained in the neck network output feature map output by the neck network module.

[0078] For example, assuming that the neck network module of the soybean detection model includes a context enhancement module, and the downsampling branch of the feature pyramid network module includes four downsampling modules connected in sequence , , and The upsampling branch includes four upsampling modules connected in sequence. , , and ,in, and Lateral connections, where , , , and The corresponding output feature map sizes are 32, 16, 8, and 4, respectively. , , and The corresponding input feature map sizes are 4, 8, 16, and 32, respectively. The output end of is connected to the input end of the context enhancement module, and the output end of the context enhancement module is connected to The input connection of The context enhancement feature map output by the context enhancement module and The corresponding output feature maps are fused. right The corresponding output feature map and The corresponding output feature maps are fused, where .

[0079] In some embodiments, an attention module is provided in the neck network module to adaptively adjust the weights in the feature map, highlight important features and suppress unimportant features. Optionally, the feature pyramid network module includes at least one adaptive feature fusion attention module; the adaptive feature fusion attention module is provided at least one lateral connection of the feature pyramid network module and / or at the connection between the feature pyramid network module and the upsampling module in the neck network module; the adaptive feature fusion attention module includes a compression excitation attention module, a spatial attention module and a one-dimensional convolution layer connected in sequence.

[0080] Among them, the compressed incentive attention module is used to determine the channel attention weight of each channel of the input feature map of the compressed incentive attention module, and generate a channel attention fusion feature map based on the channel attention weight and the input feature map of the compressed incentive attention module. The channel attention weight is used to highlight the channel of interest in the input feature map of the compressed incentive attention module; the spatial attention module is used to determine the spatial attention weight of each spatial position in the channel attention fusion feature map, and generate a spatial attention fusion feature map based on the spatial attention weight and the channel attention fusion feature map. The spatial attention weight is used to highlight the spatial position of interest in the channel attention fusion feature map; the one-dimensional convolutional layer is used to adaptively adjust the weight of each channel and the weight of each spatial position in the spatial attention fusion feature map.

[0081] In this embodiment, the compression-inspired attention module includes a global average pooling (GAP) layer, a fully connected (FC) layer, and a vector weighted fusion layer, wherein the GAP layer and the FC layer are connected in sequence. The spatial attention module includes an average value calculation function layer, a maximum value calculation function layer, a vector channel connection layer, a one-dimensional convolution layer, an S-shaped growth curve activation function (sigmoid) layer, and a vector weighted fusion layer, wherein the average value calculation function layer and the maximum value calculation function layer are set in parallel.

[0082] Specifically, for the input feature map of the adaptive feature fusion attention module, the input feature map is input into the compression-excitation attention module, so that the GAP layer and FC layer connected in sequence in the compression-excitation attention module extract the channel attention weight corresponding to the input feature map, and the vector weighted fusion layer performs weighted fusion on the channel attention map and the input feature map to obtain the channel attention fusion feature map, wherein the channel attention weight includes the weights of multiple channels of the input feature map. It can be understood that the larger the weight of the channel, the more interested the soybean detection model is in the channel. By inputting the channel attention fusion feature map into the spatial attention module, the averaged channel attention fusion feature map is determined based on the average value calculation function layer, and the maximized channel attention fusion feature map is determined based on the maximum value calculation function layer, and the averaged channel attention fusion feature map and the maximized channel attention fusion feature map are spliced ​​according to the channel dimension based on the vector channel connection layer, and the spliced ​​channel attention fusion feature map is input into the one-dimensional convolution layer to obtain the one-dimensional convolution layer output feature map, the one-dimensional convolution layer output feature map is activated based on the sigmoid layer to obtain the spatial attention weight, and the channel attention fusion feature map and the spatial attention weight are weighted fused based on the vector weighted fusion layer to obtain the spatial attention fusion feature map, wherein the spatial attention weight includes the weights of multiple spatial positions of the channel attention fusion feature map. It can be understood that the larger the weight of the spatial position, the more interested the soybean detection model is in the spatial position. By inputting the spatial attention fusion feature map into the one-dimensional convolution layer, the one-dimensional convolution layer makes adaptive adjustments to the weight of each channel and the weight of each spatial position in the spatial attention fusion feature map to strengthen the output feature map of the adaptive feature fusion attention module.

[0083] In some embodiments, the one-dimensional convolutional layer used to process the spatial attention fusion feature map can be replaced by a fully connected layer.

[0084] The lateral connection is the connection between the downsampling module and the upsampling module. The feature pyramid network module includes multiple lateral connections. The adaptive feature fusion attention module can be set only at one or more lateral connections; or the adaptive feature fusion attention module can be set only at the connection between the feature pyramid network module and the upsampling module in the neck network module; or the adaptive feature fusion attention module can be set at one or more lateral connections, and the adaptive feature fusion attention module can be set at the connection between the feature pyramid network module and the upsampling module in the neck network module. This embodiment does not limit this. For example, assuming that the feature pyramid network module includes a downsampling module , , and , and an upsampling module, the upsampling branch includes four upsampling modules connected in sequence , , and , then the neck network module of the soybean detection model can set 5 adaptive feature fusion attention modules, and the adaptive feature fusion attention modules are set respectively and The lateral connection of ,as well as The connection with the upsampling module in the neck network module.

[0085] The technical solution of this embodiment can adaptively adjust the weights of channels and spatial positions in the feature graph at at least one lateral connection of the feature pyramid network module and / or at the connection between the feature pyramid network module and the upsampling module in the neck network module, thereby optimizing the recognition and utilization of key features by the soybean detection model, thereby achieving the effect of improving the detection accuracy of the soybean detection model.

[0086] For example, Figure 3 is a schematic diagram of the structure of a soybean terminal bud detection model provided in the second embodiment of the present invention. Figure 3 As shown, the soybean terminal bud detection model replaces the ordinary convolution layer in the backbone network module of YOLOv8 with a group convolution layer, and replaces the ordinary convolution layer in the neck network module of YOLOv8 with a depth-separable convolution layer, and introduces an improved spatial pyramid pooling module and an adaptive feature fusion attention module at the connection path between the backbone network module and the upsampling module in the neck network module. It can be understood that the output features of the backbone network module are multi-scale feature fused based on the improved spatial pyramid pooling module, and the obtained multi-scale fusion feature map is input into the adaptive feature fusion attention module for attention processing, so that the feature map of the upsampling module in the neck network module is enhanced. Among them, the improved spatial pyramid pooling module is a spatial pyramid pooling module improved based on the feature pyramid network module and the context enhancement module.

[0087] S230. Train a soybean detection model based on a soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: for soybean apical bud images in the training set, predict and process the soybean apical bud images based on the soybean apical bud detection model in the training process to obtain detection prediction results corresponding to the soybean apical bud images; determine the intersection-over-union ratio corresponding to the soybean apical bud images based on the detection prediction results corresponding to the soybean apical bud images and the soybean apical bud detection labels; determine the target area and background area corresponding to the soybean apical bud images based on the soybean apical bud detection labels corresponding to the soybean apical bud images; generate an adaptive regional enhancement loss function based on the intersection-over-union ratio corresponding to the soybean apical bud images and the feature differences between the target area and the background area corresponding to the soybean apical bud images; and adjust parameters of the soybean apical bud detection model in the training process based on the adaptive regional enhancement loss function.

[0088] Exemplarily, the detection prediction result can be expressed as ,in, Characterize the soybean terminal bud image, Characterize the feature map output by the downsampling layer or the last upsampling layer of the feature pyramid network module, Feature maps representing the output of the adaptive feature fusion attention module, Characterize the feature map of the feature pyramid network module input to the head network module, Characterize the processing of the head network module.

[0089] The technical solution of this embodiment, by setting a group convolution layer in the backbone network module and setting a feature pyramid network module and a context enhancement module in the neck network module, can reduce the complexity of the soybean detection model while ensuring the detection accuracy of the soybean detection model and reducing the risk of overfitting.

[0090] Embodiment 3

[0091] Figure 4 is a flow chart of a soybean terminal bud detection method provided by the third embodiment of the present invention. The technical solution of the embodiment of the present invention is the application of the soybean terminal bud detection model trained in any of the above embodiments. Figure 4 As shown, the method includes:

[0092] S310, obtaining an image of the soybean terminal bud to be detected.

[0093] In this embodiment, the soybean terminal bud image to be detected is an image that needs to be subjected to soybean terminal bud detection during the application of the soybean terminal bud detection model.

[0094] Specifically, the soybean terminal bud image can be collected in real time, or a pre-stored soybean terminal bud image can be called from a local or server to obtain the soybean terminal bud image to be detected. In some embodiments, the soybean terminal bud image to be detected can be pre-processed to improve the detection accuracy, for example, the pre-processing includes pixel normalization and size adjustment.

[0095] Exemplarily, the image of the soybean apical bud to be detected is obtained by reading the image of the soybean apical bud taken in real time by a drone camera.

[0096] S320, inputting the soybean apical bud image to be detected into the trained soybean detection model to obtain the soybean detection result.

[0097] The soybean detection model is obtained based on the soybean apical bud detection model training method in any one of the embodiments.

[0098] Specifically, the soybean detection result includes one or more detection annotation frames and a category label corresponding to each detection annotation frame. The soybean detection result is obtained by calling the trained soybean detection model to perform detection processing on the input soybean terminal bud image to be detected.

[0099] In some embodiments, the construction of a working platform is achieved by exporting a trained soybean terminal bud detection model into a preset format and deploying the soybean terminal bud detection model in the preset format on one or more working platforms; in the working platform, the output soybean terminal bud image to be detected is detected and processed by calling the deployed soybean terminal bud detection model to obtain the soybean detection result. Among them, the working platform is a platform that can perform soybean terminal bud detection tasks, for example, the working platform includes but is not limited to an agricultural monitoring platform, an automated picking platform, and a soybean core picking platform. For example, the preset format includes but is not limited to the Open Neural Network Exchange (ONNX) format and the TensorRuntime (TensorRT) format.

[0100] The technical solution of this embodiment is to perform soybean apical bud detection on the soybean apical bud image to be detected through a trained soybean apical bud detection model, wherein the soybean apical bud detection model is a soybean apical bud detection model trained based on the soybean apical bud detection model training method in any embodiment, which can ensure the detection accuracy of the soybean apical bud.

[0101] Embodiment 4

[0102] Figure 5 Schematic diagram of a soybean apical bud detection model training device provided by the fourth embodiment of the present invention. Figure 5 As shown, the device comprises:

[0103] A soybean terminal bud detection data set construction module 410 is used to construct a soybean terminal bud detection data set, wherein the soybean terminal bud detection data set includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image;

[0104] A soybean detection model building module 420 is used to build a soybean detection model;

[0105] The soybean detection model training module 430 is used to train the soybean detection model based on the soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: based on the soybean apical bud detection model in the training process, the soybean apical bud image is predicted and processed to obtain the detection prediction result corresponding to the soybean apical bud image; based on the detection prediction result corresponding to the soybean apical bud image and the soybean apical bud detection label, the intersection-over-union ratio corresponding to the soybean apical bud image is determined; based on the soybean apical bud detection label corresponding to the soybean apical bud image, the target area and background area corresponding to the soybean apical bud image are determined; based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image, an adaptive regional enhancement loss function is generated; based on the adaptive regional enhancement loss function, the parameters of the soybean apical bud detection model in the training process are adjusted.

[0106] The technical solution of this embodiment determines the target area and background area corresponding to the soybean apical bud image based on the soybean apical bud detection label corresponding to the soybean apical bud image; generates an adaptive regional enhancement loss function based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image. The adaptive regional enhancement loss function can adaptively adjust the loss function according to the feature difference between the target area and the background area corresponding to the soybean apical bud image, which solves the problem of low detection accuracy of the soybean detection model, improves the detection ability of the soybean detection model for soybean apical buds that are small in size and easy to blend with the background, and also improves the generalization of the soybean detection model.

[0107] On the basis of the above embodiments, optionally, the soybean detection model training module 430 is specifically used to: determine the intersection-and-union loss term based on the intersection-and-union ratio corresponding to the preset value and the soybean apical bud image; determine the power term of the exponential function based on the first preset parameter and the feature difference, and obtain the corresponding exponential function based on the power term; determine the regional enhancement factor based on the exponential function and the second preset parameter; determine the adaptive regional enhancement loss function based on the intersection-and-union loss term and the regional enhancement factor.

[0108] On the basis of the above embodiments, optionally, the soybean detection model includes a backbone network module, a neck network module and a head network module; the backbone network module includes multiple convolutional layers, and at least some of the convolutional layers in the backbone network module are group convolutional layers; the neck network module includes a feature pyramid network module and a context enhancement module; wherein the backbone network module is used to extract features of the soybean apical bud image to obtain a feature map; the neck network module is used to perform multi-scale feature fusion on the feature map; wherein the feature pyramid network module is used to extract feature maps of multiple scales; the context enhancement module is used to obtain context information based on a feature map of at least one scale, and enhance the feature maps of multiple scales based on the context information; the head network module is used to output the detection prediction results.

[0109] On the basis of the above embodiments, optionally, the feature pyramid network module includes at least one adaptive feature fusion attention module; the adaptive feature fusion attention module is arranged at at least one lateral connection of the feature pyramid network module and / or at the connection between the feature pyramid network module and the head network module; the adaptive feature fusion attention module includes a compression excitation attention module, a spatial attention module and a one-dimensional convolution layer connected in sequence; wherein the compression excitation attention module is used to determine the channel attention weight of each channel of the input feature map of the compression excitation attention module, and generate a channel attention fusion feature map based on the channel attention weight and the input feature map of the compression excitation attention module, and the channel attention weight is used to highlight the channel of interest in the input feature map of the compression excitation attention module; the spatial attention module is used to determine the spatial attention weight of each spatial position in the channel attention fusion feature map, and generate a spatial attention fusion feature map based on the spatial attention weight and the channel attention fusion feature map, and the spatial attention weight is used to highlight the spatial position of interest in the channel attention fusion feature map; the one-dimensional convolution layer is used to adaptively adjust the weight of each channel and the weight of each spatial position in the spatial attention fusion feature map.

[0110] On the basis of the above embodiments, optionally, a soybean apical bud detection dataset construction module 410 is specifically used to: obtain soybean apical bud images under different soybean maturity, lighting conditions and background conditions, and determine the soybean apical bud detection labels corresponding to the soybean apical bud images; form an initial soybean apical bud detection dataset based on multiple soybean apical bud images and the soybean apical bud detection labels corresponding to the multiple soybean apical bud images; perform data enhancement processing on the initial soybean apical bud detection dataset based on a generative adversarial network and / or a traditional image enhancement algorithm to obtain a soybean apical bud detection dataset.

[0111] On the basis of the above embodiments, optionally, the soybean apical bud detection model training device also includes a soybean apical bud detection model continuation training module; wherein the soybean apical bud detection model continuation training module is used to: obtain a test data set, the test data set including soybean apical bud images and soybean apical bud detection labels corresponding to the soybean apical bud images; perform prediction processing on multiple soybean apical bud images in the test data set based on the trained soybean apical bud detection model to obtain detection prediction results corresponding to the multiple soybean apical bud images in the test data set; determine the evaluation index of the soybean apical bud detection model based on the soybean apical bud detection labels and detection prediction results respectively corresponding to the multiple soybean apical bud images in the test data set; when the evaluation index does not meet the preset index threshold, update the soybean apical bud detection data set, and continue to train the soybean apical bud detection model based on the updated soybean apical bud detection data set.

[0112] The soybean terminal bud detection model training device provided in the embodiment of the present invention can execute the soybean terminal bud detection model training method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0113] Embodiment 5

[0114] Figure 6 Schematic diagram of the structure of a soybean apical bud detection device provided in Embodiment 5 of the present invention. Figure 6 As shown, the device comprises:

[0115] The soybean terminal bud image acquisition module 510 is used to acquire the soybean terminal bud image to be detected;

[0116] The soybean detection result determination module 520 is used to input the soybean apical bud image to be detected into the trained soybean detection model to obtain the soybean detection result; wherein the soybean detection model is obtained based on the soybean apical bud detection model training method trained in any of the above embodiments.

[0117] The technical solution of this embodiment is to perform soybean apical bud detection on the soybean apical bud image to be detected through a trained soybean apical bud detection model, wherein the soybean apical bud detection model is a soybean apical bud detection model trained based on the soybean apical bud detection model training method in any embodiment, which can ensure the detection accuracy of the soybean apical bud.

[0118] Embodiment 6

[0119] Figure 7It is a structural schematic diagram of an electronic device that implements the soybean terminal bud detection model training method or soybean terminal bud detection method of an embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0120] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.

[0121] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0122] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 11 executes the various methods and processes described above, such as a soybean apical bud detection model training method or a soybean apical bud detection method.

[0123] In some embodiments, the soybean apical bud detection model training method or the soybean apical bud detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the soybean apical bud detection model training method or the soybean apical bud detection method described above may be executed. Alternatively, in other embodiments, the processor 11 may be configured to execute the soybean apical bud detection model training method or the soybean apical bud detection method in any other appropriate manner (e.g., by means of firmware).

[0124] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0125] The computer program for implementing the soybean terminal bud detection model training method or soybean terminal bud detection method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the computer program, when executed by the processor, enables the functions / operations specified in the flow chart and / or the block diagram to be implemented. The computer program can be executed completely on the machine, partially on the machine, as an independent software package, partially on the machine and partially on the remote machine, or completely on the remote machine or server.

[0126] Embodiment 7

[0127] Embodiment 7 of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to execute a soybean terminal bud detection model training method, the method comprising:

[0128] A soybean terminal bud detection dataset is constructed, and the soybean terminal bud detection dataset includes soybean terminal bud images and soybean terminal bud detection labels corresponding to the soybean terminal bud images; a soybean detection model is constructed; the soybean detection model is trained based on the soybean terminal bud detection dataset to obtain a trained soybean terminal bud detection model. During the training process: for the soybean terminal bud images in the training set, the soybean terminal bud images are predicted and processed based on the soybean terminal bud detection model in the training process to obtain the detection prediction results corresponding to the soybean terminal bud images; based on the detection prediction results corresponding to the soybean terminal bud images and the soybean terminal bud detection labels, the intersection-over-union ratio corresponding to the soybean terminal bud images is determined; based on the soybean terminal bud detection labels corresponding to the soybean terminal bud images, the target area and background area corresponding to the soybean terminal bud images are determined, and based on the intersection-over-union ratio corresponding to the soybean terminal bud images and the feature differences between the target area and the background area corresponding to the soybean terminal bud images, an adaptive regional enhancement loss function is generated, and based on the adaptive regional enhancement loss function, the parameters of the soybean terminal bud detection model in the training process are adjusted.

[0129] Alternatively, the computer instructions are used to cause the processor to execute a soybean terminal bud detection method, the method comprising:

[0130] Acquire the image of the soybean apical bud to be detected; input the image of the soybean apical bud to be detected into a trained soybean detection model to obtain a soybean detection result; wherein the soybean detection model is obtained based on the soybean apical bud detection model training method trained in any of the above embodiments.

[0131] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0132] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0133] The systems and techniques described herein may be implemented in a computing system that includes a backend (e.g., as a data server), or a computing system that includes middleware (e.g., an application server), or a computing system that includes a frontend (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backends, middleware, or frontends. The systems may be interconnected by digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0134] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0135] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0136] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A soybean terminal bud detection model training method, characterized in that: include: Constructing a soybean terminal bud detection dataset, wherein the soybean terminal bud detection dataset includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image; Construct a soybean detection model; wherein the soybean detection model includes a backbone network module, a neck network module and a head network module; the backbone network module includes multiple convolutional layers, and at least some of the convolutional layers in the backbone network module are group convolutional layers; the neck network module includes a feature pyramid network module and a context enhancement module; wherein the backbone network module is used to extract features of the soybean apical bud image to obtain a feature map; the neck network module is used to perform multi-scale feature fusion on the feature map; wherein the feature pyramid network module is used to extract feature maps of multiple scales; the context enhancement module is used to obtain context information based on the feature map of at least one scale, and enhance the feature maps of multiple scales respectively based on the context information; the head network module is used to output the detection prediction result; The soybean detection model is trained based on the soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: the soybean apical bud detection model in the training process is used to predict the soybean apical bud image to obtain a detection prediction result corresponding to the soybean apical bud image; based on the detection prediction result corresponding to the soybean apical bud image and the soybean apical bud detection label, the intersection-over-union ratio corresponding to the soybean apical bud image is determined; based on the soybean apical bud detection label corresponding to the soybean apical bud image, the target area and background area corresponding to the soybean apical bud image are determined; based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image, an adaptive regional enhancement loss function is generated; based on the adaptive regional enhancement loss function, the parameters of the soybean apical bud detection model in the training process are adjusted; The step of generating an adaptive region enhancement loss function based on the intersection-over-union ratio corresponding to the soybean bud image and the feature difference between the target region and the background region corresponding to the soybean bud image comprises: The intersection-and-union ratio loss term is determined based on the intersection-and-union ratio corresponding to the preset value and the soybean apical bud image; wherein, when the preset value is a constant 1, the intersection-and-union ratio loss term is expressed as ; Determining a power term of an exponential function based on a first preset parameter and the characteristic difference, and obtaining a corresponding exponential function based on the power term; The regional enhancement factor is determined based on the exponential function and the second preset parameter; wherein the regional enhancement factor is expressed as ; Characterizes the first preset parameter, the Characterizes the second preset parameter, Characterize differences in features; The adaptive regional enhancement loss function is determined based on the intersection-over-union loss term and the regional enhancement factor; wherein the adaptive regional enhancement loss function is expressed as: .

2. The method according to claim 1, characterized in that The feature pyramid network module includes at least one adaptive feature fusion attention module; the adaptive feature fusion attention module is arranged at at least one lateral connection of the feature pyramid network module and / or at the connection between the feature pyramid network module and the upsampling module in the neck network module; The adaptive feature fusion attention module includes a compression-excitation attention module, a spatial attention module and a one-dimensional convolutional layer connected in sequence; wherein, The compression incentive attention module is used to determine the channel attention weight of each channel of the input feature map of the compression incentive attention module, and generate a channel attention fusion feature map based on the channel attention weight and the input feature map of the compression incentive attention module, wherein the channel attention weight is used to highlight the channel of interest in the input feature map of the compression incentive attention module; The spatial attention module is used to determine the spatial attention weight of each spatial position in the channel attention fusion feature map, and generate a spatial attention fusion feature map based on the spatial attention weight and the channel attention fusion feature map, wherein the spatial attention weight is used to highlight the spatial position of interest in the channel attention fusion feature map; The one-dimensional convolutional layer is used to adaptively adjust the weight of each channel and the weight of each spatial position in the spatial attention fusion feature map.

3. The method according to claim 1, characterized in that The step of constructing a soybean terminal bud detection data set includes: Acquire soybean terminal bud images under different soybean maturity, lighting conditions and background conditions, and determine soybean terminal bud detection labels corresponding to the soybean terminal bud images; Based on the plurality of soybean apical bud images and the soybean apical bud detection labels respectively corresponding to the plurality of soybean apical bud images, an initial soybean apical bud detection data set is formed; The initial soybean terminal bud detection dataset is enhanced based on a generative adversarial network and / or a traditional image enhancement algorithm to obtain the soybean terminal bud detection dataset.

4. The method according to claim 1, characterized in that After obtaining the trained soybean terminal bud detection model, the method further includes: Acquire a test data set, wherein the test data set includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image; Based on the trained soybean apical bud detection model, a plurality of soybean apical bud images in the test data set are predicted and processed to obtain detection prediction results corresponding to the plurality of soybean apical bud images in the test data set; Determine the evaluation index of the soybean apical bud detection model based on the soybean apical bud detection labels and detection prediction results respectively corresponding to the plurality of soybean apical bud images in the test data set; When the evaluation index does not meet the preset index threshold, the soybean apical bud detection dataset is updated, and the soybean apical bud detection model is continuously trained based on the updated soybean apical bud detection dataset.

5. A soybean terminal bud detection method, characterized in that: include: Acquire the image of soybean terminal bud to be detected; The soybean apical bud image to be detected is input into a trained soybean detection model to obtain a soybean detection result; wherein the soybean detection model is obtained based on the soybean apical bud detection model training method described in any one of claims 1-4.

6. A soybean terminal bud detection model training device, characterized in that: include: A soybean terminal bud detection data set construction module is used to construct a soybean terminal bud detection data set, wherein the soybean terminal bud detection data set includes a soybean terminal bud image and a soybean terminal bud detection label corresponding to the soybean terminal bud image; A soybean detection model construction module is used to construct a soybean detection model; wherein the soybean detection model includes a backbone network module, a neck network module and a head network module; the backbone network module includes multiple convolutional layers, and at least some of the convolutional layers in the backbone network module are group convolutional layers; the neck network module includes a feature pyramid network module and a context enhancement module; wherein the backbone network module is used to extract features of the soybean apical bud image to obtain a feature map; the neck network module is used to perform multi-scale feature fusion on the feature map; wherein the feature pyramid network module is used to extract feature maps of multiple scales; the context enhancement module is used to obtain context information based on the feature map of at least one scale, and enhance the feature maps of multiple scales respectively based on the context information; the head network module is used to output the detection prediction result; A soybean detection model training module is used to train the soybean detection model based on the soybean apical bud detection data set to obtain a trained soybean apical bud detection model. During the training process: based on the soybean apical bud detection model in the training process, the soybean apical bud image is predicted and processed to obtain a detection prediction result corresponding to the soybean apical bud image; based on the detection prediction result corresponding to the soybean apical bud image and the soybean apical bud detection label, the intersection-over-union ratio corresponding to the soybean apical bud image is determined; based on the soybean apical bud detection label corresponding to the soybean apical bud image, the target area and background area corresponding to the soybean apical bud image are determined; based on the intersection-over-union ratio corresponding to the soybean apical bud image and the feature difference between the target area and the background area corresponding to the soybean apical bud image, an adaptive regional enhancement loss function is generated; based on the adaptive regional enhancement loss function, the parameters of the soybean apical bud detection model in the training process are adjusted; Wherein, the soybean detection model training module is specifically used for: The intersection-and-union ratio loss term is determined based on the intersection-and-union ratio corresponding to the preset value and the soybean apical bud image; wherein, when the preset value is a constant 1, the intersection-and-union ratio loss term is expressed as ; Determining a power term of an exponential function based on a first preset parameter and the characteristic difference, and obtaining a corresponding exponential function based on the power term; The regional enhancement factor is determined based on the exponential function and the second preset parameter; wherein the regional enhancement factor is expressed as ; Characterizes the first preset parameter, the Characterizes the second preset parameter, Characterize differences in features; The adaptive regional enhancement loss function is determined based on the intersection-over-union loss term and the regional enhancement factor; wherein the adaptive regional enhancement loss function is expressed as: .

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the soybean apical bud detection model training method described in any one of claims 1-4, or the soybean apical bud detection method described in claim 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the soybean terminal bud detection model training method according to any one of claims 1 to 4, or the soybean terminal bud detection method according to claim 5 when executed.