Obtaining method, device and equipment of target detection model and readable storage medium

By using feature extraction and feature enhancement modules in the object detection model, combining channel attention and self-attention mechanisms to generate more representative image features, the problems of low detection rate and insufficient accuracy of small objects in complex backgrounds are solved. Achieve more efficient object detection.

CN119295889APending Publication Date: 2025-01-10WUXI UNICOMP TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411135307.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The detection rate of small object detection methods in the complex context in the prior art is low, and the accuracy needs to be improved.

Method used

By acquiring sample images and inputting feature extraction modules and feature enhancement modules of candidate object detection models, the initial semantic features and enhanced semantic features are used, combined with channel attention units and self-attention mechanism networks, and more representative image features are generated, thus Improve the confidence of the model output results and determine a better-performance object detection model.

Benefits of technology

The rate and accuracy of object detection are improved, and the output effect of the model is enhanced by extracting and enhancing image features, and a better-performance object detection model is selected.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295889A_ABST
    Figure CN119295889A_ABST
Patent Text Reader

Abstract

The invention relates to a target detection model obtaining method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: a server obtains a sample image corresponding to an actual detection target and a plurality of candidate target detection models, inputs the sample image into a feature extraction module of the model to obtain an initial semantic feature and an enhanced semantic feature, obtains an image feature according to the semantic feature, inputs the image feature into a feature enhancement module of the model, and obtains a candidate target detection model; the method comprises the steps of obtaining a first enhanced image feature, inputting the first enhanced image feature into a channel attention unit to obtain a channel attention weight feature, inputting the first enhanced image feature and the channel attention weight feature into an attention network to obtain a second enhanced image feature, and finally obtaining a prediction detection target according to the second enhanced image feature. And a target detection model is determined according to each prediction detection target and the actual detection target. By adopting the method, the target detection model with better performance can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, apparatus, computer equipment, computer-readable storage medium and computer program product for acquiring a target detection model. Background Art

[0002] Small target detection under complex background is a key image processing technology, which is based on the difference between the target and the background in the image to identify and locate the target. At present, the small target detection method under complex background is a traditional detection method based on the image pixel intensity.

[0003] Traditional detection methods based on image pixel intensity mainly include Constant False Alarm Rate (CFAR), template matching, and feature saliency. The CFAR algorithm mainly distinguishes small targets from the background by different reflection intensities in the image, thereby realizing the function of locating small targets to achieve the detection effect. The template matching method mainly uses the neighborhood characteristics of the small target features in the image to establish a template, and then applies the template to the detection to complete the corresponding matching detection task. The feature saliency method is similar to CFAR, and mainly realizes the detection method through global and local pixel intensity comparison analysis. However, the detection rate of this method is low and the accuracy needs to be improved. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for acquiring a target detection model that can improve the detection rate and detection accuracy in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for acquiring a target detection model, comprising:

[0006] Obtain a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0007] For each candidate target detection model, the sample image is input into a feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained through the feature extraction module, and the image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features;

[0008] Input the image feature into the feature enhancement module of the candidate target detection model, obtain the first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain the channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain the second enhanced image feature of the sample image;

[0009] According to the second enhanced image feature, a predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target and the actual detection target output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models.

[0010] In one embodiment, the model parameters include loop parameters; the feature extraction module includes a normal convolution unit and a dense convolution unit;

[0011] The initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained by the feature extraction module. The image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features, including:

[0012] The initial semantic features of the sample image are obtained by ordinary convolution units, and the initial semantic features are enhanced by dense convolution units corresponding to the cyclic parameters to obtain enhanced semantic features. Based on the initial semantic features and the enhanced semantic features, the image features of the sample image are obtained.

[0013] In one embodiment, the model parameters also include convolution kernel parameters; the feature enhancement module also includes an asymmetric convolution unit and a hole convolution unit;

[0014] Inputting the image features into the feature enhancement module of the candidate target detection model, and obtaining the first enhanced image features through the feature enhancement module, including:

[0015] The image features are input into an asymmetric convolution unit and a hole convolution unit with a convolution kernel size corresponding to the convolution kernel parameters to obtain output image features after feature enhancement. The feature enhancement module obtains the first enhanced image features based on the image features and the output image features.

[0016] In an exemplary embodiment, the candidate object detection model further includes a detection head module;

[0017] Obtaining a predicted detection target corresponding to the sample image according to the second enhanced image feature, including:

[0018] The detection head module obtains a prediction block diagram corresponding to the sample image according to the second enhanced image feature;

[0019] Obtain the predicted detection target corresponding to the sample image according to the prediction block diagram.

[0020] In one embodiment, the prediction block diagram includes a plurality of candidate prediction detection targets; obtaining the prediction detection target corresponding to the sample image according to the prediction block diagram includes:

[0021] Calculate the confidence values ​​of multiple candidate predicted detection targets through the intersection and union ratio function;

[0022] Sort multiple candidate prediction detection targets from large to small according to their confidence values, and obtain the candidate prediction detection target with the largest confidence value as the benchmark prediction detection target;

[0023] Calculating the intersection-and-union ratio of the benchmark prediction detection target and the candidate prediction detection targets other than the benchmark prediction detection target among the candidate prediction detection targets to obtain the intersection-and-union ratio of each candidate prediction detection target;

[0024] When the intersection-and-union ratio of any candidate predicted detection target is greater than a preset intersection-and-union ratio threshold, the candidate predicted detection target is removed until the preset filtering condition is met, and the benchmark predicted detection target is used as the predicted detection target corresponding to the sample image.

[0025] In one embodiment, the actual detection target includes a positive actual detection target and a negative actual detection target; the predicted detection target includes a positive predicted detection target and a negative predicted detection target;

[0026] According to the predicted detection targets and actual detection targets output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models, including:

[0027] Generate a confusion matrix based on the predicted detection targets and the actual detection targets;

[0028] Based on the confusion matrix, a first value, a second value, and a third value are respectively obtained; the first value is a value for correctly predicting a positive class predicted detection target as a positive class actual detection target; the second value is a value for incorrectly predicting a negative class predicted detection target as a positive class actual detection target; the third value is a value for failing to identify a positive class predicted detection target as a positive class actual detection target;

