Small sample target detection method and device based on semi-supervised learning

By using a semi-supervised learning method, the deep learning model is optimized using consistency loss and supervised loss, and pseudo-labels are generated for training. This solves the problem of insufficient labeled samples in small sample object detection and achieves efficient object detection results.

CN121982284APending Publication Date: 2026-05-05BEIJING INST OF REMOTE SENSING EQUIP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING INST OF REMOTE SENSING EQUIP
Filing Date
2025-12-30
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In existing technologies, when detecting small-sample targets, the limited number of labeled sample images of the target leads to poor training performance of deep learning models, making it difficult to improve detection accuracy.

Method used

A semi-supervised learning-based approach is adopted, utilizing the labeled data of the first image data and the unlabeled data of the second image data. The weight parameters of the deep learning model are optimized through consistency loss and supervision loss, and pseudo-labels are generated for training to improve the model's detection capability.

Benefits of technology

This approach reduces annotation costs, avoids overfitting, and improves the accuracy and generalization ability of small-sample target detection when only partially labeled data is required.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121982284A_ABST
    Figure CN121982284A_ABST
Patent Text Reader

Abstract

The invention provides a small sample target detection method and device based on semi-supervised learning, and belongs to the field of target detection.The method comprises the steps that first image data and second image data are obtained, and the first image data comprise labels; for a sample image of the training data set, cyclically executing the following training steps: generating a first prediction result by using a first deep learning model, and generating a second prediction result by using a second deep learning model; calculating a consistency loss by using the first prediction result and the second prediction result; calculating supervision loss by using the label of the first image and the first prediction result; optimizing the weight parameter of the first deep learning model by using the consistency loss and the supervision loss, and optimizing the weight parameter of the second deep learning model by using the weight parameter of the first deep learning model; and performing target detection by using the second deep learning model after the weight parameter optimization is completed. According to the invention, the detection precision of small sample targets can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of target detection technology, and more specifically, relates to a small sample target detection method and device based on semi-supervised learning. Background Technology

[0002] Deep learning models are commonly used for object detection in related technologies, but the limited number of labeled sample images of the target often hinders effective training of deep learning models. Therefore, a more efficient object detection scheme is urgently needed to improve the accuracy of object detection with limited sample sizes. Summary of the Invention

[0003] The purpose of this application is to provide a method and apparatus for small sample target detection based on semi-supervised learning, so as to improve the accuracy of small sample target detection.

[0004] A first aspect of this application provides a few-shot target detection method based on semi-supervised learning, comprising:

[0005] Obtain the training dataset corresponding to the target to be detected; the training dataset contains first image data and second image data, and the first image data contains labels;

[0006] For the sample images in the training dataset, the following training steps are executed iteratively until the predetermined training conditions are met, resulting in a second deep learning model with optimized weight parameters:

[0007] A first image is selected from the first image data, and a second image of the same category as the first image is selected from the second image data. A first prediction result for the first image is generated using a first deep learning model, and a second prediction result for the second image is generated using a second deep learning model. The weight parameters and network structure of the second deep learning model and the first deep learning model are the same before the training steps are performed.

[0008] Calculate the consistency loss between the first deep learning model and the second deep learning model using the first and second prediction results;

[0009] The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result;

[0010] The weight parameters of the first deep learning model are optimized using consistency loss and supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model.

[0011] A second deep learning model, optimized using weight parameters, is used for object detection.

[0012] A second aspect of this application provides a small-sample target detection device based on semi-supervised learning, comprising:

[0013] The sample determination module is used to obtain the training dataset corresponding to the target to be detected; the training dataset includes first image data and second image data, and the first image data includes labels;

[0014] The model training module is used to iteratively execute the following training steps on sample images in the training dataset until the predetermined training conditions are met, resulting in a second deep learning model with optimized weight parameters:

[0015] A first image is selected from the first image data, and a second image of the same category as the first image is selected from the second image data. A first prediction result for the first image is generated using a first deep learning model, and a second prediction result for the second image is generated using a second deep learning model. The weight parameters and network structure of the second deep learning model and the first deep learning model are the same before the training steps are performed.

