Training methods for object detection models, and related methods, devices, and media.

By combining self-distillation and unsupervised learning in the object detection model and calculating the loss function using unlabeled and labeled sample images, the problem of low detection accuracy and high training complexity caused by scarce labeled data is solved, and efficient object detection in the catering scenario is achieved.

CN117058478BActive Publication Date: 2026-05-26HANGZHOU HUACHENG SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU HUACHENG SOFTWARE TECH CO LTD
Filing Date
2023-07-13
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In the context of scarce labeled data in the catering industry, the detection accuracy of object detection models is poor, and existing training methods are complex and inefficient.

Method used

By acquiring unlabeled and labeled sample images, and using a combination of self-distillation and unsupervised learning, the network parameters of the object detection model are adjusted by calculating the loss function, including self-distillation loss, unsupervised loss, and supervised loss, thereby improving the model's detection accuracy and reducing training complexity.

Benefits of technology

With limited labeled data, the detection accuracy of the object detection model was improved, and the training complexity was reduced, avoiding additional model modifications and pre-training operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117058478B_ABST
    Figure CN117058478B_ABST
Patent Text Reader

Abstract

This application discloses a training method for an object detection model, as well as related methods, apparatus, devices, and media. The training method for the object detection model includes: acquiring unlabeled sample images required for the current iteration and acquiring labeled sample images; acquiring the object detection model trained in the previous iteration, acquiring a first detection result for the labeled sample images and a second detection result for the unlabeled sample images of the current iteration, and acquiring the object detection model for the current iteration, acquiring a third detection result for the labeled sample images and a fourth detection result for the unlabeled sample images of the current iteration; obtaining a first loss, a second loss, and a third loss based on the above detection results; and adjusting the network parameters of the object detection model based on the first loss, the second loss, and the third loss. This scheme can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is limited labeled data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a training method for an object detection model, as well as related methods, apparatus, devices and media. Background Technology

[0002] With the continuous development of artificial intelligence technology, it has gradually been applied in many aspects of life and production. Among these applications, object detection, as one of the important ones, has received widespread attention.

[0003] The detection accuracy of object detection models is closely related to the quantity and quality of labeled data. However, in scenarios such as detecting the "three whites" (white parts, white parts, and white parts) in the food service industry, labeled data is often scarce, making effective model training impossible and resulting in poor detection accuracy, or even unusable models. Although some training methods have been proposed in recent years to overcome this problem as much as possible, existing methods often require additional workload beyond normal training. Therefore, how to improve the detection accuracy of object detection models and reduce the complexity of training them when labeled data is limited has become an urgent problem to be solved. Summary of the Invention

[0004] The main technical problem addressed by this application is to provide a training method for an object detection model, as well as related methods, devices, components, and media, which can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is limited labeled data.

[0005] To address the aforementioned issues, the first aspect of this application provides a training method for an object detection model, comprising: acquiring unlabeled sample images required for the current iteration and acquiring labeled sample images; acquiring the object detection model trained in the previous iteration of the current iteration, acquiring a first detection result for the labeled sample images and a second detection result for the unlabeled sample images of the current iteration, and acquiring the object detection model of the current iteration, acquiring a third detection result for the labeled sample images and a fourth detection result for the unlabeled sample images of the current iteration; obtaining a first loss based on the difference between the first detection result and the third detection result, obtaining a second loss based on the difference between the pseudo-labels used by the second detection result and the fourth detection result, and obtaining a third loss based on the difference between the labeled labels of the labeled sample images and the third detection result; and adjusting the network parameters of the object detection model based on the first loss, the second loss, and the third loss.

[0006] To address the aforementioned issues, a second aspect of this application provides an object detection method, comprising: acquiring a target image; detecting the target image based on an object detection model to obtain a detection result for the target image; wherein the object detection model is obtained by the training method of the object detection model in the first aspect described above.

[0007] To address the aforementioned problems, a third aspect of this application provides a training apparatus for an object detection model, comprising: an acquisition module, a detection module, a measurement module, and an adjustment module. The acquisition module is used to acquire unlabeled sample images required for the current iteration and to acquire labeled sample images. The detection module is used to acquire the object detection model trained in the previous iteration, acquire a first detection result for labeled sample images and a second detection result for unlabeled sample images in the current iteration, and acquire the object detection model for the current iteration, acquire a third detection result for labeled sample images and a fourth detection result for unlabeled sample images in the current iteration. The measurement module is used to obtain a first loss based on the difference between the first and third detection results, a second loss based on the difference between the pseudo-labels used as the second detection results and the fourth detection result, and a third loss based on the difference between the labeled labels of the labeled sample images and the third detection result. The adjustment module is used to adjust the network parameters of the object detection model based on the first, second, and third losses.

[0008] To address the aforementioned problems, a fourth aspect of this application provides a target detection apparatus, comprising: an acquisition module and a detection module; the acquisition module is used to acquire a target image; the detection module is used to detect the target image based on a target detection model to obtain a detection result of the target image; wherein the target detection model is obtained from the training device of the target detection model in the third aspect described above.

[0009] To address the aforementioned problems, a fifth aspect of this application provides an electronic device comprising a memory and a processor coupled to each other. The memory stores program instructions, and the processor executes the program instructions to implement the training method for the target detection model in the first aspect, or to implement the target detection method in the second aspect.

[0010] To address the aforementioned problems, a sixth aspect of this application provides a camera device including an optical element and an electronic device as described in the fifth aspect above, wherein the optical element is used to generate image data and is coupled to a processor in the electronic device.

[0011] To address the aforementioned problems, a seventh aspect of this application provides a computer-readable storage medium storing program instructions executable by a processor. These program instructions are used to implement the training method for the target detection model in the first aspect or to implement the target detection method in the second aspect.

[0012] The above scheme obtains unlabeled sample images required for the current iteration and labeled sample images. Based on this, it obtains the target detection model trained in the previous iteration. It then obtains the first detection result for labeled sample images and the second detection result for unlabeled sample images in the current iteration. It also obtains the target detection model for the current iteration and obtains the third detection result for labeled sample images and the fourth detection result for unlabeled sample images in the current iteration. Based on the difference between the first and third detection results, a first loss is obtained. Based on the difference between the pseudo-labels used by the second detection results and the fourth detection results, a second loss is obtained. Based on the difference between the labeled labels of the labeled sample images and the third detection results, a third loss is obtained. Based on the first, second, and third losses, the network parameters of the target detection model are adjusted. On the one hand, the first and second losses can force the target detection model for the current iteration to learn and train through a combination of self-distillation and unsupervised training, without performing additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, the third loss can further force the target detection model to learn from labeled data. Therefore, combining the three loss functions can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is limited labeled data. Attached Figure Description

