Open set object detection method and device based on foreground subspace

By constructing a foreground subspace and using image features, subspace distances and projection coordinates, the problem that existing technology cannot detect targets of unknown categories is solved, and accurate detection and adaptability of targets in open environments are achieved.

CN116229159BActive Publication Date: 2024-09-03INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310109841.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-02
Publication Date
2024-09-03
Estimated Expiration
2043-02-02

AI Technical Summary

Technical Problem

Existing target detection algorithms cannot detect unknown categories of targets in an open environment and cannot meet the needs of actual application scenarios.

Method used

The open set target detection method based on the foreground subspace is adopted. By constructing the foreground subspace, the distance between the image features of the candidate target and the foreground subspace and the projection coordinate distance of the known category prototype in the subspace are used to determine the prediction of the target. Category and location to achieve detection of unknown category targets.

Benefits of technology

It improves the accuracy of foreground target detection, can detect targets belonging to known categories and targets that do not belong to known categories, adapts to changes in target scale, and meets detection needs in open environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116229159B
    Figure CN116229159B
Patent Text Reader

Abstract

The present application discloses an open set target detection method and device based on foreground subspace, which relates to the field of computer technology, wherein the method comprises: obtaining an image to be detected; inputting the image to be detected into a target detection model, and obtaining the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model; the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category. The method and device provided by the present application improve the accuracy of foreground 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 computer technology, and in particular to an open set target detection method and device based on foreground subspace. Background Art

[0002] Object detection is one of the important tasks in the field of pattern recognition and computer vision. It aims to obtain the specific location and category of the object in the image through image analysis. It is an important basis for understanding the high-level semantic information of the image. It has long been widely concerned by academia and industry, and plays an important role in many application fields such as video surveillance, autonomous driving, intelligent transportation, robot navigation, multimedia retrieval, and film and television creation. In recent years, with the continuous development of deep learning technology, automatic feature learning from large amounts of data has gradually become the mainstream. The wide application of deep neural networks represented by convolutional neural networks in object detection has greatly promoted the development of the field and has now become the mainstream object detection technology.

[0003] Current object detection algorithms are almost all designed based on the closed category set assumption, that is, the detector can only detect objects of the labeled categories in the training data. However, in practical applications, the use scenarios of object detection algorithms are often in open environments, and the category set of the detected objects is an open set, that is, the targets of interest that the algorithm needs to detect include unknown category targets that have not been learned during the training process. However, existing algorithms will directly ignore targets of unknown categories as background and cannot detect them, so they cannot meet the needs of actual usage scenarios. Summary of the invention

[0004] In a first aspect, the present application provides an open set object detection method based on foreground subspace, comprising:

[0005] Acquire the image to be detected;

[0006] Inputting the image to be detected into a target detection model to obtain a predicted position and a predicted category of a foreground target corresponding to the image to be detected output by the target detection model;

[0007] Among them, the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category.

[0008] According to the open set target detection method based on foreground subspace provided by the present application, the image to be detected is input into the target detection model, and the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model are obtained, including:

[0009] Inputting the image to be detected into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer determines a plurality of feature maps of different scales corresponding to the image to be detected based on different feature extraction scales;

[0010] Inputting the multiple feature maps of different scales into the candidate target recognition layer of the target detection model to obtain image features and position features of the candidate targets corresponding to the image to be detected output by the candidate target recognition layer;

[0011] Inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace;

[0012] The image features of the foreground target are input into the category recognition layer of the target detection model, and the category recognition layer determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, and determines the predicted position of the foreground target based on the position features of the foreground target.

[0013] According to the open set target detection method based on foreground subspace provided by the present application, the image features of the candidate target are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace, including:

[0014] Inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace based on the minimum distance between the image features of the candidate target and any vector in the foreground subspace;

[0015] When the distance between the image feature of the candidate target and the foreground subspace is less than or equal to the foreground determination threshold, the candidate target is determined as the foreground target corresponding to the image to be detected.

[0016] According to the open set target detection method based on foreground subspace provided by the present application, the image features of the foreground target are input into the category recognition layer of the target detection model, and the category recognition layer determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, including:

[0017] Inputting the image features of the foreground target into the category recognition layer of the target detection model, the category recognition layer determines the projection coordinates of the foreground target in the foreground subspace based on the image features of the foreground target, and determines the projection coordinates of the prototypes corresponding to each known category in the foreground subspace based on the prototype features corresponding to each known category;

[0018] Based on the projection coordinates of the foreground object and the projection coordinates of each prototype, determining the distance between the foreground object and each prototype;

[0019] When the distance between the foreground object and any prototype is less than or equal to the category determination threshold, determining the known category corresponding to any prototype as the predicted category of the foreground object;

[0020] When the distances between the foreground object and each prototype are greater than the category determination threshold, the predicted category of the foreground object is determined as an unknown category.

[0021] According to the open set target detection method based on foreground subspace provided by the present application, the multi-scale feature extraction layer is constructed based on a feature pyramid network.