[0016] Calculate the consistency loss between the first deep learning model and the second deep learning model using the first and second prediction results;

[0017] The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result;

[0018] The weight parameters of the first deep learning model are optimized using consistency loss and supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model.

[0019] The object detection module is used to perform object detection using a second deep learning model optimized with weight parameters.

[0020] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described few-sample target detection method based on semi-supervised learning.

[0021] In a fourth aspect of this application, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the aforementioned few-sample target detection method based on semi-supervised learning.

[0022] A fifth aspect of this application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implement the steps of the above-described few-sample target detection method based on semi-supervised learning.

[0023] The beneficial effects of the small-sample target detection method and apparatus based on semi-supervised learning provided in this application are as follows:

[0024] Analysis of the embodiments of this application shows that the embodiments of this application only require partial annotation of the first image data, and the unlabeled second image after category screening can provide implicit supervision signals through the consistency loss calculation of the dual models (first deep learning model and second deep learning model). This can significantly reduce the annotation cost and avoid overfitting caused by relying only on a small amount of labeled data, thereby maximizing the value of the data and effectively improving the accuracy of small sample target detection. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 A flowchart illustrating a few-sample target detection method based on semi-supervised learning provided in an embodiment of this application;

[0027] Figure 2 This is a network architecture diagram of YOLOv11 provided in an embodiment of this application;

[0028] Figure 3 A flowchart of the YOLOv11 training process provided in an embodiment of this application;

[0029] Figure 4 A flowchart of the inference process of YOLOv11 provided in an embodiment of this application;

[0030] Figure 5 A flowchart illustrating a small-sample target detection method based on semi-supervised learning, provided for another embodiment of this application;

[0031] Figure 6 A schematic diagram of the knowledge distillation process provided in one embodiment of this application;

[0032] Figure 7 A schematic diagram of a knowledge distillation process is provided for another embodiment of this application;

[0033] Figure 8 This is a structural block diagram of a small sample target detection device based on semi-supervised learning provided in an embodiment of this application;

[0034] Figure 9 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0035] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0036] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.

[0037] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a few-sample object detection method based on semi-supervised learning provided in an embodiment of this application. The method can be executed by an electronic device and may include:

[0038] S101: Obtain the training dataset corresponding to the target to be detected; the training dataset includes first image data and second image data, and the first image data includes labels.

[0039] In this embodiment, both the first image data and the second image data contain multiple images to be identified. The first image data is small sample data, and its labels are the already labeled data. The second image data can be a public dataset.

[0040] S102: For the sample images in the training dataset, repeatedly execute the following training steps until the predetermined training conditions are met, to obtain the second deep learning model with optimized weight parameters:

[0041] A first image is selected from the first image data, and a second image of the same category as the first image is selected from the second image data. A first prediction result for the first image is generated using a first deep learning model, and a second prediction result for the second image is generated using a second deep learning model. The weight parameters and network structure of the second deep learning model are the same as those of the first deep learning model before the training step is performed.

[0042] Calculate the consistency loss between the first deep learning model and the second deep learning model using the first and second prediction results;

[0043] The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result;

[0044] The weight parameters of the first deep learning model are optimized using consistency loss and supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model.

[0045] In this embodiment, the predetermined training conditions include, but are not limited to, reaching a predetermined number of training rounds and achieving a preset training accuracy.

[0046] S103: Target detection is performed using a second deep learning model optimized with weight parameters.

[0047] In this embodiment, after training the first deep learning model and the second deep learning model, the second deep learning model can be used as the final model for object detection. The specific target to be detected can be determined according to actual needs. For example, if the target is an animal, the second deep learning model can be trained using an image containing the animal, combined with steps S101 to S103. Subsequently, during actual detection, the image to be detected containing the animal is input into the second deep learning model to identify the type of animal in the image.

[0048] The concept of this application embodiment is as follows: when there is only a small amount of target labeled data (i.e., the first image data), the detection generalization ability of the target is improved by using a public dataset (i.e., the second image data). Specifically, the model is initialized with a small amount of labeled data first, and then semi-supervised training is performed using unlabeled data in the public dataset. The detection ability of the model for special targets is improved through a pseudo-label mechanism.