[0013] Figure 1 This is a flowchart illustrating an embodiment of the training method for the object detection model of this application;

[0014] Figure 2 This is a schematic diagram of the framework of an embodiment of the object detection model;

[0015] Figure 3 yes Figure 2 A schematic diagram of the framework of an embodiment of a feature extraction network;

[0016] Figure 4 This is a training process diagram of an embodiment of the training object detection model;

[0017] Figure 5 yes Figure 1 A flowchart illustrating an embodiment of step S11;

[0018] Figure 6 This is a flowchart illustrating another embodiment of the training method for the object detection model of this application;

[0019] Figure 7 This is a flowchart illustrating an embodiment of the target detection method of this application;

[0020] Figure 8This is a schematic diagram of the framework of an embodiment of the training device for the object detection model of this application;

[0021] Figure 9 This is a schematic diagram of the framework of an embodiment of the target detection device of this application;

[0022] Figure 10 This is a schematic diagram of the framework of an embodiment of the electronic device of this application;

[0023] Figure 11 This is a schematic diagram of the frame of an embodiment of the camera device of this application;

[0024] Figure 12 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0025] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0026] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0027] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.

[0028] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the training method for the object detection model of this application. Specifically, it may include the following steps:

[0029] Step S11: Obtain the unlabeled sample images required for the current iteration, and obtain the labeled sample images.

[0030] In one implementation scenario, to improve the training efficiency of the object detection model, different training strategies can be adopted for different training stages. Specifically, before acquiring the unlabeled sample images required for the current iteration, the training stage of the current iteration can be determined first. If the current iteration is in the middle of training, step S11 and subsequent steps can be executed. Furthermore, depending on whether the current iteration is in the early or late training stage, the object detection model for the current iteration can be trained using the labeled sample images required for the current iteration. In this approach, when the current iteration is determined to be in the middle of training, meaning the object detection model already possesses preliminary detection performance, the steps of acquiring the unlabeled sample images required for the current iteration and subsequent steps are executed. Therefore, in the middle of training, both unlabeled and labeled sample images can jointly guide the model training, which helps improve training efficiency.

[0031] In a specific implementation scenario, the training phases (early, middle, and late) can be divided based on the number of iterations. For example, taking a preset 1000 iterations of the object detection model as an example, the first to the 300th iteration can be divided into the early training phase, the 301st to the 700th iteration into the middle training phase, and the 701st to the 1000th iteration into the late training phase; alternatively, the first to the 200th iteration can be divided into the early training phase, the 201st to the 800th iteration into the middle training phase, and the 801st to the 1000th iteration into the late training phase. Of course, the above examples are merely possible divisions of the training phase when the object detection model undergoes 1000 iterations, and are not limiting. The same principle applies when the number of iterations for the object detection model is other values, which will not be listed here. Of course, the training phase can also be user-defined, and this embodiment does not limit this.

[0032] In a specific implementation scenario, depending on whether the current iteration is in the middle of training or in the early (i.e., the model does not yet have preliminary detection performance) or late (i.e., the model has already achieved a certain level of detection performance) training phase, self-distillation training can be performed on the target detection model for the current iteration based on the labeled sample images required for that iteration. It should be noted that the specific process of self-distillation in the early or late training phases can be found in the relevant descriptions below, and will not be elaborated upon here. This method, in the early or late training phases, uses labeled sample images to perform self-distillation training on the target detection model for the current iteration. Therefore, in the early training phase, labeled samples can quickly guide the target detection model to learn and train, helping to improve training efficiency. In the late training phase, after the target detection model has improved its detection performance through unsupervised training and self-distillation in the middle of training, labeled sample images can guide it to further refine its detection performance, helping to improve model accuracy.

[0033] In another implementation scenario, unlike the aforementioned implementation, different training stages may not be distinguished, and the training strategy described in step S11 and subsequent steps may be executed on the target detection model throughout the entire training process.

[0034] Furthermore, several unlabeled sample images can be pre-collected for training, forming an unlabeled image set. Based on this, the unlabeled image set can be divided into several unlabeled sample batches according to the batch size, for use in each iteration. Alternatively, the unlabeled sample images in the unlabeled image set can be considered as candidate sample images, and the detection results of each candidate sample image by the object detection model can be used to adaptively select candidate sample images as the unlabeled sample images required for the current iteration. The above examples are merely several possible implementations for obtaining the unlabeled sample images for the current iteration and do not limit the specific process of obtaining the unlabeled sample images for the current iteration in this embodiment. For example, unlabeled sample images of a random batch size can also be selected from the unlabeled image set as the unlabeled sample images required for the current iteration. The method for obtaining labeled sample images can be deduced similarly and will not be elaborated further here.

[0035] Step S12: Obtain the target detection model trained in the previous iteration for the current iteration, obtain the first detection result for labeled sample images and the second detection result for unlabeled sample images for the current iteration, and obtain the target detection model for the current iteration, obtain the third detection result for labeled sample images and the fourth detection result for unlabeled sample images for the current iteration.

[0036] Specifically, in the embodiments disclosed in this application, for ease of distinction, the target detection model for the current iteration can be denoted as H.t And denote the target detection model trained in the previous iteration as H. t-1 .

[0037] In one implementation scenario, the object detection model in the current iteration or the object detection model trained in the previous iteration can have the same network architecture. For example, the object detection model can use the YOLOv7 network architecture. In this case, please refer to [reference needed]. Figure 2 and Figure 3 , Figure 2 This is a schematic diagram of the framework of an embodiment of an object detection model. Figure 3 yes Figure 2 A schematic diagram of the framework of an embodiment of a feature extraction network. (See diagram below.) Figure 2 and Figure 3 As shown, the backbone network of the object detection model can contain several sequentially connected feature extraction networks. The feature extraction steps of each feature extraction network can include: performing multiple first convolution operations on the input data of the feature extraction network to obtain the first output feature corresponding to the first convolution operation; then performing a second convolution operation on the first output feature of at least one first convolution operation to obtain the second output feature corresponding to the second convolution operation; fusing the first and second output features to obtain the fused output feature; and finally performing at least a third convolution operation based on the fused output feature to obtain the final output feature of the feature extraction network. This method can easily fuse low-level and high-level information, helping to improve the object detection model's ability to detect small objects.

[0038] In a specific implementation scenario, it should be noted that the above-mentioned "multiple first convolution operations" means performing two first convolution operations, or three first convolution operations, or more than three first convolution operations, without any limitation here.

[0039] In a specific implementation scenario, the first output feature and the second output feature can be directly concatenated to achieve feature fusion and obtain the fused output feature.

