Training method and device for target detection system

By introducing convolutional layers and attention layers into the backbone network of the target detection system, and using gradient fine-tuning technology, the target detection problem in the existing technology that is computationally intensive and difficult to reduce is solved, achieving the goal of achieving the goal in single-stage training. Efficient detection accuracy.

CN114925813BActive Publication Date: 2024-10-18ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210573722.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-25
Publication Date
2024-10-18
Estimated Expiration
2042-05-25

AI Technical Summary

Technical Problem

Existing target detection algorithms in deep learning models are difficult to reduce the amount of calculation while maintaining the accuracy of detection results, and cannot meet the needs of practical applications.

Method used

Design a training method for the target detection system. By introducing convolutional layers and attention layers into the backbone network, combined with gradient fine-tuning technology, it reduces the dependence on pre-training and achieves single-stage training.

Benefits of technology

It achieves good detection accuracy without pre-training, reduces the consumption of computing resources, and meets the needs of practical applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114925813B_ABST
    Figure CN114925813B_ABST
Patent Text Reader

Abstract

An embodiment of the present specification provides a training method for a target detection system, wherein the target detection system includes a backbone network and a head network, wherein the backbone network includes a plurality of convolutional layers and a plurality of self-attention layers, and the method includes: inputting a training image into the target detection system, wherein the training image is convolved using the plurality of convolutional layers to obtain a convolutional representation; self-attention is performed based on the convolutional representation using the plurality of attention layers to obtain a feature map; the feature map is processed using the head network to obtain a detection result of a target object in the training image; based on object annotation data corresponding to the training image and the detection result, a gradient norm of each neural network layer is determined; and for each neural network layer, its network parameters are updated according to an average of the gradient norms and its own gradient norm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of machine learning technology, and more particularly, to a training method and device for a target detection system. Background Art

[0002] Object detection technology aims to identify one or more objects in an image and locate different objects (give a bounding box). Object detection is used in many scenarios, such as unmanned driving and security systems.

[0003] At present, the mainstream target detection algorithms are mainly based on deep learning models. However, the existing related algorithms are difficult to meet the increasing needs in practical applications. Therefore, a target detection solution is needed that can reduce the amount of calculation while ensuring the accuracy of the detection results, so as to better meet the needs of practical applications. Summary of the invention

[0004] One or more embodiments of this specification describe a training method for a target detection system. By simultaneously introducing convolutional layers and attention layers in a backbone network, a new target detection algorithm architecture is designed, thereby eliminating the deep learning architecture's dependence on pre-training and effectively reducing the amount of computation consumed in training the target detection system.

[0005] According to a first aspect, a training method for a target detection system is provided, wherein the target detection system comprises a backbone network and a head network, wherein the backbone network comprises a plurality of convolutional layers and a plurality of self-attention layers, and the method comprises: inputting a training image into the target detection system, wherein the training image is subjected to convolution processing by using the plurality of convolutional layers to obtain a convolutional representation; self-attention processing is performed based on the convolutional representation by using the plurality of attention layers to obtain a feature map; the feature map is processed by using the head network to obtain a detection result of a target object in the training image; based on object annotation data corresponding to the training image and the detection result, a gradient norm of each neural network layer is determined; and for each neural network layer, its network parameters are updated according to an average of the gradient norms and its own gradient norm.

[0006] In one embodiment, the detection result includes a classification result and a detection bounding box of the target object, and the object annotation data includes an object classification result and an object annotation bounding box.

[0007] In one embodiment, the convolution representation includes C two-dimensional matrices; wherein, using the several attention layers to perform self-attention processing based on the convolution representation to obtain a feature map includes: using the several attention layers to perform the self-attention processing on C vectors obtained by flattening the C two-dimensional matrices to obtain Z vectors; and performing truncated and stacked processing on the Z vectors respectively to obtain Z two-dimensional matrices as the feature map.

[0008] In one embodiment, the head network includes a region generation network RPN and a classification regression layer; wherein, the head network is used to process the feature map to obtain the detection result of the target object in the training image, including: using the RPN to determine multiple candidate regions containing the target object based on the feature map; using the classification regression layer to determine the target object category and border corresponding to the candidate region based on the regional features of each candidate region, and incorporating them into the detection result.