[0049] Analysis of the embodiments of this application shows that the embodiments of this application only require partial annotation of the first image data, and the unlabeled second image after category screening can provide implicit supervision signals through the consistency loss calculation of the dual models (first deep learning model and second deep learning model). This can significantly reduce the annotation cost and avoid overfitting caused by relying only on a small amount of labeled data, thereby maximizing the value of the data and effectively improving the accuracy of small sample target detection.

[0050] In one embodiment of this application, generating a second prediction result for a second image using a second deep learning model includes:

[0051] The second deep learning model is used to predict the bounding box and class probability of the second image;

[0052] Bounding boxes with class probabilities greater than a predetermined probability are used as the second prediction results for the second image.

[0053] In this embodiment, the second image data can be input into the target deep learning model for forward propagation to generate bounding boxes and class probabilities corresponding to each second image. Bounding boxes with class probabilities greater than a predetermined probability (e.g., 70%) are retained as target boxes. After NMS processing, overlapping boxes are removed, and the relevant parameters of the remaining target boxes are the second prediction result (i.e., pseudo-label) of this embodiment.

[0054] In one embodiment of this application, training a target deep learning model using first image data includes:

[0055] When the number of training rounds of the target deep learning model is less than or equal to the predetermined number of rounds, the weight parameters of the backbone network in the target deep learning model remain unchanged, and the weight parameters of the detection head of the target deep learning model are updated using the first image data.

[0056] When the number of training rounds of the target deep learning model exceeds the predetermined number of rounds, the weight parameters of the backbone network and the weight parameters of the detection head of the target deep learning model are updated simultaneously using the first image data until the number of training rounds reaches the predetermined maximum number of rounds.

[0057] The target deep learning model that has reached the maximum number of training epochs is defined as the target deep learning model that has been successfully trained.

[0058] In this embodiment, the target deep learning model can be YOLOv11. YOLOv11 has fast detection speed, high accuracy, and is easy to deploy in engineering, making it suitable as a basic detector. This model treats the evaluation of the x-coordinate, y-coordinate, width, and height of the target bounding box, as well as the evaluation of the class probability, in the target detection task as a continuous evaluation problem. It regards the target detection task as a regression problem, eliminating complex operations such as generating candidate boxes. The task can be completed in a single forward propagation, making it suitable for real-time detection scenarios.

[0059] For reference Figure 2 , Figure 2 The YOLOv11 network architecture diagram is shown below for reference. Figure 2 YOLOv11 employs a three-tier architecture: a backbone network, a neck network, and a detection head. The backbone network extracts features from the input image, creating multi-level feature maps. The neck network fuses features, aggregating multi-scale features extracted by the backbone to enhance detection capabilities for targets of different sizes. The detection head generates the final prediction output, including bounding boxes, confidence scores, and class probabilities. The YOLOv11 training process includes a preprocessing stage, a training stage, and a model validation stage. The preprocessing stage loads the model file, scales the training images to a fixed size, and uses scaling and flipping techniques to increase data diversity. During the training stage, the model iteratively optimizes the weights, gradually decreasing the loss function. The model validation stage uses a validation set to evaluate the performance of the trained model, typically using precision and recall as evaluation metrics.

[0060] The training process for YOLOv11 can be found by referring to [reference needed]. Figure 3 The reasoning process can be referenced. Figure 4 , Figure 3This demonstrates the workflow of a single training phase of YOLOv11; the complete training process is simply a loop through this single phase. During the inference phase, the model does not need to perform iterative optimization of its own weights, therefore backpropagation is unnecessary. Figure 4 During the inference process, the target box can be predicted directly through forward propagation.

[0061] In this embodiment, a pre-trained weight file can be obtained, and the weight parameters of the pre-trained weight file can be directly updated using the first image to obtain the target deep learning model. Specifically, the training strategy can be as follows: train for a total of 50 epochs. For the first 40 epochs, the learning rate is set to 0.02 (for illustrative purposes only), and the parameter updates of the backbone network are frozen, updating only the parameters of the detection head. For the last 10 epochs, the learning rate is reduced to 0.001 (for illustrative purposes only), all parameters are unfrozen, and the model is fine-tuned to obtain the initial model yolo-init (i.e., the target deep learning model).

