Target detection algorithm based on stable learning
By optimizing sample weights and feature extraction using the deep stable learning method of StableNet, the stability and generalization problems of object detection algorithms in complex environments are solved, achieving high-precision small-sample detection and wide applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SENINT(SUZHOU) TECH CO LTD
- Filing Date
- 2026-01-19
- Publication Date
- 2026-04-28
AI Technical Summary
Existing target detection algorithms suffer from poor stability and insufficient generalization ability in complex and variable environments. They are prone to learning false correlations between targets and the environment in the training data, and their detection accuracy drops significantly when the data distribution shifts.
We employ a deep stable learning method based on StableNet, combining data preprocessing, feature extraction, stable learning, and target prediction modules. We eliminate nonlinear dependencies by using stochastic Fourier features (RFF), optimize sample weights, and use small-sample adaptive enhancement and category-aware weight adjustment. We also use a non-maximum suppression algorithm to optimize the detection results.
It improves the stability and convergence speed of the model during training, enhances its adaptability to different data distributions, significantly improves the detection accuracy and generalization ability of small sample classes, and expands the applicability of the algorithm in rare target detection and long-tailed distribution tasks.
Smart Images

Figure CN121937786A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, specifically to a target detection algorithm based on stable learning. Background Technology
[0002] Existing object detection algorithms suffer from poor stability and insufficient generalization ability in complex and variable environments. Specifically, during training, these algorithms are prone to learning "false correlations" between targets and the environment in the training data, rather than the core discriminative features of the targets themselves. For example, if small targets such as pedestrians and traffic signs in the training set mostly appear in the corners of the image due to limitations in the data collection scene, the algorithm may mistakenly associate the environmental feature of the corner position with the small target, rather than focusing on the essential features such as the target's shape and texture. Moreover, in real-world environments, the distribution of input data for object detection tasks often changes due to factors such as scene, lighting, weather, and equipment, i.e., distribution shift. For example, a model trained in an indoor scene such as a shopping mall may experience significant changes in feature distribution when applied to an outdoor scene such as a street, due to differences in background texture (indoor tiles vs. outdoor pavement), lighting conditions (artificial lighting vs. natural light), and target pose (static indoors vs. dynamic outdoor). The model may struggle to match the feature patterns learned during training, leading to a significant decrease in detection accuracy. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a target detection algorithm based on stable learning, which solves the problems mentioned in the background section.
[0004] To achieve the above objectives, the present invention provides the following technical solution: a target detection algorithm based on stable learning, wherein the target detection algorithm based on stable learning includes the following steps: S1. Constructing the algorithm framework: By combining the deep stabilization learning method of StableNet with the structure of traditional deep learning object detection models, an overall framework is built that includes a data preprocessing module, a feature extraction module, a stabilization learning module, and an object prediction module. S2, Data Preprocessing: The data preprocessing module standardizes the input image data and employs data augmentation techniques to increase the diversity of the training dataset. S3, Feature Extraction: The feature extraction module uses a convolutional neural network or a Transformer-based structure as the backbone network to extract features from the preprocessed image, resulting in feature maps at different levels and scales. The feature maps contain semantic and structural information. S4, Stable Learning: The stable learning module uses the random Fourier feature (RFF) to map nonlinear features to a high-dimensional space. By calculating the cross-covariance matrix of the mapped features, it quantifies and eliminates nonlinear dependencies. Optimize sample weights: With the goal of minimizing the cross covariance between features, the weight optimization formula is as follows: in, For feature dimension, This is the weighted cross-covariance matrix. It is the Frobenius norm. It is the feature matrix after mapping, i.e. ,in For random bias; This causes the weights to be adjusted in a direction that weakens spurious correlations; S5. Target Prediction: The target prediction module uses the target prediction network to predict the target category and location based on the feature map from the feature extraction module and the optimized feature representation from the stable learning module. If using the anchor box method: generate anchor boxes of different scales and aspect ratios on the feature map, and predict the matching degree between the anchor box and the target, i.e., confidence, category, and position offset, through convolutional layers; If there is no anchor box: directly predict the target key points such as corner points, center points, category and size information on the feature map; The non-maximum suppression (NMS) algorithm is used to remove highly overlapping predicted bounding boxes to obtain the final target detection result.
[0005] Furthermore, in step S2, the standardization process includes: Normalize pixel values to the range of [0,1] or [-1,1]; Data augmentation techniques include, but are not limited to, flipping, rotating, scaling, and cropping.
[0006] Furthermore, in step S3, the convolutional neural network includes, but is not limited to, ResNet and VGG.
[0007] Furthermore, in step S4, the stabilization learning module can separately calculate the cross-covariance matrix for the spatial dimension of each feature map layer, i.e., the target's position information at that scale, for the features of the entire image and for feature maps of different scales, such as the multi-layer feature maps of the FPN structure in target detection, corresponding to large, medium, and small targets respectively. In this way, false associations between targets of different scales and specific spatial locations can be accurately identified.
[0008] Furthermore, in step S4, the StableNet sample weighting mechanism is adopted: samples that strengthen false associations are given low weights, and samples that reflect the true characteristics of the target are given high weights, thereby weakening the dependence of the target on irrelevant spatial regions and enabling the model to focus on the discriminative features of the target itself.
[0009] Furthermore, in step S5, the anchor box method includes, but is not limited to, Faster R-CNN and SSD; Anchor-free methods include, but are not limited to, CornerNet and CenterNet.
[0010] Furthermore, step S2 also includes the following sub-steps: S2-1, Small Sample Class Recognition and Dynamic Augmentation: After the original data is standardized and preprocessed with basic augmentation, the number of samples in each category in the training set is counted, a threshold for the number of samples is set, and categories with less than 5% of the total number of samples are defined as small sample categories. For small sample categories, an adaptive augmentation strategy is adopted.
[0011] Furthermore, in step S2-1, the adaptive enhancement strategy for small samples includes expanding the rotation angle range to ±45°; increasing the scaling ratio range to 0.5-1.5 times; adding mild Gaussian noise; and increasing the number of enhancements so that each small sample generates 3-5 enhanced samples. The sample classes that make up 5% or more of the total sample size are called the majority class samples. The number of augmentation attempts for these samples is limited so that each sample generates 1-2 augmented samples.
[0012] Furthermore, based on the content flow in step S2-1, in step S4, when calculating the cross covariance matrix, it is necessary to distinguish the category to which the sample belongs and to separately label the feature vectors of samples in the smaller category. The weight optimization objective was adjusted by adding a penalty term for the contribution of small sample class features to the original formula, resulting in the updated optimized formula: in, For feature dimension, It is the Frobenius norm. For a small sample set of categories, For small sample categories The sample index set, This is the penalty coefficient, used to control the weighting of smaller samples.
[0013] Furthermore, based on the content flow in step S2-1, step S5 also includes the following sub-steps: S5-1, Small Sample Class Confidence Calibration: For predicted bounding boxes belonging to small sample categories in the prediction results, based on the confidence distribution of small sample category features recorded during training, dynamic threshold adjustment is used to reduce missed detections due to insufficient samples, such as reducing the confidence screening threshold for small sample categories by 5%-10%. In the process of removing highly overlapping prediction boxes using the non-maximum suppression (NMS) algorithm, a higher IoU threshold is set for the small sample class prediction boxes, such as increasing it from 0.5 to 0.6, to retain more potentially correct small sample target prediction results, and finally obtain the optimized target detection results.
[0014] This invention provides a target detection algorithm based on stable learning, which has the following beneficial effects: 1. This object detection algorithm based on stable learning dynamically adjusts the weights of training samples through a stable learning module, reducing the model's dependence on irrelevant features and mitigating the impact of data noise and outliers on model training. This makes the model more stable during training and converges faster. Furthermore, the algorithm of this invention can effectively identify and utilize key features that are truly relevant to the label, improving the model's adaptability to different data distributions. Even when there are differences between the distributions of training and test data, it can still maintain high detection accuracy, and its generalization ability is significantly enhanced.
[0015] 2. This target detection algorithm based on stable learning solves the problems of insufficient feature learning and model bias towards the majority class in small sample scenarios through the synergistic effect of small sample adaptive enhancement, category-aware weight adjustment, and confidence calibration. It enables the model to stably detect small sample targets even when the sample distribution is unbalanced, significantly improves the detection accuracy of small sample categories, and expands the applicability of the algorithm in practical scenarios such as rare target detection and long-tailed distribution tasks. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating the steps of a target detection algorithm based on stable learning according to the present invention. Figure 2 This is a comparison chart showing the performance of a target detection algorithm based on stable learning proposed in this invention with that of the traditional Faster R-CNN. Detailed Implementation
[0017] The embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and should not be construed as limiting the scope of the invention.
[0018] like Figures 1-2 As shown, the present invention provides a technical solution: a target detection algorithm based on stable learning, which includes the following steps: S1. Constructing the algorithm framework: By combining the deep stabilization learning method of StableNet with the structure of traditional deep learning object detection models, an overall framework is built that includes a data preprocessing module, a feature extraction module, a stabilization learning module, and an object prediction module. S2, Data Preprocessing: The data preprocessing module standardizes the input image data and employs data augmentation techniques to increase the diversity of the training dataset. Standardization processes include: Normalize pixel values to the range of [0,1] or [-1,1]; Data augmentation techniques include, but are not limited to, flipping, rotating, scaling, and cropping. It also includes the following sub-steps: S2-1, Small Sample Class Recognition and Dynamic Augmentation: After the original data is standardized and preprocessed with basic enhancement, the number of samples in each category in the training set is counted, a threshold for the number of samples is set, and the category with less than 5% of the total number of samples is defined as a small sample category. For the small sample category samples, an adaptive enhancement strategy is adopted. The adaptive enhancement strategy for small samples includes expanding the rotation angle range to ±45°; increasing the scaling ratio range to 0.5-1.5 times; adding mild Gaussian noise; and increasing the number of enhancements to generate 3-5 enhanced samples per small sample. The sample class that accounts for more than or equal to 5% of the total sample size is called the majority class sample. The number of augmentation times for this class is limited so that each sample generates 1-2 augmented samples. S3, Feature Extraction: The feature extraction module uses a convolutional neural network or a Transformer-based structure as the backbone network to extract features from the preprocessed image, obtaining feature maps at different levels and scales. The feature maps contain semantic and structural information. The convolutional neural network includes, but is not limited to, ResNet and VGG. S4, Stable Learning: The stable learning module uses the random Fourier feature (RFF) to map nonlinear features to a high-dimensional space. By calculating the cross-covariance matrix of the mapped features, it quantifies and eliminates nonlinear dependencies. RFF mapping method: Let the input features be... The mapping function is ,in For random weights, the elements follow... distributed, , For random bias, elements follow the order [0, 2]. π Evenly distributed, For mapping dimensions, typical values =1024; Optimize sample weights: With the goal of minimizing the cross covariance between features, the weight optimization formula is as follows: in, For feature dimension, , This is the weighted cross-covariance matrix. The first Column feature vectors express The j-th column eigenvector, The Frobenius norm is defined as the square root of the sum of the squares of the matrix elements. " indicates scalar multiplication. It is the feature matrix after mapping, i.e. ,in For random bias; This causes the weights to be adjusted in a direction that weakens spurious correlations; The stable learning module can calculate the cross-covariance matrix separately for the spatial dimension of each feature map layer, i.e., the target's position information at that scale, for features of the entire image and feature maps of different scales, such as the multi-layer feature maps of the FPN structure in object detection, corresponding to large, medium, and small targets respectively. Specifically, this involves: adjusting the spatial dimensions of each feature map layer. Flattening is the feature dimension. As a new feature index, the cross covariance matrix is calculated on the flattened feature vector according to the above formula. In this way, spurious associations between targets of different scales and specific spatial locations can be accurately identified. The StableNet sample weighting mechanism is adopted: samples that reinforce spurious associations are given low weights, while samples that reflect the true features of the target are given high weights. This weakens the dependence of the target on irrelevant spatial regions, allowing the model to focus on the discriminative features of the target itself. For per-sample scalar weights, the dimension is consistent with the number of samples, i.e. ; Based on the content flow in step S2-1, in step S4, when calculating the cross covariance matrix, it is necessary to distinguish the category to which the sample belongs and to separately label the feature vectors of samples in the smaller category. The weight optimization objective was adjusted by adding a penalty term for the contribution of small sample class features to the original formula, resulting in the updated optimized formula: in, For feature dimension, It is the Frobenius norm. For a small sample set of categories, For small sample categories The sample index set, This is the penalty coefficient, with a value range of 0.1 ≤ ≤0.5, the smaller the sample size, the scarcer the resource. The larger the value, the more it is used to control the weighting of smaller samples; S5. Target Prediction: The target prediction module uses the target prediction network to predict the target category and location based on the feature map from the feature extraction module and the optimized feature representation from the stable learning module. If using the anchor box method: generate anchor boxes of different scales and aspect ratios on the feature map, and predict the matching degree between the anchor box and the target, i.e., confidence, category, and position offset, through convolutional layers; If there is no anchor box: directly predict the target key points such as corner points, center points, category and size information on the feature map; The non-maximum suppression (NMS) algorithm is used to remove highly overlapping bounding boxes to obtain the final target detection result; Anchor box methods include, but are not limited to, Faster R-CNN and SSD; Anchor-free methods include, but are not limited to, CornerNet and CenterNet; Based on the content flow in step S2-1, step S5 also includes the following sub-steps: S5-1, Small Sample Class Confidence Calibration: For predicted bounding boxes belonging to small sample categories in the prediction results, based on the confidence distribution of small sample category features recorded during training, a dynamic threshold adjustment is used to reduce missed detections due to insufficient samples. The original confidence screening threshold defaults to 0.5, and the reduction is 5%-10% of the original threshold, that is, the adjusted threshold is 0.45-0.475. In the process of removing highly overlapping prediction boxes using the non-maximum suppression (NMS) algorithm, a higher IoU threshold is set for the small sample class prediction boxes, such as increasing it from 0.5 to 0.6, to retain more potentially correct small sample target prediction results, and finally obtain the optimized target detection results.
[0019] Example: Data preprocessing: Standardization: Normalize the pixel values of the input image to [-1, 1], using the formula: Basic enhancements: Random horizontal flip with a probability of 0.5, random rotation from -30° to 30°; Small sample dynamic augmentation: For classes with a sample size of <5%, the augmentation rotation angle is increased to ±45°, the scaling is increased to 0.5-1.5 times, Gaussian noise is added, the variance is 0.03, and 4 augmented samples are generated for each sample, while for the majority class, 1 augmented sample is generated for each sample. Feature extraction: ResNet-50 was selected as the backbone network, and combined with the FPN structure to output 5 layers of feature maps, scale to These correspond to the characteristics of small, medium, and large targets, respectively. Stable learning: RFF mapping: retrieve , obey , Following a uniform distribution in [0, 2π), the feature map output by FPN is mapped to a high-dimensional space; Cross-covariance calculation: For each layer of feature map, such as For each smaller objective, calculate the spatial dimension ( The cross-covariance matrix of the target can be used to identify false associations such as small target-corner locations. Weight optimization: The initial formula is used to calculate the basic weights, and then the weights are adjusted using a formula with a penalty term (λ=0.3) to give higher weights to small samples, such as increasing them by 1.2-1.5 times; Target prediction: Using the Faster R-CNN framework, anchor boxes are generated: three scales and three aspect ratios of anchor boxes are generated on the feature map; Prediction: Convolutional layer output class confidence and position offset; Small sample calibration: For small sample prediction boxes, the confidence threshold is reduced from 0.5 to 0.45, and the IoU threshold of NMS is increased from 0.5 to 0.6, and the final detection results are output.
[0020] like Figure 2 As shown, Figure 2 This is a comparison chart showing the performance of a target detection algorithm based on stable learning proposed in this invention with that of traditional Faster R-CNN (existing technology); Ultimately, the comparative conclusions show that this invention has significantly better stability, small sample performance, and feature utilization efficiency. Through three-layer optimization, it accurately improves small sample detection capabilities. Through mathematical modeling and hierarchical optimization, it breaks through the traditional feature utilization bottleneck and has greater advantages in training efficiency and resource utilization. Moreover, it has wider scene adaptability and higher engineering value.
[0021] Based on the above description, this invention dynamically adjusts the weights of training samples through a stable learning module, reducing the model's dependence on irrelevant features and mitigating the impact of data noise and outliers on model training. This makes the model more stable during training and converges faster. Furthermore, the algorithm of this invention can effectively identify and utilize key features that are truly relevant to the labels, improving the model's adaptability to different data distributions. Even when there are differences between the distributions of training and test data, it can still maintain high detection accuracy, and its generalization ability is significantly enhanced.
[0022] Moreover, this invention solves the problems of insufficient feature learning and model bias towards the majority class in small sample scenarios through the synergistic effect of small sample adaptive enhancement, category-aware weight adjustment, and confidence calibration. It enables the model to stably detect small sample targets even when the sample distribution is unbalanced, significantly improves the detection accuracy of small sample categories, and expands the applicability of the algorithm in practical scenarios such as rare target detection and long-tailed distribution tasks.
[0023] The embodiments of the present invention are given for illustrative and descriptive purposes only, and are not intended to be exhaustive or to limit the invention to the forms disclosed. Many modifications and variations will be apparent to those skilled in the art. The embodiments were chosen and described in order to better illustrate the principles and practical application of the invention, and to enable those skilled in the art to understand the invention and to design various embodiments with various modifications suitable for a particular purpose.
Claims
1. A target detection algorithm based on stable learning, characterized in that: The target detection algorithm based on stable learning includes the following steps: S1. Constructing the algorithm framework: By combining the deep stabilization learning method of StableNet with the structure of traditional deep learning object detection models, an overall framework is built that includes a data preprocessing module, a feature extraction module, a stabilization learning module, and an object prediction module. S2, Data Preprocessing: The data preprocessing module standardizes the input image data and employs data augmentation techniques to increase the diversity of the training dataset. S3, Feature Extraction: The feature extraction module uses a convolutional neural network or a Transformer-based structure as the backbone network to extract features from the preprocessed image, resulting in feature maps at different levels and scales. The feature maps contain semantic and structural information. S4, Stable Learning: The stable learning module uses the random Fourier feature (RFF) to map nonlinear features to a high-dimensional space. By calculating the cross-covariance matrix of the mapped features, it quantifies and eliminates nonlinear dependencies. Optimize sample weights: With the goal of minimizing the cross covariance between features, the weight optimization formula is as follows: in, For feature dimension, , This is the weighted cross-covariance matrix. The first Column feature vectors express The j-th column eigenvector, The Frobenius norm is defined as the square root of the sum of the squares of the matrix elements. " indicates scalar multiplication. It is the feature matrix after mapping, i.e. ,in For random bias; This causes the weights to be adjusted in a direction that weakens spurious correlations; S5. Target Prediction: The target prediction module uses the target prediction network to predict the target category and location based on the feature map from the feature extraction module and the optimized feature representation from the stable learning module. If using the anchor box method: generate anchor boxes of different scales and aspect ratios on the feature map, and predict the matching degree between the anchor box and the target, i.e., confidence, category, and position offset, through convolutional layers; If there is no anchor box: directly predict the target key points such as corner points, center points, category and size information on the feature map; The non-maximum suppression (NMS) algorithm is used to remove highly overlapping predicted bounding boxes to obtain the final target detection result.
2. The target detection algorithm based on stable learning according to claim 1, characterized in that: In step S2, the standardization process includes: Normalize pixel values to the range of [0,1] or [-1,1]; Data augmentation techniques include, but are not limited to, flipping, rotating, scaling, and cropping.
3. The target detection algorithm based on stable learning according to claim 1, characterized in that: In step S3, the convolutional neural network includes, but is not limited to, ResNet and VGG.
4. The target detection algorithm based on stable learning according to claim 1, characterized in that: In step S4, the stabilization learning module calculates the cross-covariance matrix separately for the spatial dimension of each feature map layer, i.e., the target's position information at that scale, for the features of the entire image and for feature maps of different scales, such as the multi-layer feature map of the FPN structure in target detection, which corresponds to large, medium, and small targets respectively. In this way, false associations between targets of different scales and specific spatial locations can be accurately identified.
5. The target detection algorithm based on stable learning according to claim 3, characterized in that: In step S4, the StableNet sample weighting mechanism is adopted: samples that strengthen false associations are given low weights, and samples that reflect the true characteristics of the target are given high weights, thereby weakening the dependence of the target on irrelevant spatial regions and enabling the model to focus on the discriminative features of the target itself.
6. The target detection algorithm based on stable learning according to claim 1, characterized in that: In step S5, the anchor box method includes, but is not limited to, Faster R-CNN and SSD; Anchor-free methods include, but are not limited to, CornerNet and CenterNet.
7. The target detection algorithm based on stable learning according to claim 1, characterized in that: Step S2 further includes the following sub-steps: S2-1, Small Sample Class Recognition and Dynamic Augmentation: After the original data is standardized and preprocessed with basic augmentation, the number of samples in each category in the training set is counted, a threshold for the number of samples is set, and categories with less than 5% of the total number of samples are defined as small sample categories. For small sample categories, an adaptive augmentation strategy is adopted.
8. The target detection algorithm based on stable learning according to claim 7, characterized in that: In step S2-1, the adaptive enhancement strategy for small samples includes expanding the rotation angle range to ±45°; increasing the scaling ratio range to 0.5-1.5 times; adding mild Gaussian noise; and increasing the number of enhancements so that each small sample generates 3-5 enhanced samples. The sample classes that make up 5% or more of the total sample size are called the majority class samples. The number of augmentation attempts for these samples is limited so that each sample generates 1-2 augmented samples.
9. The target detection algorithm based on stable learning according to claim 8, characterized in that: Based on the content flow in step S2-1, in step S4, when calculating the cross covariance matrix, it is necessary to distinguish the category to which the sample belongs and to separately label the feature vectors of samples in the smaller category. The weight optimization objective was adjusted by adding a penalty term for the contribution of small sample class features to the original formula, resulting in the updated optimized formula: in, For feature dimension, It is the Frobenius norm. For a small sample set of categories, For small sample categories The sample index set, This is the penalty coefficient, used to control the weighting of smaller samples.
10. The target detection algorithm based on stable learning according to claim 9, characterized in that: Based on the content flow in step S2-1, step S5 also includes the following sub-steps: S5-1, Small Sample Class Confidence Calibration: For predicted bounding boxes belonging to small sample categories in the prediction results, based on the confidence distribution of small sample category features recorded during training, dynamic threshold adjustment is used to reduce missed detections due to insufficient samples, such as reducing the confidence screening threshold for small sample categories by 5%-10%. In the process of removing highly overlapping prediction boxes using the non-maximum suppression (NMS) algorithm, a higher IoU threshold is set for the small sample class prediction boxes, such as increasing it from 0.5 to 0.6, to retain more potentially correct small sample target prediction results, and finally obtain the optimized target detection results.