Target detection method, device, computer readable storage medium and computer equipment
By using grouped convolution and shuffling processing in the feature extraction layer of the detection model, the problem of large computational load of traditional convolutional neural networks is solved, efficient target detection is achieved, and targets in virtual interactive scenes can be detected in real time on the CPU. object.
Patent Information
- Application Number
- CN201910576104.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-28
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2039-06-28
AI Technical Summary
Traditional convolutional neural networks have a large amount of calculation and slow operation speed in the image feature extraction process, resulting in low target detection efficiency.
By using group convolution and shuffling processing in the feature extraction layer of the detection model, convolution processing is performed according to the mapping relationship between each group of convolution kernels and input channels, reducing the amount of calculation, and performing target detection through the detection layer to improve detection speed. .
It achieves target detection with a small amount of calculation, improves detection speed and efficiency, and can detect target objects in virtual interactive scenes in real time on the CPU.
Smart Images

Figure CN110309876B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a target detection method, device, computer-readable storage medium and computer equipment. Background Art
[0002] With the development of computer technology, image feature extraction technology has emerged. Image feature extraction refers to extracting image information through computers to determine whether each image point belongs to an image feature. Through image feature extraction, key information in the image can be identified, such as face recognition, target detection, image classification, etc. Traditional image feature extraction methods generally extract image features through the convolution layer of a convolutional neural network, perform convolution processing with the convolution kernel and the feature channel, and output the feature data of the image.
[0003] However, each convolution kernel in the convolution layer of the traditional convolutional neural network is associated with all feature channels, which results in large amount of calculation and slow operation speed. Summary of the invention
[0004] Based on this, it is necessary to provide a target detection method, device, computer-readable storage medium and computer equipment with low computational complexity to address the technical problem of high computational complexity in traditional feature extraction methods.
[0005] A target detection method, comprising:
[0006] Get the target image;
[0007] The target image is subjected to group convolution and shuffling processing through the feature extraction layer of the detection model to obtain feature maps of different scales, wherein the group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels;
[0008] The feature maps of different scales are input into the detection layer of the detection model to perform target detection, so as to obtain information of the target object in the target image.
[0009] A detection model training method, comprising:
[0010] Obtaining training samples and labels corresponding to the training samples;
[0011] Input the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing, and obtain feature maps corresponding to each input channel of the next layer of the current convolution layer;
[0012] When the current convolution layer is a target convolution layer, obtaining a mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer;
[0013] According to the mapping relationship, convolution processing is performed on each group of convolution kernels of the target convolution layer and the feature maps of each group of corresponding input channels respectively, so as to obtain each group of feature maps output by the target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels;
[0014] Shuffling the groups of feature maps through a shuffling layer of a feature extraction layer in the detection model to obtain feature maps of different scales;
[0015] Performing target detection on the feature maps of different scales through the detection layer in the detection model to obtain a detection result;
[0016] According to the difference between the detection result and the label, the parameters of the detection model are adjusted and training is continued until the training stop condition is met.
[0017] A target detection device, characterized in that the device comprises:
[0018] An acquisition module, used for acquiring a target image;
[0019] A feature extraction module, used for performing group convolution and shuffling processing on the target image through the feature extraction layer of the detection model to obtain feature maps of different scales, wherein the group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels;
[0020] The detection module is used to input the feature maps of different scales into the detection layer of the detection model to perform target detection and obtain information of the target object in the target image.
[0021] A computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes any step of the target detection method.
[0022] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes any step of the target detection method.
[0023] The above-mentioned target detection method, device, computer-readable storage medium and computer equipment obtain a target image, and perform group convolution and shuffling processing on the target image through the feature extraction layer of the detection model. The group convolution is to convolve each group of convolution kernels with the feature map of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels, so as to obtain feature maps of different scales. The feature maps of different scales are input into the detection layer of the detection model for target detection, so that target objects of different sizes in the target image can be detected, and the information of the target object in the target image can be obtained. In this scheme, each group of convolution kernels is associated only with a specific group of input channels, which reduces the amount of calculation, thereby improving the speed of target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A diagram showing an application environment of a target detection method in an embodiment;
[0025] Figure 2 Schematic diagram of a target detection method in one embodiment;
[0026] Figure 3 A schematic flow chart of a feature extraction step in one embodiment;
[0027] Figure 4 is a schematic flow chart of steps for obtaining feature maps of different scales in one embodiment;
[0028] Figure 5 is a schematic flow chart of steps for obtaining feature maps of different scales in another embodiment;
[0029] Figure 6 A schematic diagram of a process for shuffling each group of feature maps;
[0030] Figure 7 Schematic diagram of a target detection process in one embodiment;
[0031] Figure 8 A schematic diagram of a flow chart of a detection model training method in one embodiment;
[0032] FIG9( a ) is an image sample pair with a high similarity in one embodiment;
[0033] FIG9( b ) is an image sample in which the target object is too small in one embodiment;
[0034] FIG9( c ) is an image sample with a target object labeled in one embodiment;
[0035] FIG9( d ) is an image sample of setting a label of a target object in one embodiment;
[0036] FIG9( e ) is an image sample of a target object detected by feature maps of different scales in one embodiment;
[0037] Fig.10 is a structural block diagram of a target detection device in one embodiment;
[0038] Fig.11 It is a structural block diagram of a detection model training device in one embodiment;
[0039] Fig.12 FIG. 4 is a structural block diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0041] Figure 1 FIG. 1 is an application environment diagram of a target detection method in an embodiment. The terminal 110 may be a desktop terminal or a mobile terminal. The mobile terminal may be at least one of a mobile phone, a tablet computer, and a laptop computer. The terminal 110 acquires a target image, and inputs the target image into a feature extraction layer of a detection model for group convolution and shuffling processing to obtain feature maps of different scales. The group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels. Next, the terminal 110 inputs the feature maps of different scales into the detection layer of the detection model for target detection to obtain information about the target object in the target image. Next, the category and position of the target object in the target image are displayed on the interface of the terminal 110. As shown in FIG. Figure 1 As shown, both the feature extraction layer and the detection layer may include a multi-layer neural network. It is understandable that the number of layers of the neural network included in the feature extraction layer and the detection layer may be set according to demand, and the number of layers of the neural network included in the feature extraction layer and the detection layer may be different.
[0042] In one embodiment, Figure 2 As shown, a target detection method is provided. This embodiment mainly applies this method to the above Figure 1 The terminal 110 in FIG. Figure 2 , the target detection method specifically includes the following steps:
[0043] Step 202: Acquire a target image.
[0044] The target image is an image to be detected in which a target object in the image needs to be determined, and includes but is not limited to a photographed image, a scene image in a video, and an image in a virtual interactive scene acquired in real time.
[0045] Specifically, the terminal may obtain the image to be detected from other devices, or may obtain the image shot by the terminal. The terminal may also obtain the image captured by the user when watching a video.
[0046] In this embodiment, when the user is in a virtual interaction scene, the terminal can also acquire an image in the virtual interaction scene in real time as a target image.
[0047] Step 204, performing group convolution and shuffling processing on the target image through the feature extraction layer of the detection model to obtain feature maps of different scales. The group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels.
[0048] The detection model can be divided into a feature extraction layer and a detection layer. The feature extraction layer is used to extract the features of the target image, and the detection layer can be used to detect the target object in the target image based on the extracted features. Grouped convolution refers to convolving each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels. Shuffling refers to channel shuffling, which is used to change the order of each channel so that the features of each channel are integrated.
[0049] Specifically, the terminal inputs the target image into the feature extraction layer of the trained detection model, and performs convolution processing on the target image through the feature extraction layer to obtain a preliminarily extracted feature map. Then, the convolution layer in the feature extraction layer performs convolution processing on each group of convolution kernels and the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels, and obtains each group of feature maps after group convolution. The terminal then shuffles each group of feature maps after group convolution through the feature extraction layer, and obtains a scale feature map after shuffling.
[0050] Next, the feature extraction layer continues to perform group convolution on the shuffled feature map to obtain each group of feature maps after group convolution. And the feature extraction layer shuffles each group of feature maps after group convolution to obtain a feature map of another scale. It can be understood that the scale of the feature map obtained by the latter shuffling is different from the scale of the feature map obtained by the previous shuffling. Furthermore, the terminal can perform a preset number of group convolution and shuffling processes through the feature extraction layer of the detection model to obtain multiple feature maps of different scales. The multiple feature maps of different scales can be 3. The preset number of times can be 3 times, 4 times or 5 times, etc.
[0051] Step 206: input the feature maps of different scales into the detection layer of the detection model to perform target detection, and obtain information of the target object in the target image.
[0052] The target object refers to the subject in the target image. The target object may be a person, an animal, a building, etc. in the target image. In a virtual interactive scene, the target object may be a virtual object and virtual equipment, etc. in the image of the virtual interactive scene. The information of the target object refers to the category to which the target object belongs and the position of the target object in the target image. The position of the target object may include the coordinates of the target object in the target image and the width and height of the target object in the target image.
[0053] Specifically, the terminal may input feature maps of different scales extracted by the feature extraction layer into the detection layer of the detection model. The detection layer performs target detection on the feature maps of different scales to determine whether there is a target object in the target image. When the target object is detected in the target image, the category to which the target object belongs and the position of the target object in the target image are determined.
[0054] The above-mentioned target detection method obtains a target image and performs group convolution and shuffling processing on the target image through the feature extraction layer of the detection model. The group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels, so as to obtain feature maps of different scales. The feature maps of different scales are input into the detection layer of the detection model for target detection, so that target objects of different sizes in the target image can be detected and the information of the target objects in the target image can be obtained. In this scheme, each group of convolution kernels is associated only with a specific group of input channels, which reduces the amount of calculation and improves the speed of target detection.
[0055] In one embodiment, Figure 3 As shown, the feature extraction layer includes a convolution layer and a shuffle layer; the target image is subjected to group convolution and shuffle processing by the feature extraction layer of the detection model to obtain feature maps of different scales, including:
[0056] Step 302: The target image is input into the current convolutional layer in the detection model for convolution processing to obtain feature maps corresponding to the input channels of the next layer of the current convolutional layer.
[0057] Specifically, the feature extraction layer may include an input layer and multiple convolutional layers. Each convolutional layer is a feature map set. The feature map set of the previous layer can obtain the feature map set of the next layer through convolution calculation. Each layer of feature map set consists of multiple subsets, each of which is called an input channel. For example, the target image of the input layer is an original color image, and the input channels of the input layer include input channels formed by red pixel values, input channels formed by green pixel values, and input channels formed by blue pixel values, that is, 3 input channels. The feature extraction layer of the detection model performs convolution processing on the target image through the first convolutional layer to obtain feature maps corresponding to each output channel output by the first convolutional layer. It can be understood that the feature maps corresponding to each output channel output by the first convolutional layer are the feature maps corresponding to each input channel of the second layer.
[0058] Each convolution layer of the feature extraction layer is used as the current convolution layer, and the feature map corresponding to the input channel of the current convolution layer is convolved through the convolution kernel of the current convolution layer to obtain the feature maps corresponding to the input channels of the next layer of the current convolution layer.
[0059] Step 304: When the current convolution layer is a target convolution layer, the target convolution layer performs group convolution processing on the feature maps corresponding to the input channels, so as to obtain groups of feature maps output by the target convolution layer.
[0060] Specifically, it is detected whether the current convolution layer is the target convolution layer. When the current convolution layer is the target convolution layer, the mapping relationship between each group of convolution kernels and each group of input channels of the current convolution layer can be obtained. Each group of convolution kernels performs convolution processing on the feature maps corresponding to a group of input channels having a mapping relationship with the group of convolution kernels, and obtains each group of feature maps output by the target convolution layer.
[0061] In this embodiment, there may be multiple target convolution layers. For example, the feature extraction layer includes 7 convolution layers, and each convolution layer from the third to the sixth layer may be set as a target convolution layer. It can be understood that which layer is used as the target convolution layer and how many target convolution layers exist can be set according to demand.
[0062] Step 306, shuffle the groups of feature maps output by the target convolutional layer through the shuffling layer in the detection model to obtain feature maps of different scales.
[0063] Specifically, the feature extraction layer also includes a shuffling layer. The terminal inputs each group of feature maps output by the target convolution layer into the shuffling layer, and shuffles each group of feature maps output by the target convolution layer through the shuffling layer, thereby integrating the features of one group of feature maps into other groups of feature maps. After shuffling, the feature map output by the current shuffling layer is obtained.
[0064] In this embodiment, if Figure 4 As shown, the feature extraction layer also includes multiple shuffling layers. After each target convolution layer outputs each group of feature maps, each group of feature maps output by the layer is input into the shuffling layer for shuffling processing to obtain a feature map of a scale. Next, the feature maps obtained after shuffling are grouped according to the number of groups before shuffling to obtain feature maps corresponding to each group of input channels of the next target convolution layer. The feature maps corresponding to each group of input channels after grouping are used as the input of the next target convolution layer, and the grouped convolution and shuffling processing are continued. After the grouped convolution processing of different target convolution layers and the shuffling processing of the shuffling layer, feature maps of different scales can be obtained.
[0065] For example, the feature extraction layer includes three target convolution layers and three shuffling layers. Each group of feature maps output by each target convolution layer is input to a shuffling layer for shuffling. Each shuffling layer shuffles each group of feature maps and outputs a feature map of one scale. After three shuffling layers, three feature maps of different scales can be obtained.
[0066] The target detection method is to obtain feature maps corresponding to the input channels of the next layer of the current convolution layer by inputting the target image into the detection model for convolution processing. When the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels are grouped and convoluted by the target convolution layer to obtain the feature maps of the target convolution layer output. By determining whether the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels of the current layer are processed differently. By grouping and convoluting the feature maps corresponding to the input channels of the target convolution layer, a group of convolution kernels are associated with only a specific group of input channels, so that a group of convolution kernels only perform convolution processing on the feature maps corresponding to a specific group of input channels, thereby reducing the amount of calculation for convolution processing. The groups of feature maps output by the target convolution layer are shuffled by the shuffling layer in the detection model, so that the feature data of a group of feature maps can be fused into the feature maps of the remaining groups, thereby increasing the connection between the channels of each group. Feature maps of different scales can be obtained by shuffling the feature maps of each group, so that target objects of different sizes can be detected according to the feature maps of different scales, and the recognition is more accurate.
[0067] In one embodiment, when the current convolution layer is not the target convolution layer, the feature maps of each input channel of the convolution layer can be convolved with the convolution kernels of each input channel of the convolution layer to obtain feature maps corresponding to each input channel of the next layer of the convolution layer, wherein one convolution kernel corresponds to one input channel of the next layer.
[0068] For example, when all the convolution layers from the input layer to the third layer are non-target convolution layers, each convolution layer from the first layer to the third layer takes the convolution kernel of each input channel and the feature map of each input channel for convolution calculation, and obtains the feature map of the corresponding input channel of the next layer. An output channel in one layer is an input channel of the next layer. An input channel in one layer can be convolved with multiple convolution kernels of the input channel. Therefore, the convolution calculation of a convolution kernel and an input channel can correspond to the feature map of an input channel of the next layer. It can be seen that the relationship between the current layer channel and the next layer channel can be one-to-one or one-to-many. Therefore, by calculating layer by layer, more and more channel subsets, that is, more and more feature maps, will be obtained. The more feature maps in each layer, the finer the feature description, so that the target image characteristics can be better represented, which is conducive to the subdivision of individual differences and can effectively distinguish different target objects of the same category.
[0069] In one embodiment, when the current convolution layer is the target convolution layer, the feature maps corresponding to the respective input channels are grouped and convolved through the target convolution layer to obtain groups of feature maps output by the target convolution layer, including: when the current convolution layer is the target convolution layer, obtaining the mapping relationship between each group of convolution kernels of the target convolution layer and each group of input channels; according to the mapping relationship, convolving each group of convolution kernels of the target convolution layer with the feature maps of the corresponding groups of input channels to obtain groups of feature maps output by the target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels.
[0070] Specifically, the convolution kernels of the target convolution layer in the detection model are divided into multiple groups, and the input channels of the same target convolution layer are also divided into multiple groups. The number of groups into which the convolution kernels of the same layer are divided is the same as the number of groups into which the input channels of the same layer are divided. In addition, the mapping relationship between each group of convolution kernels and each group of input channels is pre-constructed in the detection model, and a group of convolution kernels corresponds to a group of input channels. When the current convolution layer is the target convolution layer, the mapping relationship between the convolution kernels and the input channels in the target convolution layer is obtained. According to the mapping relationship, each group of convolution kernels of the target convolution layer is respectively subjected to group convolution processing with the feature maps of the corresponding groups of input channels, that is, a group of convolution kernels is subjected to convolution processing with a group of input channels having a mapping relationship with the group of convolution kernels, and a feature map output by a group of output channels of the target convolution layer can be obtained. It can be understood that the number of a group of convolution kernels of the same convolution layer is equal to the number of a group of output channels. According to the same processing method, the feature map output by each group of output channels of the target convolution layer can be obtained. The feature maps of each group of output channels are used as the feature maps of each group of input channels of the next convolutional layer of the target convolutional layer.
[0071] The above-mentioned target detection method, when the current convolution layer is the target convolution layer, obtains the mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer, and convolves each group of convolution kernels of the target convolution layer with the feature maps of each corresponding group of input channels according to the mapping relationship, so that a group of convolution kernels only performs convolution processing on one group of input channels, and there is no need to perform convolution processing on the input channels of other groups, thereby reducing the computational amount of convolution processing and improving the speed of operation.
[0072] In one embodiment, Figure 5 As shown, the groups of feature maps output by the target convolution layer are shuffled through the shuffling layer in the detection model to obtain feature maps of different scales, including:
[0073] Step 502: convert each set of feature maps output by the target convolutional layer into a feature matrix.
[0074] Step 504: transpose the feature matrix.
[0075] Step 506, flattening the transposed feature matrix to obtain feature maps of different scales.
[0076] The flattening process refers to splicing the features in the feature matrix row by row.
[0077] Specifically, the terminal inputs each group of feature maps output by the target convolution layer into the shuffle layer of the detection model, and the shuffle layer converts each group of feature maps into a feature matrix to obtain a feature matrix of (number of groups, number of each group). The feature matrix is then transposed to obtain a feature matrix of (number of each group, number of groups). Then, the terminal flattens the transposed feature matrix through the shuffle layer, that is, obtains the first row, the second row, and the last row of the transposed feature matrix, splices the last data of the first row and the first data of the second row, and splices the last data of each row with the first data of the next row to obtain a spliced feature map. Then, the groups of feature maps output by the target convolution layers of different layers are processed in the same way to obtain feature maps of multiple scales.
[0078] The above target detection method can integrate the features of one set of feature maps into other sets of feature maps by converting each set of feature maps output by the target convolution layer into a feature matrix, transposing the feature matrix, and flattening the transposed feature matrix, thereby building a correlation between each set of channels and making target detection more accurate. By shuffling each set of feature maps of different target convolution layers, feature maps of different scales can be obtained, so that target objects of different sizes in the target image can be detected.
[0079] like Figure 6As shown in FIG. 1 , it is a schematic diagram of shuffling each group of feature graphs in one embodiment. Figure 6 As shown in (a) in , the target convolutional layer outputs 3 sets of feature maps, each set of feature maps has 2, that is, there are 3 sets of output channels, each set of output channels has 2 output channels, and there are a total of (3,2) output channels. Figure 6 As shown in (b) of , the terminal converts the (3,2) output channels into a (3,2) feature matrix. Then, the terminal transposes the (3,2) feature matrix to obtain Figure 6 Next, the terminal concatenates the last data of the first row and the first data of the second row in the feature matrix of (2,3) to obtain Figure 6 The feature map shown in (d) in .
[0080] In one embodiment, Figure 7 As shown, the feature maps of different scales are input into the detection layer of the detection model for target detection to obtain information about the target object in the target image, including:
[0081] Step 702: input the feature maps of different scales into the detection layer of the detection model, and divide each feature map of the feature maps of different scales into at least two regions through the detection layer.
[0082] Specifically, the terminal inputs the feature maps of different scales into the detection layer of the detection model, and the detection layer divides the feature map of each scale into at least two areas.
[0083] In this embodiment, each feature map in the feature maps of different scales may be divided into a preset number of regions, which may be set as required, such as 8, 10, etc.
[0084] Step 704: Detect the probability of the target object existing in each area.
[0085] Specifically, each region in each feature map of the feature maps of different scales is convolved through multiple convolutional layers of the detection layer, and the probability of the existence of the target object in each region is output.
[0086] Step 706: When the probability that the target object exists in the area exceeds a threshold, determine the position and category of the target object in the area.
[0087] The threshold refers to the critical value of whether there is a target object in the region. If the threshold is exceeded, it is determined that there is a target object in the region, and if the threshold is not exceeded, it is determined that there is no target object in the region.
[0088] Specifically, when the probability of a target object existing in a region exceeds a threshold, it is determined that the target object exists in the region. When the probability of a target object existing in multiple regions exceeds a threshold, it is determined that the target object exists in multiple regions. Further, when it is determined that the target object exists in the region, the category of the target object in each region and the position of the target object in the target image can be suppressed by non-maximum suppression to obtain the category corresponding to the target object in each region and the accurate position of the target object in the target image.
[0089] The above-mentioned target detection method inputs the feature maps of different scales into the detection layer of the detection model, divides each feature map of the feature maps of different scales into at least two regions through the detection layer, detects the probability of the target object existing in each region, and determines the position and category of the target object in the region when the probability of the target object existing in the region exceeds a threshold. The joint use of feature maps of different scales provides more effective information than using a single feature map for prediction, which is conducive to improving the accuracy of target detection.
[0090] In one embodiment, the feature maps of different scales are input into the detection layer of the detection model to perform target detection to obtain information of the target object in the target image, including: inputting the feature maps of different scales into the detection layer of the detection model, fusing the feature maps of different scales through the detection layer to obtain a feature pyramid; and determining the position and category of the target object in the target image according to the feature pyramid.
[0091] Among them, feature pyramid is a recognition method used to detect objects of different scales.
[0092] Specifically, the terminal inputs the feature maps of different scales output by different shuffle layers into the detection layer of the detection model, and the detection layer uses the feature maps of different scales as the basis to construct a feature pyramid. The deconvolution operation can be used to upsample the high-level low-resolution feature maps in the feature pyramid structure to obtain the same resolution as the shallow feature maps, and the high-level feature maps and the shallow feature maps are feature fused in an element-by-element manner to obtain a more descriptive feature map after fusion. The fused feature map contains the feature map information of the high-level semantic layer and the feature map information of the shallow layer. The rich feature information provides more effective information for target detection. At the same time, the feature map after feature fusion and the low-resolution feature map are used for target detection. The joint use of multiple feature maps provides more and more effective information than using a single feature map for detection, which is conducive to improving the detection accuracy. Non-maximum suppression is used to suppress the target categories in multiple detection frames and the position offset of the detection frame relative to the default frame, and the target categories in the final detection frame and the position offset of the detection frame relative to the default frame are obtained, and the position coordinates of the detection frame are calculated according to the position offset of the detection frame relative to the default frame and the position coordinates of the default frame. The joint detection of target category and location can improve the computational performance of the detection model and the efficiency of target detection better than detecting them separately.
[0093] In one embodiment, the method further includes: when there are at least two target objects in the target image, labeling the at least two target objects using bounding boxes of corresponding sizes according to sizes of the at least two target objects.
[0094] Specifically, when the terminal detects that there are at least two target objects in the target image, the terminal can determine the size of each target object in the target image, select a corresponding bounding box according to the size of each target object, and mark each target object in the target image. By marking target objects of different sizes with bounding boxes of corresponding sizes, the position of each target object in the target image can be intuitively displayed.
[0095] In one embodiment, the target detection method is applied to a virtual interactive scene; the target image is a scene image acquired in real time in the virtual interactive scene.
[0096] Specifically, the target detection method can be applied to various virtual interactive scenes, such as virtual interactive scenes such as multiplayer online competitive games or shooting games. When the user identifier is in a virtual interactive scene, the terminal can obtain the scene image where the user identifier is currently located in real time, input the scene image into the current convolution layer in the detection model for convolution processing, and obtain the feature maps corresponding to each input channel of the next layer of the current convolution layer. When the current convolution layer is the target convolution layer, the feature maps corresponding to each input channel are grouped and convoluted by the target convolution layer to obtain each group of feature maps output by the target convolution layer; the groups of feature maps output by the target convolution layer are shuffled by the shuffling layer in the detection model to obtain feature maps of different scales. Then, the feature maps of different scales are input into the detection layer of the detection model for target detection, and the position of the target object in the scene image where the user identifier is currently located and the category to which the target object belongs can be obtained. By performing grouped convolution processing on the scene image, the calculation amount of the detection model can be greatly reduced, and the detection speed of the target object in the virtual interactive scene can be greatly improved. This enables real-time detection of target objects in a virtual interactive scene to be achieved through the CPU even when the terminal is not equipped with a graphics card.
[0097] In one embodiment, Figure 8 As shown, a detection model training method is provided, including:
[0098] Step 802: Obtain training samples and labels corresponding to the training samples.
[0099] The training sample is a sample image, and the label corresponding to the training sample includes the category to which the target object in the sample image belongs and the coordinates, height and width of the target object in the sample image.
[0100] Specifically, the terminal obtains training samples and labels corresponding to each training sample.
[0101] Step 804: input the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing to obtain feature maps corresponding to each input channel of the next layer of the current convolution layer.
[0102] Step 806: When the current convolution layer is a target convolution layer, a mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer is obtained.
[0103] Step 808, convolving each group of convolution kernels of the target convolution layer with the feature maps of each group of corresponding input channels according to the mapping relationship to obtain each group of feature maps output by the target convolution layer, wherein one group of convolution kernels corresponds to one group of input channels.
[0104] Step 810, shuffling the groups of feature maps through the shuffling layer of the feature extraction layer in the detection model to obtain feature maps of different scales.
[0105] Specifically, the terminal inputs the training sample into the feature extraction layer of the detection model to be trained, and performs convolution processing on the training sample through the feature extraction layer to obtain a preliminarily extracted feature map. Then, the convolution layer in the feature extraction layer performs convolution processing on each group of convolution kernels and the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels, and obtains each group of feature maps after group convolution. Then, the shuffling layer of the feature extraction layer shuffles each group of feature maps after group convolution, and obtains a scale feature map after shuffling.
[0106] Then, the feature extraction layer continues to perform group convolution on the shuffled feature map to obtain each group of feature maps after group convolution. And the feature extraction layer shuffles each group of feature maps after group convolution to obtain a feature map of another scale. It can be understood that the scale of the feature map obtained by the latter shuffling is different from the scale of the feature map obtained by the previous shuffling. Furthermore, the terminal can perform a preset number of group convolution and shuffling processes through the feature extraction layer of the detection model to obtain feature maps of multiple different scales.
[0107] Step 812: Perform target detection on the feature maps of different scales through the detection layer in the detection model to obtain detection results.
[0108] The detection result is whether the target object exists in the training sample. When the target object exists, the detection result also includes the coordinates of the target object in the training sample, the width and height of the target object in the training sample, and the category corresponding to the target object.
[0109] Specifically, the terminal may input feature maps of different scales extracted by the feature extraction layer into the detection layer of the detection model. The detection layer performs target detection on feature maps of different scales to determine whether there is a target object in the training sample. When it is detected that there is a target object in the training sample, the coordinates of the target object in the training sample, the width and height of the target object in the training sample, and the category corresponding to the target object are determined.
[0110] Step 814, according to the difference between the detection result and the label, adjust the parameters of the detection model and continue training until the training stop condition is met.
[0111] Specifically, the terminal compares the coordinates of the target object detected by the detection model in the training sample, the width and height of the target object in the training sample, and the category corresponding to the target object with the coordinates, height and width of the target object in the sample image in the label corresponding to the training sample, and the category to which the target object belongs to, to determine the difference between the detection result and the label.
[0112] The above detection model training method obtains training samples and labels corresponding to the training samples, inputs the training samples into the detection model to be trained to extract feature maps of different scales, obtains the detection results of the training samples according to the feature maps of different scales, and then determines the difference between the detection results and the labels corresponding to the training samples, adjusts the parameters of the detection model according to the difference and continues training until the training stop condition is met, thereby obtaining a trained detection model. The trained detection model reduces the amount of calculation of convolution processing, increases the speed of operation, and thus improves the efficiency of target detection.
[0113] In one embodiment, a target detection method is provided, comprising:
[0114] The terminal obtains the training sample and the label corresponding to the training sample.
[0115] Next, the terminal inputs the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing, and obtains feature maps corresponding to each input channel of the next layer of the current convolution layer.
[0116] Optionally, when the current convolution layer is a target convolution layer, the terminal obtains a mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer.
[0117] Next, the terminal performs convolution processing on each group of convolution kernels of the target convolution layer with the feature maps of each group of corresponding input channels according to the mapping relationship to obtain each group of feature maps output by the target convolution layer, where a group of convolution kernels corresponds to a group of input channels.
[0118] Furthermore, the terminal shuffles the groups of feature maps through a shuffling layer of the feature extraction layer in the detection model to obtain feature maps of different scales.
[0119] Next, the terminal performs target detection on the feature maps of different scales through the detection layer in the detection model to obtain detection results.
[0120] Furthermore, the terminal adjusts the parameters of the detection model according to the difference between the detection result and the label and continues training until the training is terminated when a training stop condition is met.
[0121] Next, the terminal obtains the target image; the target image is input into the current convolution layer in the detection model for convolution processing, and the feature maps corresponding to the input channels of the next layer of the current convolution layer are obtained;
[0122] Optionally, when the current convolution layer is a target convolution layer, the terminal obtains a mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer.
[0123] Next, the terminal performs convolution processing on each group of convolution kernels of the target convolution layer with the feature maps of each group of corresponding input channels according to the mapping relationship to obtain each group of feature maps output by the target convolution layer, where a group of convolution kernels corresponds to a group of input channels.
[0124] Next, the terminal converts each set of feature maps output by the target convolutional layer into a feature matrix; transposes the feature matrix; and flattens the transposed feature matrix to obtain feature maps of different scales.
[0125] Optionally, the terminal inputs the feature maps of different scales into the detection layer of the detection model, and divides each feature map of the feature maps of different scales into at least two regions through the detection layer; detects the probability of the presence of the target object in each region; and determines the position and category of the target object in the region when the probability of the presence of the target object in the region exceeds a threshold.
[0126] Optionally, the terminal inputs the feature maps of different scales into the detection layer of the detection model, fuses the feature maps of different scales through the detection layer, and obtains a feature pyramid; and determines the position and category of the target object in the target image according to the feature pyramid.
[0127] Further, when there are at least two target objects in the target image, the terminal marks the at least two target objects using bounding boxes of corresponding sizes according to sizes of the at least two target objects.
[0128] The above target detection method obtains training samples and labels corresponding to the training samples, extracts feature maps of different scales of the training samples through the detection model to be trained, obtains the detection results of the training samples through the detection layer of the detection model, compares the detection results with the labels to determine the differences between the detection results and the labels, and adjusts the parameters of the detection model according to the differences, thereby obtaining a trained detection model.
[0129] By inputting the target image into the current convolution layer in the detection model for convolution processing, the feature maps corresponding to the input channels of the next layer of the current convolution layer are obtained. When the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels are grouped and convolution processed by the target convolution layer to obtain the groups of feature maps output by the target convolution layer. By determining whether the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels of the current layer are processed differently. By grouping and convolution processing the feature maps corresponding to the input channels of the target convolution layer, a group of convolution kernels are associated with only a specific group of input channels, so that a group of convolution kernels only perform convolution processing on the feature maps corresponding to a specific group of input channels, which reduces the amount of convolution processing calculations and improves the operation speed of the detection model.
[0130] The shuffle layer in the detection model shuffles the feature maps of each group output by the target convolution layer, so that the feature data of one group of feature maps can be integrated into the feature maps of the remaining groups, increasing the connection between the channels of each group. By shuffling each group of feature maps, feature maps of different scales can be obtained, so that target objects of different sizes can be detected based on feature maps of different scales, and recognition is more accurate.
[0131] Through the detection layer, each feature map in the feature maps of different scales is divided into at least two regions, and the probability of the target object existing in each region is detected. When the probability of the target object existing in the region exceeds a threshold, the position and category of the target object in the region are determined. The joint use of feature maps of different scales provides more effective information than using a single feature map for prediction, which is conducive to improving the accuracy of target detection.
[0132] Alternatively, target detection can be performed through a feature pyramid, using feature maps after feature fusion and low-resolution feature maps. The joint detection of target category and position can improve the computational performance of the detection model and the efficiency of target detection better than detecting them separately.
[0133] In one embodiment, the target detection method can be applied to a gunfight game. Image samples are extracted from the user's video of the gunfight game, and the sampling time interval is 1 second. After sampling, the image samples need to be manually screened, and the redundant samples with too high similarity are deleted. As shown in Figure 9(a), there are two pairs of image samples with too high similarity. Too many redundant images can easily cause the detection model to overfit. Therefore, one of the image samples with too high similarity is retained, and the remaining image samples with too high similarity are deleted. Secondly, there cannot be too small target objects in the image sample. If the area of the target object is less than 1 / 400 of the area of the image sample, this image sample is deleted. Figure 9(b) shows a sample containing too small targets. If the sample set contains too many small targets, due to the limited learning ability of the detection model, it is difficult for the detection model to converge under such a sample set.
[0134] After collecting image samples, the target objects in the image samples need to be labeled, indicating the rectangular area where the target objects are located. Figure 9(c) shows a labeled sample, with the black frame marking the location of the target. Furthermore, the target objects in each image sample need to be labeled, indicating the x-coordinate and y-coordinate of the upper left corner of the target, the width and height of the target object, and the label also includes the category to which the target object belongs, namely the defender and lurker categories in the gunfight game. The labeled sample is shown in Figure 9(d).
[0135] After obtaining the image sample set and the corresponding label set, the image samples are used to train the detection model. The detection model divides a part of the convolution layer channels into multiple groups. When performing the convolution operation, each group of convolution kernels only performs convolution processing with the channels of a specific group. After the convolution operation, the shuffle layer is used to shuffle the feature maps of different groups, making full use of the connection between different groups. Feature maps of different scales can be obtained through grouped convolution processing of different convolution layers and shuffle processing of different shuffle layers.
[0136] Target objects of different sizes can be detected by feature maps of different scales. Figure 9(e) shows the target objects in the gunfight game detected by feature maps of three different scales. Three feature maps of different scales are used to detect targets of different sizes. The large-scale feature map is used to detect large target objects, the medium-scale feature map is used to detect medium-sized target objects, and the small-scale feature map is used to detect small target objects. The target objects in the sample image are detected by feature maps of different scales, and the position of each target object in the sample image and the category to which each target object belongs are output.
[0137] The detection results of the detection model are compared with the labels, and the parameters of the detection model are adjusted according to the difference between the two. The detection model is further trained to obtain a detection model that meets the conditions, that is, a trained detection model. The trained detection model can be used to achieve real-time target detection in shooting games through the CPU when the computer is not equipped with a graphics card.
[0138] Compared with traditional convolution, this solution can reduce the complexity of the detection model, while the accuracy of the detection model does not change much, reducing the amount of calculation of the detection model, thereby speeding up the target detection. Compared with traditional depthwise separable convolution, this solution can improve the detection effect of the detection model and increase the speed of feature extraction due to the use of shuffle layers to increase the connection between different feature groups, thereby achieving real-time detection of target objects in shooting games under the CPU.
[0139] Figure 2-Figure 8 FIG. 1 is a flow chart of a target detection method in one embodiment. It should be understood that although Figure 2-Figure 8The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 8 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0140] In one embodiment, Fig.10 As shown, a target detection device is provided, including: an acquisition module 1002, a feature extraction module 1004 and a detection module 1006. Among them,
[0141] The acquisition module 1002 is used to acquire a target image.
[0142] The feature extraction module 1004 is used to perform group convolution and shuffling processing on the target image through the feature extraction layer of the detection model to obtain feature maps of different scales. The group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels.
[0143] The detection module 1006 is used to input the feature maps of different scales into the detection layer of the detection model to perform target detection and obtain information of the target object in the target image.
[0144] The above-mentioned target detection device obtains a target image and inputs the target image into the feature extraction layer of the detection model for group convolution and shuffling processing. The group convolution is to convolve each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels, so as to obtain feature maps of different scales. The feature maps of different scales are input into the detection layer of the detection model for target detection, so that target objects of different sizes in the target image can be detected and the information of the target objects in the target image can be obtained. In this solution, each group of convolution kernels is associated only with a specific group of input channels, which reduces the amount of calculation and improves the speed of target detection.
[0145] In one embodiment, the feature extraction module 1004 is also used to: input the target image into the current convolution layer in the detection model for convolution processing to obtain feature maps corresponding to each input channel of the next layer of the current convolution layer; when the current convolution layer is the target convolution layer, perform group convolution processing on the feature maps corresponding to each input channel through the target convolution layer to obtain each group of feature maps output by the target convolution layer; shuffle each group of feature maps output by the target convolution layer through the shuffling layer in the detection model to obtain feature maps of different scales.
[0146] The target detection device, by inputting the target image into the current convolution layer in the detection model for convolution processing, obtains the feature maps corresponding to the input channels of the next layer of the current convolution layer. When the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels are grouped and convoluted by the target convolution layer to obtain the feature maps of the target convolution layer output. By determining whether the current convolution layer is the target convolution layer, the feature maps corresponding to the input channels of the current layer are processed differently. By grouping and convoluting the feature maps corresponding to the input channels of the target convolution layer, a group of convolution kernels are associated with only a specific group of input channels, so that a group of convolution kernels only perform convolution processing on the feature maps corresponding to a specific group of input channels, thereby reducing the amount of calculation for convolution processing. The groups of feature maps output by the target convolution layer are shuffled by the shuffling layer in the detection model, so that the feature data of a group of feature maps can be fused into the feature maps of the remaining groups, thereby increasing the connection between the channels of each group. Feature maps of different scales can be obtained by shuffling each group of feature maps, so that target objects of different sizes can be detected according to feature maps of different scales, and the recognition is more accurate.
[0147] In one embodiment, the feature extraction module 1004 is also used to: when the current convolution layer is a target convolution layer, obtain the mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer; according to the mapping relationship, convolve each group of convolution kernels of the target convolution layer with the feature maps of the corresponding groups of input channels respectively to obtain each group of feature maps output by the target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels.
[0148] The target detection device, when the current convolution layer is the target convolution layer, obtains the mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer, and performs convolution processing on each group of convolution kernels of the target convolution layer with the feature maps of each corresponding group of input channels according to the mapping relationship, so that a group of convolution kernels only performs convolution processing on one group of input channels, and there is no need to perform convolution processing on the input channels of other groups, thereby reducing the computational amount of convolution processing and improving the speed of operation.
[0149] In one embodiment, the feature extraction module 1004 is also used to: convert each group of feature maps output by the target convolution layer into a feature matrix; transpose the feature matrix; flatten the transposed feature matrix to obtain feature maps of different scales. By converting each group of feature maps output by the target convolution layer into a feature matrix, transposing the feature matrix, and flattening the transposed feature matrix, the features of one group of feature maps can be fused into other groups of feature maps, thereby constructing the association between each group of channels, making target detection more accurate. Shuffling the groups of feature maps of different target convolution layers can obtain feature maps of different scales, so that target objects of different sizes in the target image can be detected.
[0150] In one embodiment, the detection module 1006 is also used to: input the feature maps of different scales into the detection layer of the detection model, and divide each feature map of the feature maps of different scales into at least two regions through the detection layer; detect the probability of the existence of the target object in each region; when the probability of the existence of the target object in the region exceeds a threshold, determine the position and category of the target object in the region.
[0151] The above-mentioned target detection device inputs the feature maps of different scales into the detection layer of the detection model, divides each feature map of the feature maps of different scales into at least two regions through the detection layer, detects the probability of the target object existing in each region, and determines the position and category of the target object in the region when the probability of the target object existing in the region exceeds a threshold. The joint use of feature maps of different scales provides more effective information than using a single feature map for prediction, which is conducive to improving the accuracy of target detection.
[0152] In one embodiment, the detection module 1006 is further used to: input the feature maps of different scales into the detection layer of the detection model, fuse the feature maps of different scales through the detection layer to obtain a feature pyramid; and determine the position and category of the target object in the target image according to the feature pyramid. The joint detection of the target category and position can improve the computational performance of the detection model and the efficiency of target detection more than the separate detection.
[0153] In one embodiment, the device further includes: a labeling module. The labeling module is used to: when there are at least two target objects in the target image, label the at least two target objects using bounding boxes of corresponding sizes according to the sizes of the at least two target objects. Labeling target objects of different sizes using bounding boxes of corresponding sizes can intuitively display the positions of each target object in the target image.
[0154] In one embodiment, Fig.11As shown, a detection model training device is provided, including: a sample acquisition module 1102, a sample convolution module 1104, a mapping relationship acquisition module 1106, an output module 1108, a shuffling module 1110, a sample target detection module 1112 and an adjustment module 1114. Among them,
[0155] The sample acquisition module 1102 is used to acquire training samples and labels corresponding to the training samples.
[0156] The sample convolution module 1104 is used to input the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing, so as to obtain feature maps corresponding to each input channel of the next layer of the current convolution layer.
[0157] The mapping relationship acquisition module 1106 is used to obtain the mapping relationship between each group of convolution kernels and each group of input channels of the target convolution layer when the current convolution layer is the target convolution layer.
[0158] The output module 1108 is used to convolve each group of convolution kernels of the target convolution layer with the feature maps of each group of corresponding input channels according to the mapping relationship to obtain each group of feature maps output by the target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels.
[0159] The shuffling module 1110 is used to shuffle the groups of feature maps through the shuffling layer of the feature extraction layer in the detection model to obtain feature maps of different scales.
[0160] The sample target detection module 1112 is used to perform target detection on the feature maps of different scales through the detection layer in the detection model to obtain detection results.
[0161] The adjustment module 1114 is used to adjust the parameters of the detection model according to the difference between the detection result and the label and continue training until the training is terminated when the training stop condition is met.
[0162] The above detection model training device obtains training samples and labels corresponding to the training samples, inputs the training samples into the detection model to be trained to extract feature maps of different scales, obtains the detection results of the training samples according to the feature maps of different scales, and then determines the difference between the detection results and the labels corresponding to the training samples, adjusts the parameters of the detection model according to the difference and continues training until the training stop condition is met, thereby obtaining a trained detection model. The trained detection model reduces the amount of calculation of convolution processing, improves the speed of operation, and thus improves the efficiency of target detection.
[0163] Fig.12 The internal structure diagram of a computer device in one embodiment is shown. The computer device may specifically be Figure 1 The terminal 110 in FIG. Fig.12 As shown, the computer device includes a processor, a memory, a network interface, an input device and a display screen connected through a system bus. Among them, the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program, which, when executed by the processor, enables the processor to implement a target detection method. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute a target detection method. The display screen of the computer device may be a liquid crystal display or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0164] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0165] In one embodiment, the target detection device provided by the present application can be implemented in the form of a computer program. The computer program can be Fig.12 The computer device shown in the figure is run. The memory of the computer device can store various program modules constituting the target detection device, for example, Fig.10 The acquisition module 1002, feature extraction module 1004 and detection module 1006 are shown. The computer program composed of various program modules enables the processor to execute the steps of the target detection method of each embodiment of the present application described in this specification.
[0166] For example, Fig.12 The computer device shown can be Fig.10 The acquisition module 1002 in the target detection device shown in the figure performs the step of acquiring the target image. The computer device can perform group convolution and shuffling processing on the target image input into the feature extraction layer of the detection model through the feature extraction module to obtain feature maps of different scales, wherein the group convolution is the step of convolving each group of convolution kernels with the feature maps of each group of input channels according to the mapping relationship between each group of convolution kernels and each group of input channels. The computer device can perform the step of inputting the feature maps of different scales into the detection layer of the detection model for target detection through the detection module 1006 to obtain the information of the target object in the target image.
[0167] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above-mentioned target detection method. The steps of the target detection method here may be the steps of the target detection method in the above-mentioned embodiments.
[0168] In one embodiment, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the processor executes the steps of the above-mentioned target detection method. The steps of the target detection method here can be the steps in the target detection method of each of the above-mentioned embodiments.
[0169] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0170] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0171] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A target detection method, comprising: Get the target image; Input the target image into the current convolution layer in the feature extraction layer of the detection model for convolution processing to obtain feature maps corresponding to each input channel of the next layer of the current convolution layer; When the current convolution layer is the current target convolution layer, obtaining a mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer; According to the mapping relationship, convolution processing is performed on each group of convolution kernels of the current target convolution layer with the feature maps of each group of corresponding input channels to obtain each group of feature maps output by the current target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels; By using the current shuffling layer in the feature extraction layer, shuffling each group of feature maps output by the current target convolution layer to obtain a feature map of a scale; Grouping the feature maps of the one scale according to the number of groups before shuffling, to obtain feature maps corresponding to each group of input channels of the next target convolutional layer; Taking the next target convolution layer as the current target convolution layer, taking the next shuffle layer as the current shuffle layer, returning to the step of obtaining the mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer when the current convolution layer is the current target convolution layer, and continuing to execute until a plurality of feature maps of different scales are obtained; The feature maps of different scales are input into the detection layer of the detection model to perform target detection, so as to obtain information of the target object in the target image.
2. The method according to claim 1, characterized in that The step of shuffling the groups of feature maps output by the current target convolution layer through the current shuffling layer in the feature extraction layer to obtain a feature map of a scale includes: Convert each set of feature maps output by the target convolutional layer into a feature matrix; Transposing the feature matrix; The transposed feature matrix is flattened to obtain a feature map of a certain scale.
3. The method according to claim 1, characterized in that The step of inputting the feature maps of different scales into the detection layer of the detection model to perform target detection to obtain information of the target object in the target image includes: Inputting the feature maps of different scales into a detection layer of the detection model, and dividing each feature map of the feature maps of different scales into at least two regions through the detection layer; Detect the probability of the target object existing in each area; When the probability that the target object exists in the area exceeds a threshold, the position and category of the target object in the area are determined.
4. The method according to claim 1, characterized in that: The step of inputting the feature maps of different scales into the detection layer of the detection model to perform target detection to obtain information of the target object in the target image includes: Inputting the feature maps of different scales into the detection layer of the detection model, and fusing the feature maps of different scales through the detection layer to obtain a feature pyramid; The position and category of the target object in the target image are determined according to the feature pyramid.
5. The method according to claim 1, characterized in that The target detection method is applied to a virtual interaction scene; the target image is a scene image acquired in real time in the virtual interaction scene.
6. A detection model training method, comprising: Obtaining training samples and labels corresponding to the training samples; Input the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing, and obtain feature maps corresponding to each input channel of the next layer of the current convolution layer; When the current convolution layer is the current target convolution layer, obtaining a mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer; According to the mapping relationship, convolution processing is performed on each group of convolution kernels of the current target convolution layer with the feature maps of each group of corresponding input channels to obtain each group of feature maps output by the current target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels; By using the current shuffling layer in the feature extraction layer in the detection model, shuffling each group of feature maps output by the current target convolution layer to obtain a feature map of a scale; Grouping the feature maps of the one scale according to the number of groups before shuffling, to obtain feature maps corresponding to each group of input channels of the next target convolutional layer; Taking the next target convolution layer as the current target convolution layer, taking the next shuffle layer as the current shuffle layer, returning to the step of obtaining the mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer when the current convolution layer is the current target convolution layer, and continuing to execute until a plurality of feature maps of different scales are obtained; Performing target detection on the feature maps of different scales through the detection layer in the detection model to obtain a detection result; According to the difference between the detection result and the label, the parameters of the detection model are adjusted and training is continued until the training stop condition is met.
7. A target detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a target image; The feature extraction module is used to input the target image into the current convolution layer in the feature extraction layer of the detection model for convolution processing, and obtain the feature maps corresponding to the input channels of the next layer of the current convolution layer; when the current convolution layer is the current target convolution layer, obtain the mapping relationship between the groups of convolution kernels and the groups of input channels of the current target convolution layer; according to the mapping relationship, convolve the groups of convolution kernels of the current target convolution layer with the feature maps of the corresponding groups of input channels, and obtain the groups of feature maps output by the current target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels; through The current shuffle layer in the feature extraction layer shuffles each group of feature maps output by the current target convolution layer to obtain a feature map of a scale; the feature maps of the one scale are grouped according to the number of groups before shuffling to obtain feature maps corresponding to each group of input channels of the next target convolution layer; the next target convolution layer is used as the current target convolution layer, the next shuffle layer is used as the current shuffle layer, and the step of obtaining the mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer when the current convolution layer is the current target convolution layer is returned and continued until multiple feature maps of different scales are obtained; The detection module is used to input the feature maps of different scales into the detection layer of the detection model to perform target detection and obtain information of the target object in the target image.
8. The device according to claim 7, characterized in that The feature extraction module is also used to convert each group of feature maps output by the target convolution layer into a feature matrix; transpose the feature matrix; and flatten the transposed feature matrix to obtain a feature map of a certain scale.
9. The device according to claim 7, characterized in that The detection module is further used to input the feature maps of different scales into the detection layer of the detection model, and divide each feature map of the feature maps of different scales into at least two regions through the detection layer; and detect the probability of the existence of the target object in each region; When the probability that the target object exists in the area exceeds a threshold, the position and category of the target object in the area are determined.
10. The device according to claim 7, characterized in that The detection module is also used to input the feature maps of different scales into the detection layer of the detection model, fuse the feature maps of different scales through the detection layer to obtain a feature pyramid; and determine the position and category of the target object in the target image according to the feature pyramid.
11. A detection model training device, characterized in that: The device comprises: A sample acquisition module, used to acquire training samples and labels corresponding to the training samples; A sample convolution module, used for inputting the training sample into the current convolution layer of the feature extraction layer in the detection model to be trained for convolution processing, so as to obtain feature maps corresponding to the input channels of the next layer of the current convolution layer; A mapping relationship acquisition module, used for acquiring the mapping relationship between each group of convolution kernels and each group of input channels of the current target convolution layer when the current convolution layer is the current target convolution layer; An output module, configured to perform convolution processing on each group of convolution kernels of the current target convolution layer and the feature maps of each group of corresponding input channels according to the mapping relationship, to obtain each group of feature maps output by the current target convolution layer, wherein a group of convolution kernels corresponds to a group of input channels; A shuffling module, used to shuffle the groups of feature maps output by the current target convolution layer through the current shuffling layer in the feature extraction layer in the detection model to obtain a feature map of a scale; The device is also used to group the feature maps of one scale according to the number of groups before shuffling, to obtain feature maps corresponding to each group of input channels of the next target convolutional layer; use the next target convolutional layer as the current target convolutional layer, use the next shuffled layer as the current shuffled layer, return to the step of obtaining the mapping relationship between each group of convolution kernels and each group of input channels of the current target convolutional layer when the current convolutional layer is the current target convolutional layer, and continue to execute until multiple feature maps of different scales are obtained; A sample target detection module is used to perform target detection on the feature maps of different scales through the detection layer in the detection model to obtain a detection result; The adjustment module is used to adjust the parameters of the detection model according to the difference between the detection result and the label and continue training until the training is terminated when the training stop condition is met.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 6.
13. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Image recognition method based on variable group convolution
CN108009594A
High-resolution SAR terrain classification method based on multiscale convolution and feature fusion
CN108154192A
Object detection method, neural network training method, devices and electronic apparatus
CN108229455A
Lightweight small-target detection method of improving SSD (Single-Shot Detector)
CN108288075A
Quick detection method for objective on the basis of multi-scale characteristic pattern
CN108510012A