[0062] In one embodiment of this application, the weight parameters of a first deep learning model are optimized using consistency loss and supervision loss, including:

[0063] The total loss is calculated using the first formula, and the weight parameters of the first deep learning model are then optimized using this total loss. The first formula is:

[0064] L total =L sup +λ(t)L cons

[0065] Among them, L total For the total loss, L sup For consistency loss, L cons For supervised loss, λ(t) is a weight function that varies with the number of training steps or training rounds.

[0066] In one embodiment of this application, λ(t) is positively correlated with the number of training steps or training rounds.

[0067] In one embodiment of this application, the few-shot object detection method based on semi-supervised learning further includes:

[0068] The first and second deep learning models are initialized using the target deep learning model.

[0069] In one embodiment of this application, before generating a first prediction result for a first image using a first deep learning model and a second prediction result for a second image using a second deep learning model, the few-shot object detection method based on semi-supervised learning further includes:

[0070] Perform strong enhancement processing on the first image;

[0071] The second image is then subjected to weak enhancement processing.

[0072] In this embodiment, strong enhancement processing can be implemented using Mosaic, while weak enhancement processing uses simple operations such as random flipping and slight scaling.

[0073] In one embodiment of this application, optimizing the weight parameters of a first deep learning model using the total loss includes:

[0074] The weight parameters of the first deep learning model are updated using the total loss and the gradient descent method.

[0075] In one embodiment of this application, optimizing the weight parameters of a second deep learning model using the weight parameters of a first deep learning model includes:

[0076] The weight parameters of the second deep learning model are obtained by performing an exponential moving average on the weight parameters of the first deep learning model.

[0077] In one embodiment of this application, both the first deep learning model and the second deep learning model are YOLOv11 models.

[0078] In one specific implementation of this application, reference can be made to Figure 5 A few-shot object detection method based on semi-supervised learning can include four stages:

[0079] The first phase involves data preparation and preprocessing. A small amount of labeled data for specific targets is collected as the specific target dataset (i.e., the first image data) and the public dataset COCO (i.e., the second image data). All collected images are uniformly sized to 640×640 pixels (other file sizes are also possible; this is just an example), and labeled files are generated. Each labeled file corresponds to one image. The labeled file can be a TXT text document, with each line marking information about a target in the corresponding image, including, but not limited to: target category number, normalized x-coordinate of target center, normalized y-coordinate of target center, normalized width of target, and normalized height of target. The labeled files for the public dataset can be converted from JSON format, while the data in the specific target dataset is manually labeled.

[0080] Phase two is model initialization and supervised training. In this embodiment, the pre-trained weight file yolov11n.pt corresponding to COCO can be obtained. Only the first image data is used to train it. The training strategy can be as follows: train for 50 rounds, i.e., 50 epochs. During the first 40 epochs, the learning rate is set to 0.02 and the parameter updates of the backbone network are frozen, and only the parameters of the detection head are updated; in the last 10 epochs, the learning rate is reduced to 0.001, all parameters are unfrozen, and the model is finally fine-tuned to obtain the preliminary model yolo-init (i.e., the target deep learning model).

[0081] Phase three is semi-supervised training. The input is the training dataset and the initial model yolo-init, which mainly includes pseudo-label generation and knowledge distillation steps to generate a new object detection model. A detailed description follows:

[0082] In the pseudo-label generation step (i.e., the step of determining the second prediction result corresponding to the second image), the public dataset COCO can be fed into the yolo-init model (or the second deep learning model in each round) for forward propagation to generate bounding boxes and class probabilities for each image. Target boxes with class probabilities greater than a predetermined probability (e.g., 70%) are retained, and then NMS processing is used to remove overlapping boxes. The remaining target boxes are the second prediction results (i.e., pseudo-labels).