[0040] In a specific implementation scenario, in addition to directly performing a third convolution operation on the fused output features to obtain the final output features, max pooling can also be performed after performing a third convolution operation on the fused output features to obtain the final output features. No limitation is made here.

[0041] In a specific implementation scenario, the first, second, and third convolution operations described above can be 1x1 convolution operations. Of course, the size of the convolution kernel is not limited to this.

[0042] In a specific implementation scenario, the object detection model in this embodiment is not limited to the YOLO v7 network architecture; it can also employ network architectures such as Faster R-CNN and SSD. Therefore, the network architecture of the object detection model is not limited here. Taking the YOLO v7 architecture as an example, please refer to the following documentation. Figure 2After obtaining the input image (such as sample images during the training phase or test images during the inference phase), the input image can be preprocessed, and convolution and max pooling operations can be performed sequentially before being input into the feature extraction network. It should be noted that, for example, the convolution kernel for the convolution operation can be set to 3, the stride to 2, and the number of output channels to 24; while the stride for the max pooling operation can be set to 2, the feature map size can be 80*80, and the number of output channels can be 24. Based on this, three sequentially connected feature extraction networks perform feature extraction operations, downsampling by 8x, 16x, and 32x respectively, to obtain feature maps P3, P4, and P5, which are then input into the neck network for fusion, outputting feature maps H3, H4, and H5. These are then detected by three detection heads at different scales. For example, each detection head can contain two sequentially connected convolutional layers; the former has a 1*1 kernel and a stride of 1, while the latter has a 3*3 kernel and a stride of 1. Based on this, detection results at three different scales can be output: 40*40, 20*20, and 10*10, with each scale having an output dimension of 3*(number of categories + 4 + 1). Here, "3" represents the three different anchor boxes, "4" represents the position coordinates (e.g., the coordinates of the top-left and bottom-right corners), and "1" represents the confidence score. The feature extraction network and the neck network are explained in detail below: After obtaining a feature map of size 80*80 with 24 output channels through max pooling, the first feature extraction operation is performed, resulting in a feature map of size 40*40 with 116 output channels, which can be denoted as P3. The second feature extraction operation is then performed, resulting in a feature map of size 20*20 with 232 output channels, which can be denoted as P4. The third feature extraction operation is then performed, resulting in a feature map of size 10*10 with 464 output channels, which can be denoted as P5. Based on this, a 1x1 convolutional kernel can be used to compress the number of channels of P5 to 96, and then upsampled, resulting in a feature map size of 20x20, denoted as M5. Similarly, a 1x1 convolutional kernel can be used to compress the number of channels of P4 to 96. The processed P4 and M5 are then concatenated, and feature fusion is performed using RepVGGBlock, resulting in an output of 256 channels, denoted as M4. Next, M4 is upsampled, resulting in a feature map size of 40x40, denoted as U4. A 1x1 convolutional kernel is then used to compress the number of channels of P3 to 96. The processed P3 and U4 are then concatenated, and feature fusion is performed again using RepVGGBlock, resulting in an output of 96 channels, denoted as H3. Based on this, H3 is downsampled, and the feature map size becomes 20*20, denoted as D3. D3 and M4 are then concatenated, and feature fusion is performed through RepVGGBlock, resulting in an output of 96 channels, denoted as H4.Then, H4 is downsampled, and the feature map size becomes 10*10, denoted as D4. D4 and P5 are concatenated, and then feature fusion is performed through RepVGGBlock, resulting in an output of 96 channels, denoted as H5. The above operations only describe the feature extraction and fusion process when the object detection model uses the YOLO v7 network architecture. This does not limit the specific architecture of the object detection model. When the object detection model uses other network architectures, the specific process of feature extraction and fusion can be found in the technical details of those architectures, which will not be listed here. Furthermore, to improve model performance, the auxiliary branch detection head can be trained using a decoupled head. Object detection algorithms need to regress object detection boxes based on positive samples. Therefore, the sample allocation strategy will greatly affect the performance of object detection algorithms. In this embodiment, the TAL (Task Alignment Learning) method can be used to allocate positive and negative samples to the main branch and the regression branch. This method can combine classification scores and IoU (Intersection over Union) matching scores to alleviate the problems caused by the inconsistency between classification and regression tasks. For details, please refer to the technical details of TAL, which will not be elaborated here.

[0043] In one implementation scenario, the detection results may include, but are not limited to, predicted category, predicted location, and predicted confidence. Furthermore, as mentioned earlier, training stages can be distinguished during training, and the detection results can differ depending on the training stage. For example, in the middle of training, the detection results may include the predicted category, while in the early or late stages of training, the detection results may include the predicted category, predicted location, and predicted confidence. Of course, the above examples are merely a few possible implementation methods in practical applications and do not limit the specific content of the detection results. For example, the detection results may not distinguish between training stages. For ease of description, taking the detection results including predicted category as an example, the target detection model trained on the previous iteration of the current iteration detects the unlabeled sample images of the current iteration, obtaining the probability values ​​of the sample objects in the unlabeled sample images belonging to different categories. Therefore, the category corresponding to the highest probability value can be used as the predicted category of the sample object and included in the second detection result of the unlabeled sample image. In contrast, the fourth detection result of the target detection model of the current iteration for the unlabeled sample images of the current iteration may include the probability values ​​of the sample objects in the unlabeled sample images belonging to different categories. Furthermore, by using the target detection model trained on the previous iteration to detect labeled samples, the probability values ​​of the sample objects in the labeled image belonging to different categories can be obtained and included in the first detection result of the labeled sample. Similarly, by using the target detection model in the current iteration to detect labeled sample images, the probability values ​​of the sample objects in the labeled sample images belonging to different categories can be obtained and included in the third detection result of the labeled sample image. This process can be repeated when the detection result includes predicted location or prediction confidence; further examples are not provided here.

[0044] Step S13: Based on the difference between the first detection result and the third detection result, a first loss is obtained; based on the difference between the pseudo-label used by the second detection result and the fourth detection result, a second loss is obtained; and based on the difference between the labeled label of the labeled sample image and the third detection result, a third loss is obtained.

[0045] Specifically, please refer to the following: Figure 4 , Figure 4 This is a diagram illustrating the training process of an embodiment of an object detection model. For example... Figure 4 As shown, the target detection model H can be trained using the previous iteration t-1 of the current iteration. t-1The system detects unlabeled sample images required for the current iteration t, obtaining a second detection result to acquire pseudo-labels for the unlabeled sample images in the current iteration t. It also detects labeled sample images for the current iteration t, obtaining a first detection result. Simultaneously, in the current iteration t, the target detection model for the current iteration t can be used to detect the unlabeled sample images required for the current iteration t, obtaining a fourth detection result, and to detect the labeled sample images for the current iteration t, obtaining a third detection result. Based on these, a first loss can be obtained based on the first and third detection results, a second loss can be obtained based on the pseudo-labels and the fourth detection result, and a third loss can be obtained based on the labeled labels of the labeled sample images and the third detection result.