[0022] According to the open set target detection method based on foreground subspace provided by the present application, the foreground subspace is constructed based on the following steps:

[0023] Obtain prototype features corresponding to multiple known categories;

[0024] Perform principal component analysis on the prototype features corresponding to the known categories to determine multiple principal component feature vectors;

[0025] The foreground subspace is constructed based on the multiple principal component eigenvectors.

[0026] According to the open set target detection method based on foreground subspace provided by the present application, the target classification training loss function of the target detection model is determined based on the following steps:

[0027] Determining a category loss function of the target detection model based on a conditional probability that the sample foreground target belongs to a real category and a conditional probability that the sample foreground target does not belong to a non-real category;

[0028] Determining a prototype loss function of the object detection model based on a minimum distance between the projection coordinates of the sample foreground object and the corresponding prototype in the real category in the foreground subspace;

[0029] Based on the category loss function and the prototype loss function, a target classification training loss function of the target detection model is determined.

[0030] In a second aspect, the present application provides an open set target detection device based on foreground subspace, comprising:

[0031] An acquisition unit, used for acquiring an image to be detected;

[0032] A detection unit, used for inputting the image to be detected into a target detection model, and obtaining a predicted position and a predicted category of a foreground target corresponding to the image to be detected output by the target detection model;

[0033] Among them, the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category.

[0034] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the foreground subspace-based open set target detection method when executing the program.

[0035] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the open set target detection method based on foreground subspace. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

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

[0038] Figure 1One of the flowcharts of the open set object detection method based on foreground subspace provided in this application;

[0039] Figure 2 It is a structural diagram of the target detection model provided in this application;

[0040] Figure 3 The second flowchart of the open set target detection method based on foreground subspace provided in this application;

[0041] Figure 4 It is a structural schematic diagram of an open set target detection device based on foreground subspace provided by the present application;

[0042] Figure 5 It is a structural schematic diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0044] It should be noted that the terms "including" and "having" and any variations thereof in this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0045] Figure 1 One of the flow charts of the open set target detection method based on foreground subspace provided in this application is as follows: Figure 1 As shown, the method includes:

[0046] Step 110: Acquire an image to be detected.

[0047] Specifically, the execution subject of the open set target detection method based on foreground subspace provided in the embodiment of the present application is an open set target detection device. The device can be a hardware device independently set in the terminal, or it can be a software program running in the terminal. The terminal can include a mobile terminal, a server, a tablet computer, a computer, etc.

[0048] The image to be detected is an image containing a foreground target. For example, the foreground target can be monitored, and each frame of the image in the acquired video is used as the image to be detected.

[0049] The foreground target is the target to be detected in the image to be detected. For example, the image to be detected may be an image of road monitoring, and pedestrians or vehicles in the image are the foreground targets to be detected, while other objects in the image should be regarded as the background of the image.

[0050] Step 120: input the image to be detected into the target detection model, and obtain the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model; wherein the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category.

[0051] Specifically, a neural network model can be used as an initial model, and a target detection model can be obtained after training. The image to be detected is input into the target detection model, and the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model are obtained. The predicted position is the predicted result of the pixel position corresponding to the foreground target in the image to be detected, and the predicted category is the predicted result of the category corresponding to the foreground target.

[0052] For example, different types of vehicles in a road monitoring image are used as foreground targets to be detected. The road monitoring image can be used as the image to be detected and input into the target detection model, and the target detection model outputs the vehicles in the road monitoring image, the position of each vehicle in the road monitoring image, and the vehicle category corresponding to each vehicle. For example, two vehicles are detected, one of which is located in the upper left corner of the road monitoring image and the corresponding category of the vehicle is a car, and the other is located in the lower right corner of the road monitoring image and the corresponding category of the vehicle is a truck.

[0053] The known categories are known target categories, such as car categories, truck categories, and bus categories. The prototype is a representative of the feature representation corresponding to the foreground target of the known category. For example, there can be multiple specific cars under the car category, and one or more prototypes can be used to represent these specific objects belonging to the car category. Specifically, it can be: obtain multiple images containing specific car targets, use the target detection model to extract features from these images, and obtain the feature representation of these cars in the category recognition layer. In the feature space, one or more learnable feature vectors are used to represent the distribution of car samples in the feature space, which is the prototype of the category, which can abstractly represent the common features of car samples.

[0054] Accordingly, the unknown category is an unknown foreground target category. For example, a special vehicle that appears in a road monitoring image is a foreground target, but does not belong to the car category, truck category, or bus category, and can be classified as an unknown category.

[0055] Based on the assumption that "the features of foreground targets should have a certain correlation", the prototype features corresponding to the current known categories can be used to generate a foreground subspace, and then the foreground subspace can be used to judge each candidate target in the image to be detected to determine whether it belongs to a foreground target.

[0056] The method for constructing the foreground subspace can be: first determine multiple known categories that the foreground target in the image to be detected may belong to, and then collect images containing targets of these known categories; after these images are input into the target detection model, the prototype features of each category are obtained in the category recognition layer, and the foreground subspace is constructed based on these prototype features.

