Target detection method and related device, electronic device, and storage medium

By fusing image and category feature representations in the target detection method, and converting them into fused feature representations for prediction, the problem of reduced detection accuracy caused by category diversity in the existing technology is solved, and high-precision target detection is achieved.

CN114529791BActive Publication Date: 2024-10-29IFLYTEK CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210032569.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2024-10-29
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

When the diversity of categories increases, the detection accuracy of existing target detection methods decreases, making it difficult to accurately distinguish problems of similar categories.

Method used

By fusing the pixel position feature representation in the feature map of the image to be detected with the feature representation of preset objects and categories, converting it into a fused feature representation, and making predictions based on these representations to achieve targeted perception and detection, and then combine multi-classification tasks Convert to a binary classification task.

Benefits of technology

The target detection accuracy is improved, and even if there are many categories, it can be accurately detected and the detection complexity is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114529791B_ABST
    Figure CN114529791B_ABST
Patent Text Reader

Abstract

The present application discloses a target detection method and related devices, electronic devices, and storage media, wherein the target detection method includes: obtaining a first feature representation of each pixel position in a feature map of an image to be detected, and obtaining a second feature representation of several preset objects and a third feature representation of several preset categories; fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; making a prediction based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent the preset object and preset category corresponding to the fused feature representation. The above scheme can convert a multi-classification task into a binary classification task, and thus can accurately detect even if there are many categories, which is conducive to improving the accuracy of target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a target detection method and related devices, electronic equipment, and storage media. Background Art

[0002] Object detection is one of the core tasks in the field of computer vision and is the basis for achieving object tracking and behavior recognition. Existing object detection methods mainly include: object detection methods based on manually designed features and object detection methods based on neural networks.

[0003] Research has found that the number of categories in existing target detection methods has a direct impact on the detection accuracy. Generally speaking, once the number of categories increases, the detection accuracy will also decrease. In actual applications, it will be difficult to distinguish some similar categories. In view of this, how to improve the accuracy of target detection has become an urgent problem to be solved. Summary of the invention

[0004] The main technical problem solved by the present application is to provide a target detection method and related devices, electronic devices, and storage media, which can improve the accuracy of target detection.

[0005] In order to solve the above technical problems, the first aspect of the present application provides a target detection method, including: obtaining a first feature representation of each pixel position in a feature map of an image to be detected, and obtaining a second feature representation of several preset objects and a third feature representation of several preset categories; fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; making a prediction based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent the preset object and the preset category corresponding to the fused feature representation.

[0006] In order to solve the above technical problems, the second aspect of the present application provides a target detection device, including: an acquisition module, a fusion module and a prediction module, the acquisition module is used to obtain a first feature representation of each pixel position in a feature map of an image to be detected, and obtain a second feature representation of several preset objects and a third feature representation of several preset categories; the fusion module is used to fuse the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; the prediction module is used to make a prediction based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent the preset object and the preset category corresponding to the fused feature representation.

[0007] In order to solve the above technical problems, the third aspect of the present application provides an electronic device, including a memory and a processor coupled to each other, the memory storing program instructions, and the processor being used to execute the program instructions to implement the target detection method of the first aspect.

[0008] In order to solve the above technical problems, the fourth aspect of the present application provides a computer-readable storage medium storing program instructions that can be executed by a processor, and the program instructions are used to implement the target detection method of the first aspect.

[0009] The above scheme obtains the first feature representation of each pixel position in the feature map of the image to be detected, and obtains the second feature representations of several preset objects and the third feature representations of several preset categories. Based on this, the second feature representation of the preset object and the third feature representation of the preset category are fused to obtain a fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation to obtain the detection result of the target object with respect to the target category. The target object and the target category respectively represent the preset object and the preset category corresponding to the fused feature representation. Therefore, in the target detection process, by fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain the fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation, each preset category can be sensed and detected separately in a targeted manner to obtain the detection result of the target object with respect to the target category, so that the multi-classification task can be converted into a binary classification task, and even if there are many categories, accurate detection can be achieved, which is beneficial to improving the target detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a flowchart of an embodiment of the target detection method of the present application;

[0011] Figure 2 is a schematic diagram of a process of feature extraction according to an embodiment;

[0012] Figure 3 It is a process schematic diagram of an embodiment of the target detection method of the present application;

[0013] Figure 4 is a schematic diagram of a framework of an embodiment of a coding network;

[0014] Figure 5 is a schematic diagram of a process of fusing feature representations according to an embodiment;

[0015] Figure 6 is a schematic diagram of a framework of an embodiment of a decoding network;

[0016] Figure 7 is a schematic diagram of an embodiment of an image to be detected;

[0017] Figure 8is a flowchart of an embodiment of training a target detection model;

[0018] Fig. 9 It is a schematic diagram of the framework of an embodiment of the target detection device of the present application;

[0019] Fig.10 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;

[0020] Fig.11 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0021] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0022] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0023] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.