[0083] For details on the knowledge distillation steps, please refer to [link / reference]. Figure 6 and Figure 7 , Figure 6 and Figure 7 The detailed and simplified processes of knowledge distillation are presented respectively:

[0084] The first step is initialization. The initial model yolo-init is set as the first deep learning model (i.e., the Student model), and a copy of the model is made as the second deep learning model (i.e., the Teacher model). Both models have the same parameters during the initialization phase, and the parameter structures of the Teacher and Student models are identical, as shown in the following formula:

[0085]

[0086] in, This represents the weight parameters of the Teacher model. This represents the weight parameters of the Student model.

[0087] The next step is to train the Student model and update its weight parameters using the gradient descent algorithm, as shown in the following formula:

[0088]

[0089] in, This represents the parameters of the Student model after the t-th round of training. Let L represent the parameters of the Student model after the (t-1)th training round, where η is the learning rate and L is the training parameter. student The loss function for the Student model can be a hybrid loss function consisting of consistency loss and supervision loss as described in the above embodiment.

[0090] Next, the weight parameters of the Teacher model are updated according to the EMA mechanism. The Teacher model parameters are a weighted average of the Student model parameters, with more recent parameters given higher weights, as shown in the following formula:

[0091]

[0092] in, This represents the weight parameters of the Teacher model after the t-th iteration. The weights of the Student model after the t-th iteration are represented by α, which is a smoothing coefficient, typically between 0.99 and 0.999. A value further to the left indicates a faster Teacher model that follows the Student model's updates, while a value further to the right indicates a slower update but retains more historical information. Specific values ​​can be adjusted experimentally. In this embodiment, the EMA method is used, which reduces random fluctuations in the Student model's training by weighted averaging of historical parameters, resulting in a more stable parameter trajectory for the Teacher model and avoiding overfitting due to local noise.

[0093] In this embodiment, the detailed calculation steps in the knowledge distillation process can be found as follows:

[0094] The knowledge distillation step begins by dividing the augmented dataset into several batches. The weakly augmented public dataset (second image data) is input into the Teacher model to generate pseudo-labels, which are then used to constrain consistency with the output of the Student model. The strongly augmented special target dataset (first image data) is input into the Student model for inference.

[0095] During forward propagation, the weakly enhanced view is... Input teacher model θ t To obtain its prediction results Enhance view Input student model θ s To obtain its prediction results

[0096] In this embodiment, the loss function can be calculated based on the supervision loss and the consistency loss.

[0097] The supervised loss is calculated only on strongly augmented views, using real-world labeled y. i The prediction P of the student model s Calculate the target detection loss (i.e., the supervision loss). In this embodiment, the loss function can be defined as regression loss + GIoU loss, i.e., L sup =L det (P s ,y i );

[0098] Among them, consistency loss refers to: calculating the student model's response to the strongly augmented view P. s The prediction of P for weakly augmented views by the teacher model. t The difference between them, here the loss function can be defined as mean squared error + KL divergence in this embodiment, that is, L cons =D(P) s ,P t The specific calculation method is described as follows:

[0099] Regarding the calculation of the mean squared error (MSE): Calculate the feature mean μ of the region corresponding to the pseudo-label box generated by the Teacher model. t , and the feature mean μ of the region corresponding to the Student prediction box s Then calculate the MSE. The specific calculation formula is as follows:

[0100]

[0101] Among them, L MSE Indicates mean square error. Let be the arithmetic mean of all features of the Teacher model in class c. Let be the arithmetic mean of all features of the Student model for class c, where C is the total number of classes in the public dataset. The above formula forces the Student and Teacher models to maintain a consistent distribution of similar targets in the feature space.

[0102] Regarding the calculation of KL divergence: KL divergence enables the Student model to learn the classification calibration ability of the Teacher model. It constrains the Student model's classification head, making its output probability distribution as close as possible to the probability distribution of the Teacher model's pseudo-labels. The specific calculation formula is as follows:

[0103]

[0104] Among them, L KLThis represents the KL divergence, where N is the number of regions of interest involved in the calculation, i.e., the high-confidence pseudo-labeled boxes involved in the calculation. It is the softmax probability distribution output by the Teacher model for the i-th bounding box. It is the softmax probability distribution of the Student model output for the i-th box.