[0009] In one embodiment, based on the object annotation data corresponding to the training image and the detection result, the gradient norm of each neural network layer is determined, including: based on the object annotation data and the detection result, using the back propagation method to calculate the gradient of each neural network layer; calculating the norm of the gradient of each neural network layer as the corresponding gradient norm.

[0010] In one embodiment, the target detection system includes multiple neural network layers; for each neural network layer, its network parameters are updated according to the average of the gradient norm and its own gradient norm, including: calculating the average of multiple gradient norms corresponding to the multiple neural network layers; for each neural network layer, based on the ratio between its gradient norm and the average, the network parameters of the neural network layer are updated.

[0011] In a specific embodiment, calculating the average of multiple gradient norms corresponding to the multiple neural network layers includes: calculating the geometric mean of the multiple gradient norms.

[0012] In a specific embodiment, for each neural network layer, based on the ratio between its gradient norm and the average, the network parameters of the neural network layer are updated, including: for each neural network layer, calculating the ratio between its gradient norm and the average; determining a power operation result with the ratio as the base and a preset value as the exponent; and updating the network parameters of the neural network layer to the product of itself and the power operation result.

[0013] According to a second aspect, a training device for a target detection system is provided, wherein the target detection system comprises a backbone network and a head network, the backbone network comprises a plurality of convolutional layers and a plurality of self-attention layers, and the device comprises: an image processing unit configured to process a training image using the target detection system; the image processing unit comprises: a convolution subunit configured to perform convolution processing on the training image using the plurality of convolutional layers to obtain a convolutional representation; an attention subunit configured to perform self-attention processing based on the convolutional representation using the plurality of attention layers to obtain a feature map; a processing subunit configured to process the feature map using the head network to obtain a detection result of a target object in the training image; a gradient norm calculation unit configured to determine the gradient norm of each neural network layer based on object annotation data corresponding to the training image and the detection result; and a network parameter updating unit configured to update the network parameters of each neural network layer according to the average of the gradient norm and its own gradient norm.

[0014] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.

[0015] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method of the first aspect is implemented.

[0016] By using the method and apparatus provided in the embodiments of this specification, the backbone network in the target detection system is designed as a hybrid architecture including convolutional layers and self-attention layers, and a gradient calibration technology is proposed to correct the training gradients of each neural network layer in the target detection system, so that the target detection system does not require pre-training, but can achieve good accuracy by directly performing single-stage training. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0018] Figure 1 A schematic diagram showing the system architecture of a target detection system according to an embodiment is shown;

[0019] Figure 2 A schematic diagram of a training method for an object detection system according to an embodiment is shown;

[0020] Figure 3 Shows the structural diagram of the self-attention module in the Transformer mechanism;

[0021] Figure 4 A schematic diagram showing a process of processing an image using an object detection system according to an embodiment;

[0022] Figure 5 A schematic diagram of the structure of a training device for a target detection system according to an embodiment is shown. DETAILED DESCRIPTION

[0023] The solution provided in this specification is described below in conjunction with the accompanying drawings.

[0024] As mentioned above, the current mainstream object detection algorithms are mainly based on deep learning architectures. However, due to the large number of parameters in deep learning models, current object detectors usually require two-step training to achieve good accuracy, including pre-training and fine-tuning. Pre-training usually requires a long time of training on a large dataset (such as the ImageNet dataset) and consumes a lot of computing resources; fine-tuning is to train the pre-trained model briefly on the target dataset (such as the COCO dataset, actual business data), so that it fits the data.

[0025] Popular deep learning architectures include Convolutional Neural Networks (CNN) and Transformer. Since pre-training is too time-consuming and computationally intensive, many researchers have explored how to achieve good detection results without pre-training when CNN networks were the mainstream detector framework. Unfortunately, their successful experience cannot be replicated under the transformer architecture, that is, it is currently impossible to train a transformer-based detector to good accuracy without pre-training.

[0026] Furthermore, the inventors found that the convolutional layer in the CNN network has an inductive bias, which can be understood as a kind of prior knowledge. Generally speaking, the stronger the prior, the weaker the dependence on pre-training. The inductive bias of the CNN network includes locality, that is, there is a connection between pixel blocks with similar spatial positions but not between distant ones, and spatial invariance. For example, a tiger is a tiger whether it is on the left or right side of the picture. On the other hand, the self-attention layer in the Transformer can perform a global attention mechanism, which is computationally expensive and strongly dependent on pre-training. However, in the pre-training stage, the self-attention layer close to the input end is actually learning the inductive bias, and behaves like a convolution operation.