[0024] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the target detection method of the present application. Specifically, it may include the following steps:

[0025] Step S11: obtaining a first feature representation of each pixel position in a feature map of the image to be detected, and obtaining a second feature representation of a plurality of preset objects and a third feature representation of a plurality of preset categories.

[0026] In an implementation scenario, in order to improve the efficiency of target detection, a target detection model can be pre-trained, and the target detection model can further include a feature extraction network for extracting the feature map of the image to be detected. Of course, a feature extraction network can also be trained separately to extract the feature map of the image to be detected, which is not limited here. It should be noted that the feature extraction network may include but is not limited to a convolutional neural network, and the network structure of the feature extraction network is not limited here. In addition, the feature extraction network may include several layers of feature extraction layers, such as 1 layer of feature extraction layer, 2 layers of feature extraction layers, and 3 layers of feature extraction layers, and the number of layers of feature extraction layers contained in the feature extraction network is not limited here.

[0027] In a specific implementation scenario, the feature map output by the last feature extraction layer of the feature extraction network can be taken as the feature map of the image to be detected, so as to obtain the first feature representation based on the feature map. Figure 2 , Figure 2 FIG. 1 is a schematic diagram of a process of feature extraction according to an embodiment of the present invention. Figure 2 As shown, the feature extraction network includes 4 layers of feature extraction layers. After feature extraction, the samples are downsampled to 4, 8, 16, and 32 times of the original image to be detected. On this basis, the feature map downsampled to 32 times of the original image to be detected (i.e., the feature map output by the 4th feature extraction layer) can be taken as the feature map of the image to be detected, which is used to obtain the first feature representation based on the feature map in the subsequent process. Other cases can be deduced by analogy, and no examples are given here one by one.

[0028] In a specific implementation scenario, the feature maps extracted by the feature extraction layers of each layer of the feature extraction network can also be fused to obtain a fused feature map as the feature map of the image to be detected, which is used to subsequently obtain the first feature representation based on the feature map. Exemplarily, the feature maps extracted by the feature extraction layers of each layer can be sorted in descending order according to the downsampling multiple, and one feature map is selected in turn as the current feature map, and the current feature map is upsampled to obtain the upsampled feature map of the current feature map, and the feature map ranked after the current feature map is selected as the feature map to be fused, and then the upsampled feature map of the current feature map is fused with the feature map to be fused to obtain a fused feature map; on this basis, the fused feature map is used as the current feature map, and then an unselected feature map is selected in turn as the feature map to be fused, the current feature map is upsampled to obtain the upsampled feature map of the current feature map, and the upsampled feature map of the current feature map is fused with the feature map to be fused to obtain a new fused feature map, and the above-mentioned step of using the fused feature map as the current feature map and subsequent steps are repeated until all feature maps are fused. Figure 2For example, you can first select a 32-fold downsampled feature map as the current feature map, and upsample it to a 16-fold downsampled feature map (i.e., double upsampled) as the upsampled feature map, and then fuse the upsampled feature map with the 16-fold downsampled feature map output by the third feature extraction layer to obtain a 16-fold downsampled fused feature map; on this basis, you can use the 16-fold downsampled fused feature map as the current feature map, and upsample it to obtain an 8-fold downsampled feature map (i.e., double upsampled) as the upsampled feature map, and then fuse the upsampled feature map with the 16-fold downsampled feature map output by the third feature extraction layer to obtain a 16-fold downsampled fused feature map. The feature map is fused with the 8-fold downsampled feature map output by the second feature extraction layer to obtain an 8-fold downsampled fused feature map; on this basis, the 8-fold downsampled fused feature map can be used as the current feature map, and upsampled to obtain a 4-fold downsampled (i.e., double upsampled) feature map as the upsampled feature map, and then the upsampled feature map is fused with the 4-fold downsampled feature map output by the first feature extraction layer to obtain the final fused feature map as the feature map of the image to be detected, which is used to obtain the first feature representation based on the feature map in the subsequent process. Other situations can be deduced by analogy, and no examples are given here.

[0029] In an implementation scenario, the first feature representation of each pixel position may include image feature information and position feature information of the pixel position. For ease of description, the size of the feature map of the image to be detected can be recorded as W*H*C, that is, the number of channels is C, the width is W, and the height is H. Then each pixel position in the feature map can be regarded as having a feature vector with a dimension of C. Exemplarily, C can be 256, etc., which is not limited here. In addition, for each pixel position, it can be based on its first position pos in the length direction x , get the first position feature representation, and based on its second position pos in the width direction y , obtain the second position feature representation, then concatenate the first position feature representation and the second position feature representation to obtain a feature vector representing the position feature information of the pixel position, and finally add the feature vector of each pixel position in the feature map and the feature vector representing the position feature information of the pixel position to obtain the first feature representation of the pixel position.