[0105] In summary, the formula for the total consistency loss is as follows:

[0106] L cons =λ KL ·L KL +λ feat ·L MSE

[0107] Where λ KL , λ feat These are all predetermined weight parameters used to balance the weights, and can be set according to specific needs in actual applications.

[0108] When determining the loss function, the total loss described in this embodiment is a weighted sum of the two, i.e., L total =L sup +λ(t)L cons λ(t) is a weight function that varies with the number of training steps / rounds. λ(t) can be set to start with a small value and gradually increase as the number of training steps or rounds increases, allowing the first and second deep learning models to initially focus more on labeled data and gradually rely on consistency constraints later.

[0109] Finally, the training and updating process is repeated. The steps of training the Student model and updating the Teacher model parameters are repeated until training is complete. The Teacher model always uses EMA to smooth the parameters of the Student model to avoid overfitting and local noise.

[0110] Phase four allows the Teacher model to be deployed on appropriate platforms (e.g., Linux embedded platforms) for edge engineering applications. The model files generated in the preceding steps can be PyTorch training framework-supported PT model files. In practice, to enable deployment on various Linux embedded platforms and utilize their hardware acceleration technologies, the PT model files can be converted to ONNX format model files. ONNX defines an open, neutral model representation standard. Once converted to ONNX, the model can be decoupled from the original PyTorch training framework, thus enabling widespread application across multiple scenarios.

[0111] In the knowledge distillation step, before selecting a second image from the second image data that matches the category of the first image, the public dataset COCO (or the second image data) can be input into the second deep learning model to filter out data whose category probability is greater than a predetermined probability, which will then be used as the data source for selecting the second image. In other words, the confidence-based pseudo-label filtering operation can be performed once or multiple times, depending on the actual needs; this embodiment does not impose any limitations on this.

[0112] Analysis of this embodiment reveals the following key points:

[0113] First, the YOLOv11 model is used as the target deep learning model, which has fast detection speed, high accuracy, and is easy to deploy in engineering, making it suitable as a basic detector.

[0114] Second, a semi-supervised learning method was adopted, which uses the trained model to predict unlabeled data, and uses the prediction results with high confidence as pseudo-labels for the next round of training. Then, pseudo-labels are generated iteratively and the model is retrained to gradually improve performance.

[0115] Third, targeted data augmentation strategies were adopted. Mosaic strong augmentation was performed on a small number of special targets in the supervised branch to improve the robustness of the model. Weak augmentation of flip-scaling class was performed on public datasets to generate stable pseudo-labels. For different augmentation versions of the same type of target, the model output was constrained to be consistent to improve generalization.

[0116] Fourth, knowledge distillation involves using teacher models to guide student model training, stabilizing the quality of pseudo-labels, filtering low-confidence pseudo-labels to prevent noise accumulation, and finally gradually increasing the proportion of pseudo-labels by introducing unlabeled data from easy to difficult data, thereby achieving knowledge distillation.

[0117] Corresponding to the few-shot object detection method based on semi-supervised learning in the above embodiment, Figure 8 This is a structural block diagram of a small-sample target detection device based on semi-supervised learning, provided in one embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 8 The small sample target detection device 20 based on semi-supervised learning includes: a sample determination module 21, a model training module 22, and a target detection module 23.

[0118] The sample determination module 21 is used to obtain the training dataset corresponding to the target to be detected; the training dataset includes first image data and second image data, and the first image data includes labels.

[0119] Model training module 22 is used to iteratively execute the following training steps on sample images of the training dataset until the predetermined training conditions are met, thereby obtaining a second deep learning model with optimized weight parameters:

[0120] A first prediction result for a first image is generated using a first deep learning model, and a second prediction result for a second image is generated using a second deep learning model; the weight parameters and network structure of the second deep learning model are the same as those of the first deep learning model before the training step is performed.

[0121] Calculate the consistency loss between the first deep learning model and the second deep learning model using the first and second prediction results;

[0122] The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result;

[0123] The weight parameters of the first deep learning model are optimized using consistency loss and supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model.