[0027] Based on this, the inventors proposed replacing the first few self-attention layers close to the input end in the Transformer-based deep learning architecture with convolutional layers, thereby directly reducing the dependence of the Transformer-based detector on pre-training.

[0028] Figure 1 A schematic diagram of the system architecture of a target detection system according to an embodiment is shown. Figure 1 As shown in the figure, the target detection system includes a backbone network and a head network, where the backbone network is used to encode and represent the image, including several convolutional layers and several self-attention layers. Figure 1 In the figure, m and n are shown respectively; the head network is used to determine the target detection box and classification category according to the encoded representation. It should be understood that the "several" in the text refers to one or more, and the values ​​of m and n can be set and adjusted according to actual needs.

[0029] However, the network structures of the convolutional layer and the attention layer are quite different, and it is difficult to achieve good results by direct training in a conventional way. In fact, the inventors found that the gradient of the attention layer is ten times higher than that of the convolutional layer, so they proposed a gradient calibration technology, which enables the above-mentioned object detection system to achieve good training performance.

[0030] Figure 2 A schematic diagram of a training method for a target detection system according to an embodiment is shown. The execution subject of the method can be any platform, server or device cluster with computing and processing capabilities. Figure 2 As shown, the method comprises the following steps:

[0031] Step S210, input the training image into the target detection system, specifically in sub-step S211, use several convolution layers to perform convolution processing on the training image to obtain a convolution representation; in sub-step S212, use several attention layers to perform self-attention processing based on the convolution representation to obtain a feature map; in sub-step S213, use the head network to process the feature map to obtain the detection result of the target object in the training image; step S220, based on the object annotation data corresponding to the training image and the detection result, determine the gradient norm of each neural network layer; step S230, for each neural network layer, update its network parameters according to the average of the gradient norm and its own gradient norm.

[0032] The above steps are expanded as follows:

[0033] First, in step S210, a training image is input into the target detection system, and the detection result of the target object in the training image is output. Specifically, step S210 includes the following sub-steps:

[0034] Step S211, performing convolution processing on the training image using a plurality of convolution layers to obtain a convolution representation.

[0035] It should be noted that convolution processing (or convolution operation) is a common operation for analyzing images. Convolution processing can be used to extract abstract features from the pixel matrix of the original image. According to the design of the convolution kernel, these abstract features can, for example, reflect more global features such as the line shape and color distribution of an area in the original image. Furthermore, convolution processing uses several convolution kernels in a single convolution layer to perform convolution calculations on the image representation (usually a three-dimensional tensor) input to the layer. Specifically, when performing convolution calculations, each of the several convolution kernels is slid on the feature matrix corresponding to the height and width dimensions of the image representation. For each sliding step, each element in the convolution kernel is multiplied and summed with the matrix element value it covers, so that a new image representation can be obtained.

[0036] Each of the above-mentioned several convolutional layers, i.e., one or more convolutional layers, performs convolution processing on the image representation output by the previous convolutional layer, so that the image representation output by the last convolutional layer is used as the above-mentioned convolutional representation. It can be understood that the input of the first convolutional layer is the original training image.

[0037] In one embodiment, between some of the above-mentioned convolutional layers, or after a certain convolutional layer, a rectified linear unit (ReLU) excitation layer is also provided to perform nonlinear mapping on the output result of the convolutional layer. The result of the nonlinear mapping can be input into the next convolutional layer to continue the convolution processing, or can be used as the above-mentioned convolution representation output. In another embodiment, between some of the convolutional layers, a pooling layer is also provided to perform a pooling operation on the output result of the convolutional layer. The result of the pooling operation can be input into the next convolutional layer to continue the convolution operation. In another embodiment, after a certain convolutional layer, a residual module is also provided, and the residual module performs summation processing on the input and output of the certain convolutional layer, and uses the summation result as the input of the next convolutional layer or the ReLU excitation layer.

[0038] As described above, one or more convolutional layers may be used, and a ReLU excitation layer and / or a pooling layer may be selectively added as needed to process the training image to obtain a corresponding convolutional representation.