[0057] After the image to be detected is input into the target detection model, the target detection model can extract features from the image to be detected, determine multiple candidate targets, and the image features of each candidate target. The candidate target may be a foreground target that needs to be detected, or it may not be a foreground target.

[0058] The object detection model can determine whether each candidate object is a foreground object based on the distance between the image features of each candidate object and the foreground subspace. For example, the smaller the distance, the greater the possibility that the candidate object is a foreground object; the larger the distance, the less likely the candidate object is to be a foreground object.

[0059] After determining the foreground target, the target detection model compares the similarity between the foreground target and the prototype corresponding to the known category. This can be achieved by comparing the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace. The smaller the distance, the higher the similarity, and the more likely the foreground target and the prototype corresponding to the known category belong to the same category; the larger the distance, the lower the similarity, and the more likely the foreground target and the prototype corresponding to the known category belong to different categories. Based on the above principle, the predicted category of the foreground target can be determined.

[0060] The open set target detection method based on foreground subspace provided in the embodiment of the present application obtains the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model by inputting the image to be detected into the target detection model; the target detection model determines the foreground target according to the distance between the image features of each candidate target in the image to be detected and the foreground subspace, and determines the predicted category of the foreground target according to the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace. Since the foreground subspace is constructed according to the prototype features corresponding to the known category, it can not only detect the foreground targets belonging to the known category, but also detect the foreground targets that do not belong to the known category, thereby improving the accuracy of foreground target detection.

[0061] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.

[0062] In some embodiments, step 120 includes:

[0063] The image to be detected is input into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer determines a plurality of feature maps of different scales corresponding to the image to be detected based on different feature extraction scales;

[0064] Inputting multiple feature maps of different scales into the candidate target recognition layer of the target detection model, and obtaining the image features and position features of the candidate targets corresponding to the image to be detected output by the candidate target recognition layer;

[0065] The image features of the candidate target are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace;

[0066] The image features of the foreground target are input into the category recognition layer of the target detection model, which determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, and determines the predicted position of the foreground target based on the position features of the foreground target.

[0067] Specifically, Figure 2 It is a schematic diagram of the structure of the target detection model provided in this application, such as Figure 2 As shown, the target detection model includes a multi-scale feature extraction layer 210, a candidate target recognition layer 220, a foreground target recognition layer 230 and a category recognition layer 240 which are connected in sequence.

[0068] The image to be detected is input into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer extracts features of the image to be detected from different feature extraction scales to obtain feature maps of multiple different scales corresponding to the image to be detected.

[0069] The feature maps of multiple different scales are input into the candidate target recognition layer of the target detection model, and the candidate target recognition layer recognizes the feature maps of multiple different scales to obtain candidate targets, as well as image features and position features of the candidate targets.

[0070] The image features of the candidate target are input into the foreground target recognition layer of the target detection model. The foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace, and determines whether the candidate target belongs to the foreground target, that is, the foreground target corresponding to the image to be detected, based on the distance.

[0071] The image features of the foreground target are input into the category recognition layer of the target detection model, which determines the projection coordinates of the foreground target in the foreground subspace and the projection coordinates of the prototype corresponding to the known category in the foreground subspace. The predicted category of the foreground target is determined based on the distance between these projection coordinates, and the predicted position of the foreground target is determined based on the position features of the foreground target.

[0072] The open set target detection method based on foreground subspace provided in the embodiment of the present application realizes cross-scale semantic information association of features by extracting multi-scale features and classifying targets based on foreground subspace, thereby utilizing a uniformly constructed category recognition layer, so that target detection can better adapt to changes in target scale.

[0073] In some embodiments, the image features of the candidate targets are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of each candidate target and the foreground subspace, including:

[0074] The image features of the candidate target are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace based on the minimum distance between the image features of the candidate target and any vector in the foreground subspace;

[0075] When the distance between the image feature of the candidate target and the foreground subspace is less than or equal to the foreground determination threshold, the candidate target is determined as the foreground target corresponding to the image to be detected.

[0076] Specifically, the candidate target recognition layer outputs the image features and position features of each candidate target. The image features of candidate target X can be expressed as f(X), in is a real number set, l is the feature dimension. The position feature can be expressed as the offset of the bounding box corresponding to the candidate target (t x ,t y ,t w ,t h ) is expressed as follows. x It is used to indicate the offset of the center of the bounding box corresponding to the candidate target relative to the upper left corner of the network unit where the prediction box is located along the image to be detected in the X direction, t y It is used to indicate the offset of the center of the bounding box corresponding to the candidate target relative to the upper left corner of the network unit where the prediction box is located along the Y direction of the image to be detected, t w Used to represent the width of the bounding box corresponding to the candidate target, t h Used to represent the height of the bounding box corresponding to the candidate object.