[0124] The object detection module 23 is used to perform object detection using a second deep learning model optimized with weight parameters.

[0125] In one embodiment of this application, the model training module 22 is specifically used for:

[0126] The second deep learning model is used to predict the bounding box and class probability of the second image;

[0127] Bounding boxes with class probabilities greater than a predetermined probability are used as the second prediction results for the second image.

[0128] In one embodiment of this application, the sample determination module 21 is specifically used for:

[0129] When the number of training rounds of the target deep learning model is less than or equal to the predetermined number of rounds, the weight parameters of the backbone network in the target deep learning model remain unchanged, and the weight parameters of the detection head of the target deep learning model are updated using the first image data.

[0130] When the number of training rounds of the target deep learning model exceeds the predetermined number of rounds, the weight parameters of the backbone network and the weight parameters of the detection head of the target deep learning model are updated simultaneously using the first image data until the number of training rounds reaches the predetermined maximum number of rounds.

[0131] The target deep learning model that has reached the maximum number of training epochs is defined as the target deep learning model that has been successfully trained.

[0132] In one embodiment of this application, the model training module 22 is specifically used for:

[0133] The total loss is calculated using the first formula, and the weight parameters of the first deep learning model are then optimized using this total loss. The first formula is:

[0134] L total =L sup +λ(t)L cons

[0135] Among them, L total For the total loss, L sup For consistency loss, L cons For supervised loss, λ(t) is a weight function that varies with the number of training steps or training rounds.

[0136] In one embodiment of this application, λ(t) is positively correlated with the number of training steps or training rounds.

[0137] In one embodiment of this application, the model training module 22 is further configured to:

[0138] The first and second deep learning models are initialized using the target deep learning model.

[0139] In one embodiment of this application, before generating a first prediction result for a first image using a first deep learning model and a second prediction result for a second image using a second deep learning model, the model training module 22 is further configured to:

[0140] Perform strong enhancement processing on the first image;

[0141] The second image is then subjected to weak enhancement processing.

[0142] In one embodiment of this application, the model training module 22 is specifically used for:

[0143] The weight parameters of the first deep learning model are updated using the total loss and the gradient descent method.

[0144] In one embodiment of this application, the model training module 22 is specifically used for:

[0145] The weight parameters of the second deep learning model are obtained by performing an exponential moving average on the weight parameters of the first deep learning model.

[0146] In one embodiment of this application, both the first deep learning model and the second deep learning model are YOLOv11 models.

[0147] See Figure 9 , Figure 9 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 9The electronic device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of each module / unit in the above-described device embodiments, for example... Figure 8 The functions of the sample determination module 21, model training module 22, and target detection module 23 are shown.

[0148] It should be understood that, in the embodiments of this application, the processor 301 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0149] Input device 302 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 303 may include a display (LCD, etc.), a speaker, etc.

[0150] The memory 304 may include read-only memory and random access memory, and provides instructions and data to the processor 301. A portion of the memory 304 may also include non-volatile random access memory.

[0151] In specific implementations, the processor 301, input device 302, and output device 303 described in the embodiments of this application can execute the implementation method described in the semi-supervised learning-based few-sample target detection method provided in the embodiments of this application, or they can execute the implementation method of the electronic device described in the embodiments of this application, which will not be repeated here.

[0152] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to implement these processes. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0153] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0154] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0155] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the electronic devices and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0156] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces or modules, or it may be an electrical, mechanical, or other form of connection.

[0157] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.

[0158] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0159] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A few-sample target detection method based on semi-supervised learning, characterized in that, include: Obtain the training dataset corresponding to the target to be detected; The training dataset includes first image data and second image data, wherein the first image data includes labels; For the training dataset, the following training steps are executed iteratively until the predetermined training conditions are met, resulting in a second deep learning model with optimized weight parameters: A first image is selected from the first image data, and a second image with the same category as the first image is selected from the second image data. A first prediction result for the first image is generated using a first deep learning model, and a second prediction result for the second image is generated using a second deep learning model. The weight parameters and network structure of the second deep learning model and the first deep learning model are the same before the training step is performed. The consistency loss between the first deep learning model and the second deep learning model is calculated using the first prediction result and the second prediction result. The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result. The weight parameters of the first deep learning model are optimized using the consistency loss and the supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model. A second deep learning model, optimized using weight parameters, is used for object detection.