[0030] In a specific implementation scenario, taking the dimension of the feature vector representing the position feature information of the pixel position as 256 as an example, the first 128 dimensions can represent the position encoding in the width direction, and the last 128 dimensions can represent the position encoding in the height direction, wherein the feature of each dimension can be calculated by the following formula:

[0031]

[0032]

[0033]

[0034]

[0035] In the above formulas (1) to (4), the value range of i is 0 to 63, so for the pixel position (pos x ,pos y ), we can use formulas (1) and (2) to get the 128-dimensional position code in the width direction, and use formulas (3) and (4) to get the 128-dimensional position code in the height direction. By concatenating the two 128-dimensional position codes, we can get the pixel position (pos x ,pos y )’s position feature information.

[0036] In one implementation scenario, in order to further improve the accuracy of target detection, after obtaining the first feature representation of each pixel position in the above manner, the first feature representation of each pixel position can also be input into a semantic encoding network to extract deep semantics, and the semantic features extracted from each pixel position are updated to the new first feature representation of the corresponding pixel position. Figure 3 , Figure 3 FIG. 1 is a schematic diagram of a process of an embodiment of the target detection method of the present application. Figure 3 As shown in FIG. 1 , after fusing the position feature information of the position coding, the deep semantics is extracted by the coding network, and the first feature representation of each pixel position can be updated. It should be noted that the network structure of the coding network is not limited here. For example, please refer to Figure 4 , Figure 4 Schematic diagram of the framework of an embodiment of a coding network. Figure 4 As shown in the figure, the encoding network can specifically adopt a Transformer-based network architecture. The encoding network can specifically include N layers with the same structure, each layer contains two sub-layers, namely a multi-head attention layer and a feedforward network layer, and each sub-layer is residually connected and then normalized. For the specific processing process of the encoding network, please refer to the relevant technical details of the Transformer, which will not be repeated here.

[0037] In an implementation scenario, the first feature representations of each pixel position may be sorted in the order of the pixel positions, so that the first feature representations of each pixel position may be flattened into a feature sequence. For example, the first feature representation of the first row and first column, the first feature representation of the first row and second column, the first feature representation of the first row and third column, ..., the first feature representation of the i-th row and j-th column, etc. may be flattened as a feature sequence.

[0038] In one implementation scenario, the first total number of several preset objects can be set based on the usage scenario of target detection. For example, for home monitoring scenarios, the number of objects that need to be detected is generally small, so the first total number can be set to be appropriately smaller, such as 5, 6, 7, 8, 9, etc.; or, for station monitoring, the number of objects that need to be detected is generally large, so the first total number can be set to be appropriately larger, such as 100, 101, 102, etc. Other scenarios can be deduced by analogy, and examples are not given one by one here. The above method, setting the first total number of preset objects based on the usage scenario of target detection, can improve the adaptability to different usage scenarios.

[0039] In an implementation scenario, the second total number of several preset categories can be set based on the usage scenario of target detection. For example, for the autonomous driving scenario, there are generally many types of objects that need to be detected, such as but not limited to: pedestrians, motor vehicles, non-motor vehicles, road signs, signal lights, indicator lines (such as stop lines, sidewalks, lane lines, left turn lines, right turn lines, straight lines, etc.), etc., which are not limited here, so the second total number can be set to be appropriately larger, such as 20, 21, 22, 23, etc.; or, for the package inspection scenario, the types of objects that need to be detected are generally small, such as but not limited to: clothing, food, dangerous goods, etc., which are not limited here, so the second total number can be set to be appropriately smaller, such as 5, 6, 7, 8, etc. Other scenarios can be deduced by analogy, and examples are not given one by one here. The above method, setting the second total number of preset categories based on the usage scenario of target detection, can improve the adaptability to different usage scenarios.

[0040] In an implementation scenario, as mentioned above, in order to improve the efficiency of target detection, a target detection model can be pre-trained, and the second feature representation and the third feature representation can be obtained based on the trained target detection model. For the specific training process, please refer to the following relevant description, which will not be repeated here.

[0041] Step S12: Fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation.

[0042] Specifically, the second feature representation of each preset object can be concatenated with the third feature representation of each preset category to obtain a fused feature representation. For example, in the target detection process, there are M preset objects and N preset categories. Figure 5 , Figure 5 FIG. 1 is a schematic diagram of a process of fusing feature representations according to an embodiment of the present invention. Figure 5As shown, for each preset object, its second feature representation can be concatenated with the third feature representations of the first to Nth preset categories to obtain N fused feature representations, that is, M*N fused feature representations can be obtained in the end. Figure 3 In the case of two preset objects and two preset categories, the second feature representations of the two preset objects and the third feature representations of the two preset categories can be spliced ​​in pairs to obtain four fused feature representations to achieve category perception in the target detection process. Other situations can be deduced by analogy, and examples are not given one by one here. In the above method, the second feature representation of each preset object is spliced ​​with the third feature representation of each preset category to obtain a fused feature representation, that is, the second feature representation and the third feature representation can be spliced ​​in pairs, so that in the subsequent prediction process, the detection results of each preset object for each preset category can be obtained, which is beneficial to improve the integrity of target detection.