[0046] For ease of description, the second detection result (i.e., the pseudo-label) of the i-th unlabeled sample image in the current iteration can be denoted as... And let p be the fourth detection result of the i-th unlabeled sample image in the current iteration. i And the first detection result of the i-th labeled sample image in the current iteration is denoted as Let the third detection result of the i-th labeled sample image in the current iteration be denoted as And let y denote the label of the i-th labeled sample image in the current iteration. i Based on this, the first loss (i.e., the self-distillation loss) can be measured using loss functions such as the KL divergence. For example, the first loss L1 can be expressed as:

[0047]

[0048] In the above formula (1), D KL Let represent the KL divergence loss function, and n represent the total number of labeled sample images in the current iteration. Of course, the distillation temperature can also be considered in this process, in which case the first loss L1 can be expressed as:

[0049]

[0050] In the above formula (2), τ represents the distillation temperature.

[0051] Furthermore, the second loss (i.e., the unsupervised loss) can be measured using loss functions such as cross-entropy. For example, the second loss L2 can be expressed as:

[0052]

[0053] In the above formula (3), CE represents the cross-entropy loss function, and k represents the total number of unlabeled sample images required in the current iteration t.

[0054] Furthermore, the third loss (i.e., the supervised loss) can be measured using loss functions such as cross-entropy. For example, the third loss L3 can be expressed as:

[0055]

[0056] Step S14: Adjust the network parameters of the target detection model based on the first loss, the second loss, and the third loss.

[0057] Specifically, the first loss, second loss, and third loss can be summed to obtain the total loss. Based on this total loss, the network parameters of the object detection model can be adjusted. For example, the network parameters can be adjusted using optimization methods such as gradient descent. Of course, the calculation method for the total loss is not limited to this. For instance, the first loss, second loss, and third loss can be weighted to obtain the total loss. Naturally, the weighting coefficients of the above three factors can be set according to the actual application needs. For example, when self-distillation is emphasized more, the weighting coefficient of the first loss can be set appropriately larger; when unsupervised training is emphasized more, the weighting coefficient of the second loss can be set appropriately larger; or when supervised training is emphasized more, the weighting coefficient of the third loss can be set appropriately larger. No limitation is imposed here.

[0058] It should be noted that after the network parameters of the object detection model are adjusted in the current iteration, the next iteration can begin. In other words, the next iteration will be the new current iteration, and the above operation will be repeated until the object detection model training converges, thus obtaining the final object detection model.

[0059] The above scheme obtains unlabeled sample images required for the current iteration and labeled sample images. Based on this, it obtains the target detection model trained in the previous iteration. It then obtains the first detection result for labeled sample images and the second detection result for unlabeled sample images in the current iteration. It also obtains the target detection model for the current iteration and obtains the third detection result for labeled sample images and the fourth detection result for unlabeled sample images in the current iteration. Based on the difference between the first and third detection results, a first loss is obtained. Based on the difference between the pseudo-labels used by the second detection results and the fourth detection results, a second loss is obtained. Based on the difference between the labeled labels of the labeled sample images and the third detection results, a third loss is obtained. Based on the first, second, and third losses, the network parameters of the target detection model are adjusted. On the one hand, the first and second losses can force the target detection model for the current iteration to learn and train through a combination of self-distillation and unsupervised training, without performing additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, the third loss can further force the target detection model to learn from labeled data. Therefore, combining the three loss functions can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is limited labeled data.

[0060] Please refer to the following: Figure 5 , Figure 5 yes Figure 1 A flowchart of an embodiment of step S11.

[0061] Specifically, this may include the following steps:

[0062] Step S111: Obtain the target detection model trained in the previous iteration in the current iteration, and obtain the fifth detection result for each candidate sample image in the unlabeled image set.

[0063] Specifically, the details of the fifth test result can be found in the relevant description of "test result" in the aforementioned public embodiments, and will not be repeated here.

[0064] Step S112: Based on the fifth detection result of the candidate sample image, obtain the selection score of the candidate sample image.

[0065] In one implementation scenario, the selected score may include a first score representing the difficulty of detection. Taking the fifth detection result, which includes the predicted categories, predicted probabilities, and confidence levels of sample objects in candidate sample images, as an example, a sub-score for the corresponding sample object in the candidate sample image can be obtained based on the product of the predicted probabilities and confidence levels of the sample objects in the candidate sample image. Then, based on the sub-scores of each sample object in the candidate sample image, the first score of the candidate sample image can be obtained. For example, the average of the sub-scores of each sample object in the candidate sample image can be taken as the first score of the candidate sample image. For ease of description, let's say the i-th candidate sample image contains... Taking a sample object as an example, for the j-th sample object b j It belongs to prediction category c k The predicted probability of (i.e., the k-th preset category) can be denoted as p(c k ; j ) and its confidence level can be denoted as C(c k ; j Therefore, the first score of the i-th candidate sample image is... It can be represented as:

[0066]

[0067] Of course, Formula (5) is only one possible way to calculate the first score in practical applications, and does not limit other possible calculation methods. For example, the sum of the sub-scores of each sample object in the candidate sample image can also be used as the first score of the candidate sample image, which is not limited here. In the above method, the selected score includes the first score that represents the difficulty of detection. The fifth detection result includes the predicted category of the sample object in the candidate sample image and its predicted probability and confidence. Based on this, the sub-score of the corresponding sample object in the candidate sample image is obtained based on the product of the predicted probability and confidence of the sample object in the candidate sample image. Based on the sub-score of each sample object in the candidate sample image, the first score of the candidate sample image is obtained. This can filter the unlabeled sample images in the current iteration in terms of the difficulty of detection of the candidate sample image, which helps to select the unlabeled sample images that are easy to detect in the current iteration, so as to improve the training effect of the target detection model.

[0068] In another implementation scenario, unlike the aforementioned approach, the selection score can also include a second score representing the quantity of sample objects. In this case, based on the fifth detection result of the candidate sample image, the number of sample objects in the candidate sample image can be statistically obtained, and the second score of the candidate sample image can be obtained based on the number of sample objects in the candidate sample image. For example, the number of candidate objects in the candidate sample image can be directly used as the second score of the candidate sample image. Of course, the above example is merely one possible implementation in practical applications and does not limit other possible calculation methods for the second score. For example, after obtaining the quantity value, it can also be positively correlated and used as the second score. In the above approach, the selection score includes a second score representing the quantity of sample objects. Based on this, the number of sample objects in the candidate sample image is statistically obtained based on the fifth detection result of the candidate sample image, and the second score of the candidate sample image is obtained based on the number of sample objects in the candidate sample image. This allows for the filtering of unlabeled sample images in the current iteration based on the quantity of sample objects in the candidate sample image, helping to select as many easily detectable unlabeled sample images as possible for the current iteration, thereby improving the training effect of the object detection model.