[0077] The image features of the candidate target are input into the foreground target recognition layer of the target detection model. The foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace based on the minimum distance between the image features of the candidate target and any vector in the foreground subspace. For example, the image feature f(X) of the candidate target X and the foreground subspace The distance between them is defined as the foreground subspace The square of the minimum Euclidean distance between any vector z and f(X) in the feature space is expressed as:

[0078]

[0079] in, is the image feature f(X) of the candidate target X and the foreground subspace The distance between.

[0080] In selecting a suitable foreground judgment threshold T F Later, the distance can be used to determine whether the candidate target is a foreground. When , the candidate target X is determined as the foreground target corresponding to the image to be detected, otherwise it is determined as the background and discarded directly.

[0081] The judgment principle of the foreground target is as follows: the foreground target has a certain similarity. When the image feature f(X) of any candidate target X is in the foreground subspace When the distance is close, the image feature f(X) of any candidate target X can be linearly reconstructed by the prototype feature of the known category, so it is considered to have a high similarity with the prototype of the known category and is regarded as a foreground target; otherwise, it is considered to be dissimilar to the prototype of the known category and is regarded as the background.

[0082] In some embodiments, the image features of the foreground object are input to the category recognition layer of the object detection model, and the category recognition layer determines the predicted category of the foreground object based on the distance between the projection coordinates of the foreground object and the prototype corresponding to the known category in the foreground subspace, including:

[0083] The image features of the foreground target are input into the category recognition layer of the target detection model, and the category recognition layer determines the projection coordinates of the foreground target in the foreground subspace based on the image features of the foreground target, and determines the projection coordinates of the prototype corresponding to each known category in the foreground subspace based on the prototype features corresponding to each known category;

[0084] Based on the projection coordinates of the foreground object and the projection coordinates of each prototype, the distance between the foreground object and each prototype is determined;

[0085] When the distance between the foreground target and any prototype is less than or equal to the category determination threshold, the known category corresponding to any prototype is determined as the predicted category of the foreground target;

[0086] When the distances between the foreground object and each prototype are greater than the category determination threshold, the predicted category of the foreground object is determined as an unknown category.

[0087] Specifically, considering that the information related to the foreground target category discrimination mainly exists in the foreground subspace, the category recognition layer determines the projection coordinates of the foreground target in the foreground subspace according to the image features of the foreground target, which can be expressed as:

[0088]

[0089] Among them, X is the foreground target determined from the candidate targets, f(X) is the image feature of the foreground target X, T is the transposition operator, k is the feature dimension of the foreground subspace, is the projection coordinate of the foreground target X in the foreground subspace, and U is the unit orthogonal basis set of the foreground subspace, that is, where u i is the i-th basis vector in the foreground subspace, i∈[1,k], and

[0090] Using a similar method, the category recognition layer can determine the projection coordinates of the prototypes corresponding to each known category in the foreground subspace. For example, the jth prototype corresponding to the i-th known category is projected into the foreground subspace to obtain the projection coordinates of the prototype.

[0091] In the foreground subspace, the probability that a foreground object X belongs to a known category is determined by the similarity between the foreground object X and the prototype in the known category, and the similarity depends on the distance between their projected coordinates, which can be expressed as:

[0092]

[0093] in, is the Euclidean distance between the foreground object X and the jth prototype corresponding to the i-th known category in the foreground subspace.

[0094] When the distance between the foreground target and any prototype is less than or equal to the category determination threshold, the known category corresponding to the prototype is determined as the predicted category of the foreground target; when the distance between the foreground target and each prototype is greater than the category determination threshold, the predicted category of the foreground target is determined as an unknown category.

[0095] For example, in order to determine the predicted category of the foreground object, first find the prototype (closest prototype) with the smallest projection distance to the foreground object in the foreground subspace, which can be expressed as:

[0096]

[0097] Among them, the prototype with the smallest projection distance (the closest prototype) is the i-th * j-th known category * A prototype.

[0098] Then, based on the distance, the foreground object is judged to belong to a known category or an unknown category. When the distance between the foreground object and the nearest prototype is not greater than the category judgment threshold T dis , it is determined to belong to the known category corresponding to the nearest prototype, otherwise it is an unknown category. It can be expressed as:

[0099]

[0100] In the formula, y * is the predicted category of the foreground object.

[0101] In some embodiments, the multi-scale feature extraction layer is constructed based on a feature pyramid network.

[0102] Specifically, the multi-scale feature extraction layer can be constructed using a feature pyramid network.

[0103] A multi-scale feature extraction layer can be constructed based on the feature extraction and feature fusion parts of the YOLO series detection algorithms. For example, when the YOLOx-DarkNet53 algorithm is selected, the DarkNet53 network is used as the backbone network to extract features from the image to be detected, and then the spatial pyramid pooling structure (SPP) is used to convert feature maps of any size into feature vectors of fixed size to adapt to images of different sizes, and then the feature pyramid network (FPN) is used to fuse features of different scales to obtain three fused feature maps of different scales.

[0104] Correspondingly, the candidate target recognition layer can also be constructed according to the YOLO series detection algorithm.