2. The few-sample target detection method based on semi-supervised learning as described in claim 1, characterized in that, The second prediction result generated using the second deep learning model for the second image includes: The bounding box and class probability of the second image are predicted using a second deep learning model; The bounding box with a class probability greater than a predetermined probability is used as the second prediction result corresponding to the second image.

3. The few-sample target detection method based on semi-supervised learning as described in claim 2, characterized in that, The step of training a target deep learning model using the first image data includes: When the number of training rounds of the target deep learning model is less than or equal to the predetermined number of rounds, the weight parameters of the backbone network in the target deep learning model remain unchanged, and the weight parameters of the detection head of the target deep learning model are updated using the first image data. When the number of training rounds of the target deep learning model is greater than the predetermined number of rounds, the weight parameters of the backbone network and the weight parameters of the detection head of the target deep learning model are updated simultaneously using the first image data until the number of training rounds reaches the predetermined maximum number of rounds. The target deep learning model that has reached the maximum number of training epochs is defined as the target deep learning model that has been successfully trained.

4. The few-sample target detection method based on semi-supervised learning as described in claim 2, characterized in that, Also includes: The first deep learning model and the second deep learning model are initialized using the target deep learning model.

5. The few-sample target detection method based on semi-supervised learning as described in claim 1, characterized in that, The optimization of the weight parameters of the first deep learning model using the consistency loss and the supervision loss includes: The total loss is calculated using a first formula, and the weight parameters of the first deep learning model are optimized using the total loss; the first formula is: L total L sup +λ(t)L cons Among them, L total For the total loss, L sup For the aforementioned consistency loss, L cons Let λ(t) be the supervised loss, and let λ(t) be the weight function that varies with the number of training steps or training rounds.

6. The few-sample target detection method based on semi-supervised learning as described in claim 5, characterized in that, The λ(t) is positively correlated with the number of training steps or training rounds.

7. The few-sample target detection method based on semi-supervised learning as described in claim 1, characterized in that, Before generating a first prediction result for the first image using a first deep learning model and a second prediction result for the second image using a second deep learning model, the few-shot object detection method based on semi-supervised learning further includes: The first image is subjected to strong enhancement processing; The second image is then subjected to weak enhancement processing.

8. The few-sample target detection method based on semi-supervised learning as described in claim 1, characterized in that, The step of optimizing the weight parameters of the second deep learning model using the weight parameters of the first deep learning model includes: The weight parameters of the second deep learning model are obtained by performing an exponential moving average on the weight parameters of the first deep learning model.

9. The few-sample target detection method based on semi-supervised learning as described in any one of claims 1 to 8, characterized in that, Both the first deep learning model and the second deep learning model are YOLOv11 models.

10. A small-sample target detection device based on semi-supervised learning, characterized in that, include: The sample determination module is used to obtain the training dataset corresponding to the target to be detected; The training dataset includes first image data and second image data, wherein the first image data includes labels; The model training module is used to iteratively execute the following training steps on the sample images of the training dataset until the predetermined training conditions are met, thereby obtaining a second deep learning model with optimized weight parameters: A first image is selected from the first image data, and a second image with the same category as the first image is selected from the second image data. A first prediction result for the first image is generated using a first deep learning model, and a second prediction result for the second image is generated using a second deep learning model. The weight parameters and network structure of the second deep learning model and the first deep learning model are the same before the training step is performed. The consistency loss between the first deep learning model and the second deep learning model is calculated using the first prediction result and the second prediction result. The supervised loss of the first deep learning model is calculated using the label of the first image and the first prediction result. The weight parameters of the first deep learning model are optimized using the consistency loss and the supervision loss, and the weight parameters of the second deep learning model are optimized using the weight parameters of the first deep learning model. The object detection module is used to perform object detection using a second deep learning model optimized with weight parameters.