[0043] Step S13: Predict based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category.

[0044] In the disclosed embodiment, the target object and the target category respectively represent the preset object and preset category corresponding to the fused feature representation. Taking the home monitoring scene as an example, the first total number of several preset objects can be set to 3. For the sake of distinction, they can be respectively called "first object", "second object" and "third object". The second total number of several preset categories can be set to 2, such as "person" and "pet". Then, the second feature representation of the preset object "first object" can be fused with the third feature representation of the preset category "person" to obtain a fused feature representation. When prediction is made based on the fused feature representation and the first feature representation, the target object is the "first object" and the target category is "person"; or, the second feature representation of the preset object "first object" can be fused with the third feature representation of the preset category "pet" to obtain a fused feature representation. When prediction is made based on the fused feature representation and the first feature representation, the target object is the "first object" and the target category is "pet". Other situations can be deduced by analogy, and examples are not given one by one here.

[0045] In an implementation scenario, as mentioned above, in order to improve the efficiency of target detection, a target detection model can be pre-trained, so that the target detection model can be used to perform target detection. Figure 3 The target detection model can further include a decoding network and a prediction network. The fused feature representation and the first feature representation of each pixel position can be input into the decoding network for decoding to obtain a decoded feature representation, and then the decoded feature representation can be input into the prediction network to obtain a detection result corresponding to the fused feature representation.

[0046] In a specific implementation scenario, the network structure of the decoding network is not limited here. Figure 6 , Figure 6 Schematic diagram of a decoding network implementation example. Figure 6 As shown in , the decoding network can specifically adopt a Transformer-based network architecture. The decoding network can specifically include L layers with the same structure, each layer contains three sub-layers, namely two multi-head attention layers and a feedforward network layer, and each sub-layer is residually connected and then normalized. Figure 4 The encoding network shown in the figure has a similar network structure to the encoding network. The main difference is that the three features Q, K, and V of the second multi-head attention layer in the decoding network do not come from the same feature. The K and V features come from the output features of the encoding network (i.e., the first feature representation), while the Q feature comes from the fused feature representation.

[0047] In a specific implementation scenario, the prediction network may include sub-networks for performing prediction processing on each decoded feature representation, and each sub-network may include a feedforward network layer and a fully connected layer. The feedforward network layer is used to process the decoded feature representation to obtain a new feature representation, and then the new feature representation is input into the fully connected layer to obtain the corresponding detection result.

[0048] In one implementation scenario, the detection result may specifically include: the predicted position of the target object in the image to be detected, and whether there is a target object of the target category at the predicted position. Taking the fusion of the second feature representation of the preset object "first object" and the third feature representation of the preset category "person" as an example, the detection result may specifically include: the predicted position of the "first object" in the image to be detected, and whether there is a "person" at the predicted position; or, taking the fusion of the second feature representation of the preset object "first object" and the third feature representation of the preset category "pet" as an example, the detection result may specifically include: the predicted position of the "first object" in the image to be detected, and whether there is a "pet" at the predicted position. Other situations can be deduced by analogy, and no examples are given here one by one.