[0029] Obtaining an average precision of the candidate target prediction model using the first value, the second value, and the third value;

[0030] The target detection model is determined from multiple candidate target detection models according to the average precision.

[0031] In an exemplary embodiment, obtaining the average accuracy of the candidate target prediction model using the first value, the second value, and the third value includes:

[0032] Using the first value, the second value, and the third value, respectively, to obtain the precision and recall of the candidate target prediction model;

[0033] A precision-recall curve is constructed based on the precision and recall, and the curve fitting degree of the precision-recall curve is obtained;

[0034] Use the precision-recall curve to calculate the average precision of the candidate object detection model;

[0035] The target detection model is determined from multiple candidate target detection models based on the average precision, including:

[0036] According to the curve fitting degree and the average precision, the target detection model is determined from multiple candidate target detection models.

[0037] In a second aspect, the present application also provides a device for acquiring a target detection model, comprising:

[0038] An acquisition module is used to acquire a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0039] An image feature acquisition module is used for inputting the sample image into the feature extraction module of the candidate target detection model for each candidate target detection model, obtaining the initial semantic features of the sample image and the enhanced semantic features for enhancing the initial semantic features through the feature extraction module, and obtaining the image features of the sample image according to the initial semantic features and the enhanced semantic features;

[0040] An image feature enhancement module is used to input the image feature into the feature enhancement module of the candidate target detection model, obtain a first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain a channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain a second enhanced image feature of the sample image;

[0041] The target detection model determination module is used to obtain the predicted detection target corresponding to the sample image according to the second enhanced image feature, and to determine the target detection model from multiple candidate target detection models according to the predicted detection target and the actual detection target output by each candidate target detection model.

[0042] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0043] Obtain a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0044] For each candidate target detection model, the sample image is input into a feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained through the feature extraction module, and the image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features;

[0045] Input the image feature into the feature enhancement module of the candidate target detection model, obtain the first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain the channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain the second enhanced image feature of the sample image;

[0046] According to the second enhanced image feature, a predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target and the actual detection target output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models.

[0047] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0048] Obtain a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0049] For each candidate target detection model, the sample image is input into a feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained through the feature extraction module, and the image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features;

[0050] Input the image feature into the feature enhancement module of the candidate target detection model, obtain the first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain the channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain the second enhanced image feature of the sample image;

[0051] According to the second enhanced image feature, a predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target and the actual detection target output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models.

[0052] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0053] Obtain a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0054] For each candidate target detection model, the sample image is input into a feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained through the feature extraction module, and the image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features;

[0055] Input the image feature into the feature enhancement module of the candidate target detection model, obtain the first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain the channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain the second enhanced image feature of the sample image;

[0056] According to the second enhanced image feature, a predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target and the actual detection target output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models.

[0057] The method, apparatus, computer device, computer-readable storage medium and computer program product for acquiring the above-mentioned target detection model, the server acquires a sample image corresponding to an actual detection target, and a plurality of pre-built candidate target detection models corresponding to different model parameters, and for each candidate target detection model, inputs the sample image into a feature extraction module of the candidate target detection model, obtains the initial semantic features of the sample image through the feature extraction module, and the enhanced semantic features for enhancing the initial semantic features, obtains the image features of the sample image based on the initial semantic features and the enhanced semantic features, inputs the image features into the feature enhancement module of the candidate target detection model, obtains the first enhanced image features through the feature enhancement module, and inputs the first enhanced image features into the channel attention unit in the feature enhancement module to obtain the channel attention weight features, inputs the first enhanced image features and the channel attention weight features into the self-attention mechanism network in the feature enhancement module to obtain the second enhanced image features of the sample image, and finally obtains the predicted detection target corresponding to the sample image based on the second enhanced image features, and determines the target detection model from multiple candidate target detection models based on the predicted detection targets and actual detection targets output by each candidate target detection model. Through the above method, more representative image features can be extracted and feature enhancement can be performed, which is beneficial to improving the credibility of the model output results and is conducive to training a target detection model with better performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0059] Figure 1 is an application environment diagram of a method for acquiring a target detection model in one embodiment;

[0060] Figure 2 A schematic diagram of a process for acquiring a target detection model in an embodiment;

[0061] Figure 3 is a schematic diagram of the structure of a candidate target detection model in an embodiment;

[0062] Figure 4 is a schematic diagram of the structure of a dense convolution unit in another embodiment;

[0063] Figure 5 is a schematic diagram of the structure of a feature enhancement module in an embodiment;

[0064] Figure 6 Schematic diagram of the structure of a channel attention unit in one embodiment;

[0065] Figure 7 is a characteristic heat map in another embodiment;

[0066] Figure 8 is a training comparison diagram of a candidate detection model in an embodiment;

[0067] Fig. 9 A diagram showing ablation learning experiment results in another embodiment;

[0068] Fig.10 is a structural block diagram of a device for acquiring a target detection model in one embodiment;

[0069] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0070] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0071] The method for obtaining the target detection model provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network, and the terminal 102 sends the collected sample image to the server 104, and the sample image corresponds to the actual detection target. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The data storage system stores the received sample images and multiple candidate target detection models, and each candidate target detection model corresponds to different model parameters. The server 104 obtains the sample image and multiple pre-built candidate target detection models from the data storage system, and for each candidate target detection model, the sample image is input into the feature extraction module of the candidate target detection model. The initial semantic features of the sample image are obtained through the feature extraction module, and the enhanced semantic features of the initial semantic features are characterized. According to the initial semantic features and the enhanced semantic features, the image features of the sample image are obtained, and then the image features are input into the feature enhancement module of the candidate target detection model, and the first enhanced image features are obtained through the feature enhancement module, and the first enhanced image features are input into the channel attention unit in the feature enhancement module to obtain the channel attention weight feature, and the first enhanced image features and the channel attention weight feature are input into the self-attention mechanism network in the feature enhancement module to obtain the second enhanced image features of the sample image, and finally, according to the second enhanced image features, the predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target and the actual detection target output by each candidate target detection model, the target detection model is determined from multiple candidate target detection models. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0072] In an exemplary embodiment, Figure 2 As shown, a method for obtaining a target detection model is provided, and the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S201 to S204. Among them:

[0073] Step S201, obtaining a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter.

[0074] Among them, the sample images can be understood as images of different sizes, which include multiple actual small targets; the candidate target detection models can be understood as target detection models corresponding to different model parameters. The internal structure of the models is the same, and only the parameters of some components are different.

[0075] Optionally, the server 104 obtains pre-stored sample images and a plurality of pre-built candidate object detection models from a data storage system, which lays a data foundation for subsequently determining a final object detection model.

[0076] Step S202: For each candidate target detection model, the sample image is input into the feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features that enhance the initial semantic features are obtained through the feature extraction module. The image features of the sample image are obtained based on the initial semantic features and the enhanced semantic features.

[0077] Among them, the initial semantic features can be understood as the attributes or characteristics of the image at the most basic level, which can convey the core meaning of the image; the enhanced semantic features can be understood as the information that further enhances the initial semantic features, which can more accurately convey the core meaning of the image; the image features can be understood as the attributes and information used to describe and represent the image content, such as color features, texture features, shape features, spatial features and local features.

[0078] For example, the server inputs the sample images into the feature extraction modules of each candidate target detection model, obtains the initial semantic features of the sample images and the enhanced semantic features for feature enhancement of the initial semantics through the feature extraction modules, and finally obtains the image features for clearly conveying the attributes and information of the image content of the sample images based on the initial semantic features and the enhanced semantic features. The above feature extraction process can extract more effective image features, thereby improving the credibility of the output results of the model.

[0079] Step S203: input the image features into the feature enhancement module of the candidate target detection model, obtain the first enhanced image features through the feature enhancement module, input the first enhanced image features into the channel attention unit in the feature enhancement module, obtain the channel attention weight features, input the first enhanced image features and the channel attention weight features into the self-attention mechanism network in the feature enhancement module, and obtain the second enhanced image features of the sample image.

[0080] Among them, the first enhanced image feature can be understood as the image feature after the feature enhancement of the first half of the image feature; the channel attention unit is CAM (Channel Attention Module) which can be understood as the module for generating the channel attention of the corresponding feature; the channel attention weight feature can be understood as a mechanism for emphasizing or suppressing the importance of different channel features in neural networks, especially convolutional neural networks (CNN). Different weight features correspond to different features, such as the channel weight features corresponding to color features and texture features are different; the self-attention mechanism network is sim-AM (Similarity Attention Module), which can be understood as a network structure for processing sequence data, especially in natural language processing and computer vision. Its core idea is to adaptively adjust the representation of each element by calculating the relationship between different elements in the input sequence; the second enhanced image feature is the image feature obtained by feature enhancement of the second half of the first enhanced image feature.

[0081] Optionally, the server 104 inputs the image features into a feature enhancement module of the candidate target detection model. The feature enhancement module obtains a first enhanced image feature, and the first enhanced image feature is input into the channel attention bile duct in the feature enhancement module to obtain a channel attention weight feature, and the first enhanced image feature and the channel attention weight feature are input into the self-attention mechanism network in the feature enhancement module to obtain a second enhanced image feature of the sample image. The above feature enhancement method can further improve the focus of the feature, thereby improving the credibility of the model output result.

[0082] Step S204, obtaining a predicted detection target corresponding to the sample image according to the second enhanced image feature, and determining a target detection model from multiple candidate target detection models according to the predicted detection targets and actual detection targets output by each candidate target detection model.

[0083] The predicted detection target can be understood as the object information in the image. The object can be a person or an object, and includes corresponding position information.

[0084] For example, the server 104 obtains the predicted detection target corresponding to the sample image according to the second enhanced image feature, and determines the target detection model from multiple candidate target detection models according to the predicted detection target and the actual detection target output by each candidate target detection model. By comparing the output results of the model with the actual results, the target detection model with the best effect is determined from multiple candidate target detection models, which can speed up the determination of the target detection model, and at the same time, the model with the best performance can be selected as the final model for use.

[0085] In the above-mentioned method for acquiring the target detection model, the server acquires a sample image corresponding to the actual detection target, and a plurality of pre-built candidate target detection models corresponding to different model parameters. For each candidate target detection model, the sample image is input into the feature extraction module of the candidate target detection model, and the initial semantic features of the sample image and the enhanced semantic features for feature enhancement of the initial semantic features are obtained through the feature extraction module. The image features of the sample image are obtained based on the initial semantic features and the enhanced semantic features. The image features are input into the feature enhancement module of the candidate target detection model, and the first enhanced image features are obtained through the feature enhancement module. The first enhanced image features are input into the channel attention unit in the feature enhancement module to obtain the channel attention weight features. The first enhanced image features and the channel attention weight features are input into the self-attention mechanism network in the feature enhancement module to obtain the second enhanced image features of the sample image. Finally, based on the second enhanced image features, the predicted detection target corresponding to the sample image is obtained, and the target detection model is determined from multiple candidate target detection models based on the predicted detection targets and the actual detection targets output by each candidate target detection model. Through the above method, more representative image features can be extracted and feature enhancement can be performed, which is beneficial to improving the credibility of the model output results and is conducive to training a target detection model with better performance.

[0086] In one embodiment, the model parameters include loop parameters; the feature extraction module includes a normal convolution unit and a dense convolution unit;

[0087] The initial semantic features of the sample image and the enhanced semantic features of the initial semantic features are obtained by the feature extraction module. The image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features, including:

[0088] The initial semantic features of the sample image are obtained by ordinary convolution units, and the initial semantic features are enhanced by dense convolution units corresponding to the cyclic parameters to obtain enhanced semantic features. Based on the initial semantic features and the enhanced semantic features, the image features of the sample image are obtained.

[0089] Among them, the ordinary convolution unit can connect the units connected in sequence in the convolution layer, the dense convolution unit can be understood as the units connected in sequence and skipped in the convolution layer, and the loop parameter can be understood as the number of dense convolution units.