[0105] The detection head of the YOLO series detection algorithm generally generates predictions about candidate targets through a multi-layer neural network, including category conditional probability, foreground target score, and target bounding box offset, of which the former uses sigmoid output in the last layer. Based on the original detection head, the present application can delete the foreground target score prediction, retain the original target bounding box offset prediction, and delete the sigmoid layer used for category conditional probability prediction and the previous layer, and replace them with an l-dimensional feature representation in the foreground subspace to obtain a candidate target recognition layer. The candidate target recognition layer outputs the image features and position features of the candidate target. Image features can be represented by l-dimensional features, and position features can be represented by the offset of a 4-dimensional bounding box.

[0106] The open set target detection method based on foreground subspace provided in the embodiment of the present application can unify image features of multiple scales, so that target detection can better adapt to changes in target scale.

[0107] In some embodiments, the foreground subspace is constructed based on the following steps:

[0108] Obtain prototype features corresponding to multiple known categories;

[0109] Perform principal component analysis on the prototype features corresponding to each known category to determine multiple principal component feature vectors;

[0110] Based on multiple principal component eigenvectors, a foreground subspace is constructed.

[0111] Specifically, the number of known categories is C, and each known category contains n prototypes, then all prototypes can be recorded as Where i∈1,2,…,C represents the known category index, and j∈1,2,…,n represents the prototype index of each known category. Here, it can be assumed that all categories use the same number of prototypes, but in practice each known category can use a different number of prototypes.

[0112] Each prototype feature can be determined, and the principal component analysis (PCA) can be performed on the prototype features corresponding to all known categories. The principal component eigenvectors corresponding to the first k largest eigenvalues ​​are taken.

[0113] Taking each principal component eigenvector as the basis vector, the foreground subspace is constructed and expressed as:

[0114]

[0115] Among them, α i is the linear coefficient.

[0116] In some embodiments, the target classification training loss function of the target detection model is determined based on the following steps:

[0117] Determine the category loss function of the target detection model based on the conditional probability that the sample foreground target belongs to the real category and the conditional probability that the sample foreground target does not belong to the non-real category;

[0118] Determine the prototype loss function of the target detection model based on the minimum distance between the projection coordinates of the sample foreground target and the corresponding prototype in the real category in the foreground subspace;

[0119] Based on the category loss function and the prototype loss function, the target classification training loss function of the target detection model is determined.

[0120] Specifically, a one-to-many training method can be used for the target detection model to improve the ability to distinguish targets of unknown categories. By defining a reasonable loss function to measure the difference between the current output and the expected output, the gradient is calculated and continuously propagated upward to correct and adjust the network parameters.

[0121] In order to improve the detection ability of the target detection model for foreground targets of unknown categories, the target classification training loss function of the target detection model can include two parts: the category loss function and the prototype loss function: one-to-many category loss (OVALoss) constructed according to the category information of the training samples, and the prototype loss (Prototype Loss) constructed according to the distribution relationship between the prototype and the training samples. The loss function is constructed based on the prediction box training samples, which are generated by predicting the images in the training set input into the target detection model. Each prediction box corresponds to a candidate target image in the image, and it is matched with the real target box in the image. The category of the corresponding real target box is the real category of the candidate target in the prediction box.

[0122] The model parameters in the target detection model can be obtained by minimizing the target classification training loss function on a set of image samples containing foreground targets of known categories.

[0123] The target classification training loss function of the target detection model can be expressed as:

[0124]

[0125] In the formula, Training loss function for target classification, is a one-to-many category loss function, is the prototype loss function, and λ is the weight adjustment parameter. (X, y) is a prediction box training sample, which is generated by inputting the image in the training set into the target detection model for prediction, where X represents the candidate target corresponding to the prediction box, and y represents the real target box category matching the prediction box. The set of prediction box training samples generated by all training images is recorded as and is the projection coordinate of the candidate target image feature corresponding to the prediction box in the foreground subspace, θ is the network parameter to be learned, Represents the set of prototypes of all known categories, and c is any category other than the true category y.

[0126] For one-to-many category loss function L ova , which makes the distribution of the prototype match the category of the training data. The p(y=i|X) in this loss is the conditional probability that the sample foreground target belongs to the corresponding category i, which is calculated by the distance between the features of the sample foreground target and the prototype.

[0127] In the one-to-many category loss, C two-category classifiers h are defined i (X):

[0128]

[0129] Where r is the comparison threshold.

[0130] For a sample foreground object X belonging to the yth class, it should be judged as a positive class by the classifier of the yth class, and as a negative class by the classifiers of other classes:

[0131]

[0132] Therefore, the output of the classifier can be used to calculate the conditional probability that the sample foreground target belongs to category i:

[0133]

[0134] Where ξ is a hyperparameter and σ represents the function transformation.

[0135] Then p(y|X) is the conditional probability that the sample foreground target belongs to the real category, and 1-p(c|X) is the conditional probability that the sample foreground target does not belong to the non-real category. According to the definition of the cross entropy loss function, the category loss function of the prediction box training sample (X, y) can be obtained:

[0136]