[0049] In a specific implementation scenario, the detection result may specifically include a probability value of a target object of a target category existing at the predicted location. Figure 7 , Figure 7 is a schematic diagram of an embodiment of an image to be detected. Still taking the case where the plurality of preset objects include "first object" and "second object", and the plurality of preset categories include "person" and "pet" as an example, Figure 7 As shown, the detection result of the “first object” with respect to the “person” includes the predicted position of the “first object” in the image to be detected (such as Figure 7The predicted position of the first object with the category of "person" is 0.99, and the detection result of the first object with respect to the pet includes the predicted position of the first object in the image to be detected (as shown in the dashed box A). Figure 7 The predicted position of the "first object" with the category of "pet" is 0.01. In addition, the detection result of the "second object" with respect to the "person" includes the predicted position of the "second object" in the image to be detected (as shown in the dotted box A). Figure 7 The predicted position of the second object in the image to be detected has a probability value of 0.02 that the class “person” exists at the predicted position. The detection result of the second object on the “pet” includes the predicted position of the second object in the image to be detected (such as Figure 7 The predicted position is shown in the dashed box B), and the probability value of the "second object" of the category "pet" is 0.98. It should be noted that the above probability value and predicted position are only one possible situation in the actual application process, and the actual detection result is not limited thereto. In addition, when several preset objects and several preset categories are other situations, the same can be applied, and no examples are given here one by one.

[0050] In a specific implementation scenario, as mentioned above, the detection result may specifically include the probability value of the target object of the target category existing at the predicted position. On this basis, the final category of the target object and the target position in the image to be detected can be determined based on the probability value of the target object with respect to each preset category. Exemplarily, as a possible implementation method in the actual application process, a detection threshold (such as 0.8, 0.85, etc.) can be pre-set. On this basis, it can be determined whether the maximum value of the probability value of the target object with respect to each preset category is greater than the detection threshold. If so, it can be determined that the final category of the target object is the preset category corresponding to the maximum probability value, and the target position of the target object in the image to be detected is the predicted position in the detection result to which the final category belongs. Please continue to refer to Figure 7, since the probability values ​​of the “first object” for “people” and “pets” are 0.99 and 0.01 respectively, and the maximum value thereof is greater than the detection threshold, the preset category “people” corresponding to the maximum probability value can be used as the final category of the “first object”, and the predicted position in the detection result to which the final category belongs (i.e., the dotted box A) can be used as the target position of the “first object”; similarly, since the probability values ​​of the “second object” for “people” and “pets” are 0.02 and 0.98 respectively, and the maximum value thereof is greater than the detection threshold, the preset category “pet” corresponding to the maximum probability value can be used as the final category of the “second object”, and the predicted position in the detection result to which the final category belongs (i.e., the dotted box B) can be used as the target position of the “second object”. It should be noted that if the maximum value of the probability values ​​of the target object for each preset category is not greater than the detection threshold, it can be considered that the target object does not exist in the image to be detected (i.e., Figure 3 In the above manner, the detection result includes the probability value of the target object of the target category existing at the predicted position, and based on the probability value of the target object with respect to each preset category, the final category of the target object and the target position in the image to be detected are determined, and the final category and target position can be obtained through post-processing as simple as possible, which is conducive to reducing the complexity of target detection.

[0051] The above scheme obtains the first feature representation of each pixel position in the feature map of the image to be detected, and obtains the second feature representations of several preset objects and the third feature representations of several preset categories. Based on this, the second feature representation of the preset object and the third feature representation of the preset category are fused to obtain a fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation to obtain the detection result of the target object with respect to the target category. The target object and the target category respectively represent the preset object and the preset category corresponding to the fused feature representation. Therefore, in the target detection process, by fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain the fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation, each preset category can be sensed and detected separately in a targeted manner to obtain the detection result of the target object with respect to the target category, so that the multi-classification task can be converted into a binary classification task, and even if there are many categories, accurate detection can be achieved, which is beneficial to improving the target detection accuracy.

[0052] See also Figure 8 , Figure 81 is a flow chart of an embodiment of training a target detection model. As mentioned above, in order to improve the target detection efficiency, the target detection model can be pre-trained, and the second feature representation and the third feature representation can be obtained based on the target detection model training, and the target detection model can be trained using sample images, and the sample images can be marked with annotation information of several sample objects. Specifically, the embodiment of the present disclosure can include the following steps:

[0053] Step S81: obtaining a sample feature representation of each pixel position in a sample feature map of the sample image, and fusing the object feature representation of a preset object with the category feature representation of a preset category to obtain a sample fusion representation.

[0054] For details, please refer to the related descriptions of obtaining the first feature representation and fusing the second feature representation and the third feature representation in the aforementioned disclosed embodiment, which will not be repeated here. In addition, during the first training, the object feature representation of each preset object can be initialized, and the category feature representation of each preset category can be initialized. Exemplarily, the object feature representation of M preset objects can be randomly initialized, and the category feature representation of N preset categories can be randomly initialized.

[0055] Step S82: Predict based on the sample feature representation and the sample fusion representation to obtain a prediction result of the sample target object with respect to the sample target category.

[0056] In the disclosed embodiment, the sample target object and the sample target category respectively represent the preset object and preset category corresponding to the sample fusion representation. For details, please refer to the relevant description in the aforementioned disclosed embodiment regarding "prediction based on the first feature representation and the fusion feature representation to obtain the detection result of the target object regarding the target category", which will not be repeated here.

[0057] Step S83: Based on the difference between the annotation information and the prediction results, adjust the network parameters of the object feature representation, category feature representation and target detection model.

[0058] In one implementation scenario, several groups of comparison combinations can be obtained based on the differences between the prediction results and the annotation information, and then the object feature representation, category feature representation and network parameters of the target detection model can be adjusted based on the differences between the prediction results and the annotation information in each group of comparison combinations. The above method can improve the accuracy of the loss metric by first matching the combination and then calculating the difference, which is conducive to improving the accuracy of the subsequent adjustment of the feature representation and network parameters.

[0059] In a specific implementation scenario, the annotation information of the sample object may include the actual position of the sample object in the sample image, and the actual category of the sample object, and the prediction result may include the predicted position of the sample target object in the sample image, and whether there is a sample target object of the sample target category at the predicted position. On this basis, the Hungarian algorithm can be used to perform bilateral matching of the annotation information and the prediction result, and the best annotation information is matched for each prediction result, such as matching the prediction result with the annotation information belonging to the actual position closest to the prediction position contained therein. It should be noted that in actual application, there may be a situation where the amount of standard information is less than the number of prediction results. In this case, fictitious annotation information can be used, and the fictitious annotation information does not contain specific object categories. For the specific matching process, please refer to the technical details of the Hungarian algorithm, which will not be repeated here.

[0060] In a specific implementation scenario, in each comparison combination, for the difference between whether there is a sample target object of the sample target category at the predicted position in the prediction result and the actual category of the sample object in the annotation information (i.e., binary classification loss), a loss function such as cross entropy can be used to measure the first loss, and for the difference between the predicted position of the sample target object in the sample image in the prediction result and the actual position of the sample object in the sample image in the annotation information (i.e., regression loss), a loss function such as IoU (Intersection over Union), L1, L2, etc. can be used to measure the second loss, and by combining the first loss and the second loss, the sub-loss corresponding to the comparison combination can be obtained, so that the sub-losses corresponding to each comparison combination can be fused (e.g., added, weighted, etc.) to obtain the total loss, and then based on the total loss, the network parameters of the object feature representation, category feature representation and target detection model can be adjusted by optimization methods such as gradient descent. For the specific process of difference measurement, please refer to the technical details of the aforementioned loss functions such as cross entropy loss, IoU loss, L1 loss, L2 loss, etc., and for the specific process of feature representation and parameter adjustment, please refer to the technical details of optimization methods such as gradient descent, which will not be repeated here.

[0061] In an implementation scenario, as described above, the target detection model may include a feature extraction network, an encoding network, a decoding network, and a prediction network. The functions of each network can refer to the relevant description in the aforementioned disclosed embodiment, which will not be repeated here. On this basis, in the process of adjusting the network parameters of the target detection model, the network parameters of each network can be adjusted.

[0062] Step S84: re-execute the step of obtaining the sample feature representation of each pixel position in the sample feature map of the sample image and subsequent steps until the training converges, and use the object feature representation as the second feature representation and the category feature representation as the third feature representation.

[0063] Specifically, if the training has not converged (e.g., the number of training iterations is still less than a certain set threshold, or the total loss is still greater than a certain set threshold, etc.), the above steps of obtaining the sample feature representation of each pixel position in the sample feature map of the sample image and subsequent steps can be re-executed to train the target detection model again until the training converges. After the training converges, the latest object feature representation can be used as the second feature representation, and the latest category feature representation can be used as the third feature representation.

[0064] The above scheme obtains the sample feature representation of each pixel position in the sample feature map of the sample image, and fuses the object feature representation of the preset object and the category feature representation of the preset category to obtain the sample fusion representation, and then predicts based on the sample feature representation and the sample fusion representation to obtain the prediction result of the sample target object with respect to the sample target category, and the sample target object and the sample target category respectively represent the preset object and the preset category corresponding to the sample fusion representation. On this basis, based on the difference between the annotation information and the prediction result, the network parameters of the object feature representation, the category feature representation and the target detection model are adjusted, and the step of obtaining the sample feature representation of each pixel position in the sample feature map of the sample image and the subsequent steps are re-executed until the training converges, and the object feature representation is used as the second feature representation, and the category feature representation is used as the third feature representation. Therefore, the object feature representation and the category feature representation can be adjusted together during the training process of the target detection model, which is conducive to enabling the network to learn the characteristics of each category of objects a priori, thereby reducing the training difficulty and further facilitating the improvement of the convergence speed.

[0065] See also Fig. 9 , Fig. 9 It is a schematic diagram of the framework of an embodiment of a target detection device 90 of the present application. The target detection device 90 includes: an acquisition module 91, a fusion module 92 and a prediction module 93. The acquisition module 91 is used to obtain the first feature representation of each pixel position in the feature map of the image to be detected, and obtain the second feature representation of several preset objects and the third feature representation of several preset categories; the fusion module 92 is used to fuse the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; the prediction module 93 is used to predict based on the first feature representation and the fused feature representation to obtain the detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent the preset object and the preset category corresponding to the fused feature representation.

[0066] In the above scheme, during the target detection process, the second feature representation of the preset object and the third feature representation of the preset category are fused to obtain a fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation. Each preset category can be perceived and detected separately to obtain the detection result of the target object with respect to the target category, thereby converting a multi-classification task into a binary classification task, and even if there are many categories, accurate detection can be achieved, which is beneficial to improving the target detection accuracy.

[0067] In some disclosed embodiments, the detection result includes: a predicted position of the target object in the image to be detected, and whether a target object of the target category exists at the predicted position.

[0068] Therefore, the detection result is set to include: the predicted position of the target object in the image to be detected, and whether there is a target object of the target category at the predicted position. Therefore, on the basis of fusing the second feature representation and the third feature representation to achieve category-aware target detection, the multi-classification task is converted into a binary classification task, so that the detection result contains the binary classification result of the target object regarding the target category, which is conducive to reducing the complexity of subsequent processing as much as possible.

[0069] In some disclosed embodiments, the detection result includes a probability value of a target object of a target category existing at the predicted position; the target detection device 90 also includes a post-processing module for determining the final category of the target object and the target position in the image to be detected based on the probability values ​​of the target object with respect to each preset category.

[0070] Therefore, the detection result includes the probability value of the target object of the target category existing at the predicted position, and based on the probability value of the target object with respect to each preset category, the final category of the target object and the target position in the image to be detected are determined. The final category and target position can be obtained through post-processing that is as simple as possible, which is conducive to reducing the complexity of target detection.

[0071] In some disclosed embodiments, the fusion module 92 is specifically used to concatenate the second feature representation of each preset object with the third feature representation of each preset category to obtain a fused feature representation.

[0072] Therefore, the second feature representation of each preset object is respectively spliced ​​with the third feature representation of each preset category to obtain a fused feature representation, that is, the second feature representation and the third feature representation can be spliced ​​two by two, so that in the subsequent prediction process, the detection results of each preset object for each preset category can be obtained, which is beneficial to improve the integrity of target detection.

[0073] In some disclosed embodiments, the detection result is obtained based on detection of a target detection model, the second feature representation and the third feature representation are obtained based on training of the target detection model, and the target detection model is trained using sample images, and the sample images are marked with annotation information of several sample objects.

[0074] Therefore, in the process of training the target detection model, training the second feature representation and the third feature representation together is beneficial to improving the accuracy of the second feature representation and the third feature representation.

[0075] In some disclosed embodiments, the target detection device 90 includes a sample acquisition module for acquiring a sample feature representation of each pixel position in a sample feature map of a sample image, and fusing the object feature representation of a preset object and the category feature representation of a preset category to obtain a sample fusion representation; the target detection device 90 includes a sample prediction module for performing prediction based on the sample feature representation and the sample fusion representation to obtain a prediction result of the sample target object with respect to the sample target category; wherein the sample target object and the sample target category respectively represent the preset object and the preset category corresponding to the sample fusion representation; the target detection device 90 includes an optimization and adjustment module for adjusting the network parameters of the object feature representation, the category feature representation and the target detection model based on the difference between the annotation information and the prediction result; the target detection device 90 includes a feature acquisition module for re-executing the step of acquiring the sample feature representation of each pixel position in the sample feature map of the sample image and subsequent steps until the training converges, and taking the object feature representation as the second feature representation, and taking the category feature representation as the third feature representation.

[0076] Therefore, during the target detection model training process, the object feature representation and the category feature representation can be adjusted at the same time, which is conducive to enabling the network to learn the characteristics of each category of objects a priori, thereby reducing the difficulty of training and further helping to improve the convergence speed.

[0077] In some disclosed embodiments, the optimization and adjustment module includes a matching submodule for obtaining several groups of comparison combinations based on the differences between the prediction results and the annotation information; the optimization and adjustment module includes an optimization submodule for adjusting the network parameters of the object feature representation, the category feature representation and the target detection model based on the differences between the prediction results and the annotation information in each group of comparison combinations.

[0078] Therefore, by matching the combination first and then calculating the difference, the accuracy of the loss metric can be improved, which is beneficial to improving the accuracy of the subsequent adjustment of feature representation and network parameters.

[0079] In some disclosed embodiments, the object detection device 90 includes a feature initialization module for initializing an object feature representation of each preset object and initializing a category feature representation of each preset category.

[0080] Therefore, before formal training, the object feature representation of each preset object and the category feature representation of each preset category are obtained through initialization without specially designing feature representation, which is conducive to further reducing the complexity of model training.

[0081] In some disclosed embodiments, the first feature representation includes image feature information and position feature information of a pixel position; and / or, at least one of a first total number of preset objects and a second total number of preset categories is set based on a usage scenario of target detection.

[0082] Therefore, the first feature representation is set to include image feature information and position feature information of the pixel position, so that the image feature information and the position feature information can be simultaneously referenced during the target detection process, which is conducive to improving the accuracy of target detection; and at least one of the first total number of several preset objects and the second total number of several preset categories is set based on the usage scenario of target detection, which can improve the adaptability to different usage scenarios.

[0083] See also Fig.10 , Fig.10 1 is a schematic diagram of a framework of an embodiment of an electronic device 100 of the present application. The electronic device 100 includes a memory 101 and a processor 102 coupled to each other, the memory 101 stores program instructions, and the processor 102 is used to execute the program instructions to implement the steps in any of the above target detection method embodiments. Specifically, the electronic device 100 may include but is not limited to: a desktop computer, a laptop computer, a server, a mobile phone, a tablet computer, etc., which are not limited here.

[0084] Specifically, the processor 102 is used to control itself and the memory 101 to implement the steps in any of the above-mentioned target detection method embodiments. The processor 102 can also be referred to as a CPU (Central Processing Unit). The processor 102 may be an integrated circuit chip having signal processing capabilities. The processor 102 may also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 102 may be implemented by an integrated circuit chip.

[0085] In the above scheme, during the target detection process, the second feature representation of the preset object and the third feature representation of the preset category are fused to obtain a fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation. Each preset category can be perceived and detected separately to obtain the detection result of the target object with respect to the target category, thereby converting a multi-classification task into a binary classification task, and even if there are many categories, accurate detection can be achieved, which is beneficial to improving the target detection accuracy.

[0086] See also Fig.11 , Fig.11 1 is a schematic diagram of a framework of an embodiment of a computer-readable storage medium 110 of the present application. The computer-readable storage medium 110 stores program instructions 111 that can be executed by a processor, and the program instructions 111 are used to implement the steps in any of the above-mentioned target detection method embodiments.

[0087] In the above scheme, during the target detection process, the second feature representation of the preset object and the third feature representation of the preset category are fused to obtain a fused feature representation, and then prediction is made based on the first feature representation and the fused feature representation. Each preset category can be perceived and detected separately to obtain the detection result of the target object with respect to the target category, thereby converting a multi-classification task into a binary classification task, and even if there are many categories, accurate detection can be achieved, which is beneficial to improving the target detection accuracy.

[0088] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0089] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0090] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0092] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0093] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A target detection method, characterized in that: include: Obtaining a first feature representation of each pixel position in a feature map of the image to be detected, and obtaining a second feature representation of a plurality of preset objects and a third feature representation of a plurality of preset categories; Fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; Prediction is performed based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent a preset object and a preset category corresponding to the fused feature representation, and the detection result includes: a predicted position of the target object in the image to be detected, and whether a target object of the target category exists at the predicted position, and the detection result also includes a probability value of a target object of the target category existing at the predicted position.