[0090] Optionally, the initial semantic features of the sample image are obtained by a common convolution unit, and then the initial semantic features are enhanced by a number of dense convolution units corresponding to the loop parameter to obtain enhanced semantic features, and the image features of the sample image are obtained based on the initial semantic features and the enhanced semantic features. By changing the connection mode of the convolution layer in the dense convolution unit, the image features are jointly determined based on the initial semantic features and the enhanced semantic features, which effectively improves the feature extraction effect.

[0091] In one embodiment, the model parameters also include convolution kernel parameters; the feature enhancement module also includes an asymmetric convolution unit and a hole convolution unit;

[0092] Inputting the image features into the feature enhancement module of the candidate target detection model, and obtaining the first enhanced image features through the feature enhancement module, including:

[0093] The image features are input into an asymmetric convolution unit and a hole convolution unit with a convolution kernel size corresponding to the convolution kernel parameters to obtain output image features after feature enhancement. The feature enhancement module obtains the first enhanced image features based on the image features and the output image features.

[0094] Among them, the asymmetric convolution unit can be understood as two parallel convolution units, each of which contains multiple convolution layers, and the width and length of the convolution layers are not equal; the hole convolution unit can be understood as being used to increase the receptive field of the convolution layer; the convolution kernel parameters can be understood as the width and length of each convolution layer. The length and width must be different, but the length and width between convolution layers can be the same.

[0095] For example, the image features are input into an asymmetric convolution unit and a hole convolution unit of a convolution kernel size corresponding to the convolution kernel parameters to obtain the output image features after feature enhancement, and then the feature enhancement module obtains the first enhanced image features according to the image features and the output image features. The above means are used to improve the focus of each feature of the image features, thereby improving more effective image features for subsequent output prediction and detection targets.

[0096] In an exemplary embodiment, the candidate target detection model also includes a detection head module; based on the second enhanced image features, a predicted detection target corresponding to the sample image is obtained, including: the detection head module obtains a prediction block diagram corresponding to the sample image based on the second enhanced image features; and obtains the predicted detection target corresponding to the sample image based on the prediction block diagram.

[0097] The detection head module can be understood as the part that generates the final prediction. It is the key component in the model that converts feature maps into object categories and locations (bounding box coordinates).

[0098] Optionally, the server 104 inputs the second enhanced image features obtained above into the detection head module, and the detection head module obtains the prediction block diagram corresponding to the sample image according to the second enhanced image features, and finally the candidate target detection model obtains the predicted detection target corresponding to the sample image according to the prediction block diagram. The detection head module converts the image features into a prediction block diagram with object categories and positions, which speeds up the acquisition of predicted detection targets.

[0099] In one embodiment, a prediction block diagram includes multiple candidate prediction detection targets; the prediction detection target corresponding to the sample image is obtained according to the prediction block diagram, including: calculating the confidence values ​​of multiple candidate prediction detection targets through an intersection-and-union function; sorting the multiple candidate prediction detection targets from large to small according to the confidence values, and obtaining the candidate prediction detection target with the largest confidence value as the baseline prediction detection target; calculating the intersection-and-union ratio of the baseline prediction detection target and the candidate prediction detection targets other than the baseline prediction detection target among the candidate prediction detection targets to obtain the intersection-and-union ratio of each candidate prediction detection target; when the intersection-and-union ratio of any candidate prediction detection target is greater than a preset intersection-and-union ratio threshold, the candidate prediction detection target is removed until the preset filtering condition is met, and the baseline prediction detection target is used as the prediction detection target corresponding to the sample image.

[0100] Among them, the intersection-over-union function can be understood as an indicator for evaluating the performance of target detection and image segmentation models. It quantifies the accuracy of the detection results by calculating the ratio of the intersection and union of the predicted bounding box and the true bounding box (ground truth); the confidence value can be understood as an indicator used to indicate the degree of confidence of the model in a certain prediction result in target detection and other classification tasks. It is usually a value between 0 and 1, reflecting the confidence of the model that an object belongs to a specific category; the preset filtering condition can be understood as all candidate prediction detection targets are removed, leaving only the benchmark prediction detection target.

[0101] For example, the server 104 uses the intersection-and-union function to calculate the actual detection target and multiple candidate prediction detection targets to obtain the confidence value of the candidate prediction detection target, and sorts the multiple candidate prediction detection targets from large to small according to the confidence value, and obtains the candidate prediction detection target with the largest confidence value as the benchmark prediction detection target, and then calculates the intersection-and-union ratio of the benchmark prediction detection target and the remaining candidate prediction detection targets to obtain the corresponding intersection-and-union ratio. If the intersection-and-union ratio of any candidate prediction detection target is greater than a preset intersection-and-union ratio threshold, the candidate prediction detection target is removed until the candidate prediction detection targets other than the benchmark prediction detection target are filtered out, and the benchmark prediction detection target is used as the prediction detection target corresponding to the sample image. The above means can obtain a prediction detection target that is closer to the actual detection target, which is conducive to improving the output effect of the model.

[0102] In one embodiment, the actual detection target includes a positive actual detection target and a negative actual detection target; the predicted detection target includes a positive predicted detection target and a negative predicted detection target;

[0103] According to the predicted detection targets and actual detection targets output by each candidate target detection model, a target detection model is determined from multiple candidate target detection models, including: generating a confusion matrix according to the predicted detection targets and the actual detection targets; obtaining a first value, a second value, and a third value based on the confusion matrix; the first value is a value for correctly predicting a positive class predicted detection target as a positive class actual detection target; the second value is a value for incorrectly predicting a negative class predicted detection target as a positive class actual detection target; the third value is a value for failing to identify a positive class predicted detection target as a positive class actual detection target; obtaining an average accuracy of the candidate target prediction models using the first value, the second value, and the third value; and determining a target detection model from multiple candidate target detection models according to the average accuracy.

[0104] Among them, the positive actual detection target can be understood as the actual detection target that is correctly recognized, and the negative actual detection target can be the actual detection target that is incorrectly recognized; similarly, the positive predicted detection target can be understood as the detection target that the model output considers to be correctly recognized, and the negative predicted detection target can be understood as the detection target that the model output considers to be incorrectly recognized.