[0039] Step S212, using several attention layers to perform self-attention processing based on the above convolutional representation to obtain a feature map.

[0040] It should be noted that the output of the convolution layer and the input of the attention layer usually have different data formats. Therefore, the above convolution representation needs to be reshaped and then used as the input of the attention layer. Specifically, the convolution representation is usually a three-dimensional tensor, which may be recorded as (W, H, C), where W and H correspond to the width and height dimensions of the image respectively, and C is the number of channels. At this time, the convolution representation can also be regarded as C two-dimensional matrices. The input of the attention layer is required to be a vector sequence. Therefore, it is proposed to flatten the W and H dimensions, that is, for each of the C two-dimensional matrices, the row vectors therein are sequentially concatenated to obtain the corresponding one-dimensional vectors, so that C (W*H)-dimensional vectors can be obtained to form a vector sequence. Therefore, this vector sequence can be used as the input of the first attention layer among the above-mentioned several attention layers. In addition, the input and output formats of the attention layer are both vector sequences, or they can be regarded as vector sequences forming matrices.

[0041] The above self-attention processing refers to the processing method that introduces the self-attention mechanism. The self-attention mechanism is a type of attention mechanism. When processing information, humans will selectively focus on a part of all information and ignore other visible information. This mechanism is usually called an attention mechanism, and the self-attention mechanism refers to the process of processing existing information without introducing external information. For example, when using the self-attention mechanism to encode each word in a sentence, only the information of all words in the sentence is referenced, and other text content outside the sentence is not introduced.

[0042] In this step, we can refer to the self-attention processing method in the Transformer mechanism. Specifically, for any i-th attention layer among the above-mentioned attention layers, let its input matrix be Z (i) , so, in the i-th attention layer, first transform the matrix Z (i) Project them into the query space, key space and value space respectively to obtain the query matrix Q, key matrix K and value matrix V. Then, use the query matrix Q and key matrix K to determine the attention weights, and then use the determined attention weights to transform the value matrix V, so that the transformed matrix Z (i+1) As the output of the current attention layer.

[0043] In one embodiment, a residual module and a feed-forward layer may be designed to form a self-attention block together with the self-attention layer to process the above convolutional representation. Figure 3 Figure 2 shows the structure of the self-attention module in the Transformer mechanism. Figure 3 As shown in Figure 2, the self-attention module includes a sequentially connected attention layer, a residual module, a feedforward layer, and another residual module, where the self-attention layer first inputs the matrix Z (i) After processing, the matrix output by the self-attention layer is obtained. The residual module R1 first combines the output matrix with the above matrix Z (i) The output of the residual module R1 is processed by the feedforward layer, and then the output is processed by the residual module R2 to obtain the output matrix Z of the current self-attention module. (i+1) Furthermore, if the current self-attention module is followed by another self-attention module, the output matrix can be used as the input of the next attention module. Otherwise, the feature map can be determined based on the output matrix.

[0044] From the above, the matrix (or vector sequence) output by each self-attention layer or each self-attention module can be obtained to determine the above-mentioned feature map. In one embodiment, the above-mentioned feature map can be determined based on the output of the last self-attention layer among the above-mentioned several self-attention layers, or based on the output of the last self-attention module among the several self-attention modules. In another embodiment, the above-mentioned feature map can be determined based on the average matrix of all matrices output by all self-attention layers or all self-attention modules.

[0045] Furthermore, based on the output vector sequence, the inverse operation corresponding to the above flattening process is performed on it to obtain the above feature map. Specifically, for each vector in the vector sequence, it is truncated into a predetermined number of equal-length sub-vectors, and then stacked to obtain the corresponding two-dimensional matrix, so that S two-dimensional matrices corresponding to multiple (which can be recorded as S) vectors contained in the vector sequence can be obtained to form the above feature map.

[0046] As mentioned above, by performing self-attention processing on the convolutional representation, the feature map of the training image can be obtained.

[0047] In step S213, the feature map is processed using the head network to obtain a detection result of the target object in the training image.

[0048] It should be noted that the head network can adopt the head network of an anchor-based target detection algorithm, such as Faster-RCNN, FPN, etc., or the head network of an anchor-free target detection algorithm. Below, the head network in the classic Faster-RCNN algorithm is taken as an example to illustrate the implementation of this step.