2. The method according to claim 1, characterized in that After performing prediction based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category, the method further includes: Based on the probability values ​​of the target object with respect to each of the preset categories, a final category of the target object and a target position in the image to be detected are determined.

3. The method according to claim 1, characterized in that: The fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation includes: The second feature representation of each of the preset objects is respectively concatenated with the third feature representation of each of the preset categories to obtain the fused feature representation.

4. The method according to claim 1, characterized in that The detection result is obtained based on the target detection model, the second feature representation and the third feature representation are obtained based on the training of the target detection model, and the target detection model is obtained by training using sample images, and the sample images are marked with annotation information of several sample objects.

5. The method according to claim 4, characterized in that The training steps of the target detection model include: Acquire a sample feature representation of each pixel position in a sample feature map of the sample image, and fuse the object feature representation of the preset object with the category feature representation of the preset category to obtain a sample fusion representation; Predicting based on the sample feature representation and the sample fusion representation to obtain a prediction result of the sample target object with respect to the sample target category; wherein the sample target object and the sample target category respectively represent a preset object and a preset category corresponding to the sample fusion representation; Based on the difference between the annotation information and the prediction result, adjusting the object feature representation, the category feature representation and the network parameters of the target detection model; The step of obtaining the sample feature representation of each pixel position in the sample feature map of the sample image and subsequent steps are re-executed until the training converges, and the object feature representation is used as the second feature representation, and the category feature representation is used as the third feature representation.