[0137] For the prototype loss function L pl Although the use of distance-based cross entropy loss can make the model converge and correctly classify, it is difficult to make the sample features of the same category compact in space by only using distance-based cross entropy loss to optimize the model. Therefore, this application also introduces prototype loss during the training process, which forces each sample feature to be close to its prototype of the same category, as shown in the following formula, where y is the real known category of sample X, and j is * Then it is the prototype label closest to the sample in this category:

[0138]

[0139]

[0140] In the formula, Represents the prototype with the smallest distance to the true known category y corresponding to sample X.

[0141] The open set target detection method based on foreground subspace provided in the embodiment of the present application uses a one-to-many training method, and the target classification training loss function includes both category loss and prototype loss, so that the training of the target detection model can not only correctly classify, but also better focus on the difference between the target and the prototype in each category, thereby improving the ability to judge targets of unknown categories.

[0142] Figure 3 The second flowchart of the open set target detection method based on foreground subspace provided in this application is as follows: Figure 3 As shown, the method includes:

[0143] Step S1: Build the basic architecture of the algorithm based on the YOLO target detection algorithm

[0144] The basic architecture of this algorithm can be built using any version of the YOLO target detection algorithm, retaining the feature extraction and feature fusion parts. Taking Yolox-DarkNet53 as an example, the DarkNet53 network in the original framework is retained as the backbone network for feature extraction, and the spatial pyramid pooling structure (SPP) is used to convert feature maps of any size into feature vectors of fixed size, and then the feature pyramid network (FPN) is used to fuse features of different scales to obtain the fused feature map.

[0145] Step S2: Construct foreground subspace

[0146] Obtain multiple known categories and the prototypes corresponding to each known category. Perform principal component analysis (PCA) on each prototype of the prototype classifier in the detection head, and take the principal component directions of the corresponding multiple maximum eigenvalues. The multidimensional subspace spanned by them is the foreground subspace.

[0147] Step S3: Target detection and unknown target discovery

[0148] The fused feature maps of three different scales are sent to the same detection head, and the features at each scale are decoded to obtain the prediction results of the target position and type in the image.

[0149] This step is specifically divided into:

[0150] Step S3.1: Use the shared Conv (convolutional layer) + BN (normalization layer) + ReLu (activation function layer) module to adjust the input feature map.

[0151] Step S3.2, input the adjusted feature map into two decoupled prediction branches, where the classification prediction branch predicts the l-dimensional feature representation of the candidate target image in the prototype space through two Conv+BN+ReLu modules, and the position prediction branch predicts the offset of the target bounding box through two Conv+BN+ReLu modules and one 1×1 convolution.

[0152] Step S3.3, decode the prediction values ​​of the candidate targets in sequence (the prediction value dimension corresponding to each prediction box is l+4).

[0153] Step S3.3.1: Based on the bounding box offset (t x ,t y ) Calculate the center coordinates of the prediction box (b x ,b y ):

[0154] b x =c x +t x

[0155] by =c y +t y

[0156] Where (c x ,c y ) is the coordinate of the upper left corner of the network unit where the prediction box is located.

[0157] Step S3.3.2: Based on the bounding box offset (t w ,t h ) Calculate the width and height of the edge prediction box (b w ,b h ):

[0158]

[0159]

[0160] Step S3.3.3, calculate the distance from the candidate target feature to the foreground subspace. Determine whether the candidate target is the foreground according to the foreground determination threshold: when the distance is less than or equal to the foreground determination threshold, determine that the candidate target image contained in the prediction box is the foreground and identify the category, otherwise determine that it is the background and directly discard it.

[0161] Step S3.3.4: Project the features of the candidate target determined to be the foreground into the foreground subspace, and determine the projection coordinates of the candidate target.

[0162] Step S3.3.5, project all prototypes into the foreground subspace and record their projection coordinates.

[0163] Step S3.3.6: In the foreground subspace, calculate the Euclidean distance between the projection coordinates of the candidate target and the projection coordinates of all category prototypes. First find the prototype with the smallest distance, and then judge whether the target in the frame belongs to a known category or an unknown category based on the distance. When the distance between it and the nearest prototype is not greater than the category judgment threshold, it is judged to belong to the known category corresponding to the nearest prototype, otherwise it is an unknown category.

[0164] (1) This application proposes an open set target detection algorithm based on the YOLO series target detection algorithm, which can not only detect foreground targets of predetermined categories from the input image, but also actively identify foreground targets of unknown categories that appear as the environment changes.

[0165] (2) This application embeds a prototype classifier in the detection head and uses it to integrate the foreground discrimination mechanism and the open set object classification mechanism into the same framework to achieve the ability of open set object detection.

[0166] (3) This application uses the prototype vector of the known target category to construct the foreground subspace, and implements the foreground target discrimination mechanism based on the distance from the image features of the candidate target to the foreground subspace.

[0167] (4) This application projects the target candidate image features into the foreground subspace, determines the target category based on the distance between its features and the prototypes of each category, and realizes open set target recognition.