[0049] Figure 4 A schematic diagram of a process of processing an image using an object detection system according to an embodiment is shown, wherein a head network includes a region proposal network (RPN) and a classification regression layer shown therein.

[0050] Specifically, the RPN network is first used to determine multiple candidate regions containing the target object based on the above feature map. The candidate region (Region Proposal, referred to as RP) is the area in the image where the target may appear. In some cases, it is also called the region of interest ROI (Region Of Interest). The determination of the candidate region provides a basis for the subsequent classification of the target and the regression determination of the border. Figure 4 As shown in the figure, in one example, the region generation network RPN proposes the region bounding boxes of three candidate regions in the feature map, which are represented as regions A, B, and C respectively.

[0051] Next, the feature map and the generated results of multiple candidate regions based on the feature map are input to the classification and regression layer. The classification and regression layer determines the object category and bounding box of each candidate region based on the region features of the candidate region itself.

[0052] According to one embodiment, the classification and regression layer is a fully connected layer that performs object category classification and bounding box regression based on the regional features of each region input by the previous layer. More specifically, the classification and regression layer can include multiple classifiers, each of which is trained to identify different categories of targets in the candidate region. In the scenario of animal detection, each classifier is trained to identify different categories of animals, such as tigers, lions, starfish, swallows, etc.

[0053] The classification regression layer also includes a regressor for regressing the bounding box corresponding to the identified target and determining the minimum rectangular area surrounding the target as the bounding box.

[0054] From the above, we can get the detection results of the training images, including the classification results and detection bounding boxes of the target objects.

[0055] After the training image is processed by the target detection system and the corresponding detection result is obtained, step S220 is executed to determine the gradient norm of each neural network layer based on the object annotation data corresponding to the training image and the detection result. It should be understood that the target detection system includes multiple neural network layers, which generally refer to network layers containing weight parameters to be learned, such as the self-attention layer and convolution layer in the above-mentioned backbone network.

[0056] As mentioned above, the network structures of the convolutional layer and the attention layer are quite different, and it is difficult to achieve good results by training in a conventional way, so a gradient precision calibration technology is proposed. Specifically, considering that the gradients of the attention layer and the convolutional layer are quite different, and actual experience shows that compared with making large adjustments to the parameters of several network layers, a small adjustment to the parameters of all network layers can produce a better trained model. Therefore, the inventor proposes that after calculating the gradients of each network layer in the target detection system, instead of directly using the original gradient to adjust the parameters, the average of the gradient norms of all neural network layers in the target detection system is calculated, and based on this average, it is determined whether the gradients of each network layer are too large or too small, and how large the amplitude is; then the network parameters of each layer are adjusted according to the obtained deviation amplitude, so that they are close to the obtained average.

[0057] In one embodiment, the gradient of each neural network layer in the target detection system can be calculated based on the above detection results and object annotation data corresponding to the training image, and the back propagation method can be used; then, the norm of the gradient of each neural network layer is calculated as the corresponding gradient norm. The object annotation data includes object classification results and object annotation borders, which can be obtained by manual marking. In another embodiment, the calculation of the gradient norm can be triggered by calculating the gradient of a neural network layer, without waiting for the gradients of all layers to be calculated before starting to calculate the gradient norm.

[0058] For the calculation of the gradient, existing technologies can be used. For the calculation of the gradient norm, the first-order norm or the second-order norm can be calculated. According to an example, the gradient norm C of the parameter in the jth neuron in any i-th network layer can be calculated using the following formula (1): i,j , and then calculate the gradient norm C corresponding to the i-th network layer according to formula (2) i .

[0059]

[0060]

[0061] In formula (1), z i-1 represents the output of the activation function in the i-1th neural network layer, y i (j) represents the back propagation error propagated to the jth neuron in the i-th network layer, z i-1 *y i The calculation result of (j) is the gradient of the parameters in the jth neuron in the ith network layer.

[0062] From the above, we can determine the gradient norm C of each neural network layer i .

[0063] Afterwards, in step S230, for each neural network layer, its network parameters are updated according to its own gradient norm and the average of multiple gradient norms corresponding to multiple neural network layers.

[0064] In one embodiment, the arithmetic mean of multiple gradient norms can be calculated, that is, the sum is divided by the total number. In another embodiment, the geometric mean of multiple gradient norms can be calculated, that is, the square root of the terms after multiplication, which can be seen in the following formula (3).