[0105] Among them, the first value can be understood as the value of correctly predicting the positive class predicted detection target as the positive class actual detection target, the second value can be understood as the value of incorrectly predicting the negative class predicted detection target as the positive class actual detection target, and the third value can be understood as the value of the positive class predicted detection target that cannot be identified as the positive class actual detection target.

[0106] Optionally, the server 104 generates a confusion matrix based on the predicted detection target and the actual detection target, and obtains the first value, the second value, and the third value based on the confusion matrix, and finally obtains the average accuracy of the candidate target prediction model using the first value, the second value, and the third value, and determines the target detection model from multiple candidate target detection models based on the average accuracy. Through the calculation of the confusion matrix, the performance of the model in different categories can be accurately understood, and the advantages and disadvantages of the model can be found. By calculating the average accuracy of each candidate model, the optimal model can be scientifically selected to improve the efficiency and accuracy of the target detection task. Using the analysis results of the confusion matrix, feedback basis can be provided for subsequent model improvement and optimization, and model performance can be continuously improved.

[0107] In an exemplary embodiment, the average precision of the candidate target prediction model is obtained using the first value, the second value, and the third value, including: obtaining the precision and recall of the candidate target prediction model respectively using the first value, the second value, and the third value; constructing a precision-recall curve based on the precision and the recall, and obtaining the curve fitting of the precision-recall curve; calculating the average precision of the candidate target detection model using the precision-recall curve; determining the target detection model from multiple candidate target detection models according to the average precision, including: determining the target detection model from multiple candidate target detection models according to the curve fitting and the average precision.

[0108] Among them, precision can be understood as the first value / first value + second value; recall can be understood as the first value / first value + third value; curve fitting can be understood as the smoothness of the curve, and average precision can be understood as the curve area under each point.

[0109] For example, the server 104 uses the first value, the second value, and the third value to respectively obtain the precision and recall of the candidate target prediction model, and constructs a precision-recall curve based on the precision and recall, and simultaneously obtains the curve fitting degree of the curve, and calculates the curve area corresponding to each point on the curve as the average precision of the candidate target detection model, and selects the candidate target detection model with the smoothest curve and the largest average precision as the target detection model. By visualizing the precision, recall, and average precision, the output effect of each candidate target detection model can be more intuitively judged, which is conducive to quickly selecting the candidate target detection model with the best performance as the target detection model.

[0110] An exemplary specific structure of the target detection model of this application is DDSA-Net, such as Figure 3As shown. The network mainly includes three modules, namely the feature preliminary extraction module (Blackbone), the feature enhancement module (AESA Patch), and the feature fusion module. The feature preliminary extraction module is mainly composed of multi-layer IDB and ordinary convolution, which has the function of preliminary extraction of input image features. The feature enhancement module is mainly composed of SimAM attention mechanism, asymmetric convolution and hole convolution. The size of the asymmetric convolution kernel is adaptively adjusted according to the depth of feature extraction of the entire network. The feature fusion module is mainly composed of upsampling and a series of convolutions. In order to make the detection effect better, the present invention designs three detection heads with the same YOLO. The three detection heads cover multi-scale image features, which are the receptive fields of A*A, B*B, and C*C pixels respectively. Upsampling is used between the three detection heads to make each detection head independent of each other and have a connection relationship, and predict and output three target borders of corresponding sizes. In the link of each detection head, it can be seen that Head.3 is the feature prediction map presented after the AESA Patch NO.1 module, Head.2 inherits and strengthens the features of Head.1 and then presents the feature prediction map after AESA Patch NO.2, and Head.1 inherits and strengthens the features of Head.2 and then presents the feature prediction map after AESA Patch NO.3. The overall structure of the network is as follows: Figure 3 , the specific parameters in the network are shown in Table 1:

[0111] Table 1 Network parameters

[0112]

[0113] The following is a detailed introduction to the main modules. The first is the improved dense network module. Since the dense network has a strong ability to parse image semantics, the present invention proposes an improved dense network (Improved Dense Block, IDB) based on the dense connection method. The network mainly connects three convolutional layers densely, and finally superimposes the initial semantic features of the front end of the module with the terminal module in the plane dimension. The network structure of IDB is as follows: Figure 4 As shown, its expression is:

[0114]

[0115] In the above formula, Refers to IDB, It can be expressed as:

[0116]

[0117] in, is the input, yes The weights of the convolution, is the bias, conv represents the convolution operation, and LeakyReLU is a nonlinear activation function.

[0118] It stands for "Convlution + BN + LeakyRelu", which can be expressed as:

[0119]

[0120] in, and Yes Input The mean and variance of is a very small constant to avoid the denominator being zero. and are the stretch and offset parameters in the batch normalized layer velocity layer.

[0121] exist Figure 4 In the example, "BN" stands for batch normalization, which can normalize the image so that the network can converge quickly. LeakyRelu refers to the activation function. Compared with the Relu function, LeakyRelu retains some negative numbers on the negative semi-axis, avoiding the vanishing gradient of the Relu function when the value is less than 0.

[0122] The second is to introduce the local asymmetric enhanced Sim attention module of the present invention, such as Figure 5 As shown in Figure 1. In this network, two asymmetric convolutions are first performed in parallel, and then their output features are superimposed. Then, after the dilated convolution, they are semantically fused with the front-end features. Finally, average pooling is introduced to enhance the features in the first half of the network. Next, CAM and SimAM attention mechanisms are added to further enhance the features. Here, CAM refers to channel attention, as shown in Figure 1. Figure 6 As shown in the figure, since channel attention can adaptively weight the feature maps of multiple channels and enhance the high-dimensional information of image targets, it is also one of the important enhancement modules in this module. Finally, after the SimAM attention network, the basic idea of ​​the model is to apply the attention mechanism to the feature map in the image, so that the network can adaptively focus on the most representative feature area in the image. Specifically, SimAM contains two important components, namely similarity matrix calculation and similarity weighting. The similarity matrix is ​​calculated by calculating the similarity between each position in the feature map, and converting the information in the image into a similarity matrix. The similarity here can be measured in different ways, such as Euclidean distance, cosine similarity, etc. The calculation of the similarity matrix can be achieved by convolution or full connection.