[0069] In another implementation scenario, the selection score can also be obtained from a first score representing the difficulty of detection and a second score representing the quantity of sample objects. Specifically, the first and second scores of the candidate sample images in the unlabeled image set can be normalized respectively, and then the selection score of the corresponding candidate sample image can be obtained based on the normalized first and second scores of the candidate sample image. For example, the product of the normalized first and second scores of a certain sample object in the candidate sample image can be obtained, and the sum of the products of each sample object in the candidate sample image can be obtained and the square root value can be taken as the selection score of the candidate sample image. This is not limited here. Of course, the above examples are only a few possible implementation methods in practical applications and do not limit other possible calculation methods. For example, the sum of the products of each sample object in the candidate sample image can also be used as the selection score of the candidate sample image. The above method selects a score by using a first score that represents the difficulty of detection and a second score that represents the quantity of sample objects. Based on this, the first and second scores of the candidate sample images in the unlabeled image set are normalized respectively. Based on the normalized first and second scores of the candidate sample images, the selection score of the corresponding candidate sample image is obtained, which can improve the accuracy of the selection score.

[0070] Of course, in practical applications, the choice of score is not limited to at least one of the two measurement dimensions mentioned above; it can also be based on other measurement dimensions, which are not limited here.

[0071] Step S113: Based on the selection score of the candidate sample image, select the candidate sample image as the unlabeled sample image required for the current iteration.

[0072] Specifically, the candidate sample images in the unlabeled image set are sorted in descending order of selection score, and the candidate sample images located in the first preset order (e.g., the first 50, the first 80, etc.) are selected as the unlabeled sample images required for the current iteration.

[0073] The above scheme obtains the target detection model trained in the previous iteration in the current iteration, obtains the fifth detection result of each candidate sample image in the unlabeled image set, and obtains the selection score of the candidate sample image based on the fifth detection result of the candidate sample image. Based on the selection score of the candidate sample image, the candidate sample image is selected as the unlabeled sample image required for the current iteration. Therefore, it can select unlabeled sample images that are easy to detect for the current iteration, which helps to further improve the training effect of the target detection model in the current iteration.

[0074] Please see Figure 6 , Figure 6 This is a flowchart illustrating another embodiment of the training method for the object detection model of this application. Specifically, it may include the following steps:

[0075] Step S61: Determine the training phase of the current iteration.

[0076] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0077] Step S62: Determine whether the current iteration is in the early training stage, middle training stage, or late training stage. If it is in the early training stage or late training stage, proceed to step S63. If it is in the late training stage, proceed to step S64.

[0078] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0079] Step S63: Perform self-distillation training on the target detection model for the current iteration based on the labeled sample images required for the current iteration.

[0080] In one implementation scenario, in order to improve training efficiency and accuracy in the early stages of training, before self-distillation, the labeled sample images of the second part of the labeled image batch used in the previous iteration can be reused as the labeled sample images of the first part of the labeled image batch used in the current iteration. New labeled sample images are then obtained as the labeled sample images of the second part of the labeled image batch required for the current iteration. The new labeled sample images are different from the labeled sample images reused in the current iteration, and the total number of images in the first part and the second part remains unchanged. For example, taking N as the total number of the first and second parts, the labeled sample images of the second part in the labeled image batch used in the previous iteration of training can be reused as the first labeled sample image in the labeled image batch used in the current iteration of training, i.e., the labeled sample images before the current iteration of N / 2. New labeled sample images are then obtained as the labeled sample images of the second part in the labeled image batch required for the current iteration of training, i.e., the labeled sample images after the current iteration of N / 2. Of course, the first and second parts are not limited to the same proportion, but they can also be different. For example, the last N / 3 of the labeled sample images from the previous training batch can be reused as the first N / 3 of the labeled sample images in the current iteration's batch, and 2N / 3 new labeled sample images are obtained as the last 2N / 3 of the labeled sample images in the current iteration's batch. It should be noted that, in this case, after the current iteration ends, the next iteration is considered the new current iteration. At this time, the last 2N / 3 of the labeled sample images from the old batch used in the current iteration can be reused as the first 2N / 3 of the labeled sample images in the new batch required for the current iteration, and N / 3 new labeled sample images are obtained as the last N / 3 of the labeled sample images in the new batch required for the current iteration. Other cases can be deduced similarly, and will not be exemplified here. The above method, before self-distillation, reuses the second part of the labeled sample images from the labeled image batch used in the previous iteration for the current iteration as the first part of the labeled sample images from the labeled image batch used in the current iteration for training, and obtains new labeled sample images as the second part of the labeled sample images from the labeled image batch required for the current iteration for training. The new labeled sample images are different from the labeled sample images reused in the current iteration. The total number of images in the first part and the second part remains unchanged, which can avoid repeated modifications to the model framework.

[0081] In one implementation scenario, after obtaining the labeled sample images required for the current iteration, self-distillation training can begin. Specifically, the target detection model trained in the previous iteration and the sixth detection result for the labeled sample images required for the current iteration can be obtained, along with the target detection model for the current iteration and the seventh detection result for the labeled sample images required for the current iteration. Based on this, a fourth loss can be obtained based on the difference between the pseudo-label used as the sixth detection result and the seventh detection result, and a fifth loss can be obtained based on the difference between the seventh detection result and the labeled label of the labeled sample images required for the current iteration. The network parameters of the target detection model can then be adjusted based on the fourth and fifth losses. It should be noted that the measurement method for the fourth loss can refer to the description of the first loss in the aforementioned public embodiments, and the measurement method for the fifth loss can refer to the description of the third loss in the aforementioned public embodiments, and will not be repeated here. The above method, by performing self-distillation training on the object detection model in the early or late stages of training, can retain the prediction results of the previous iteration on sample allocation and use them as the target output in the current iteration. This helps reduce computational costs and memory usage, and also makes it easier to achieve model parallelization.

[0082] Step S64: Obtain the unlabeled sample images required for the current iteration, and obtain the labeled sample images.

