Cascade attention-based detection model training and target detection method and system
By combining a cascaded attention pyramid network and a region generation network, the problem of information loss caused by incomplete targets is solved, resulting in more accurate candidate region generation and improved target detection accuracy.
Patent Information
- Application Number
- CN202310569798.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2043-05-19
AI Technical Summary
Existing target detection methods suffer from information loss due to target incompleteness in complex scenarios, making it impossible to effectively acquire information about incomplete targets and resulting in inaccurate localization.
A target detection model based on cascaded attention is adopted. The highest-level features of the network are enhanced and fused through a cascaded attention pyramid network. Combined with a region generation network and a region of interest pooling network, multi-scale feature extraction and candidate region generation are performed. The cascaded attention mechanism is used to explore the hierarchical relationship between the network layers and improve the feature discrimination power.
It achieves more accurate candidate region generation, improves the accuracy and stability of target detection, and enhances the detection performance of the model.
Smart Images

Figure CN117036770B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer vision, pattern recognition and artificial intelligence, in particular to a target detection model training method and system based on cascaded attention and a target detection method and system. BACKGROUND
[0002] In recent years, the emergence of massive picture and video data has provided new impetus and challenges for image and video semantic understanding research. Under this background, full-supervised visual analysis and understanding is still a popular research direction in the field of computer vision. As a classic task in the field of computer vision, target detection aims to identify the location and category of objects of interest in an image. As an important branch of computer vision, target detection has rapidly developed and has a profound impact, providing an important auxiliary role for the realization of image segmentation, scene understanding, target tracking and other visual tasks, and has a broad research value. In addition, the application of technology related to target detection is also accelerating landing, and has high economic value in practical tasks such as autonomous driving, intelligent security, medical image analysis.
[0003] In the task of target detection, the target in a complex scene often exists in a shielding or partially shielding phenomenon, which leads to the incompleteness of the target, thereby causing the problem of inaccurate positioning of the target. The target detection method based on deep learning pays more attention to the target in the salient region, and the information of the incomplete target is gradually replaced by the salient information of the complete target as the number of neural network layers increases, so that the information of the incomplete target cannot be effectively obtained, thereby causing the problem of inaccurate positioning of the incomplete target.
[0004] In view of the information loss problem caused by the incompleteness of the target, in recent years, methods based on feature pyramid structure have been proposed to enhance the feature space representation ability and multi-scale fusion to mine target information, and to better learn the feature information of the incomplete target by integrating different receptive fields, thereby effectively alleviating the information loss problem of the incomplete target. For example, Ma J, Chen B, et al. proposed a dual refinement feature pyramid network DRFPN in 2020, which improved from two aspects of upsampling and multi-scale fusion. The network model learns the position information in the upsampling process by means of the context information between adjacent network layers, realizes more robust upsampling, and realizes adaptive merging of feature channels in the multi-scale fusion process by means of the channel attention mechanism. Luo Y, Cao X, et al. proposed a channel enhanced feature pyramid network CEFPN in 2022, which focused on the information utilization angle from the feature channel dimension. Sub-pixel convolution is used instead of 1x1 convolution and upsampling in the fusion process, and the channel information reduced in the 1x1 convolution process is made up in the spatial context information of the feature. At the same time, a variety of convolution combinations are used to obtain local information and global information with a larger receptive field, and the channel attention mechanism is used to generate more discriminative features.
[0005] Although the above methods effectively alleviate the problem of information loss and achieve feature enhancement, there are still deficiencies, such as when feature enhancement based on attention mechanism is performed, only the feature enhancement and attention learning process of the current layer are considered, and the hierarchical relationship of other network layers is ignored. SUMMARY
[0006] The purpose of the present application is to provide a target detection model training method and system based on cascaded attention, and a target detection method and system, to solve at least one technical problem in the background art.
[0007] In order to achieve the above purpose, the present application adopts the following technical solutions:
[0008] On the one hand, the present application provides a detection model training method based on cascaded attention, comprising:
[0009] obtaining a target detection training set; the training set includes multiple images and labels of multiple target objects to be identified in the images;
[0010] Based on the multiple images as input and the labeled target objects to be identified in the images as output, the training of the detection model is performed, and the detection model includes a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network;
[0011] The backbone network is used to extract the global features of the training set images; the cascaded attention pyramid network is used to perform cascaded attention enhancement on the highest layer features of the network and to fuse them, to add more discriminative high-order semantic information to the shallow layer features, and to obtain enhanced multi-scale features; the region generation network is used to generate candidate regions for the multi-scale features, to obtain candidate region scores and candidate region boxes under multiple scales, to perform twice non-maximum suppression processing on the candidate boxes under the five scales, and to calculate the classification loss and the regression loss, to complete the generation of candidate regions in the first stage; and the region of interest pooling network is used to complete the second stage candidate box adjustment and class prediction for the candidate regions after fixing the size of the image features corresponding to the candidate region boxes, to obtain the target detection result.
[0012] Optionally, the loss of the region generation network and the loss of the region of interest pooling network are added together as the final detection loss function.
[0013] Optionally, the training set is input into the network model in batches for forward propagation, and the loss value is calculated by the detection loss function, the network model is optimized by back propagation, and the training is stopped when the detection loss value tends to converge, to obtain the final trained target detection model based on cascaded attention.
[0014] Optionally, a target detection test set is obtained, picture data in the test set is preprocessed, and the preprocessed picture data is input into the trained target detection model based on the cascaded attention to obtain a prediction box and a category output. The prediction boxes are arranged in descending order of confidence, and non-maximum suppression is performed to obtain a detection result.
[0015] In a second aspect, the present application provides a detection model training system based on cascaded attention, comprising:
[0016] An acquisition module is configured to acquire a target detection training set, wherein the training set comprises a plurality of images and labels of targets to be identified in the plurality of images.
[0017] A training module is configured to train a detection model based on the plurality of images as input and the labels of the targets to be identified in the images as output, wherein the detection model comprises a backbone network, a cascaded attention pyramid network, a region generation network, and a region of interest pooling network.
[0018] The backbone network is configured to extract global features of the training set images. The cascaded attention pyramid network is configured to perform cascaded attention enhancement and fusion on the highest layer features of the network, to add more discriminative high-order semantic information to the shallow layer features, and to obtain enhanced multi-scale features. The region generation network is configured to generate candidate regions from the multi-scale features, to obtain candidate region scores and candidate region boxes at multiple scales, to perform non-maximum suppression processing twice on the candidate boxes at the five scales, and to calculate classification loss and regression loss to complete the generation of candidate regions in the first stage. The region of interest pooling network is configured to complete the second stage candidate box adjustment and category prediction of the candidate regions by fixing the size of the image features corresponding to the candidate region boxes, and to obtain a target detection result.
[0019] In a third aspect, the present application provides a target detection method, comprising:
[0020] Acquiring an image to be detected.
[0021] Detecting a target in the image by using a target detection model to obtain a target detection result, wherein the target detection model is trained according to the detection model training method based on cascaded attention as described above.
[0022] In a fourth aspect, the present application provides a target detection system, comprising:
[0023] An acquisition module is configured to acquire an image to be detected.
[0024] A detection module is configured to detect a target in the image by using a target detection model to obtain a target detection result, wherein the target detection model is trained according to the detection model training method based on cascaded attention as described above.
[0025] In a fifth aspect, the present application provides a non-transitory computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the target detection method as described above.
[0026] In a sixth aspect, the present application provides a computer program product comprising a computer program for implementing the target detection method as described above when run on one or more processors.
[0027] In a seventh aspect, the present application provides an electronic device comprising a processor, a memory and a computer program; wherein the processor is connected with the memory, and the computer program is stored in the memory; when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes instructions for implementing the target detection method as described above.
[0028] The present application has the following advantages: the attention mechanism is used and the hierarchical relationship of each layer of the network is mined in a cascading manner to obtain a more discriminative image representation, extract a more optimal feature, and further realize more accurate candidate region generation and improve the detection precision.
[0029] The advantages of the additional aspects of the present application will be more apparent from the following description section or be understood through the practice of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0031] Figure 1 The target detection model training method flowchart described in the embodiments of the present application.
[0032] Figure 2 The target detection network structure diagram described in the embodiments of the present application.
[0033] Figure 3 The feature enhancement module diagram described in the embodiments of the present application.
[0034] Figure 4 The attention generation module diagram and the cascading attention fusion module diagram described in the embodiments of the present application.
[0035] Figure 5The image detection visual result diagram on the PASCAL VOC data set described in the embodiments of the present application. DETAILED DESCRIPTION
[0036] Embodiments of the present application are described in detail below with reference to the attached drawings. The embodiments described below are examples of the present application and are not intended to limit the present application.
[0037] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present application belongs.
[0038] It should also be understood that terms such as those defined in a general dictionary should be understood to have meanings consistent with those in the context of the prior art and should not be interpreted in an idealized or overly formal sense unless defined otherwise.
[0039] Those skilled in the art can understand that, unless otherwise stated, the singular forms "a", "an" and "the" used herein also include the plural forms. It should be further understood that the use of the phrase "comprising" in the specification of the present application means that the features, integers, steps, operations, elements and / or groups thereof are present, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or groups thereof.
[0040] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine the different embodiments or examples described in the specification and the features of the different embodiments or examples without contradiction.
[0041] In order to facilitate understanding of the present application, the present application is further explained in specific embodiments below with reference to the accompanying drawings, and the specific embodiments do not constitute a limitation on the embodiments of the present application.
[0042] Those skilled in the art should understand that the drawings are only schematic diagrams of the embodiments, and the components in the drawings are not necessarily necessary for the implementation of the present application.
[0043] Embodiment 1
[0044] In this embodiment 1, first provided is a detection model training system based on cascaded attention, comprising: an acquisition module for acquiring a target detection training set; the training set comprises a plurality of images and labels of targets to be recognized in the plurality of images; a training module for training a detection model based on the plurality of images as input and the targets to be recognized labeled in the images as output, the detection model comprising a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network.
[0045] The backbone network is used to extract global features of the training set images; the cascaded attention pyramid network is used to perform cascaded attention enhancement and fusion on the highest layer features of the network, to add more discriminative high-order semantic information to the shallow layer features, and to obtain enhanced multi-scale features; the region generation network is used to generate candidate regions for the multi-scale features, to obtain candidate region scores and candidate region boxes under multiple scales, to perform twice non-maximum suppression processing on the candidate boxes under the five scales, and to calculate classification loss and regression loss, to complete the generation of candidate regions in the first stage; and the region of interest pooling network is used to complete the second stage candidate box adjustment and class prediction for the candidate regions after fixing the size of the image features corresponding to the candidate region boxes, to obtain a target detection result.
[0046] In this embodiment, the above system is used to implement a detection model training method based on cascaded attention, to obtain a target detection model, comprising: acquiring a target detection training set; the training set comprises a plurality of images and labels of targets to be recognized in the plurality of images; training a detection model based on the plurality of images as input and the targets to be recognized labeled in the images as output, the detection model comprising a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network.
[0047] The loss of the region generation network and the loss of the region of interest pooling network are added together as the final detection loss function. The training set is input into the network model in batches for forward propagation, and the loss value is calculated through the detection loss function, the network model is optimized through back propagation, and the training is stopped when the detection loss value tends to converge, to obtain the final trained target detection model based on cascaded attention.
[0048] The target detection test set is acquired, the picture data in the test set is preprocessed, input into the trained target detection model based on cascaded attention, to obtain a prediction box and a class output, the prediction boxes are arranged in descending order of confidence, non-maximum suppression is performed, and a detection result is obtained.
[0049] Embodiment 2
[0050] In this embodiment 2, first provide a target detection system, comprising: an acquisition module for acquiring an image to be detected; a detection module for detecting a target in the image using a target detection model to obtain a target detection result; wherein the target detection model is trained according to a detection model training method based on cascaded attention. The target detection system can realize the target detection method, comprising: acquiring the image to be detected by the acquisition module; detecting the target in the image based on the target detection model by the detection module to obtain the target detection result; wherein the target detection model is trained according to the detection model training method based on cascaded attention.
[0051] The detection model training method based on cascaded attention includes: obtaining a target detection training set; the training set includes a plurality of images and labels of a plurality of target recognition targets labeled in the images; based on the plurality of images as input and the labeled target recognition targets in the images as output, the training of the detection model is performed, and the detection model includes a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network; wherein the backbone network is used to extract the global features of the training set images; the cascaded attention pyramid network is used to perform cascaded attention enhancement and fusion on the highest layer features of the network, to add more discriminative high-order semantic information to the shallow layer features, and to obtain enhanced multi-scale features; the region generation network is used to generate candidate regions for the multi-scale features, to obtain candidate region scores and candidate region boxes under multiple scales, to perform twice non-maximum suppression processing on the candidate boxes under the five scales, and to calculate classification loss and regression loss to complete the generation of candidate regions in the first stage; the region of interest pooling network is used to complete the second stage candidate box adjustment and class prediction of the candidate regions after fixing the size of the image features corresponding to the candidate region boxes, to obtain the target detection result.
[0052] The loss of the region generation network and the loss of the region of interest pooling network are added to obtain the final detection loss function. The training set is input into the network model in batches for forward propagation, and the loss value is calculated by the detection loss function, the network model is optimized by back propagation, and the training is stopped when the detection loss value tends to converge, to obtain the final trained target detection model based on cascaded attention.
[0053] The target detection test set is obtained, the picture data in the test set is preprocessed, and is input into the trained target detection model based on cascaded attention to obtain the prediction box and the class output. The prediction boxes are arranged in descending order of confidence, and non-maximum suppression is performed to obtain the detection result.
[0054] Embodiment 3
[0055] In this embodiment 3, a target detection method based on cascaded attention is provided, and a cascaded attention pyramid network is constructed, which can fully mine the saliency information under the network layer, and use the information to gradually and progressively filter out the redundant information of the current layer, so as to extract more discriminative features and generate more accurate candidate regions, and improve the detection accuracy of the model.
[0056] A cascaded attention pyramid network is constructed, wherein the cascaded attention pyramid network is divided into a feature enhancement module and an attention cascade fusion module, including the following steps:
[0057] Step one: obtain the target detection dataset, divide the dataset into a training set and a test set, and perform data preprocessing;
[0058] Step two: use the ResNet50 feature extraction network to extract the global features of the input picture, and output the features at different stages of the network. Then enter the cascaded attention pyramid network, use the above different stage feature outputs as input, use the dense connection method based on cascaded attention to enhance the deepest layer features, and use the pyramid structure to fuse the enhanced features downward to obtain enhanced multi-scale output. Next, in the region proposal network (RPN), use the enhanced multi-scale output as input, generate 2000 candidate boxes for each scale feature, perform twice non-maximum suppression (NMS) processing, filter the candidate boxes to 1000, and use the cross-entropy loss function to calculate the classification loss and the L1 function loss to calculate the candidate box regression loss, complete the first stage of candidate region generation, and finally use the above obtained candidate boxes as the input of the region of interest pooling network (ROI), map the candidate boxes to the original features, and fix the size, use the neural network to complete the second stage of candidate box fine-tuning, and use the cross-entropy loss function to calculate the classification loss and the L1 function loss to calculate the candidate box regression loss;
[0059] Step three: add the loss of the region generation network in step two and the loss of the region of interest pooling network to obtain the final detection loss function; then input the training set of the target detection dataset into the network model in batches for forward propagation, calculate the loss value through the detection loss function, then perform back propagation to optimize the network model, until the detection loss value tends to converge, stop training, and obtain the trained target detection model based on cascaded attention.
[0060] Step four: obtain the target detection test set; process the pictures in the test set according to the data preprocessing operation in step one, then input them into the trained target detection model based on cascaded attention, obtain the prediction box and class output, arrange them in descending order according to the confidence of the prediction box, perform non-maximum suppression (IOU threshold is 0.8), and obtain the final detection result.
[0061] The preprocessing in step one can include image cropping, image mirror flipping, image size adjustment, normalization, etc. The feature extraction network in step two can be replaced by other networks such as VGG, DarkNet, ResNetXT, etc. The number of candidate boxes before NMS and the number of candidate boxes after NMS in step two can be set by oneself. The cross-entropy loss function in step two can be replaced by Focal Loss loss function, Seesaw Loss loss function.
[0062] Embodiment 4
[0063] Referring to Figure 1 , the embodiment provides a training method of a target detection model, which includes a training model stage and a test model stage. In the training model stage, image features are extracted by a ResNet50 network and features at different stages of the network are output. Then, the features are input into a cascaded attention pyramid network to mine the hierarchical relationship of each layer of the network and enhance the multi-scale feature output. Then, a region recommendation network is entered to generate candidate boxes, and a region of interest pooling network is entered to fix the size of the original image features corresponding to the candidate boxes and adjust the candidate boxes again. In the test model stage, the proposed target detection method based on cascaded attention is used to extract more optimal feature expression from the test input image by the trained model and perform coordinate regression and class prediction.
[0064] The specific method is as follows:
[0065] Step one: obtain a large public target detection data set, and divide the data set into a training set and a test set. In the training stage, the data set is preprocessed, including random horizontal inversion and normalization processing, and the image is scaled by 1000 pixels or 600 pixels in equal proportion.
[0066] Step two: use ResNet50 to extract the global features of the input picture. Then, the features at different stages of the ResNet50 network are output in the manner of (a), denoted as [P2, P3, P4, P5]. Then, a cascaded attention pyramid network is entered, such as Figure 2 Figure 2 (b) shows, comprising two modules: feature enhancement module and cascade attention fusion module. Similar to the conventional feature pyramid structure, the cascade attention pyramid network is responsible for multi-scale fusion of feature outputs at different stages of the feature extraction network, except that the cascade attention pyramid network performs cascade attention enhancement on the highest layer feature P5 of the network. Specifically, when enhancing the high-level feature P5, a set of feature enhancement modules with hole rates of [3, 6, 12, 18, 24] are used to mine rich multi-scale context information for deep features, wherein the feature enhancement module is as shown in Figure 3 The attention maps generated by each feature enhancement module are fused in a cascaded manner by means of the attention cascade fusion module to realize the re-enhancement of the output of the current feature enhancement module. The generation method of the attention map is as shown in Figure 4 (a), and the cascade attention fusion module is as shown in Figure 4 (b). Meanwhile, the enhanced features are fused downward by means of the feature pyramid structure to add more discriminative high-level semantic information to the shallow features, obtaining the output [C2, C3, C4, C5]. Then the enhanced multi-scale outputs are sent into the region proposal network respectively to generate candidate regions, obtaining the candidate region scores and candidate region boxes at five scales. The candidate boxes at the five scales are processed by NMS twice to obtain more accurate candidate regions, and the classification loss and regression loss are calculated to complete the generation of candidate regions in the first stage, as shown in Figure 2 (c). The second adjustment of the candidate regions and the class prediction in the second stage are completed by using the region of interest pooling network, and the classification loss and regression loss are calculated, as shown in Figure 2 (d).
[0067] Step three: add the loss of the region generation network in step two and the loss of the region of interest pooling network to obtain the final detection loss function; then input the training set of the target detection dataset according to each batch of 16 images into the network model for forward propagation, calculate the loss value through the detection loss function, and then perform back propagation to optimize the network model until the detection loss value converges, thereby obtaining the trained target detection model based on cascade attention. During training, the network model parameters are optimized using SGD (Stochastic Gradient Descent), and the number of iterations of the model is set to 12, wherein the initial learning rate is set to 0.02, the momentum is set to 0.9, the weight decay is set to 1x1e-4, the learning rate warm-up setting is used, the learning rate is gradually increased from 0.001 to the initial learning rate 0.02 in the first 500 iters, and the current learning rate is reduced by 0.1 times at the 8th iteration and the 11th iteration of the model, respectively.
[0068] Step four: Obtain the target detection test set; process the pictures in the test set according to the data preprocessing operation in step one, and then input them into the trained target detection model based on the cascade attention to obtain the prediction box and the class output. Arrange the prediction boxes in descending order of confidence, perform non-maximum suppression (IOU threshold is 0.8), obtain the final detection result, and calculate mAP, where mAP is the average accuracy, which is a commonly used target detection performance indicator. The experimental results measured are shown in Table 1.
[0069] Table 1: Performance comparison of target detection methods on COCO test set
[0070]
[0071] In Table 1, by comparing the performance with existing methods, it is verified that the method described in this embodiment improves the accuracy of target detection. As shown in Table 1, compared with the Faster RCNN method, the Faster RCNN using the cascade attention pyramid network proposed in this embodiment has better performance in accurate positioning of targets. Figure 5 The quantitative evaluation results of Table 1 and the visualization results of Figure 5 reflect the effectiveness and robustness of the method.
[0072] Embodiment 5
[0073] Embodiment 5 provides a non-transitory computer readable storage medium for storing computer instructions, which, when executed by a processor, implement the target detection method as described above.
[0074] Embodiment 6
[0075] Embodiment 6 provides a computer program product comprising a computer program for implementing the target detection method as described above when running on one or more processors.
[0076] Embodiment 7
[0077] Embodiment 7 provides an electronic device comprising a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory to make the electronic device execute instructions for implementing the target detection method as described above.
[0078] Embodiment 8
[0079] The embodiment 8 provides a non-transitory computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the cascade attention-based target detection model training method.
[0080] Embodiment 9
[0081] The embodiment 9 provides a computer program product, comprising a computer program which, when running on one or more processors, is used to implement the cascade attention-based target detection model training method.
[0082] Embodiment 10
[0083] The embodiment 7 provides an electronic device, comprising a processor, a memory and a computer program; wherein the processor is connected with the memory, and the computer program is stored in the memory; when the electronic device is running, the processor executes the computer program stored in the memory, so that the electronic device executes instructions for implementing the cascade attention-based target detection model training method.
[0084] To sum up, the cascade attention-based target detection model training method and system and the target detection method and system provided by the embodiment of the present application can obtain data and pre-process the data, obtain global features through a feature extraction network, and use features at different stages of the network as outputs. The method constructs a cascade attention pyramid network, uses the features at different stages as inputs, and uses the proposed network to sufficiently mine significant information under the network layer and gradually and progressively filter out redundant information at the current layer. With the feature pyramid structure, the most discriminative information is passed down, so that the remaining scale feature representation space has more discriminative ability, and the region generation network is provided with high-quality features, more accurate candidate region generation is completed, and the convergence stability of the region of interest pooling network is improved. The cascade attention is used to mine the hierarchical relationship of each layer of the network, so that more discriminative feature expression is obtained, and the detection accuracy of the model is improved.
[0085] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can adopt a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0086] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks. Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks.
[0087] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks. Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks.
[0088] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks. Figure 1 one or more functions specified in the flowchart or multiple flows and / or blocks.
[0089] The above description is made in connection with the preferred embodiments of the application. It is not intended to limit the scope of the application. Various modifications and changes can be made by one skilled in the art which fall within the scope of the application disclosed in the specification and drawings.
Claims
1. A method for training a detection model based on cascaded attention, characterized in that, The method comprises the following steps: obtaining a target detection training set; the training set comprises a plurality of images and labels of targets to be identified in the plurality of images; based on the plurality of images as input and based on the labeled targets to be identified in the images as output, training a detection model, the detection model comprising a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network; wherein the backbone network is used to extract global features of the training set images; the cascaded attention pyramid network is used to perform cascaded attention enhancement and fusion on the highest layer features of the network, to add more discriminative high-order semantic information to the shallow layer features, and to obtain enhanced multi-scale features; the region generation network is used to generate candidate regions of the multi-scale features, to obtain candidate region scores and candidate region boxes under multiple scales, to perform non-maximum suppression processing on the candidate boxes under the five scales twice, and to calculate classification loss and regression loss to complete the generation of candidate regions in the first stage; the region of interest pooling network is used to complete the second stage candidate box adjustment and class prediction of the candidate regions after fixing the image features corresponding to the candidate region boxes, and to obtain the target detection result; wherein the cascaded attention pyramid network comprises a feature enhancement module and a cascaded attention fusion module; the cascaded attention pyramid network performs multi-scale fusion on the feature outputs of different stages of the feature extraction network, and performs cascaded attention enhancement on the highest layer features of the network; when enhancing the high layer features, a group of different hollow rate feature enhancement modules are used to mine rich multi-scale context information from the deep layer features; the attention cascaded fusion module fuses the attention guidance maps generated by each feature enhancement module in a cascaded manner to realize re-enhancement; and the enhanced features are fused downward by means of a feature pyramid structure to add more discriminative high-order semantic information to the shallow layer features, and the output is obtained.
2. The cascade attention-based detection model training method according to claim 1, characterized in that, The loss of the region generation network and the loss of the region of interest pooling network are added to obtain a final detection loss function.
3. The method of claim 2, wherein, The training set is input into the network model in batches for forward propagation, and the loss value is calculated by the detection loss function, the network model is optimized by back propagation, and the training is stopped when the detection loss value tends to converge, and a final trained cascaded attention-based target detection model is obtained.
4. The cascade attention-based detection model training method according to claim 3, characterized in that, obtaining a target detection test set, preprocessing the image data in the test set, inputting the preprocessed image data into the trained cascaded attention-based target detection model, obtaining a prediction box and a class output, arranging the prediction boxes in descending order of confidence, performing non-maximum suppression to obtain a detection result. 5.A system for training a detection model based on cascaded attention, characterized in that, The method comprises the following steps: an obtaining module is configured to obtain a target detection training set; the training set comprises a plurality of images and labels of targets to be identified in the plurality of images; a training module is configured to train a detection model based on the plurality of images as input and based on the labeled targets to be identified in the images as output, the detection model comprising a backbone network, a cascaded attention pyramid network, a region generation network and a region of interest pooling network; The backbone network is used to extract global features from the training dataset. The cascaded attention pyramid network is used to enhance and fuse the highest-level features of the network, adding more discriminative high-order semantic information to the shallow features, resulting in enhanced multi-scale features. The region generation network is used to generate candidate regions from the multi-scale features, obtaining candidate region scores and candidate bounding boxes at multiple scales. Non-maximum suppression is applied twice to these candidate bounding boxes at five scales, and classification and regression losses are calculated to complete the generation of candidate regions in the first stage. The region of interest pooling network is used to fix the size of the image features corresponding to the candidate bounding boxes, completing the second stage of candidate bounding box adjustment and... Category prediction yields the target detection result. The cascaded attention pyramid network comprises a feature enhancement module and a cascaded attention fusion module. This network performs multi-scale fusion of feature outputs from different stages of the feature extraction network, enhancing the highest-level features with cascaded attention. During high-level feature enhancement, a set of different dilation rate feature enhancement modules are used to mine rich multi-scale contextual information from deep features. The attention cascaded fusion module fuses the attention guidance maps generated by each previous feature enhancement module in a cascaded manner for further enhancement. The enhanced features are then fused downwards using the feature pyramid structure to add more discriminative higher-order semantic information to the shallow features, resulting in the output.
6. A target detection method characterized by, include: Acquire the image to be detected; The target detection model is used to detect targets in the image to obtain target detection results; wherein the target detection model is trained by the cascaded attention-based detection model training method according to any one of claims 1-4.
7. A target detection system characterized by, include: The acquisition module is used to acquire the image to be detected; The detection module is used to detect targets in an image using a target detection model to obtain target detection results; wherein the target detection model is trained using the cascaded attention-based detection model training method according to any one of claims 1-4.
8. A computer program product, characterised in that, Includes a computer program, which, when run on one or more processors, is used to implement the target detection method as described in claim 6.
9. A non-transitory computer-readable storage medium, comprising: The non-transitory computer-readable storage medium is used to store computer instructions, which, when executed by a processor, implement the target detection method as described in claim 6.
10. An electronic device, comprising: include: The device includes a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to cause the electronic device to execute instructions for implementing the target detection method as described in claim 6.
Citation Information
Patent Citations
Remote sensing image semantic segmentation method based on context information and attention mechanism
CN110197182A
Human head detection method and system based on neural network and storage medium
CN111368634A