[0123] The similarity weighting method is to apply the similarity matrix to each position in the feature map to produce a weighted feature map. Specifically, SimAM uses the similarity of each position to the position in the field where it is located as a weight, and performs a weighted average on the corresponding feature vector. In this way, the network can focus on the most representative feature area while retaining the global information of the image, thereby improving the discriminability of image features. Compared with the deep convolutional attention mechanism, SimAM is mathematically interpretable. Its algorithm is based on visual neural theory. When processing visual tasks, it can highlight the difference between its information-rich neurons and neighboring neurons, and add weight coefficients based on this difference, so that the network can distinguish between foreground and background more flexibly and accurately, making the network more robust. SimAM can be expressed as:

[0124]

[0125]

[0126]

[0127]

[0128] In the above expression, Represents the pixel point in each window pane, where the energy The higher the image neurons The greater the difference from the surrounding neurons.

[0129] An exemplary embodiment has the following specific process:

[0130] The dataset for experimental training in this application has X images and Y small objects, including images of various sizes. The experiment selected 20% of the images as the validation dataset, and selected Z images of the remaining small object images as test samples. The specific method is as follows:

[0131] A. Send the image to be inspected with a size of D*D pixels into the network, and first generate three feature maps of different sizes, namely Head.1, Head.2, and Head.3, through the DDSA-Net proposed in the present invention;

[0132] B. Generate three corresponding prediction boxes for each target in each Head, that is, generate n detection boxes for each target in each image;

[0133] C. Calculate the confidence values ​​of the n detection boxes in each target through the IOU function, and use non-maximum suppression (NMS) to filter out the redundant boxes, leaving only one target box and outputting it.

[0134] In addition, since the present invention needs to detect small targets, it is inevitable to solve the classification problem. Therefore, the binary cross entropy loss function (BCE) is introduced. This loss function is mainly aimed at the binary classification problem and fits the task of distinguishing small targets from the surrounding background that the present invention needs to complete. From the perspective of probability, the cross entropy loss completes the binary classification task by calculating the probability of whether the pixel points in each area of ​​the image are small targets, simplifying the complex problem. Its expression is:

[0135]

[0136] In addition, the CIoU target box loss function is introduced. In order to make the model converge quickly, CIoU introduces the penalty factor RCIoU on the basis of DIoU, making the training model more accurate. Compared with the IoU function, when there is no overlap between the prior box and the predicted box, CIoU will consider the distance between the two boxes instead of outputting 0 like the IoU function, thus affecting the overall back propagation of the model. Its expression is:

[0137]

[0138] In this formula, Represents the probability result of the model's prediction of the sample, It means sample The real label, Represents the number of samples in the population.

[0139] in,

[0140]

[0141]

[0142]

[0143]

[0144] In the above formula, represents the intersection of the predicted bounding box and the label bounding box, Represents the union of the predicted bounding box and the label bounding box, It is used to measure the consistency of the relative proportions of two rectangular boxes, including the predicted and And the label and , Represents the Euclidean distance between the predicted box and the true box, It represents the diagonal distance of the smallest enclosing rectangular box that can contain both the predicted box and the true box.

[0145] The parameters of the algorithm of the present invention during the training process are as follows.

[0146] The network training epoch size is set to 300, the Batch Normlization function sets the momentum to 0.9, the batch size to 32, and the stochastic gradient descent (SGD) method is used to update the network weights, setting the weight to 0.0005 and the momentum to 0.937. The linear learning rate is introduced, which gradually increases to 0.01 from epoch 0 to 20, and then gradually decreases at a rate of 0.1, and drops to 0.001 at epoch 300. The dilated convolution rate is set to 2.

[0147] In order to obtain the best model, the present invention lists three ablation training schemes: Scheme 1, appropriately reduce the number of cycles of the IDB module, verify the performance of the model when the IDB cycle number is [2, 4, 6] and the performance of the model when the cycle number is [2, 2, 2], and the other modules and parameters remain unchanged; Scheme 2, replace the SimAM mechanism in the AESA Patch with CBAM, CAM+SimAM, SE+SimAM; Scheme 3, uniformly set the asymmetric convolution sizes in the three AESA Patches to And set the asymmetric convolution sizes in the three AESA patches to and , and , and In order to intuitively show the specific effect of model ablation, the present invention performs feature visualization on scheme 1 and scheme 2 respectively, such as Figure 7 shown.

[0148] exist Figure 7 It can be seen from the figure that when the feature heat map output by IDB[2, 4, 6] is selected in Scheme 1, the activation intensity of the former model in the target object area is significantly higher than that in other areas, which fully demonstrates the efficient feature extraction capability of IDB[2, 4, 6] in Scheme 1. Similarly, the corresponding heat maps output by the three methods in the proposed Scheme 3 show that the image features output by the AESA_Patch (CAM+SimAM) module are more focused on the key feature areas of the target object, while forming a significant contrast with the background. This highly significant focusing effect not only improves the model's ability to distinguish in complex scenes, but also shows the model's efficiency in capturing the details of the target object.

[0149] Furthermore, for quantitative analysis and this purpose, this application uses AP, F1 score and model size as evaluation indicators. The specific performance indicators of each model are shown in Table 2.

[0150] Table 2 Specific parameters of each scheme

[0151]

[0152] As can be seen from Table 2, the model performances of the three schemes are different. The present invention uses AP as the main indicator to select a group of model blocks with relatively high AP values ​​in each scheme to verify the model again, and obtains two combined models. IDB[2,2,2], CBAM and asymmetric convolutions of different sizes are selected as model 1. IDB[2,2,2], CAM, SimAM and asymmetric convolutions of different sizes are selected as model 2. The two schemes are verified and trained to obtain the PR curve, as shown in Figure 8 As shown in the figure, (a) represents the training result of model 1, and (b) represents the training result of model 2. It can be seen from the figure that the PR curve of (b) is smoother than that of (a), and the AP value of small targets (b) is 0.9% higher than that of (a).