[0065]

[0066] In one embodiment, for each neural network layer, its gradient norm C is calculated i With the average In a specific embodiment, the result of a power operation with the ratio as the base and a preset value α (for example, α=0.25) as the exponent can be determined first, that is, Then the network parameters W of the neural network layer are i Updated to the product of itself and the result of the power operation, which can be written as: W i ←r i W i In another specific embodiment, the network parameters of the neural network layer can be directly updated to the product of itself and the ratio. In this way, the network parameters of the target detection system can be effectively updated.

[0067] In summary, the training method of the target detection system disclosed in the embodiment of this specification is adopted, and the backbone network in the target detection system is designed as a hybrid architecture including convolutional layers and self-attention layers. In addition, a gradient calibration technology is proposed to correct the training gradients of each neural network layer in the target detection system, so that the target detection system does not need pre-training, but can achieve good accuracy by directly performing single-stage training.

[0068] Corresponding to the above training method, the embodiment of this specification also discloses a training device. Figure 5 A schematic diagram of the structure of a training device for a target detection system according to an embodiment is shown, wherein the target detection system comprises a backbone network and a head network, wherein the backbone network comprises several convolutional layers and several self-attention layers. Figure 5 As shown, the device 500 includes:

[0069] The image processing unit 510 is configured to process the training image using the target detection system; the image processing unit 510 includes: a convolution subunit 511, configured to perform convolution processing on the training image using the several convolution layers to obtain a convolution representation; an attention subunit 512, configured to perform self-attention processing based on the convolution representation using the several attention layers to obtain a feature map; a processing subunit 513, configured to process the feature map using the head network to obtain a detection result of the target object in the training image. The gradient norm calculation unit 520 is configured to determine the gradient norm of each neural network layer based on the object annotation data corresponding to the training image and the detection result. The network parameter updating unit 530 is configured to update the network parameters of each neural network layer according to the average of the gradient norm and its own gradient norm.

[0070] In one embodiment, the detection result includes a classification result and a detection bounding box of the target object, and the object annotation data includes an object classification result and an object annotation bounding box.

[0071] In one embodiment, the convolution representation includes C two-dimensional matrices; the attention sub-unit 512 is specifically configured as follows: using the several attention layers, the self-attention processing is performed on the C vectors obtained by flattening the C two-dimensional matrices to obtain Z vectors; the Z vectors are truncated and stacked respectively to obtain Z two-dimensional matrices as the feature map.

[0072] In one embodiment, the head network includes a region generation network RPN and a classification regression layer; the processing subunit 513 is specifically configured as follows: using the RPN to determine multiple candidate regions containing the target object based on the feature map; using the classification regression layer to determine the target object category and border corresponding to the candidate region based on the regional features of each candidate region, and include them in the detection result.

[0073] In one embodiment, the gradient norm calculation unit 520 is specifically configured as follows: based on the object annotation data and the detection results, the gradient of each neural network layer is calculated using the back propagation method; and the norm of the gradient of each neural network layer is calculated as the corresponding gradient norm.

[0074] In one embodiment, the target detection system includes multiple neural network layers; the network parameter updating unit 530 includes: an average calculation subunit 531, configured to calculate the average of multiple gradient norms corresponding to the multiple neural network layers; a parameter updating subunit 532, configured to update the network parameters of each neural network layer based on the ratio between its gradient norm and the average.

[0075] In one embodiment, the average calculation subunit 531 is specifically configured to calculate the geometric mean of the multiple gradient norms.

[0076] In one embodiment, the parameter updating subunit 532 is specifically configured as follows: for each neural network layer, calculating the ratio between its gradient norm and the average; determining a power operation result with the ratio as the base and a preset value as the exponent; and updating the network parameter of the neural network layer to the product of itself and the power operation result.

[0077] In summary, the training device of the target detection system disclosed in the embodiment of this specification is used to design the backbone network in the target detection system as a hybrid architecture including convolutional layers and self-attention layers, and a gradient calibration technology is proposed to correct the training gradients of each neural network layer in the target detection system, so that the target detection system does not need pre-training, but can achieve good accuracy by directly performing single-stage training.

[0078] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described.