[0083] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0084] Step S65: Obtain the target detection model trained in the previous iteration for the current iteration, obtain the first detection result for labeled sample images and the second detection result for unlabeled sample images for the current iteration, and obtain the target detection model for the current iteration, obtain the third detection result for labeled sample images and the fourth detection result for unlabeled sample images for the current iteration.

[0085] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0086] Step S66: Based on the difference between the first detection result and the third detection result, a first loss is obtained; based on the difference between the pseudo-label used by the second detection result and the fourth detection result, a second loss is obtained; and based on the difference between the labeled label of the labeled sample image and the third detection result, a third loss is obtained.

[0087] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0088] Step S67: Adjust the network parameters of the target detection model based on the first loss, the second loss, and the third loss.

[0089] For details, please refer to the relevant descriptions in the foregoing disclosed embodiments, which will not be repeated here.

[0090] The above scheme selects different training strategies to train the object detection model according to the training stage of the current iteration. It can perform self-distillation training on the object detection model of the current iteration using labeled sample images in the early or late stages of training. Therefore, in the early stage of training, labeled samples can guide the object detection model to learn and train as soon as possible, which helps to improve training efficiency in the early stage of training. In the late stage of training, the object detection model can improve its detection performance by combining unsupervised training and self-distillation in the middle stage of training, and then be guided to further improve its detection performance by labeled sample images, which helps to improve the accuracy of the model.

[0091] Please see Figure 7 , Figure 7 This is a flowchart illustrating an embodiment of the target detection method of this application.

[0092] Specifically, this may include the following steps:

[0093] Step S71: Obtain the image to be tested.

[0094] Specifically, the image to be tested can be obtained offline, such as by copying it from a storage medium or by receiving it from instant messaging software; this is not limited here. Of course, the image to be tested can also be obtained online, such as by directly capturing it from terminal devices such as IPCs or mobile phones. The source of the image to be tested is not limited here.

[0095] Step S72: Detect the image to be tested based on the object detection model to obtain the detection result of the image to be tested.

[0096] In this embodiment, the object detection model is trained using the steps described in the training method embodiments of any of the above-mentioned object detection models. For the specific training process, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here. Furthermore, the specific detection process of the object detection model for the target image will differ depending on the network architecture of the object detection model. For example, taking the YOLO v7 network architecture as an example, its specific detection process can be found in the relevant descriptions in the foregoing embodiments, and will not be repeated here.

[0097] The above scheme acquires the image to be tested and performs detection on the image to be tested based on the target detection model to obtain the detection result of the image to be tested. Moreover, the target detection model is trained by the steps in the training method embodiment of any of the above target detection models, so it can improve the detection accuracy of the image to be tested.

[0098] Please see Figure 8 , Figure 8This is a schematic diagram of the framework of an embodiment of the training device 80 for the object detection model of this application. The training device 80 for the object detection model includes an acquisition module 81, a detection module 82, a measurement module 83, and an adjustment module 84. The acquisition module 81 is used to acquire unlabeled sample images required for the current iteration and to acquire labeled sample images. The detection module 82 is used to acquire the object detection model trained in the previous iteration, acquire a first detection result for labeled sample images and a second detection result for unlabeled sample images in the current iteration, acquire the object detection model in the current iteration, and acquire a third detection result for labeled sample images and a fourth detection result for unlabeled sample images in the current iteration. The measurement module 83 is used to obtain a first loss based on the difference between the first detection result and the third detection result, a second loss based on the difference between the pseudo-label used by the second detection result and the fourth detection result, and a third loss based on the difference between the labeled label of the labeled sample image and the third detection result. The adjustment module 84 is used to adjust the network parameters of the object detection model based on the first loss, the second loss, and the third loss.

[0099] The above scheme, on the one hand, forces the object detection model to learn and train in the current iteration through a combination of self-distillation and unsupervised training using the first and second losses, without requiring additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, combining the third loss forces the object detection model to learn from labeled data. Therefore, combining the three losses can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when labeled data is limited.

[0100] In some disclosed embodiments, the acquisition module 81 includes a result acquisition submodule, used to acquire the target detection model trained in the previous iteration in the current iteration, and acquire the fifth detection result for each candidate sample image in the unlabeled image set respectively; the acquisition module 81 includes a score determination submodule, used to obtain the selection score of the candidate sample image based on the fifth detection result of the candidate sample image; the acquisition module 81 includes an image selection submodule, used to select the candidate sample image as the unlabeled sample image required for the current iteration based on the selection score of the candidate sample image.

[0101] In some disclosed embodiments, the selected score includes a first score characterizing the difficulty of detection, the fifth detection result includes the predicted category of the sample object in the candidate sample image and its predicted probability and confidence level, the score determination submodule includes a sub-score acquisition unit, used to obtain the sub-score of the corresponding sample object in the candidate sample image based on the product of the predicted probability and confidence level of the sample object in the candidate sample image; the score determination submodule includes a first score acquisition unit, used to obtain the first score of the candidate sample image based on the sub-score of each sample object in the candidate sample image.

[0102] In some disclosed embodiments, the selection score includes a second score characterizing the quantity of sample objects. The score determination submodule includes a quantity value statistics unit, which is used to statistically obtain the quantity value of sample objects in the candidate sample image based on the fifth detection result of the candidate sample image. The score determination submodule includes a second score acquisition unit, which is used to obtain the second score of the candidate sample image based on the quantity value of sample objects in the candidate sample image.

[0103] In some disclosed embodiments, the selection score is obtained by a first score representing the difficulty of detection and a second score representing the quantity of sample objects. The score determination submodule includes a normalization unit for normalizing the first and second scores of the candidate sample images in the unlabeled image set, respectively. The score determination submodule also includes a score fusion unit for obtaining the selection score of the corresponding candidate sample image based on the normalized first and second scores of the candidate sample image.

[0104] In some disclosed embodiments, the training device 80 for the object detection model further includes a stage determination module for determining the training stage of the current iteration; the acquisition module 81 is specifically used to perform the step of acquiring unlabeled sample images required for the current iteration in response to the current iteration being in the middle of the training stage.

[0105] In some disclosed embodiments, the training apparatus 80 for the target detection model further includes a self-distillation module, which is used to perform self-distillation training on the target detection model for the current iteration based on the labeled sample images required for the current iteration, in response to whether the current iteration is in the early or late training phase.

[0106] In some disclosed embodiments, the training device 80 for the object detection model further includes a sample reuse module, which reuses the labeled sample images of the second part of the labeled image batch used in the previous iteration for the current iteration as the labeled sample images of the first part of the labeled image batch used in the current iteration for training; the training device 80 for the object detection model further includes a new sample acquisition module, which acquires new labeled sample images as the labeled sample images of the second part of the labeled image batch required for the current iteration for training; wherein the new labeled sample images are different from the labeled sample images reused in the current iteration, and the total number of images in the first part and the second part remains unchanged.