[0168] (5) This application combines the feature pyramid structure with the prototype classifier to achieve the fusion of multi-scale features in the target classifier, and uses a unified prototype space to realize the cross-scale semantic information association of features, so that detection can better adapt to the changes in target scale.

[0169] (6) This application uses a "one-to-many" approach to train the detection model, so that it can better focus on the characteristics of each category during the learning process and improve the ability to distinguish targets of unknown categories.

[0170] Based on the methods in some of the above embodiments, the present application also provides a device.

[0171] Figure 4 is a schematic diagram of the structure of an open set target detection device based on foreground subspace provided by the present application, such as Figure 4 As shown, the device comprises:

[0172] An acquisition unit 410 is used to acquire an image to be detected;

[0173] The detection unit 420 is used to input the image to be detected into the target detection model to obtain the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model;

[0174] Among them, the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category.

[0175] The open set target detection device based on foreground subspace provided in the embodiment of the present application obtains the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model by inputting the image to be detected into the target detection model; the target detection model determines the foreground target according to the distance between the image features of each candidate target in the image to be detected and the foreground subspace, and determines the predicted category of the foreground target according to the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace. Since the foreground subspace is constructed according to the prototype features corresponding to the known category, it can not only detect the foreground target belonging to the known category, but also detect the foreground target that does not belong to the known category, thereby improving the accuracy of foreground target detection.

[0176] In some embodiments, the detection unit is specifically used for:

[0177] The image to be detected is input into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer determines a plurality of feature maps of different scales corresponding to the image to be detected based on different feature extraction scales;

[0178] Inputting multiple feature maps of different scales into the candidate target recognition layer of the target detection model, and obtaining the image features and position features of the candidate targets corresponding to the image to be detected output by the candidate target recognition layer;

[0179] The image features of the candidate target are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace;

[0180] The image features of the foreground target are input into the category recognition layer of the target detection model, which determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, and determines the predicted position of the foreground target based on the position features of the foreground target.

[0181] In some embodiments, the detection unit is specifically used for:

[0182] The image features of the candidate target are input into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace based on the minimum distance between the image features of the candidate target and any vector in the foreground subspace;

[0183] When the distance between the image feature of the candidate target and the foreground subspace is less than or equal to the foreground determination threshold, the candidate target is determined as the foreground target corresponding to the image to be detected.

[0184] In some embodiments, the detection unit is specifically used for:

[0185] The image features of the foreground target are input into the category recognition layer of the target detection model, and the category recognition layer determines the projection coordinates of the foreground target in the foreground subspace based on the image features of the foreground target, and determines the projection coordinates of the prototype corresponding to each known category in the foreground subspace based on the prototype features corresponding to each known category;

[0186] Based on the projection coordinates of the foreground object and the projection coordinates of each prototype, the distance between the foreground object and each prototype is determined;

[0187] When the distance between the foreground target and any prototype is less than or equal to the category determination threshold, the known category corresponding to any prototype is determined as the predicted category of the foreground target;

[0188] When the distances between the foreground object and each prototype are greater than the category determination threshold, the predicted category of the foreground object is determined as an unknown category.

[0189] In some embodiments, the multi-scale feature extraction layer is constructed based on a feature pyramid network.

[0190] In some embodiments, the apparatus further comprises:

[0191] A construction unit for obtaining prototype features corresponding to multiple known categories;

[0192] Perform principal component analysis on the prototype features corresponding to each known category to determine multiple principal component feature vectors;

[0193] Based on multiple principal component eigenvectors, a foreground subspace is constructed.

[0194] In some embodiments, the apparatus further comprises:

[0195] A determination unit, used to determine a category loss function of the target detection model based on a conditional probability that the sample foreground target belongs to a real category and a conditional probability that the sample foreground target does not belong to a non-real category;

[0196] Determine the prototype loss function of the target detection model based on the minimum distance between the projection coordinates of the sample foreground target and the corresponding prototype in the real category in the foreground subspace;

[0197] Based on the category loss function and the prototype loss function, the target classification training loss function of the target detection model is determined.

[0198] In some embodiments, Figure 5 A schematic diagram of the structure of the electronic device provided in this application, such as Figure 5As shown, the electronic device may include: a processor (Processor) 510, a communication interface (Communications Interface) 520, a memory (Memory) 530 and a communication bus (Communications Bus) 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic command in the memory 530 to execute the following method:

[0199] Acquire an image to be detected; input the image to be detected into a target detection model to obtain the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model; wherein the target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category.

[0200] In addition, the logic commands in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several commands to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0201] The processor in the electronic device provided in the embodiment of the present application can call the logic instructions in the memory to implement the above method. Its specific implementation method is consistent with the implementation method of the aforementioned method and can achieve the same beneficial effects, which will not be repeated here.

[0202] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the methods provided in the above embodiments are implemented.

[0203] Its specific implementation is consistent with the aforementioned method implementation and can achieve the same beneficial effects, so it will not be repeated here.