[0079] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 The method described. Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0080] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A training method for a target detection system, the target detection system comprising a backbone network and a head network, the backbone network comprising a plurality of convolutional layers and a plurality of self-attention layers, the method comprising: The training images are input into the target detection system, wherein: Using the several convolution layers to perform convolution processing on the training image to obtain a convolution representation; using the several attention layers to perform self-attention processing based on the convolution representation to obtain a feature map; using the head network to process the feature map to obtain a detection result of the target object in the training image; Determining a gradient norm of each neural network layer in a plurality of neural network layers based on the object annotation data corresponding to the training image and the detection result; For each neural network layer, the deviation amplitude of its own gradient norm is determined according to the average of multiple gradient norms corresponding to the multiple neural network layers, so as to update its network parameters according to the deviation amplitude.

2. The method according to claim 1, wherein: The detection result includes a classification result and a detection frame of the target object, and the object annotation data includes an object classification result and an object annotation frame.

3. The method according to claim 1, wherein: The convolutional representation includes C two-dimensional matrices; wherein the self-attention processing is performed based on the convolutional representation using the plurality of attention layers to obtain a feature map, including: Using the plurality of attention layers, performing the self-attention processing on the C vectors obtained by flattening the C two-dimensional matrices to obtain Z vectors; The Z vectors are truncated and stacked respectively to obtain Z two-dimensional matrices as the feature maps.

4. The method according to claim 1, wherein: The head network includes a region generation network RPN and a classification regression layer; wherein, using the head network to process the feature map to obtain the detection result of the target object in the training picture includes: Determine, using the RPN based on the feature map, a plurality of candidate regions containing the target object; The classification and regression layer is used to determine the target object category and bounding box corresponding to each candidate region based on the regional features of the candidate region, and include them in the detection result.

5. The method according to claim 1, wherein: Determining the gradient norm of each neural network layer in the plurality of neural network layers based on the object annotation data corresponding to the training image and the detection result, including: Based on the object annotation data and the detection result, the gradient of each neural network layer is calculated using the back propagation method; The norm of the gradient of each neural network layer is calculated as the corresponding gradient norm.

6. The method according to claim 1, wherein: For each neural network layer, according to the average of multiple gradient norms corresponding to the multiple neural network layers, the deviation amplitude of its own gradient norm is determined, so as to update its network parameters according to the deviation amplitude, including: Calculating the average of multiple gradient norms corresponding to the multiple neural network layers; For each neural network layer, a network parameter of the neural network layer is updated based on a ratio between its gradient norm and the average.

7. The method according to claim 6, wherein: Calculating the average of multiple gradient norms corresponding to the multiple neural network layers includes: A geometric mean of the plurality of gradient norms is calculated.

8. The method according to claim 6, wherein: For each of the neural network layers, based on the ratio between its gradient norm and the average, updating the network parameters of the neural network layer includes: For each neural network layer, the ratio between its gradient norm and the average is calculated; a power operation result with the ratio as the base and a preset value as the exponent is determined; and a network parameter of the neural network layer is updated to the product of itself and the power operation result.

9. A training device for a target detection system, the target detection system comprising a backbone network and a head network, the backbone network comprising a plurality of convolutional layers and a plurality of self-attention layers, the device comprising: An image processing unit configured to process training images using the object detection system; The image processing unit includes: a convolution subunit configured to perform convolution processing on the training image using the plurality of convolution layers to obtain a convolution representation; an attention subunit configured to perform self-attention processing based on the convolution representation using the plurality of attention layers to obtain a feature map; a processing subunit configured to process the feature map using the head network to obtain a detection result of the target object in the training image; A gradient norm calculation unit configured to determine a gradient norm of each neural network layer in the plurality of neural network layers based on the object annotation data corresponding to the training image and the detection result; The network parameter updating unit is configured to determine the deviation amplitude of its own gradient norm for each neural network layer according to the average of multiple gradient norms corresponding to the multiple neural network layers, so as to update its network parameters according to the deviation amplitude.

10. A computing device comprising a memory and a processor, wherein: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Fruit and vegetable detection method based on deep learning

    CN107451602A

  • Telephone traffic quality inspection violation reason extraction method and device based on multi-task learning

    CN114091432A

  • Small target detection method based on improved faster-RCNN in automatic driving scene

    CN114202743A

  • Neural network training in a distributed system

    US20210097396A1