[0107] In some disclosed embodiments, the self-distillation module includes a result detection submodule for obtaining the target detection model trained in the previous iteration for the current iteration, and a sixth detection result for the labeled sample images required for the current iteration, and obtaining the target detection model for the current iteration, and a seventh detection result for the labeled sample images required for the current iteration; the self-distillation module includes a measurement submodule for obtaining a fourth loss based on the difference between the pseudo-label used by the sixth detection result and the seventh detection result, and obtaining a fifth loss based on the difference between the seventh detection result and the labeled label of the labeled sample images required for the current iteration; the self-distillation module includes an adjustment submodule for adjusting the network parameters of the target detection model based on the fourth loss and the fifth loss.

[0108] In some disclosed embodiments, the object detection model adopts the YOLO v7 network architecture. The backbone network of the object detection model includes several sequentially connected feature extraction networks. The training device 80 of the object detection model also includes a first convolution module, which performs multiple first convolution operations on the input data of the feature extraction networks to obtain a first output feature corresponding to the first convolution operation. The training device 80 of the object detection model also includes a second convolution module, which performs a second convolution operation on the first output feature of at least one first convolution operation to obtain a second output feature corresponding to the second convolution operation. The training device 80 of the object detection model also includes a feature fusion module, which fuses the first output feature and the second output feature to obtain a fused output feature. The training device 80 of the object detection model also includes a feature fusion module, which performs at least a third convolution operation based on the fused output feature to obtain the final output feature of the feature extraction network.

[0109] Please see Figure 9 , Figure 9This is a schematic diagram of the framework of an embodiment of the target detection device 90 of this application. The target detection device 90 includes an acquisition module 91 and a detection module 92. The acquisition module 91 is used to acquire an image to be tested; the detection module 92 is used to detect the image to be tested based on a target detection model to obtain the detection result of the image to be tested; wherein, the target detection model is obtained by the training device of the above-mentioned target detection model.

[0110] In the above scheme, the target detection model in the target detection device 90 is obtained from the training device of the aforementioned target detection model. On the one hand, the first and second losses, through a combination of self-distillation and unsupervised training, force the target detection model in the current iteration to learn and train, without performing additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, further combining the third loss forces the target detection model to learn from labeled data. Therefore, combining the three losses can improve the detection accuracy of the target detection model and reduce the complexity of training the target detection model when there is limited labeled data.

[0111] Please see Figure 10 , Figure 10 This is a schematic diagram of an embodiment of the electronic device 100 of this application. The electronic device 100 includes a memory 101 and a processor 102 coupled to each other. The memory 101 stores program instructions, and the processor 102 executes the program instructions to implement the steps in any of the above-described object detection model training method embodiments, or to implement the steps in any of the above-described object detection method embodiments. For details, please refer to the foregoing disclosed embodiments, which will not be repeated here. It should be noted that the electronic device 100 may include, but is not limited to, integrated circuit boards, etc., and is not limited thereto.

[0112] Specifically, processor 102 can also be referred to as a CPU (Central Processing Unit). Processor 102 may be an integrated circuit chip with signal processing capabilities. Processor 102 can also be a general-purpose processor, digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. A general-purpose processor can be a microprocessor or any conventional processor. In addition, processor 102 can be implemented by multiple integrated circuit chips.

[0113] In the above scheme, the processor 102 in the electronic device 100 implements the steps in any of the above-described object detection model training method embodiments, or implements the steps in any of the above-described object detection method embodiments. On the one hand, by using the first and second losses, the object detection model in the current iteration can be forced to learn and train through a combination of self-distillation and unsupervised training, without performing additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, by further combining the third loss, the object detection model can be forced to learn from labeled data. Therefore, combining the three losses can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is limited labeled data.

[0114] Please see Figure 11 , Figure 11 This is a schematic diagram of a frame of an embodiment of the imaging device 110 of this application. The imaging device 110 may include an optical element 111 and an electronic device 112 as described in the above-described electronic device embodiment, and the optical element 111 is coupled to a processor 1121 in the electronic device 112. The optical element 111 may include a lens, a sensor, etc., and is not limited thereto.

[0115] In the above scheme, the processor 1121 included in the electronic device 112 of the camera device 110 implements the steps in any of the above-described object detection model training method embodiments, or implements the steps in any of the above-described object detection method embodiments. On the one hand, by using the first and second losses, the object detection model in the current iteration can be forced to learn and train through a combination of self-distillation and unsupervised training, without performing additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, by further combining the third loss, the object detection model can be forced to learn from labeled data. Therefore, combining the three losses can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when there is a small amount of labeled data.

[0116] Please see Figure 12 , Figure 12 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium 120 of this application. The computer-readable storage medium 120 stores processor-executable program instructions 121, which can be executed to implement the steps in any of the above-described object detection model training method embodiments, or to implement the steps in any of the above-described object detection method embodiments.

[0117] It should be noted that the computer-readable storage medium 120 can be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or a medium that can store program instructions 121. Alternatively, it can be a server that stores the program instructions 121. The server can send the stored program instructions 121 to other devices for execution, or it can execute the stored program instructions 121 itself.

[0118] The above scheme, implemented by the computer-readable storage medium 120, allows for the implementation of steps in any of the above object detection model training method embodiments. On one hand, the first and second losses force the object detection model in the current iteration to learn and train through a combination of self-distillation and unsupervised learning, without requiring additional operations such as modifying the model framework or pre-training a teacher model outside of normal training. On the other hand, the combination of the third loss forces the object detection model to learn from labeled data. Therefore, combining these three losses can improve the detection accuracy of the object detection model and reduce the complexity of training the object detection model when labeled data is limited.

[0119] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components 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 through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

[0121] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0122] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0123] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

Claims

1. A training method for an object detection model, characterized in that, include: Obtain the unlabeled sample images required for the current iteration, and obtain the labeled sample images; Obtain the target detection model trained in the previous iteration of the current iteration, obtain the first detection result for the labeled sample image and the second detection result for the unlabeled sample image of the current iteration, and obtain the target detection model of the current iteration, obtain the third detection result for the labeled sample image and the fourth detection result for the unlabeled sample image of the current iteration. A first loss is obtained based on the difference between the first detection result and the third detection result; a second loss is obtained based on the difference between the pseudo-label used by the second detection result and the fourth detection result; and a third loss is obtained based on the difference between the labeled label of the labeled sample image and the third detection result. Based on the first loss, the second loss, and the third loss, the network parameters of the target detection model are adjusted; Before acquiring the unlabeled sample images required for the current iteration, the training stage of the current iteration is determined. Depending on whether the current iteration is in the early or late training stage, the target detection model for the current iteration is self-distilled based on the labeled sample images required for the current iteration. The self-distillation training steps include: Obtain the target detection model trained in the previous iteration for the current iteration, and the sixth detection result of the labeled sample images required for the current iteration; and obtain the target detection model for the current iteration, and the seventh detection result of the labeled sample images required for the current iteration. A fourth loss is obtained based on the difference between the pseudo-label used as the sixth detection result and the seventh detection result, and a fifth loss is obtained based on the difference between the seventh detection result and the labeled label of the labeled sample image required for the current iteration. Based on the fourth loss and the fifth loss, the network parameters of the target detection model are adjusted.