[0153] In order to test the actual effect of the model, the above two models are tested on two pictures respectively and their detection effects are observed, as shown in the figure below. Fig. 9 As shown in the figure, the leftmost column represents the label map, and the remaining two columns represent the detection effect diagrams of the two algorithms. Fig. 9 (a) represents the original image picture that has been manually annotated. Fig. 9 (b) shows the detection effect diagram of model 1. Fig. 9 (c) shows the detection effect diagram of model 2. Fig. 9 In the first row of three pictures, there is still a big gap between Model 1 and Model 2 in detection. The detection accuracy of Model 2 is higher than that of Model 1. In addition, Model 1 has some false detections, and its effect is far inferior to Model 2. Fig. 9 In the second row of , model 2 has higher detection accuracy than model 1. Overall, model 2 is much better than model 1 in detection accuracy.

[0154] Compared with the prior art, this application has the following advantages:

[0155] 1. By improving the connection relationship between the convolutional layers within the dense network unit, the feature extraction of the sample image is further improved, and the effective feature information can be better focused.

[0156] 2. By adding the channel attention mechanism, the image features are further enhanced and the output effect of the model is improved.

[0157] 3. The target detection model in this application can not only provide accurate target location, but also has good robustness and achieves a balance between time and space.

[0158] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0159] Based on the same inventive concept, the embodiment of the present application also provides a device for acquiring a target detection model for implementing the target detection model acquisition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the device for acquiring one or more target detection models provided below can refer to the limitations of the target detection model acquisition method above, and will not be repeated here.

[0160] In an exemplary embodiment, Fig.10 As shown, a device for acquiring a target detection model is provided, comprising: an acquisition module 1001, an image feature acquisition module 1002, an image feature enhancement module 1003 and a target detection model determination module, wherein:

[0161] The acquisition module 1001 is used to acquire a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter;

[0162] The image feature acquisition module 1002 is used for inputting the sample image into the feature extraction module of the candidate target detection model for each candidate target detection model, obtaining the initial semantic features of the sample image and the enhanced semantic features for enhancing the initial semantic features through the feature extraction module, and obtaining the image features of the sample image according to the initial semantic features and the enhanced semantic features;

[0163] The image feature enhancement module 1003 is used to input the image feature into the feature enhancement module of the candidate target detection model, obtain a first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module, obtain a channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module, and obtain a second enhanced image feature of the sample image;

[0164] The target detection model determination module 1004 is used to obtain the predicted detection target corresponding to the sample image according to the second enhanced image feature, and determine the target detection model from multiple candidate target detection models according to the predicted detection target and the actual detection target output by each candidate target detection model.

[0165] In one embodiment, the model parameters include loop parameters; the feature extraction module includes ordinary convolution units and dense convolution units; the image feature acquisition module is also used to obtain the initial semantic features of the sample image through the ordinary convolution units, and the initial semantic features are enhanced by the dense convolution units corresponding to the loop parameters to obtain enhanced semantic features, and the image features of the sample image are obtained based on the initial semantic features and the enhanced semantic features.

[0166] In one embodiment, the model parameters also include convolution kernel parameters; the feature enhancement module also includes an asymmetric convolution unit and a hole convolution unit; the image feature enhancement module 1003 is also used to input the image features into the asymmetric convolution unit and the hole convolution unit of the convolution kernel size corresponding to the convolution kernel parameters to obtain the output image features after feature enhancement, and the feature enhancement module obtains the first enhanced image features based on the image features and the output image features.

[0167] In an exemplary embodiment, the candidate target detection model further includes a detection head module; the target detection model determination module 1004 further includes:

[0168] The prediction block diagram determination submodule is used for obtaining the prediction block diagram corresponding to the sample image by the detection head module according to the second enhanced image feature.

[0169] The predicted detection target determination submodule obtains the predicted detection target corresponding to the sample image according to the prediction block diagram.

[0170] In one embodiment, a predicted detection target corresponding to a sample image is obtained according to a prediction block diagram; the predicted detection target determination submodule is also used to calculate confidence values ​​of multiple candidate predicted detection targets through an intersection-and-union ratio function; multiple candidate predicted detection targets are sorted from large to small according to the confidence values, and the candidate predicted detection target with the largest confidence value is obtained as the baseline predicted detection target; an intersection-and-union ratio is calculated for the baseline predicted detection target and the candidate predicted detection targets other than the baseline predicted detection target to obtain the intersection-and-union ratio of each candidate predicted detection target; when the intersection-and-union ratio of any candidate predicted detection target is greater than a preset intersection-and-union ratio threshold, the candidate predicted detection target is removed until a preset filtering condition is met, and the baseline predicted detection target is used as the predicted detection target corresponding to the sample image.

[0171] In one of the embodiments, the actual detection target includes a positive actual detection target and a negative actual detection target; the predicted detection target includes a positive predicted detection target and a negative predicted detection target; the target detection model determination module 1004 is also used to generate a confusion matrix based on the predicted detection target and the actual detection target; based on the confusion matrix, a first value, a second value and a third value are respectively obtained; the first value is a value for correctly predicting the positive predicted detection target as the positive actual detection target; the second value is a value for incorrectly predicting the negative predicted detection target as the positive actual detection target; the third value is a value for failing to identify the positive predicted detection target as the positive actual detection target; the first value, the second value and the third value are used to obtain the average accuracy of the candidate target prediction model; and the target detection model is determined from multiple candidate target detection models according to the average accuracy.

[0172] In an exemplary embodiment, the target detection model determination module 1004 is further used to use the first value, the second value and the third value to respectively obtain the precision and recall of the candidate target prediction model; construct a precision-recall curve based on the precision and recall, and obtain the curve fitting of the precision-recall curve; use the precision-recall curve to calculate the average precision of the candidate target detection model; and determine the target detection model from multiple candidate target detection models based on the curve fitting and the average precision.

[0173] Each module in the acquisition device of the above target detection model can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0174] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.11As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store sample image data, candidate target detection models and model parameter data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for obtaining a target detection model is implemented.

[0175] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0176] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method for acquiring the target detection model of the above embodiment is implemented.