[0204] An embodiment of the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0205] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0206] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0207] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An open set object detection method based on foreground subspace, characterized in that: include: Acquire the image to be detected; Inputting the image to be detected into a target detection model to obtain a predicted position and a predicted category of a foreground target corresponding to the image to be detected output by the target detection model; The target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category; The step of inputting the image to be detected into the target detection model to obtain the predicted position and predicted category of the foreground target corresponding to the image to be detected output by the target detection model includes: Inputting the image to be detected into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer determines a plurality of feature maps of different scales corresponding to the image to be detected based on different feature extraction scales; Inputting the multiple feature maps of different scales into the candidate target recognition layer of the target detection model to obtain image features and position features of the candidate targets corresponding to the image to be detected output by the candidate target recognition layer; Inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace; Inputting the image features of the foreground target into the category recognition layer of the target detection model, the category recognition layer determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, and determines the predicted position of the foreground target based on the position features of the foreground target; The foreground subspace is constructed based on the following steps: Obtain prototype features corresponding to multiple known categories; Perform principal component analysis on the prototype features corresponding to the known categories to determine multiple principal component feature vectors; The foreground subspace is constructed based on the multiple principal component eigenvectors.

2. The open set target detection method based on foreground subspace according to claim 1, characterized in that: The step of inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and determining the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace by the foreground target recognition layer, comprises: Inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the distance between the image features of the candidate target and the foreground subspace based on the minimum distance between the image features of the candidate target and any vector in the foreground subspace; When the distance between the image feature of the candidate target and the foreground subspace is less than or equal to the foreground determination threshold, the candidate target is determined as the foreground target corresponding to the image to be detected.

3. The open set target detection method based on foreground subspace according to claim 1, characterized in that: The step of inputting the image features of the foreground target into the category recognition layer of the target detection model, and determining the predicted category of the foreground target by the category recognition layer based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, comprises: Inputting the image features of the foreground target into the category recognition layer of the target detection model, the category recognition layer determines the projection coordinates of the foreground target in the foreground subspace based on the image features of the foreground target, and determines the projection coordinates of the prototypes corresponding to each known category in the foreground subspace based on the prototype features corresponding to each known category; Based on the projection coordinates of the foreground object and the projection coordinates of each prototype, determining the distance between the foreground object and each prototype; When the distance between the foreground object and any prototype is less than or equal to the category determination threshold, determining the known category corresponding to any prototype as the predicted category of the foreground object; When the distances between the foreground object and each prototype are greater than the category determination threshold, the predicted category of the foreground object is determined as an unknown category.

4. The open set target detection method based on foreground subspace according to claim 1, characterized in that: The multi-scale feature extraction layer is constructed based on a feature pyramid network.

5. The open set target detection method based on foreground subspace according to any one of claims 1 to 4, characterized in that: The target classification training loss function of the target detection model is determined based on the following steps: Determining a category loss function of the target detection model based on a conditional probability that the sample foreground target belongs to a real category and a conditional probability that the sample foreground target does not belong to a non-real category; Determining a prototype loss function of the object detection model based on a minimum distance between the projection coordinates of the sample foreground object and the corresponding prototype in the real category in the foreground subspace; Based on the category loss function and the prototype loss function, a target classification training loss function of the target detection model is determined.

6. An open set target detection device based on foreground subspace, characterized in that: include: An acquisition unit, used for acquiring an image to be detected; A detection unit, used for inputting the image to be detected into a target detection model, and obtaining a predicted position and a predicted category of a foreground target corresponding to the image to be detected output by the target detection model; The target detection model is used to determine the foreground target based on the distance between the image features of the candidate target in the image to be detected and the foreground subspace, and to determine the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace; the foreground subspace is constructed based on the prototype features corresponding to the known category; The detection unit is specifically used for: Inputting the image to be detected into the multi-scale feature extraction layer of the target detection model, and the multi-scale feature extraction layer determines a plurality of feature maps of different scales corresponding to the image to be detected based on different feature extraction scales; Inputting the multiple feature maps of different scales into the candidate target recognition layer of the target detection model to obtain image features and position features of the candidate targets corresponding to the image to be detected output by the candidate target recognition layer; Inputting the image features of the candidate target into the foreground target recognition layer of the target detection model, and the foreground target recognition layer determines the foreground target corresponding to the image to be detected based on the distance between the image features of the candidate target and the foreground subspace; Inputting the image features of the foreground target into the category recognition layer of the target detection model, the category recognition layer determines the predicted category of the foreground target based on the distance between the projection coordinates of the foreground target and the prototype corresponding to the known category in the foreground subspace, and determines the predicted position of the foreground target based on the position features of the foreground target; The device also includes: A construction unit for obtaining prototype features corresponding to multiple known categories; Perform principal component analysis on the prototype features corresponding to the known categories to determine multiple principal component feature vectors; The foreground subspace is constructed based on the multiple principal component eigenvectors.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the open set target detection method based on foreground subspace according to any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the open set target detection method based on foreground subspace according to any one of claims 1 to 5 is implemented.