2. The method according to claim 1, characterized in that, The process of obtaining the unlabeled sample images required for the current iteration includes: Obtain the target detection model trained in the previous iteration in the current iteration, and obtain the fifth detection result for each candidate sample image in the unlabeled map set respectively; Based on the fifth detection result of the candidate sample image, the selection score of the candidate sample image is obtained; Based on the selection score of the candidate sample image, the candidate sample image is selected as the unlabeled sample image required for the current iteration.

3. The method according to claim 2, characterized in that, The selection score includes a first score characterizing the difficulty of detection; the fifth detection result includes the predicted category, prediction probability, and confidence level of the sample objects in the candidate sample image; and the selection score of the candidate sample image is obtained based on the fifth detection result of the candidate sample image, including: Based on the product of the predicted probability and the confidence level of the sample object in the candidate sample image, a sub-score corresponding to the sample object in the candidate sample image is obtained; The first score of the candidate sample image is obtained based on the sub-scores of each of the sample objects in the candidate sample image.

4. The method according to claim 2, characterized in that, The selection score includes a second score representing the quantity of sample objects. The process of obtaining the selection score for the candidate sample image based on the fifth detection result of the candidate sample image includes: Based on the fifth detection result of the candidate sample image, the number of sample objects in the candidate sample image is statistically obtained; The second score of the candidate sample image is obtained based on the number of sample objects in the candidate sample image.

5. The method according to claim 2, characterized in that, The selection score is obtained from a first score representing the difficulty of detection and a second score representing the quantity of sample objects. The process of obtaining the selection score of the candidate sample image based on the fifth detection result of the candidate sample image includes: The first and second scores of the candidate sample images in the unlabeled image set are normalized respectively; Based on the first score and the second score after normalization of the candidate sample image, the selection score corresponding to the candidate sample image is obtained.

6. The method according to claim 1, characterized in that, The process of obtaining the unlabeled sample images required for the current iteration includes: In response to the fact that the current iteration is in the middle of the training phase, the step of obtaining the unlabeled sample images required for the current iteration is performed.

7. The method according to claim 1, characterized in that, Before performing self-distillation training on the target detection model for the current iteration based on the labeled sample images required for the current iteration, the method further includes: The labeled sample images of the second part of the labeled image batch used in the previous iteration of training are reused as the labeled sample images of the first part of the labeled image batch used in the current iteration of training; and Obtain new labeled sample images as the second part of the labeled sample images in the batch of labeled images required for the current iteration of training; The new labeled sample image is different from the labeled sample image reused in the current iteration, and the total number of images in the first part and the second part remains unchanged.

8. The method according to claim 1, characterized in that, The object detection model adopts the YOLO v7 network architecture. The backbone network of the object detection model contains several sequentially connected feature extraction networks. The feature extraction steps of the feature extraction networks include: The first convolution operation is performed multiple times on the input data of the feature extraction network to obtain the first output feature corresponding to the first convolution operation; Perform a second convolution operation on the first output feature of at least one first convolution operation to obtain a second output feature corresponding to the second convolution operation; The first output feature and the second output feature are fused together to obtain the fused output feature; Based on the fused output features, at least a third convolution operation is performed to obtain the final output features of the feature extraction network.

9. A target detection method, characterized in that, include: Acquire the image to be tested; The target detection model is used to detect the image to be tested, and the detection result of the image to be tested is obtained; wherein the target detection model is obtained by the training method of the target detection model according to any one of claims 1 to 8.

10. A training device for an object detection model, characterized in that, include: The acquisition module is used to acquire unlabeled sample images required for the current iteration and to acquire labeled sample images; The detection module is used to obtain the target detection model trained in the previous iteration in the current iteration, obtain the first detection result for the labeled sample image and the second detection result for the unlabeled sample image in the current iteration, and obtain the target detection model in the current iteration, obtain the third detection result for the labeled sample image and the fourth detection result for the unlabeled sample image in the current iteration. The measurement module is used to obtain a first loss based on the difference between the first detection result and the third detection result, a second loss based on the difference between the pseudo-label used by the second detection result and the fourth detection result, and a third loss based on the difference between the labeled label of the labeled sample image and the third detection result. An adjustment module is used to adjust the network parameters of the target detection model based on the first loss, the second loss, and the third loss; The phase determination module is used to determine the training phase of the current iteration; The self-distillation module is used to perform self-distillation training on the target detection model for the current iteration based on the labeled sample images required for the current iteration, depending on whether the current iteration is in the early or late training phase. The result detection submodule is used to obtain the target detection model trained in the previous iteration for the current iteration, as well as the sixth detection result of the labeled sample image required for the current iteration, and to obtain the target detection model for the current iteration, as well as the seventh detection result of the labeled sample image required for the current iteration. The metric submodule is used to obtain a fourth loss based on the difference between the pseudo-label used as the sixth detection result and the seventh detection result, and to obtain a fifth loss based on the difference between the seventh detection result and the labeled label of the labeled sample image required for the current iteration. The adjustment submodule is used to adjust the network parameters of the target detection model based on the fourth loss and the fifth loss.

11. A target detection device, characterized in that, include: The acquisition module is used to acquire the image to be tested; A detection module is used to detect the image to be tested based on a target detection model to obtain the detection result of the image to be tested; wherein the target detection model is obtained by the training device of the target detection model according to claim 10.

12. An electronic device, characterized in that, The device includes a memory and a processor that are coupled to each other. The memory stores program instructions, and the processor executes the program instructions to implement the training method of the target detection model according to any one of claims 1 to 8, or to implement the target detection method according to claim 9.

13. A camera device, characterized in that, It includes an optical element and an electronic device as described in claim 12, wherein the optical element is used to generate image data and the optical element is coupled to a processor in the electronic device.

14. A computer-readable storage medium, characterized in that, The device stores program instructions that can be executed by a processor, the program instructions being used to implement the training method of the target detection model according to any one of claims 1 to 8, or to implement the target detection method according to claim 9.