[0177] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for acquiring the target detection model of the above embodiment is implemented.

[0178] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the method for acquiring the target detection model of the above embodiment.

[0179] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0180] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0181] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0182] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for acquiring a target detection model, characterized in that: The method comprises: Acquire a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter; For each of the candidate target detection models, the sample image is input into a feature extraction module of the candidate target detection model, initial semantic features of the sample image and enhanced semantic features of the initial semantic features are obtained through the feature extraction module, and image features of the sample image are obtained according to the initial semantic features and the enhanced semantic features; Input the image feature into the feature enhancement module of the candidate target detection model, obtain a first enhanced image feature through the feature enhancement module, input the first enhanced image feature into the channel attention unit in the feature enhancement module to obtain a channel attention weight feature, input the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module to obtain a second enhanced image feature of the sample image; According to the second enhanced image feature, the predicted detection target corresponding to the sample image is obtained, and according to the predicted detection target output by each candidate target detection model and the actual detection target, a target detection model is determined from multiple candidate target detection models.

2. The method according to claim 1, characterized in that The model parameters include loop parameters; the feature extraction module includes a common convolution unit and a dense convolution unit; The method of obtaining the initial semantic features of the sample image and the enhanced semantic features by performing feature enhancement on the initial semantic features through the feature extraction module, and obtaining the image features of the sample image according to the initial semantic features and the enhanced semantic features, comprises: The initial semantic features of the sample image are obtained by the ordinary convolution unit, and the initial semantic features are enhanced by the dense convolution units corresponding to the number of the loop parameters to obtain enhanced semantic features, and the image features of the sample image are obtained based on the initial semantic features and the enhanced semantic features.

3. The method according to claim 1, characterized in that The model parameters also include convolution kernel parameters; the feature enhancement module also includes an asymmetric convolution unit and a hole convolution unit; The step of inputting the image feature into the feature enhancement module of the candidate target detection model and obtaining the first enhanced image feature through the feature enhancement module comprises: The image features are input into an asymmetric convolution unit and the hole convolution unit with a convolution kernel size corresponding to the convolution kernel parameters to obtain output image features after feature enhancement. The feature enhancement module obtains a first enhanced image feature based on the image features and the output image features.

4. The method according to claim 1, characterized in that: The candidate target detection model also includes a detection head module; The obtaining, according to the second enhanced image feature, a predicted detection target corresponding to the sample image includes: The detection head module obtains a prediction block diagram corresponding to the sample image according to the second enhanced image feature; The predicted detection target corresponding to the sample image is obtained according to the prediction block diagram.

5. The method according to claim 4, characterized in that The prediction block diagram includes a plurality of candidate prediction detection targets; The step of obtaining the predicted detection target corresponding to the sample image according to the prediction block diagram includes: Calculating the confidence values ​​of the plurality of candidate predicted detection targets by using an intersection-over-union function; Sort the plurality of candidate prediction detection targets from large to small according to the confidence values, and obtain the candidate prediction detection target with the largest confidence value as the benchmark prediction detection target; Calculating an intersection-and-union ratio of the benchmark prediction detection target and candidate prediction detection targets among the candidate prediction detection targets except the benchmark prediction detection target to obtain an intersection-and-union ratio of each candidate prediction detection target; When the intersection-and-union ratio of any candidate predicted detection target is greater than a preset intersection-and-union ratio threshold, the candidate predicted detection target is removed until a preset filtering condition is met, and the benchmark predicted detection target is used as the predicted detection target corresponding to the sample image.

6. The method according to claim 1, characterized in that The actual detection targets include positive actual detection targets and negative actual detection targets; the predicted detection targets include positive predicted detection targets and negative predicted detection targets; The step of determining a target detection model from a plurality of candidate target detection models according to the predicted detection targets output by each of the candidate target detection models and the actual detection targets includes: Generate a confusion matrix based on the predicted detection target and the actual detection target; Based on the confusion matrix, a first value, a second value and a third value are respectively obtained; the first value is a value for correctly predicting the positive class predicted detection target as the positive class actual detection target; the second value is a value for incorrectly predicting the negative class predicted detection target as the positive class actual detection target; the third value is a value for failing to identify the positive class predicted detection target as the positive class actual detection target; Obtaining an average accuracy of the candidate target prediction model using the first value, the second value, and the third value; The target detection model is determined from the plurality of candidate target detection models according to the average precision.

7. The method according to claim 6, characterized in that The using the first value, the second value, and the third value to obtain the average accuracy of the candidate target prediction model includes: Using the first value, the second value, and the third value, respectively, to obtain the precision and recall of the candidate target prediction model; Constructing a precision-recall curve based on the precision and the recall, and obtaining a curve fitting degree of the precision-recall curve; Calculating the average precision of the candidate target detection model using the precision-recall curve; Determining the target detection model from the plurality of candidate target detection models according to the average precision includes: The target detection model is determined from the plurality of candidate target detection models according to the curve fitting degree and the average precision.

8. A device for acquiring a target detection model, characterized in that: The device comprises: An acquisition module is used to acquire a sample image and a plurality of pre-built candidate target detection models; the sample image corresponds to an actual detection target; each candidate target detection model corresponds to a different model parameter; An image feature acquisition module, for inputting the sample image into a feature extraction module of the candidate target detection model for each candidate target detection model, obtaining an initial semantic feature of the sample image and an enhanced semantic feature for enhancing the initial semantic feature through the feature extraction module, and obtaining an image feature of the sample image according to the initial semantic feature and the enhanced semantic feature; An image feature enhancement module, used for inputting the image feature into the feature enhancement module of the candidate target detection model, obtaining a first enhanced image feature through the feature enhancement module, and inputting the first enhanced image feature into the channel attention unit in the feature enhancement module to obtain a channel attention weight feature, and inputting the first enhanced image feature and the channel attention weight feature into the self-attention mechanism network in the feature enhancement module to obtain a second enhanced image feature of the sample image; The target detection model determination module is used to obtain the predicted detection target corresponding to the sample image according to the second enhanced image feature, and to determine the target detection model from multiple candidate target detection models according to the predicted detection target output by each candidate target detection model and the actual detection target.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.