Small sample target detection method and device based on explicit marginal equilibrium
By calculating the average feature vector of the basic target class and the explicit marginal equilibrium loss, the inherent contradiction between discrimination and representation in small sample target detection is resolved, thereby improving the detection accuracy and generalization ability of the model.
Patent Information
- Application Number
- CN202410835951.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2044-06-26
AI Technical Summary
Existing technologies lack appropriate marginal constraints, making it difficult to alleviate the inherent contradiction between model discrimination and representation, resulting in poor target detection performance in small samples.
By calculating the average feature vector of each basic target class, the maximum marginal loss and the loss function during the training phase are determined. An expanded target class is constructed and the class coefficient vector is calculated. The model's discrimination and representation balance are improved by using explicit marginal equilibrium loss and instance perturbation fine-tuning detector.
It effectively improves the model's detection accuracy and generalization ability on new target categories, resolves the inherent contradiction between discrimination and representation, and achieves better detection results.
Smart Images

Figure CN118864923B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of small sample target detection technology, and in particular to a small sample target detection method and apparatus based on explicit marginal equilibrium. Background Technology
[0002] Object detection is a long-standing research hotspot in computer vision, possessing significant academic and industrial value, and has achieved substantial progress on labeled, large-scale datasets. However, state-of-the-art object detectors are still far from being able to quickly adapt to scenarios with scarce data, such as identifying rare species, novel military targets, and uncommon events. Therefore, researchers in this field have proposed the Few-Shot Object Detection (FSOD) framework. This framework, through a two-step paradigm of base class training and balancing fine-tuning, transfers relevant knowledge from a well-labeled base object class (i.e., the base class) to a new object class (i.e., the new class) with limited samples, effectively improving detection accuracy on new object categories when data volume is limited.
[0003] Given that there is sufficient labeled data for base classes but limited labeled data for new classes, a common approach for FSOD to address extreme data scarcity is to adopt a two-step learning paradigm, namely, base class training (representation learning) and balancing fine-tuning (new class adaptation), as described below. The implicit assumption is that the representations of the base classes are sufficient to facilitate the extraction of representations for the new classes. A typical two-step learning paradigm is as follows: given an object detection dataset containing a sufficient number of labeled base classes and a new class with only a small number of labeled samples, the model is trained to detect objects of both the base class and the new class simultaneously.
[0004] 1) Base class training: The model is trained only on a dataset containing base classes with sufficient annotations;
[0005] 2) Balanced fine-tuning: During the fine-tuning process, the new class data adopts the N-way-K-shot setting, that is, there are N new classes, and each class contains K labeled targets; to avoid overfitting, K samples from each base class are also added for new class detection adaptation. These new class samples and base class samples constitute the fine-tuning dataset.
[0006] After training, the model is evaluated on a test set containing both the new class and the base class using the following formula:
[0007]
[0008] However, for FSOD, the inherent contradiction between the model's discrimination and representation is as follows:
[0009] 1. Improving discriminative ability but impairing representation ability (excessive margin): In order to improve discriminative ability, the margin between base classes needs to be more significant so that samples of the same class can be aligned in the feature space; however, since FSOD uses the distribution of base classes to represent the distribution of new classes, significant margin between base classes will impair the representation of new classes and reduce the generalization ability of the model.
[0010] 2. Improving representational ability impairs discriminative ability (too small margins): In order to improve representational ability, that is, to accurately describe the feature distribution of new classes, the margins between base classes should be small enough to facilitate rapid knowledge transfer; however, this limits the distinguishability of representations of different categories.
[0011] Furthermore, existing technologies lack appropriate marginal constraints, and existing few-shot learning techniques (including few-shot object detection and few-shot classification) lack effective utilization of class relationships, which limits the final learning effect.
[0012] In summary, existing technologies lack appropriate marginal constraints, making it difficult to alleviate the inherent contradiction between model discrimination and representation, which urgently needs to be addressed. Summary of the Invention
[0013] This application provides a small-sample target detection method and apparatus based on explicit marginal equilibrium to solve the problems of existing technologies lacking appropriate marginal constraints and making it difficult to alleviate the inherent contradiction between model discrimination and representation.
[0014] The first aspect of this application provides a small-sample target detection method based on explicit marginal equilibrium, comprising the following steps: calculating the average feature vector of all sample instances corresponding to each basic target class, determining the maximum marginal loss and a training phase loss function based on the average feature vector, and training a preset detector using the training phase loss function to generate an initial detector; constructing an extended target class based on the basic target class and a preset new target class, determining the category coefficient vector corresponding to the extended target class, and calculating a category equilibrium coefficient based on the category coefficient vector to extend the maximum marginal loss using the category equilibrium coefficient to obtain an explicit marginal equilibrium loss; calculating the gradient map of each sample instance, determining the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tuning the initial detector using the explicit marginal equilibrium loss and the instance perturbation to obtain a fine-tuned initial detector, and using the fine-tuned initial detector for target detection operations.
[0015] Optionally, in one embodiment of this application, the method further includes: obtaining the base class statistics of the base target class, and calculating the new class statistics based on the base class statistics and the class balance coefficient; calculating the instance feature gradient of each sample instance, and perturbing each sample instance based on the instance feature gradient, a preset feature gradient threshold, and a perturbation strategy to generate a perturbed instance; constructing an instance set corresponding to the new class statistics based on the new class statistics and the perturbed instances, and training a preset classifier using the instance set and a preset classification loss function to perform target classification operations using the trained classifier.
[0016] Optionally, in one embodiment of this application, the step of calculating the average feature vector of all sample instances corresponding to each basic target class, and determining the maximum marginal loss and the training stage loss function based on the average feature vector, includes: sequentially inputting each sample instance of each basic target class into a preset image encoder, RPN network, and RoI network to output the feature vector of each sample instance; calculating the average feature vector of all sample instances corresponding to each basic target class based on the feature vector of each sample instance; calculating the maximum marginal loss using the average feature vector, and determining the training stage loss function based on the maximum marginal loss and a preset initial loss function.
[0017] Optionally, in one embodiment of this application, the step of determining the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tuning the initial detector using the explicit marginal equalization loss and the instance perturbation, includes: comparing the gradient at each pixel position in the gradient map with the preset gradient threshold and obtaining a comparison result to generate the instance perturbation based on the comparison result; and determining a fine-tuning stage loss function using the explicit marginal equalization loss and the preset initial loss function to fine-tune the initial detector using the fine-tuning stage loss function and the instance perturbation.
[0018] Optionally, in one embodiment of this application, the mathematical expression for the maximum marginal loss is:
[0019]
[0020] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N b K represents the number of categories of the basic target class; i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; iThis represents the average feature vector of the i-th basic target class; Let represent the feature vector of the t-th sample instance corresponding to the i-th basic target class.
[0021] Optionally, in one embodiment of this application, the mathematical expression for the explicit marginal equilibrium loss is:
[0022]
[0023] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N represents the number of categories of the extended target class; K i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; This represents the feature vector of the t-th sample instance corresponding to the i-th basic target class; This indicates that it contains the closest μ. i The indices of the M average eigenvectors.
[0024] A second aspect of this application provides a small-sample target detection device based on explicit marginal equilibrium, comprising: a basic training module, configured to calculate the average feature vector of all sample instances corresponding to each basic target class, determine the maximum marginal loss and a training phase loss function based on the average feature vector, and train a preset detector through the training phase loss function to generate an initial detector; an expansion module, configured to construct an expanded target class based on the basic target class and a preset new target class, determine the category coefficient vector corresponding to the expanded target class, and calculate a category equilibrium coefficient based on the category coefficient vector to expand the maximum marginal loss through the category equilibrium coefficient to obtain an explicit marginal equilibrium loss; and a target detection module, configured to calculate the gradient map of each sample instance, determine the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tune the initial detector through the explicit marginal equilibrium loss and the instance perturbation to obtain a fine-tuned initial detector, and perform target detection operations using the fine-tuned initial detector.
[0025] Optionally, in one embodiment of this application, it further includes: an acquisition module, configured to acquire the base class statistics of the base target class, and calculate a new class statistics based on the base class statistics and the class balance coefficient; an interference module, configured to calculate the instance feature gradient of each sample instance, and interfere with each sample instance based on the instance feature gradient, a preset feature gradient threshold, and an interference strategy to generate interference instances; and a classification module, configured to construct an instance set corresponding to the new class statistics based on the new class statistics and the interference instances, and train a preset classifier using the instance set and a preset classification loss function to perform target classification operations using the trained classifier.
[0026] Optionally, in one embodiment of this application, the basic training module includes: an input unit, configured to sequentially input each sample instance of each basic target class into a preset image encoder, an RPN network, and a RoI network to output a feature vector of each sample instance; a calculation unit, configured to calculate the average feature vector of all sample instances corresponding to each basic target class based on the feature vector of each sample instance; and a determination unit, configured to calculate the maximum marginal loss using the average feature vector, and determine the training stage loss function based on the maximum marginal loss and a preset initial loss function.
[0027] Optionally, in one embodiment of this application, the target detection module includes: a comparison unit, configured to compare the gradient of each pixel position in the gradient map with the preset gradient threshold and obtain a comparison result, so as to generate the instance perturbation based on the comparison result; and a fine-tuning unit, configured to determine a fine-tuning stage loss function through the explicit marginal equilibrium loss and the preset initial loss function, so as to fine-tune the initial detector using the fine-tuning stage loss function and the instance perturbation.
[0028] Optionally, in one embodiment of this application, the mathematical expression for the maximum marginal loss is:
[0029]
[0030] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N b K represents the number of categories of the basic target class; i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; Let represent the feature vector of the t-th sample instance corresponding to the i-th basic target class.
[0031] Optionally, in one embodiment of this application, the mathematical expression for the explicit marginal equilibrium loss is:
[0032]
[0033] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N represents the number of categories of the extended target class; K i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; This represents the feature vector of the t-th sample instance corresponding to the i-th basic target class; This indicates that it contains the closest μ. i The indices of the M average eigenvectors.
[0034] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the small sample target detection method based on explicit marginal equilibrium as described in the above embodiments.
[0035] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described small-sample target detection method based on explicit marginal equilibrium.
[0036] Therefore, the embodiments of this application have the following beneficial effects:
[0037] The embodiments of this application can calculate the average feature vector of all sample instances corresponding to each basic target class, determine the maximum marginal loss and the training phase loss function based on the average feature vector, and train a preset detector using the training phase loss function to generate an initial detector; based on the basic target class and the preset new target class, an extended target class is constructed, and the category coefficient vector corresponding to the extended target class is determined; the category balance coefficient is calculated based on the category coefficient vector to extend the maximum marginal loss, resulting in an explicit marginal balance loss; the gradient map of each sample instance is calculated, and the instance perturbation corresponding to each sample instance is determined based on the gradient map and a preset gradient threshold; the initial detector is fine-tuned using the explicit marginal balance loss and instance perturbation to obtain a fine-tuned initial detector, which is then used for target detection. This application effectively improves the balance between model discrimination and representation through the maximum marginal loss and instance perturbation strategy, thereby constructing an excellent, generalizable new class distribution. This solves the problems of existing technologies lacking appropriate marginal constraints and difficulty in alleviating the inherent contradiction between model discrimination and representation.
[0038] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0039] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:
[0040] Figure 1 This is a flowchart illustrating a small-sample target detection method based on explicit marginal equilibrium according to an embodiment of this application.
[0041] Figure 2 A schematic diagram illustrating the execution logic of a small-sample target detection method based on explicit marginal equilibrium, provided as an embodiment of this application;
[0042] Figure 3 A schematic diagram of a prototype vector provided for one embodiment of this application;
[0043] Figure 4 A schematic diagram illustrating the detection results of this application and the baseline method on the PASCAL VOC dataset, as provided in one embodiment of this application;
[0044] Figure 5 A schematic diagram illustrating a comparison of the detection accuracy of this application with other methods on the PASCAL VOC dataset, provided as an embodiment of this application;
[0045] Figure 6A schematic diagram illustrating a comparison of the detection accuracy of this application with other methods on the MS COCO dataset, provided as an embodiment of this application;
[0046] Figure 7 A schematic diagram illustrating the execution logic of a small-sample target classification method based on explicit marginal equilibrium, provided as an embodiment of this application;
[0047] Figure 8 A visualization diagram of a feature vector distribution provided for one embodiment of this application;
[0048] Figure 9 A schematic diagram illustrating a comparison of the classification accuracy of this application with other methods on a small sample classification dataset, provided as an embodiment of this application;
[0049] Figure 10 This is an example diagram of a small-sample target detection device based on explicit marginal equilibrium according to an embodiment of this application;
[0050] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0051] Among them, 10-small sample target detection device based on explicit marginal equilibrium; 100-basic training module, 200-extension module, 300-target detection module; 1101-memory, 1102-processor, 1103-communication interface. Detailed Implementation
[0052] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0053] The following describes a method and apparatus for small-sample target detection based on explicit marginal equilibrium, according to embodiments of this application, with reference to the accompanying drawings. Addressing the problems mentioned in the background section, this application provides a method for small-sample target detection based on explicit marginal equilibrium. In this method, the average feature vector of all sample instances corresponding to each basic target class is calculated, and the maximum marginal loss and training phase loss function are determined based on the average feature vector. A preset detector is trained using the training phase loss function to generate an initial detector. Based on the basic target class and a preset new target class, an extended target class is constructed, and the category coefficient vector corresponding to the extended target class is determined. A category equilibrium coefficient is calculated based on the category coefficient vector to extend the maximum marginal loss, resulting in an explicit marginal equilibrium loss. The gradient map of each sample instance is calculated, and the instance perturbation corresponding to each sample instance is determined based on the gradient map and a preset gradient threshold. The initial detector is fine-tuned using the explicit marginal equilibrium loss and instance perturbation to obtain a fine-tuned initial detector, which is then used for target detection. This application effectively improves the balance between model discrimination and representation through the maximum marginal loss and instance perturbation strategy, thereby constructing an excellent generalizable new class distribution. This solves the problems of existing technologies lacking appropriate marginal constraints and making it difficult to alleviate the inherent contradiction between model discrimination and representation.
[0054] Specifically, Figure 1 This is a flowchart illustrating a small-sample target detection method based on explicit marginal equilibrium, provided as an embodiment of this application.
[0055] like Figure 1 As shown, this small-sample target detection method based on explicit marginal equilibrium includes the following steps:
[0056] In step S101, the average feature vector of all sample instances corresponding to each basic target class is calculated, and the maximum marginal loss and training stage loss function are determined based on the average feature vector. The preset detector is then trained using the training stage loss function to generate the initial detector.
[0057] In the basic training phase of this application embodiment, the few-sample object detector can typically learn representative features through sufficient supervision and divide the learned embedding space into subspaces of each base class.
[0058] Since new class samples will be placed in the marginal space between base classes during fine-tuning, embodiments of this application can achieve maximum marginal loss. This allows for sufficient margins and avoids feature confusion.
[0059] Optionally, in one embodiment of this application, the average feature vector of all sample instances corresponding to each basic target class is calculated, and the maximum marginal loss and the training stage loss function are determined based on the average feature vector. This includes: sequentially inputting each sample instance of each basic target class into an image encoder, an RPN network, and a RoI network to output the feature vector of each sample instance; calculating the average feature vector of all sample instances corresponding to each basic target class based on the feature vector of each sample instance; calculating the maximum marginal loss using the average feature vector; and determining the training stage loss function based on the maximum marginal loss and a preset initial loss function.
[0060] It should be noted that the maximum margin of categories can be achieved by bringing the prototype vectors of the same class closer together and pushing the prototype vectors of different classes further apart. In order to derive the prototype vectors, each sample instance is sequentially input into the image encoder, the RPN network, and the RoI network to obtain the feature vector of the sample instance. And the prototype vector of class i can be calculated as K i The average of the feature vectors of instances within a class. Therefore, embodiments of this application can determine the maximum marginal loss.
[0061] Optionally, in one embodiment of this application, the mathematical expression for the maximum marginal loss is:
[0062]
[0063] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N b K represents the number of categories in the base target class; i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; Let represent the feature vector of the t-th sample instance corresponding to the i-th basic target class.
[0064] In the embodiments of this application, the maximum marginal loss can be defined as:
[0065]
[0066] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N b K represents the number of categories in the base target class; iμ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; Let represent the feature vector of the t-th sample instance corresponding to the i-th basic target class.
[0067] As can be seen from equation (2), in the molecule, the intra-class distance of the i-th class is defined as the instance feature vector. To its class prototype vector μ i The average Euclidean distance. In the denominator, the inter-class distance is defined as the minimum distance between the class prototype vectors (i.e., the average feature vectors).
[0068] Therefore, the objective function (i.e., the total loss function) of the detector in the basic training phase of this application embodiment is updated as follows:
[0069]
[0070] Here, λ can be set to 1.0 based on experience.
[0071] Therefore, embodiments of this application can improve the margin between base classes through maximum marginal loss during the basic training phase, reserving sufficient space for the features of new classes.
[0072] In step S102, an extended target class is constructed based on the basic target class and the preset new target class, and the category coefficient vector corresponding to the extended target class is determined. The category balance coefficient is calculated based on the category coefficient vector to extend the maximum marginal loss and obtain the explicit marginal balance loss.
[0073] Furthermore, during the fine-tuning phase, due to marginal maximization, the new class may not be well represented, for example, it may be mapped to multiple clusters or peaks.
[0074] Therefore, embodiments of this application can determine the explicit marginal equilibrium loss. The loss is calculated based on the semantic relationship between the base class and the new class, i.e., the class balance coefficient w. ij Explicitly adjust the margin size to balance the representation and distinction of the new class.
[0075] Therefore, the Explicit Margin Equilibrium (EME) of this application embodiment can quantify the relationship between the base class and the new class by calculating the class balance coefficient based on the linear representation assumption, and use these coefficients to explicitly optimize the marginal space by reweighting the corresponding inter-class distance loss term during the fine-tuning process, thereby achieving a flexible marginal balance for new class adaptation and alleviating the discrimination-representation dilemma in small sample target detection.
[0076] Optionally, in one embodiment of this application, the mathematical expression for the explicit marginal equilibrium loss is:
[0077]
[0078] Where, θ ena Represents the image encoder parameters; θ aai Represents the RoI network parameters; N represents the number of categories of the target class to be expanded; K i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ a μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; This represents the feature vector of the t-th sample instance corresponding to the i-th basic target class; This indicates that it contains the closest μ. i The indices of the M average eigenvectors.
[0079] In actual implementation, due to the scarcity of instances of the new class, it is impossible to fully adapt the model. Therefore, it usually relies on the distribution of the base class for representation, and only fine-tuning of the fully connected layer is needed to complete the detection of the new class. Therefore, the embodiments of this application assume that it is sufficient to represent the new sample by a linear combination of the learned class prototypes. Thus, the class coefficient vector can be represented as:
[0080]
[0081] All category prototypes were computed on a fine-tuned training dataset.
[0082] From the above equation, we can see that the weight vector The solution can be found using the least squares method, i.e. Here, pinv(·) represents the pseudo-inverse operator.
[0083] Furthermore, embodiments of this application may define the class balance vector as follows: Among them, w i The j-th element, i.e., w ij This reveals the contribution of the j-th class prototype vector to the i-th class prototype vector; in other words, the class balance coefficient w. ij The size represents the degree of closeness between class j and class i.
[0084] It should be noted that when obtaining the class balance coefficient, those skilled in the art can use other methods to describe the class relationship, and are not limited to the cosine similarity of the average feature vector. No specific limitation is made here.
[0085] Subsequently, in order to adaptively adjust the margin size according to the semantic relationships between categories, embodiments of this application may use a category balance coefficient w. ij To reweight the inter-class distance based on equation (2).
[0086] Specifically, to achieve a marginal balance between representation and differentiation, embodiments of this application can expand the margin between closer categories while reducing the push on more distantly related classes; through category relationship modeling, embodiments of this application can extend marginal optimization to more neighboring classes and reduce the explicit marginal balance loss. The expression is as follows:
[0087]
[0088] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N represents the number of categories of the target class to be expanded; K i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; This represents the feature vector of the t-th sample instance corresponding to the i-th basic target class; This indicates that it contains the closest μ. i The indices of the M average eigenvectors.
[0089] Therefore, the embodiments of this application are based on the EME strategy, which establishes explicit constraints on the margins through the semantic relationship between the base class and the new class (quantified as the class balance coefficient). The loss function based on these constraints can flexibly adjust the margin space through the closeness or distance of the classes, thereby effectively improving the balance between discrimination and representation.
[0090] In step S103, the gradient map of each sample instance is calculated, and the instance perturbation corresponding to each sample instance is determined according to the gradient map and the preset gradient threshold. The initial detector is then fine-tuned by the explicit marginal equilibrium loss and the instance perturbation to obtain the fine-tuned initial detector, which is then used for target detection.
[0091] After obtaining the explicit marginal equilibrium loss, the embodiments of this application may further introduce a gradient-based online data augmentation strategy, namely the instance perturbation strategy, to enhance the marginal equilibrium process in a small amount of data environment. In the fine-tuning stage, the instance perturbation strategy is used to reduce the inter-class distance by dispersing the intra-class distribution, thereby balancing the discrimination and representation capabilities through the maximum marginal loss and the instance perturbation strategy.
[0092] Optionally, in one embodiment of this application, the instance perturbation corresponding to each sample instance is determined based on the gradient map and a preset gradient threshold, and the initial detector is fine-tuned using an explicit marginal equilibrium loss and the instance perturbation, including: comparing the gradient of each pixel position in the gradient map with the preset gradient threshold and obtaining a comparison result to generate an instance perturbation based on the comparison result; and determining a fine-tuning stage loss function using an explicit marginal equilibrium loss and a preset initial loss function to fine-tune the initial detector using the fine-tuning stage loss function and the instance perturbation.
[0093] In specific implementation, embodiments of this application can enhance the input instances during the fine-tuning stage by using regions with high mask gradient values, such as... Figure 2 As shown. Since the gradient map reflects the model's focus, embodiments of this application can hide the most discriminative regions to force the network to focus on the complete object and increase the diversity of the data.
[0094] In the embodiments of this application, the gradient map of each sample instance can be derived by the following formula:
[0095]
[0096] Where (w,h) represents the pixel position; ||·|| represents the l2 norm.
[0097] The perturbated instance is represented as follows:
[0098] o′=o·T o (6)
[0099] Among them, T o It is a binary mask of the same size as o.
[0100] When G o When (w,h)≥τ, the pixel value is 1; otherwise, it is 0. The threshold τ controls the perturbation intensity, i.e. the proportion of the mask. All perturbation instances can be fine-tuned by inputting them into the detector.
[0101] It should be noted that, in actual implementation, when using instance perturbation, the methods for determining the mask region of the input image in this application embodiment include, but are not limited to: saliency map of the input image, feature activation map of the input image, etc.; furthermore, in visualization analysis, such as Figure 3 As shown, alternative solutions for the visualization analysis of the target prototype vector are not limited to methods such as UMAP (Uniform Manifold Approximation and Projection, data processing dimensionality reduction). Those skilled in the art can determine the specific solution according to the actual situation, and no specific limitation is made here.
[0102] Furthermore, the overall loss in the fine-tuning stage of the embodiments of this application Can be updated to:
[0103]
[0104] It should be noted that the EME in the embodiments of this application can be embedded as a plug-and-play module into different baseline methods, such as Figure 4 , Figure 5 and Figure 6 As shown, where, Figure 4 The red boxes in the diagram represent incorrect detection results, the green boxes represent correct detection results, and the blue boxes represent missed targets. Compared with the baseline method, the embodiments of this application show better detection performance on various commonly used benchmark datasets, which effectively demonstrates the versatility and effectiveness of EME.
[0105] Optionally, in one embodiment of this application, the method further includes: obtaining the base class statistics of the basic target class, and calculating the new class statistics based on the base class statistics and the class balance coefficient; calculating the instance feature gradient of each sample instance, and perturbing each sample instance based on the instance feature gradient, a preset feature gradient threshold, and a perturbation strategy to generate perturbed instances; constructing an instance set corresponding to the new class statistics based on the new class statistics and the perturbed instances, and training a preset classifier through the instance set and a preset classification loss function to perform target classification operations using the trained classifier.
[0106] Furthermore, this application embodiment can perform target classification operations simultaneously with target detection. In actual execution, this application embodiment, for a given classification dataset... This includes base classes (C b ) and new class (C n Classifiers are typically trained on base classes and on support sets. Fine-tuning is performed on top; among them, there are N n -way-K-shot new sample (N) n (Given new classes, K samples per class), and in the query set The evaluation is conducted on the above, where each new category (the i-th new category) is evaluated on... and There are K support samples and Q query samples.
[0107] In few-sample classification, classifiers are prone to overfitting due to biases in the feature distributions estimated from the limited training samples. To address this issue, these inaccurately estimated distributions can be calibrated by borrowing the distribution statistics of base classes with sufficient samples; then, sufficient feature vectors can be sampled from the calibrated distributions, thereby expanding the classifier's training corpus.
[0108] Specifically, in embodiments of this application, it is assumed that the feature embedding follows a Gaussian distribution, and DC from Select M most similar base classes and calculate their statistics (mean μ). j Sum of variances ∑ j The statistic (mean) of the shift to the new category and variance ):
[0109]
[0110] in, express The k-th instance vector in the distribution; α is a hyperparameter that controls the dispersion of the distribution.
[0111] To avoid bias in a specific sampling and achieve more diverse and accurate distribution estimation, embodiments of this application can perform K distribution calibrations on each supporting instance to obtain a set of statistics. Then, DC in A distribution with calibration statistics is randomly selected, and random sampling is performed on that distribution to increase the input samples for the classifier.
[0112] The EME process for small sample classification in this application embodiment is based on the DC benchmark method and the application of class balance coefficients in FSOD to flexibly adjust the differences in class margins, such as Figure 7 As shown. In small sample classification, the embodiments of this application can reuse this coefficient for distribution calibration of new classes. Specifically, the specific process of small sample classification in the embodiments of this application is as follows:
[0113] Step 1: In order to utilize more base classes for accurate calibration, embodiments of this application may again utilize explicit distribution equalization calibration to reweight the base class statistics under the linear representation assumption, thereby reconstructing the distribution of the new classes.
[0114] (1) Calculate the equilibrium coefficient:
[0115] Embodiments of this application may assume that new sample instances can be represented by a linear combination of well-estimated base class prototype vectors, i.e.:
[0116]
[0117] Wherein, the linear combination coefficient vector Corresponding to the k-th sample instance of the i-th new target class, that is, the linear combination coefficient vector The j-th coefficient (element) is represented as It reflects the semantic relationship between the j-th base class and the i-th new class;
[0118] It should be noted that the difference between equation (9) and equation (4) in FSOD is that the left side of equation (9) only contains the prototype vector of the base class, while the left side of FSOD contains the prototype vectors of both the base class and the new class.
[0119] (2) Weighting / calibration of new class statistics:
[0120] According to equation (9), the embodiments of this application can calculate the mean of the i-th new class by a linear combination of the statistics (mean, variance) of the base class. and variance
[0121]
[0122] in, Normalized The summation value is 1), through The reweighting of base classes helps to accurately calibrate the statistics of the new classes by allowing more base classes to express their unique relationship with the specific new classes (reflected by the linear combination coefficients mentioned above).
[0123] Step 2: This application embodiment also uses instance perturbation to perturb the prototype vector, making the calibrated distribution more diverse, accurate and robust, thereby sampling and fitting more valuable new data in a data-scarce environment.
[0124] Instance perturbation enhances feature vectors by masking elements with higher gradient values, such as... Figure 8 As shown, the gradient of each instance feature v is:
[0125]
[0126] in, This is the cross-entropy loss function (classification loss).
[0127] An instance of interference can be represented as:
[0128] υ′=υ·T υ (11)
[0129] Among them, T v For size and G v The same binary mask, when T v If the corresponding element is greater than τ, the element is equal to 1; otherwise, it is 0.
[0130] Subsequently, the disturbed features are input into formulas (9) and (10) to improve the balance coefficients and statistics of the new class;
[0131] Step 3: Define the total classification loss and train the model / classifier.
[0132] An embodiment of this application can generate an instance set from the distribution of calibration statistics for all new categories. The training objective of the classifier is to make the support set and Minimizing the cross-entropy loss on the x-axis, the total classification loss can be defined as follows:
[0133]
[0134] Where y and θ represent the class label and classifier parameters, respectively.
[0135] Therefore, embodiments of this application can also apply explicit balancing strategies to small-sample classification to obtain balancing coefficients between class distributions based on the semantic relationship between the base class and the new class. Furthermore, the distribution statistics of the new class are reweighted using these balancing coefficients to calibrate the distribution of the new class. Figure 9 As shown, this effectively improves the accuracy of small sample classification.
[0136] The small-sample object detection method based on explicit marginal equilibrium proposed in this application calculates the average feature vector of all sample instances corresponding to each basic object class, determines the maximum marginal loss and the training stage loss function based on the average feature vector, and trains a preset detector using the training stage loss function to generate an initial detector. Based on the basic object class and the preset new object class, an extended object class is constructed, and the corresponding class coefficient vector is determined. A class equilibrium coefficient is calculated based on the class coefficient vector to extend the maximum marginal loss, resulting in an explicit marginal equilibrium loss. The gradient map of each sample instance is calculated, and the instance perturbation corresponding to each sample instance is determined based on the gradient map and a preset gradient threshold. The initial detector is then fine-tuned using the explicit marginal equilibrium loss and instance perturbation to obtain a fine-tuned initial detector, which is then used for object detection. This application effectively improves the balance between model discrimination and representation through the maximum marginal loss and instance perturbation strategy, thereby constructing an excellent generalizable new class distribution.
[0137] Secondly, the small-sample target detection device based on explicit marginal equilibrium proposed according to the embodiments of this application is described with reference to the accompanying drawings.
[0138] Figure 10 This is a block diagram of a small-sample target detection device based on explicit marginal equilibrium according to an embodiment of this application.
[0139] like Figure 10 As shown, the small sample target detection device 10 based on explicit marginal equilibrium includes: a basic training module 100, an extension module 200, and a target detection module 300.
[0140] The basic training module 100 is used to calculate the average feature vector of all sample instances corresponding to each basic target class, and to determine the maximum marginal loss and the training stage loss function based on the average feature vector. The preset detector is trained through the training stage loss function to generate the initial detector.
[0141] The extension module 200 is used to construct an extended target class based on the basic target class and a preset new target class, determine the category coefficient vector corresponding to the extended target class, and calculate the category balance coefficient based on the category coefficient vector, so as to extend the maximum marginal loss through the category balance coefficient and obtain the explicit marginal balance loss.
[0142] The target detection module 300 is used to calculate the gradient map of each sample instance, determine the instance perturbation corresponding to each sample instance based on the gradient map and the preset gradient threshold, and fine-tune the initial detector through explicit marginal equilibrium loss and instance perturbation to obtain the fine-tuned initial detector, so as to perform target detection operation using the fine-tuned initial detector.
[0143] Optionally, in one embodiment of this application, the small sample target detection device 10 based on explicit marginal equilibrium of this application embodiment further includes: an acquisition module, an interference module, and a classification module.
[0144] The acquisition module is used to acquire the base class statistics of the basic target class and calculate the new class statistics based on the base class statistics and the class balance coefficient.
[0145] The interference module is used to calculate the instance feature gradient of each sample instance, and based on the instance feature gradient, the preset feature gradient threshold and the interference strategy, to interfere with each sample instance to generate interference instances.
[0146] The classification module is used to construct an instance set corresponding to the new class statistics based on the new class statistics and interference instances, and to train a preset classifier using the instance set and a preset classification loss function, so as to perform target classification operations using the trained classifier.
[0147] Optionally, in one embodiment of this application, the basic training module 100 includes: an input unit, a calculation unit, and a determination unit.
[0148] The input unit is used to sequentially input each sample instance of each basic target class into the image encoder, RPN network, and RoI network to output the feature vector of each sample instance.
[0149] The computation unit is used to calculate the average feature vector of all sample instances corresponding to each base target class based on the feature vector of each sample instance.
[0150] The unit is defined to calculate the maximum marginal loss using the average feature vector and to determine the loss function for the training phase based on the maximum marginal loss and the preset initial loss function.
[0151] Optionally, in one embodiment of this application, the target detection module 300 includes a comparison unit and a fine-tuning unit.
[0152] The comparison unit is used to compare the gradient of each pixel position in the gradient map with a preset gradient threshold and obtain the comparison result, so as to generate an instance perturbation based on the comparison result.
[0153] The fine-tuning unit is used to determine the fine-tuning stage loss function through the explicit marginal equilibrium loss and the preset initial loss function, so as to fine-tune the initial detector using the fine-tuning stage loss function and instance perturbation.
[0154] Optionally, in one embodiment of this application, the mathematical expression for the maximum marginal loss is:
[0155]
[0156] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N b K represents the number of categories in the base target class; i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; Let represent the feature vector of the t-th sample instance corresponding to the i-th basic target class.
[0157] Optionally, in one embodiment of this application, the mathematical expression for the explicit marginal equilibrium loss is:
[0158]
[0159] Where, θ enc Represents the image encoder parameters; θ roi Represents the RoI network parameters; N represents the number of categories of the target class to be expanded; K i μ represents the number of all sample instances of the i-th base target class; S represents the scale scaling of each sample instance; μ j μ represents the average feature vector of the j-th basic target class; i This represents the average feature vector of the i-th basic target class; This represents the feature vector of the t-th sample instance corresponding to the i-th basic target class; This indicates that it contains the closest μ.i The indices of the M average eigenvectors.
[0160] It should be noted that the foregoing explanation of the small sample target detection method based on explicit marginal equilibrium also applies to the small sample target detection device based on explicit marginal equilibrium in this embodiment, and will not be repeated here.
[0161] The small-sample target detection device based on explicit marginal equilibrium proposed in this application includes a basic training module for calculating the average feature vector of all sample instances corresponding to each basic target class, determining the maximum marginal loss and the training phase loss function based on the average feature vector, and training a preset detector using the training phase loss function to generate an initial detector; an expansion module for constructing an expanded target class based on the basic target class and a preset new target class, determining the category coefficient vector corresponding to the expanded target class, and calculating the category equilibrium coefficient based on the category coefficient vector to expand the maximum marginal loss through the category equilibrium coefficient, thus obtaining an explicit marginal equilibrium loss; and a target detection module for calculating the gradient map of each sample instance, determining the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tuning the initial detector using the explicit marginal equilibrium loss and instance perturbation to obtain a fine-tuned initial detector for target detection operations. This application effectively improves the balance between model discrimination and representation through the maximum marginal loss and instance perturbation strategy, thereby constructing an excellent generalizable new class distribution.
[0162] Figure 11 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include:
[0163] The memory 1101, the processor 1102, and the computer program stored on the memory 1101 and executable on the processor 1102.
[0164] When the processor 1102 executes the program, it implements the small sample target detection method based on explicit marginal equilibrium provided in the above embodiments.
[0165] Furthermore, electronic devices also include:
[0166] Communication interface 1103 is used for communication between memory 1101 and processor 1102.
[0167] The memory 1101 is used to store computer programs that can run on the processor 1102.
[0168] The memory 1101 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0169] If the memory 1101, processor 1102, and communication interface 1103 are implemented independently, then the communication interface 1103, memory 1101, and processor 1102 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0170] Optionally, in a specific implementation, if the memory 1101, processor 1102, and communication interface 1103 are integrated on a single chip, then the memory 1101, processor 1102, and communication interface 1103 can communicate with each other through an internal interface.
[0171] The processor 1102 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0172] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described small-sample target detection method based on explicit marginal equilibrium.
[0173] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0174] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0175] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0176] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.
[0177] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0178] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0179] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0180] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of this application.
Claims
1. A small-sample target detection method based on explicit marginal equilibrium, characterized in that, Includes the following steps: Calculate the average feature vector of all sample instances corresponding to each basic target class, and determine the maximum marginal loss and training stage loss function based on the average feature vector. Train the preset detector using the training stage loss function to generate the initial detector. Based on the basic target class and the preset new target class, an extended target class is constructed, and the category coefficient vector corresponding to the extended target class is determined. The category balance coefficient is calculated according to the category coefficient vector, so as to extend the maximum marginal loss through the category balance coefficient and obtain the explicit marginal balance loss. Calculate the gradient map of each sample instance, and determine the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold. Fine-tune the initial detector using the explicit marginal equilibrium loss and the instance perturbation to obtain the fine-tuned initial detector, and use the fine-tuned initial detector to perform target detection operations. When using instance perturbation, methods for determining the masked region of the input image include, but are not limited to: saliency map of the input image, feature activation map of the input image; The mathematical expression for the explicit marginal equilibrium loss is as follows: in, Indicates image encoder parameters; Indicates RoI network parameters; This indicates the number of categories of the target class being extended; Indicates the first The number of all sample instances of each basic target class; This represents the number of scale reductions for each sample instance; Indicates the first The average feature vector of each basic target class; Indicates the first The average feature vector of each basic target class; Indicates the first The first basic target class corresponding to the Feature vectors of each sample instance; Indicates containing the closest of M Index of the average eigenvectors.
2. The method according to claim 1, characterized in that, Also includes: Obtain the base class statistics of the base target class, and calculate the new class statistics based on the base class statistics and the class balance coefficient; Calculate the instance feature gradient of each sample instance, and based on the instance feature gradient, a preset feature gradient threshold and an interference strategy, interfere with each sample instance to generate an interference instance; Based on the new class statistics and the interference instances, an instance set corresponding to the new class statistics is constructed, and a preset classifier is trained using the instance set and a preset classification loss function, so as to perform target classification operation using the trained classifier.
3. The method according to claim 1, characterized in that, The step of calculating the average feature vector of all sample instances corresponding to each basic target class, and determining the maximum marginal loss and the training phase loss function based on the average feature vector, includes: Each sample instance of each basic target class is sequentially input into a preset image encoder, RPN network, and RoI network to output the feature vector of each sample instance; Calculate the average feature vector of all sample instances corresponding to each basic target class based on the feature vector of each sample instance; The maximum marginal loss is calculated using the average feature vector, and the training phase loss function is determined based on the maximum marginal loss and the preset initial loss function.
4. The method according to claim 3, characterized in that, The step of determining the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tuning the initial detector using the explicit marginal equilibrium loss and the instance perturbation, includes: The gradient at each pixel location in the gradient map is compared with the preset gradient threshold, and the comparison result is obtained to generate the instance perturbation based on the comparison result; The fine-tuning stage loss function is determined by the explicit marginal equilibrium loss and the preset initial loss function, so as to fine-tune the initial detector using the fine-tuning stage loss function and the instance perturbation.
5. The method according to claim 1, characterized in that, The mathematical expression for the maximum marginal loss is: in, Indicates image encoder parameters; Indicates RoI network parameters; This indicates the number of categories of the base target class; Indicates the first The number of all sample instances of each basic target class; This represents the number of scale reductions for each sample instance; Indicates the first The average feature vector of each basic target class; Indicates the first The average feature vector of each basic target class; Indicates the first The first basic target class corresponding to the The feature vector of each sample instance.
6. A small-sample target detection device based on explicit marginal equilibrium, characterized in that, include: The basic training module is used to calculate the average feature vector of all sample instances corresponding to each basic target class, and determine the maximum marginal loss and the training stage loss function based on the average feature vector. The module also trains a preset detector using the training stage loss function to generate an initial detector. An extension module is used to construct an extended target class based on a base target class and a preset new target class, determine the category coefficient vector corresponding to the extended target class, and calculate the category balance coefficient based on the category coefficient vector, so as to extend the maximum marginal loss through the category balance coefficient to obtain the explicit marginal balance loss. The target detection module is used to calculate the gradient map of each sample instance, determine the instance perturbation corresponding to each sample instance based on the gradient map and a preset gradient threshold, and fine-tune the initial detector through the explicit marginal equilibrium loss and the instance perturbation to obtain the fine-tuned initial detector, so as to use the fine-tuned initial detector to perform target detection operation. When using instance perturbation, methods for determining the masked region of the input image include, but are not limited to: saliency map of the input image, feature activation map of the input image; The mathematical expression for the explicit marginal equilibrium loss is as follows: in, Indicates image encoder parameters; Indicates RoI network parameters; This indicates the number of categories of the target class being extended; Indicates the first The number of all sample instances of each basic target class; This represents the number of scale reductions for each sample instance; Indicates the first The average feature vector of each basic target class; Indicates the first The average feature vector of each basic target class; Indicates the first The first basic target class corresponding to the Feature vectors of each sample instance; Indicates containing the closest of M Index of the average eigenvectors.
7. The apparatus according to claim 6, characterized in that, Also includes: The acquisition module is used to acquire the base class statistics of the basic target class, and calculate the new class statistics based on the base class statistics and the class balance coefficient; The interference module is used to calculate the instance feature gradient of each sample instance, and based on the instance feature gradient, a preset feature gradient threshold and an interference strategy, to interfere with each sample instance to generate an interference instance. The classification module is used to construct an instance set corresponding to the new class statistics based on the new class statistics and the interference instances, and to train a preset classifier using the instance set and a preset classification loss function, so as to perform target classification operation using the trained classifier.
8. The apparatus according to claim 6, characterized in that, The basic training module includes: The input unit is used to sequentially input each sample instance of each basic target class into a preset image encoder, RPN network and RoI network to output the feature vector of each sample instance; The calculation unit is used to calculate the average feature vector of all sample instances corresponding to each basic target class based on the feature vector of each sample instance. The determining unit is used to calculate the maximum marginal loss using the average feature vector, and to determine the training phase loss function based on the maximum marginal loss and a preset initial loss function.
9. The apparatus according to claim 8, characterized in that, The target detection module includes: A comparison unit is used to compare the gradient at each pixel position in the gradient map with the preset gradient threshold and obtain a comparison result, so as to generate the instance perturbation based on the comparison result; The fine-tuning unit is used to determine the fine-tuning stage loss function through the explicit marginal equilibrium loss and the preset initial loss function, so as to fine-tune the initial detector using the fine-tuning stage loss function and the instance perturbation.
10. The apparatus according to claim 6, characterized in that, The mathematical expression for the maximum marginal loss is: in, Indicates image encoder parameters; Indicates RoI network parameters; This indicates the number of categories of the base target class; Indicates the first The number of all sample instances of each basic target class; This represents the number of scale reductions for each sample instance; Indicates the first The average feature vector of each basic target class; Indicates the first The average feature vector of each basic target class; Indicates the first The first basic target class corresponding to the The feature vector of each sample instance.
11. An electronic device, characterized in that, include: The memory, the processor, and the computer program stored in the memory and executable on the processor, the processor executing the program to implement the small sample target detection method based on explicit marginal equilibrium as described in any one of claims 1-5.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the small-sample target detection method based on explicit marginal equilibrium as described in any one of claims 1-5.
Citation Information
Patent Citations
Self-adaptive cross-domain target detection method based on uncertainty guidance
CN113392933A
Single-stage small-sample-object detection method based on decoupled metric
US11205098B1