6. The method according to claim 5, characterized in that The adjusting the object feature representation, the category feature representation and the network parameters of the target detection model based on the difference between the labeling information and the prediction result includes: Based on the differences between the prediction results and the annotation information, obtaining a plurality of comparison combinations; Based on the difference between the prediction results and the annotation information in each group of the comparison combinations, the object feature representation, the category feature representation and the network parameters of the target detection model are adjusted.

7. The method according to claim 5, characterized in that Before obtaining the sample feature representation of each pixel position in the sample feature map of the sample image, the method further includes: Initialize the object feature representation of each of the preset objects, and initialize the category feature representation of each of the preset categories.

8. The method according to claim 1, characterized in that The first feature representation includes image feature information and position feature information of the pixel position; And / or, at least one of the first total number of the plurality of preset objects and the second total number of the plurality of preset categories is set based on a usage scenario of target detection.

9. A target detection device, characterized in that: include: An acquisition module, used to acquire a first feature representation of each pixel position in a feature map of the image to be detected, and to acquire a second feature representation of a plurality of preset objects and a third feature representation of a plurality of preset categories; A fusion module, used for fusing the second feature representation of the preset object and the third feature representation of the preset category to obtain a fused feature representation; A prediction module is used to make predictions based on the first feature representation and the fused feature representation to obtain a detection result of the target object with respect to the target category; wherein the target object and the target category respectively represent a preset object and a preset category corresponding to the fused feature representation, and the detection result includes: a predicted position of the target object in the image to be detected, and whether a target object of the target category exists at the predicted position, and the detection result also includes a probability value of the target object of the target category existing at the predicted position.

10. An electronic device, characterized in that: It comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the target detection method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the target detection method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Target detection method and device, electronic equipment and storage medium

    CN110807385A

  • Article identification method and device, computer equipment and storage medium

    CN111340126A

  • Target detection model training method and device, equipment and storage medium

    CN112801164A

  • Object detection method, neural network training method, apparatus, and electronic device

    WO2018153319A1