Training method and device of target detection model, target detection method, device and equipment
By distilling features between a lightweight student detection model and a high-precision teacher detection model, and using target image labels to determine the matching relationship of candidate features, the deployment difficulty of Transformer-based models on computing-limited applications is solved, and high-precision target detection is achieved.
Patent Information
- Application Number
- CN202310020937.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-06
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-01-06
AI Technical Summary
Transformer-based object detection models are difficult to deploy in applications with limited computing resources and are also difficult to perform knowledge distillation.
By constructing a feature distillation between a lightweight student detection model and a high-precision teacher detection model, the matching relationship of candidate features is determined using target image labels, and the student detection model is trained based on distillation loss.
It improves the detection accuracy of lightweight models, ensuring consistent output with high-precision models on applications with limited computing power.
Smart Images

Figure CN115984619B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence, and more particularly to the field of deep learning, specifically to a training method for an object detection model, an object detection method, an apparatus, and a device. Background Technology
[0002] In recent years, Transformer-based object detection (DETR) methods have achieved significant improvements in scalability and detection accuracy. However, their enormous computational complexity and large number of model parameters make them difficult to deploy in applications with limited computing resources. Furthermore, due to the typically unordered output of this detection model, it is difficult to apply existing knowledge distillation methods to this type of detection model. Summary of the Invention
[0003] This disclosure provides a method for training an object detection model, an object detection method, an apparatus, and a device.
[0004] According to one aspect of this disclosure, a method for training an object detection model is provided, comprising:
[0005] The target image is input into the student detection model and the teacher detection model respectively to obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0006] Based on the target labels in the target image, determine the student labels corresponding to the candidate student features and the teacher labels corresponding to the candidate teacher features, respectively.
[0007] Based on the student tags and the teacher tags, determine the characteristics of candidate students and candidate teachers that have a matching relationship;
[0008] The student detection model is trained based on the matching candidate student features and candidate teacher features.
[0009] According to one aspect of this disclosure, a target detection method is provided, comprising:
[0010] Acquire the image to be detected;
[0011] The image to be detected is input into a pre-trained student detection model, and the output of the student detection model is the target detection result; wherein, the training method of the student detection model is the target detection model training method provided in any embodiment of this disclosure.
[0012] According to another aspect of this disclosure, a training apparatus for an object detection model is provided, comprising:
[0013] The feature determination module is used to input the target image into the student detection model and the teacher detection model respectively, and obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0014] The label determination module is used to determine the student label corresponding to the candidate student feature and the teacher label corresponding to the candidate teacher feature based on the target label in the target image.
[0015] The feature matching module is used to determine candidate student features and candidate teacher features that have a matching relationship based on the student tags and the teacher tags;
[0016] The model training module is used to train the student detection model based on the matching candidate student features and candidate teacher features.
[0017] According to one aspect of this disclosure, a target detection device is provided, comprising:
[0018] The image acquisition module is used to acquire the image to be detected;
[0019] The detection result determination module is used to input the image to be detected into a pre-trained student detection model and obtain the output of the student detection model as the target detection result; wherein, the student detection model is obtained by the training device of the target detection model provided in any embodiment of this disclosure.
[0020] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0021] At least one processor; and
[0022] A memory communicatively connected to the at least one processor; wherein,
[0023] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a training method or object detection method for an object detection model as described in any embodiment of this disclosure.
[0024] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform a training method or a target detection method for a target detection model according to any embodiment of this disclosure.
[0025] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a training method or object detection method for an object detection model according to any embodiment of this disclosure.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0027] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0028] Figure 1 This is a schematic diagram of a training method for an object detection model according to an embodiment of the present disclosure;
[0029] Figure 2 This is a schematic diagram of another training method for an object detection model according to an embodiment of the present disclosure;
[0030] Figure 3 This is a schematic diagram of a training method for another object detection model according to an embodiment of the present disclosure;
[0031] Figure 4 This is a schematic diagram of a training method for another object detection model according to an embodiment of the present disclosure;
[0032] Figure 5 This is a schematic diagram of a target detection method according to an embodiment of the present disclosure;
[0033] Figure 6 This is a schematic diagram of the structure of a training device for an object detection model according to an embodiment of the present disclosure;
[0034] Figure 7 This is a schematic diagram of the structure of a target detection device according to an embodiment of the present disclosure;
[0035] Figure 8 This is a block diagram of an electronic device used to implement the training method of the target detection model in the embodiments of this disclosure. Detailed Implementation
[0036] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0037] Figure 1This is a schematic diagram of a training method for an object detection model according to an embodiment of the present disclosure. This embodiment is applicable to situations where the knowledge distillation method of an object detection model is optimized. This method can be executed by a training device for the object detection model, which can be implemented in software and / or hardware and integrated into an electronic device. The electronic device involved in this embodiment can be a server or other device with computing capabilities. Specifically, refer to... Figure 1 The method specifically includes the following:
[0038] S110. Input the target image into the student detection model and the teacher detection model respectively to obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0039] Student detection models refer to lightweight models with fewer parameters and lower computational requirements, suitable for deployment in applications with limited computing power. Examples include CNN or RNN models. Teacher detection models, on the other hand, are models with high accuracy but require a large number of parameters and training data. For instance, the Transformer-based DETR model has achieved significant improvements in scalability and performance, with detection accuracy significantly outperforming classic convolutional neural network object detection methods. However, the DETR model has a lower inductive bias, requiring even more parameters and training data for training. This large model size makes it difficult to deploy in applications with limited computing power, despite its high accuracy. Therefore, in practical applications, model compression is needed to transform large-scale teacher detection models into lightweight, deployable student detection models while maintaining high accuracy. For example, a large-parameter network model can be pre-trained as the teacher detection model, while a smaller-parameter target network model can be constructed as the student detection model. During the training of the student detection model, its feature representations are gradually made to approximate those of the teacher detection model, thus achieving a distillation of the teacher detection model.
[0040] Candidate student features refer to the logit output features of the object detection decoder in the constructed student detection model; that is, the upper-level output features of the classification encoder and regression box decoder in the student detection model are candidate student features. Candidate teacher features refer to the logit output features of the object detection decoder in the trained teacher detection model; that is, the upper-level output features of the classification encoder and regression box decoder in the teacher detection model are candidate teacher features. Target images refer to the sample images used to train the student detection model, where the detection targets are pre-labeled to obtain target labels. There can be one or more target images, and the number of target images is not limited.
[0041] Specifically, a large-scale teacher detection model is pre-trained, and a small-scale student detection model is constructed. The pre-prepared training target images are input into the teacher detection model and the student detection model respectively, and the upper-layer output features of the final output layer are candidate student features and candidate teacher features.
[0042] For example, a Transformer-based DETR model is pre-trained as a teacher detection model, and a CNN model is selected as a student detection model. The target image is data-augmented and then input into the student detection model to obtain the logit output of each layer in the target detection decoder, which serves as the candidate student features. Similarly, the data-augmented target image is input into the teacher detection model to obtain the logit output of each layer in the target detection decoder, which serves as the candidate teacher features.
[0043] S120. Based on the target labels in the target image, determine the student labels corresponding to the candidate student features and the teacher labels corresponding to the candidate teacher features.
[0044] In this context, target labels refer to the labeling results of the targets to be detected in the target image. For example, target labels include target classification labels and target regression box labels. Target classification labels are used to label the category of the target to be detected, and target regression box labels are used to label the location information of the target to be detected. Student labels are used to represent the target labels matching the candidate student features output by the student detection model, and teacher labels are used to represent the target labels matching the candidate teacher features output by the teacher detection model. For example, student labels can be represented using the target classification labels from the matched target labels.
[0045] Specifically, the target label corresponding to the candidate student feature is taken as the student label corresponding to that candidate student feature, and the target label corresponding to the candidate teacher feature is taken as the teacher label corresponding to that candidate teacher feature. For example, the candidate student feature and candidate teacher feature that match each target label in the target image are obtained, and the student label of the matching candidate student feature and the teacher label of the matching candidate teacher feature are determined according to the target label.
[0046] S130. Based on student and teacher labels, determine the characteristics of candidate students and candidate teachers that have a matching relationship.
[0047] Specifically, if any candidate student feature's student label matches any candidate teacher feature's teacher label, then the candidate student feature and the candidate teacher feature are determined to be a match.
[0048] For example, if the student labels of the candidate student features include category 1, category 2 and category 3, and the teacher labels of the candidate teacher features include category 4 and category 5, and it is determined that category 1 and category 4 match, then it is determined that the candidate student features corresponding to category 1 and the candidate teacher features corresponding to category 4 have a matching relationship. Similarly, if it is determined that category 2 and category 3 match category 5, then it is determined that the candidate student features corresponding to category 2 and category 3 and the candidate teacher features corresponding to category 5 have a matching relationship.
[0049] In another optional implementation of this embodiment, S130 includes:
[0050] Identify at least one candidate student feature and at least one candidate teacher feature that have the same student label and teacher label, and define them as candidate student features and candidate teacher features with a matching relationship.
[0051] Specifically, since student and teacher labels are determined based on target labels in the target image, if student and teacher labels are the same, it means that the candidate student feature corresponding to the student label and the candidate teacher feature corresponding to the teacher label are the same target to be detected in the target image, and the candidate student feature and the candidate teacher feature have a matching relationship.
[0052] For example, based on the above example, if category 1 and category 4 match, it means that category 1 and category 4 are the same; if category 2 and category 3 match category 5, it means that category 2 and category 3 are the same as category 5. Therefore, all candidate student features labeled as category 1 and all candidate teacher features labeled as category 4 are matched; similarly, all candidate student features labeled as categories 2 and 3 and all candidate teacher features labeled as category 5 are matched. It should be noted that the number of matching candidate student and candidate teacher features can be multiple. That is, multiple candidate student features and multiple candidate teacher features belong to the same category and are matched.
[0053] This embodiment determines whether candidate student and teacher features have a matching relationship by checking if student and teacher labels are the same, which improves the accuracy of matching candidate student and teacher features. Since the student and teacher labels in this embodiment are determined directly based on the target labels of the target image, matching errors caused by directly matching candidate student and teacher features are avoided, thus improving the accuracy of feature matching.
[0054] S140. Train the student detection model based on the matching student and teacher features.
[0055] Specifically, the distillation loss between candidate student features and candidate teacher features with matching relationships is determined, and the parameters of the student detection model are optimized based on this distillation loss to achieve the purpose of training the student detection model.
[0056] For example, based on the above example, the KL divergence between candidate student features of category 1 and candidate teacher features of category 4 is determined as the first distillation loss; the KL divergence between candidate student features of categories 2 and 3 and candidate teacher features of category 5 is determined as the second distillation loss, and the parameters of the student detection model are optimized based on the first distillation loss and the second distillation loss.
[0057] The solution in this embodiment determines the student labels of candidate student features in the student detection model and the teacher labels of candidate teacher features in the teacher detection model, and determines the matching results of candidate student features and candidate teacher features by matching the teacher labels and student labels. This solves the problem of ensuring the consistency of output features of the student detection model and the teacher detection model when the outputs of the student detection model and the teacher detection model are disordered, thereby improving the training accuracy of the student detection model.
[0058] Figure 2 This is a schematic diagram illustrating another training method for an object detection model according to an embodiment of the present disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 2 As shown, the training methods for the object detection model include the following:
[0059] S210. Input the target image into the student detection model and the teacher detection model respectively to obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0060] S220. Determine the student matching information of the target label and candidate student features in the target image, as well as the teacher matching information of the candidate teacher features.
[0061] Since each target label in the target image corresponds to a target to be detected, determining the student matching information between the target label and candidate student features can characterize the matching relationship between the candidate student features and the target to be detected. In other words, the student matching information characterizes the information of the target to be detected corresponding to any candidate student feature output by the student detection model. Similarly, the teacher matching information between the target label and candidate teacher features can characterize the matching relationship between the candidate teacher features and the target to be detected. In other words, the teacher matching information characterizes the information of the target to be detected corresponding to any candidate teacher feature output by the teacher detection model.
[0062] For example, based on a pre-determined matching algorithm, the similarity between the target feature to be detected in the target label and the candidate student feature is determined. If the similarity with any candidate student feature is greater than a preset threshold, the student matching information of that candidate student feature is determined to match the target label. Similarly, based on a pre-determined matching algorithm, the similarity between the target feature to be detected in the target label and the candidate teacher feature is determined. If the similarity with any candidate teacher feature is greater than a preset threshold, the teacher matching information of that candidate teacher feature is determined to match the target label. For example, the pre-determined matching algorithm includes the Hungarian matching algorithm or a sparse matching algorithm, etc., and the matching algorithm is not limited here.
[0063] S230. Determine the student labels corresponding to the candidate student features based on the student matching information, and determine the teacher labels corresponding to the candidate teacher features based on the teacher matching information.
[0064] The matching information for each candidate student feature is used to determine the match between the candidate student feature and the target label. Then, based on this match, the corresponding student label is determined. For example, the student matching information includes the degree of match between the candidate student feature and each target label; the target label with the highest match degree is then determined as the student label corresponding to the candidate student feature. Similarly, the matching information for each candidate teacher feature is used to determine the match between the candidate teacher feature and the target label. Then, based on this match, the corresponding teacher label is determined. For example, the teacher matching information includes the degree of match between the candidate teacher feature and each target label; the target label with the highest match degree is then determined as the student label corresponding to the candidate teacher feature.
[0065] For example, the target label includes three detection target categories: category 1, category 2, and category 3. If the student label corresponding to the candidate student feature is category 1, it means that the candidate student feature matches the target to be detected corresponding to category 1.
[0066] In another optional implementation of this embodiment, S230 includes:
[0067] If the student matching information successfully matches any target label in the target image, then the student label corresponding to the candidate student feature is determined to be the foreground feature student label; if the student matching information fails to match any target label in the target image, then the student label corresponding to the candidate student feature is determined to be the background feature student label.
[0068] If the teacher matching information successfully matches any target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be the foreground feature teacher label; if the teacher matching information fails to match any target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be the background feature teacher label.
[0069] Since target labels represent the objects to be detected in the target image, and these objects belong to the foreground, if a student's matching information matches any target label, then the candidate student feature is determined to be a foreground target, and the corresponding student label is determined to be a foreground feature student label. If a student's matching information fails to match any target label, then the candidate student feature corresponding to that matching information belongs to the background feature, and the student label is determined to be a background feature student label. Similarly, if a teacher's matching information matches any target label, then the candidate teacher feature is determined to be a foreground target, and the corresponding teacher label is determined to be a foreground feature teacher label. If a teacher's matching information fails to match any target label, then the candidate teacher feature corresponding to that matching information belongs to the background feature, and the teacher label is determined to be a background feature teacher label.
[0070] This embodiment determines whether candidate student features or candidate teacher features belong to foreground features or background features by matching information with target labels, and assigns corresponding labels to both foreground and background features, thereby improving the accuracy of candidate feature classification. As a result, the student detection model can learn not only the foreground features trained by the teacher detection model, but also the background features trained by the teacher detection model during the training process, thus improving the training accuracy of the student detection model.
[0071] S240. Based on student and teacher labels, determine the characteristics of candidate students and candidate teachers that have a matching relationship.
[0072] In another optional implementation of this embodiment, S240 includes:
[0073] Foreground candidate student features are determined based on foreground student labels, and foreground candidate student and foreground candidate teacher features with matching relationships are determined based on foreground teacher labels.
[0074] Background candidate student features are determined based on the background feature student labels, and background candidate student features and background candidate teacher features with matching relationships are determined based on the background feature teacher labels.
[0075] If the student label of any candidate student feature is a foreground student feature, it means that the candidate student feature has successfully matched the foreground feature in the target image, and the candidate student feature is a foreground candidate student feature. Similarly, if the teacher label of any candidate teacher feature is a foreground student feature, it means that the candidate teacher feature has also successfully matched the foreground feature in the target image, and the candidate teacher feature belongs to the foreground candidate teacher feature. Therefore, it is determined that the foreground candidate student feature and the foreground candidate teacher feature that have successfully matched the foreground feature have a matching relationship.
[0076] Similarly, if the student label of any candidate student feature is the background student label, it means that the candidate student feature has successfully matched the background feature in the target image, and the candidate student feature is a background candidate student feature. Likewise, if the teacher label of any candidate teacher feature is the background student label, it means that the candidate teacher feature has also successfully matched the background feature in the target image, and the candidate teacher feature belongs to the background candidate teacher feature. Therefore, it is determined that the background candidate student feature and the background candidate teacher feature that have successfully matched the background feature have a matching relationship.
[0077] Optionally, the foreground feature labels can be further classified according to different categories of the target label, that is, the foreground candidate student features can be further subdivided, for example, including a first foreground feature label and a second foreground feature label. For example, if the target label categories include category 1, category 2, and category 3, then the candidate student features that successfully match category 1 are the first category foreground candidate student features, and the corresponding student label is the first foreground feature label. Similarly, the candidate student features that successfully match other categories are the other category foreground candidate student features, and the corresponding student label is the other foreground feature label. The candidate teacher features that successfully match category 1 are the first category foreground candidate teacher features, and the corresponding teacher label is the first foreground feature label. Similarly, the candidate teacher features that successfully match other categories are the other category foreground candidate teacher features, and the corresponding teacher label is the other foreground feature label.
[0078] This embodiment distinguishes the foreground and background features in candidate student and candidate teacher features using foreground and background feature labels, and classifies and matches the candidate student and candidate teacher features based on the foreground and background features. This allows the student detection model to learn the foreground and background features of the target to be detected learned by the teacher detection model, improving the completeness of the knowledge distillation of the teacher detection model by the student detection model, and thus improving the consistency of the output features of the student detection model and the teacher detection model.
[0079] S250. Train the student detection model based on the matching student and teacher features.
[0080] Specifically, the foreground distillation loss is determined based on the foreground candidate student and foreground candidate teacher features that have a matching relationship, the background distillation loss is determined based on the background candidate student and background candidate teacher features that have a matching relationship, and the parameters of the student detection model are optimized based on the foreground distillation loss and the background distillation loss.
[0081] For example, the first category of foreground KL divergence is determined based on the first category of foreground candidate student features and the first category of foreground candidate teacher features with matching relationships; the other categories of foreground candidate student features and the other categories of foreground candidate teacher features with matching relationships are determined; the average background candidate student features of all background candidate student features and the average background candidate teacher features of all background candidate teacher features are determined; the background KL divergence is determined based on the average background candidate student features and the average background candidate teacher features with matching relationships; and the parameters of the student detection model are optimized based on the first category of foreground KL divergence, the other categories of foreground KL divergence, and the background KL divergence.
[0082] The solution in this embodiment determines the student labels of candidate student features in the student detection model and the teacher labels of candidate teacher features in the teacher detection model by matching information with the target labels. This improves the accuracy of student and teacher label determination and further ensures the consistency of output features of the student and teacher detection models even when the outputs of the student and teacher detection models are disordered, thereby improving the training accuracy of the student detection model.
[0083] Figure 3 This is a schematic diagram illustrating another training method for an object detection model according to an embodiment of the present disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 3 As shown, the training methods for the object detection model include the following:
[0084] S310. Input the target image into the student detection model and the teacher detection model respectively to obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0085] S320. Based on the student detection model and candidate student features, determine the candidate student prediction results corresponding to the candidate student features, and based on the teacher detection model and candidate teacher features, determine the candidate teacher prediction results corresponding to the candidate teacher features.
[0086] Among them, the candidate student prediction result refers to the detection result of the student detection model corresponding to the candidate student features, and the candidate teacher prediction result refers to the detection result of the teacher detection model corresponding to the candidate teacher features.
[0087] Specifically, candidate student features are processed through the classification encoder and regression box decoder of the student detection model to obtain candidate student classification predictions and candidate student regression box predictions, which are then used as the candidate student prediction results. For example, the multi-layer logit output features generated in the student detection model are all processed through the classification encoder and regression box decoder of the student detection model to obtain classification outputs and regression box outputs. Similarly, candidate teacher features are processed through the classification encoder and regression box decoder of the teacher detection model to obtain candidate teacher classification predictions and candidate teacher regression box predictions, which are then used as the candidate teacher prediction results. For example, the multi-layer logit output features generated in the teacher detection model are all processed through the classification encoder and regression box decoder of the teacher detection model to obtain classification outputs and regression box outputs.
[0088] S330. Determine the target student cost matrix corresponding to the candidate student prediction result and the target teacher cost matrix corresponding to the candidate teacher prediction result based on the target label in the target image.
[0089] The cost matrix is used to characterize the degree of matching between the prediction result and the target label.
[0090] Specifically, the target student cost matrix is determined based on the difference between the target label and the candidate student prediction results, and the target teacher cost matrix is determined based on the difference between the target label and the candidate teacher prediction results. For example, the target student cost matrix is used to characterize the overall difference between the prediction results and the target label, and the prediction results include classification prediction results and regression box prediction results. This embodiment does not limit the specific method for determining the cost matrix.
[0091] In another optional implementation of this embodiment, S330 includes:
[0092] Based on the target classification labels in the target labels, determine the student classification cost matrix corresponding to the candidate student prediction results and the teacher classification cost matrix corresponding to the candidate teacher prediction results;
[0093] The student regression box cost matrix corresponding to the candidate student prediction result and the teacher regression box cost matrix corresponding to the candidate teacher prediction result are determined based on the target regression box label in the target label; wherein, the regression box cost matrix includes at least the regression box distance cost matrix and the regression box overlap cost matrix.
[0094] The target student cost matrix corresponding to the candidate student prediction result is determined based on the student classification cost matrix and the student regression box cost matrix, and the target teacher cost matrix corresponding to the candidate teacher prediction result is determined based on the teacher classification cost matrix and the teacher regression box cost matrix.
[0095] Since this embodiment trains a detection model, and the model's detection requirements include both classification and location detection, the pre-labeled target labels include target classification labels and target bounding box labels. The target classification labels represent the category of the target to be detected, while the bounding box labels represent the location information of the target. Similarly, the candidate student prediction results include candidate student classification prediction results and candidate student bounding box prediction results, and the candidate teacher prediction results include candidate teacher classification prediction results and candidate teacher bounding box prediction results.
[0096] Specifically, the student classification cost matrix is determined based on the difference between the target classification label in the target label and the candidate student classification prediction results in the candidate student prediction results; the teacher classification cost matrix is determined based on the difference between the target classification label in the target label and the candidate teacher classification prediction results in the candidate teacher prediction results. Simultaneously, the student regression box cost matrix is determined based on the difference between the target regression box label in the target label and the candidate student regression box prediction results in the candidate student prediction results; the teacher regression box cost matrix is determined based on the difference between the target regression box label in the target label and the candidate teacher regression box prediction results in the candidate teacher prediction results.
[0097] Furthermore, to improve the accuracy of the regression box cost matrix, the regression box cost matrix includes a regression box distance cost matrix and a regression box overlap cost matrix. The regression box distance cost matrix represents the vertex distance between the target regression box label in the target label and the candidate regression box prediction results in the candidate prediction results. The regression box overlap cost matrix represents the degree of overlap between the target regression box label in the target label and the candidate regression box prediction results in the candidate prediction results. By representing the differences between regression boxes from at least two aspects, the accuracy of determining the differences between regression boxes is improved, avoiding inaccuracies in the determination of differences caused by differences in only one aspect, such as distance or overlap. For example, when the vertex of the target regression box label is very close to the vertex in the candidate prediction results, the overlap difference is large. If the determination is based solely on the distance cost matrix or the overlap cost matrix, the result will be inaccurate. Similarly, when the target regression box label and the candidate prediction results highly overlap, but the distance between the vertices is far, if the determination is based solely on the overlap cost matrix or the distance cost matrix, the result will be inaccurate.
[0098] The weighted result is determined based on the student classification cost matrix, the student regression box cost matrix, and their corresponding weights, and serves as the target student cost matrix corresponding to the candidate student prediction result. Similarly, the weighted result is determined based on the teacher classification cost matrix, the teacher regression box cost matrix, and their corresponding weights, and serves as the target teacher cost matrix corresponding to the candidate teacher prediction result. The weight values can be adjusted according to actual circumstances, such as based on the detection accuracy of the classification and regression boxes; this is not a restriction here.
[0099] This embodiment improves the accuracy of cost matrix determination by determining the cost matrix separately for the classification results and the regression box results, and further improves the accuracy of cost matrix determination by determining the cost matrix from multiple aspects of the regression box cost matrix.
[0100] S340. Based on the Hungarian matching method, determine the student matching information of the candidate student features corresponding to the candidate student prediction results according to the target student cost matrix and target label, and determine the teacher matching information of the candidate teacher features corresponding to the candidate teacher prediction results according to the target teacher cost matrix and target label.
[0101] Based on a predetermined matching method, the target student cost matrix is used to match the predicted results of candidate students with the target labels. This determines the predicted result of a candidate student for each target label, and based on the matched target label, the student matching information for the candidate student features corresponding to that predicted result is determined. Similarly, the target teacher cost matrix is used to match the predicted results of candidate teachers with the target labels. This determines the predicted result of a candidate teacher for each target label, and based on the matched target label, the teacher matching information for the candidate teacher features corresponding to that predicted result is determined.
[0102] S350. Determine the student labels corresponding to the candidate student features based on the student matching information, and determine the teacher labels corresponding to the candidate teacher features based on the teacher matching information.
[0103] S360: Based on student and teacher tags, determine candidate student and teacher features that have matching relationships.
[0104] S370. Train the student detection model based on the matching student and teacher features.
[0105] The scheme in this embodiment determines the cost matrix by matching the target label with the prediction results of each model, and then determines the student label of the candidate student feature and the teacher label of the candidate teacher feature by matching the cost matrix with the target label, thereby improving the accuracy of student label and teacher label determination.
[0106] Figure 4This is a schematic diagram illustrating another training method for an object detection model according to an embodiment of the present disclosure. This embodiment is a further refinement of the above technical solution, and the technical solution in this embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 4 As shown, the training methods for the object detection model include the following:
[0107] After data augmentation, the target image is input into the student detection model to obtain the logit output of each layer of the target detection decoder in the student detection model, which serves as the candidate student features.
[0108] The multi-level logit outputs of the student detection model are all passed through the classification encoder and regression box decoder of the student detection model to obtain the candidate student prediction results, which include the candidate student classification prediction results and the candidate student regression box prediction results.
[0109] The student classification cost matrix is calculated based on the candidate student classification prediction results and the target classification labels in the target image.
[0110] The student regression box cost matrix is calculated based on the candidate student regression box prediction results and the target regression box labels in the target image. The regression box cost matrix includes the L1 distance cost matrix and the GIOU distance cost matrix, where the L1 distance cost matrix represents the regression box distance cost matrix and the GIOU distance cost matrix represents the regression box overlap cost matrix.
[0111] The target student cost matrix is determined based on the student classification cost matrix, L1 distance cost matrix, and GIOU distance cost matrix. The target student cost matrix is then used to perform Hungarian matching between the candidate student prediction results and the target label to obtain the candidate student features matched_logit_s that match each target label.
[0112] Meanwhile, the target image, after data augmentation, is input into the teacher detection model to obtain the logit output of each layer of the target detection decoder in the teacher detection model, which serves as the candidate teacher features.
[0113] The multi-level logit output of the teacher detection model is passed through the classification encoder and regression box decoder of the teacher detection model to obtain the candidate teacher prediction results, which include the candidate teacher classification prediction results and the candidate teacher regression box prediction results.
[0114] The teacher classification cost matrix is calculated based on the candidate teacher classification prediction results and the target classification labels in the target image.
[0115] The teacher regression box cost matrix is calculated based on the candidate teacher regression box prediction results and the target regression box labels in the target image. The regression box cost matrix includes the L1 distance cost matrix and the GIOU distance cost matrix.
[0116] The target teacher cost matrix is determined based on the teacher classification cost matrix, L1 distance cost matrix, and GIOU distance cost matrix. The target teacher cost matrix is then used to perform Hungarian matching between the candidate teacher prediction results and the target labels to obtain the candidate teacher features matched_logit_t that match each target label.
[0117] Calculate the prospect KL divergence Loss_matched_kl for candidate student features matched_logit_s and candidate teacher features matched_logit_t that match the same target label.
[0118] The average background logit features that do not match the target label in the student detection model and the teacher detection model are calculated to obtain the average background candidate student features and the average background candidate teacher features. The background KL divergence Loss_unmatched_kl of the average background candidate student features and the average background candidate teacher features is then calculated.
[0119] The parameters of the student detection model are optimized based on the foreground KL divergence Loss_matched_kl and the background KL divergence Loss_unmatched_kl to train the student detection model.
[0120] For example, a high-precision obstacle detection model can be trained using a massive dataset as the teacher detection model. Using the training method of this embodiment, a lightweight, high-precision small model can be distilled from this large model as the student detection model, applied to the field of autonomous driving and deployed in automotive chips. Alternatively, a high-precision pedestrian detection model can be trained using a massive dataset as the teacher detection model. Using the training method of this embodiment, a lightweight, high-precision small model can be distilled from this large model as the student detection model, applied to the field of security monitoring and deployed in surveillance camera chips.
[0121] The solution in this embodiment determines the student labels of candidate student features in the student detection model and the teacher labels of candidate teacher features in the teacher detection model, and determines the matching results of candidate student features and candidate teacher features by matching the teacher labels and student labels. This solves the problem of ensuring the consistency of output features of the student detection model and the teacher detection model when the outputs of the student detection model and the teacher detection model are disordered, thereby improving the training accuracy of the student detection model.
[0122] Figure 5This is a schematic diagram of a target detection method according to an embodiment of the present disclosure. This embodiment is applicable to situations where the target detection method needs to be optimized. The method can be executed by a target detection device, which can be implemented by software and / or hardware and integrated into an electronic device. The electronic device involved in this embodiment can be a server or other device with computing capabilities. Specifically, refer to... Figure 5 The method specifically includes the following:
[0123] S510. Acquire the image to be detected.
[0124] The image to be detected is an image that includes a target to be detected. For example, the target to be detected is an obstacle, and the image to be detected is an obstacle detection image in the field of autonomous driving applications; the target to be detected is a pedestrian, and the image to be detected is a pedestrian detection image in the field of surveillance applications.
[0125] S520. Input the image to be detected into the pre-trained student detection model, and obtain the target detection result as the output of the student detection model.
[0126] The training method for the student detection model is the same as the training method for the target detection model provided in any embodiment of this disclosure.
[0127] Specifically, the image to be detected is input into a student detection model that has been pre-trained using the training method of the target detection model provided in any embodiment of this disclosure. The student detection model learns the learning features of the teacher detection model, and the output of the student detection model is the target detection result. The target detection result has a high degree of consistency with the output result of the teacher detection model.
[0128] By inputting the image to be detected into the student detection model, the accuracy of target detection in the image is improved, and the target detection method can be deployed on practical applications with limited computing power.
[0129] Figure 6 This is a schematic diagram of a training apparatus for an object detection model according to an embodiment of the present disclosure. This apparatus can execute the training method for the object detection model involved in any embodiment of the present disclosure; (Refer to...) Figure 6 The training device 600 for the target detection model includes: a feature determination module 610, a label determination module 620, a feature matching module 630, and a model training module 640.
[0130] The feature determination module 610 is used to input the target image into the student detection model and the teacher detection model respectively, and obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model.
[0131] The label determination module 620 is used to determine the student label corresponding to the candidate student feature and the teacher label corresponding to the candidate teacher feature based on the target label in the target image.
[0132] The feature matching module 630 is used to determine candidate student features and candidate teacher features that have a matching relationship based on the student tags and the teacher tags;
[0133] The model training module 640 is used to train the student detection model based on the candidate student features and candidate teacher features that have a matching relationship.
[0134] The solution in this embodiment determines the student labels of candidate student features in the student detection model and the teacher labels of candidate teacher features in the teacher detection model, and determines the matching results of candidate student features and candidate teacher features by matching the teacher labels and student labels. This solves the problem of ensuring the consistency of output features of the student detection model and the teacher detection model when the outputs of the student detection model and the teacher detection model are disordered, thereby improving the training accuracy of the student detection model.
[0135] In an optional implementation of this embodiment, the feature matching module is specifically used for:
[0136] Identify at least one candidate student feature and at least one candidate teacher feature that are the same as the student label and the teacher label, and define them as candidate student features and candidate teacher features with a matching relationship.
[0137] In an optional implementation of this embodiment, the tag determination module includes:
[0138] The matching information determination unit is used to determine the student matching information of the target label and the candidate student features in the target image, and the teacher matching information of the candidate teacher features;
[0139] The label determination unit is used to determine the student label corresponding to the candidate student feature based on the student matching information, and to determine the teacher label corresponding to the candidate teacher feature based on the teacher matching information.
[0140] In an optional implementation of this embodiment, the label determining unit is specifically used for:
[0141] If the student matching information successfully matches any target label in the target image, then the student label corresponding to the candidate student feature is determined to be a foreground feature student label; if the student matching information fails to match any target label in the target image, then the student label corresponding to the candidate student feature is determined to be a background feature student label.
[0142] If the teacher matching information successfully matches any target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be a foreground feature teacher label; if the teacher matching information fails to match any target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be a background feature teacher label.
[0143] In an optional implementation of this embodiment, the feature matching module is specifically used for:
[0144] Based on the foreground feature student labels, foreground candidate student features are determined, and based on the foreground feature teacher labels, foreground candidate student features and foreground candidate teacher features with matching relationships are determined;
[0145] Background candidate student features are determined based on the background feature student labels, and background candidate student features and background candidate teacher features with matching relationships are determined based on the background feature teacher labels.
[0146] In an optional implementation of this embodiment, the matching information determining unit includes:
[0147] The prediction result determination subunit is used to determine the candidate student prediction result corresponding to the candidate student feature based on the student detection model and the candidate student feature, and to determine the candidate teacher prediction result corresponding to the candidate teacher feature based on the teacher detection model and the candidate teacher feature;
[0148] The cost matrix determination subunit is used to determine the target student cost matrix corresponding to the candidate student prediction result and the target teacher cost matrix corresponding to the candidate teacher prediction result based on the target label in the target image.
[0149] The matching information determination subunit is used to determine, based on the Hungarian matching method, the student matching information corresponding to the candidate student features of the candidate student prediction result according to the target student cost matrix and the target label, and the teacher matching information corresponding to the candidate teacher prediction result according to the target teacher cost matrix and the target label.
[0150] In an optional implementation of this embodiment, the cost matrix determines the sub-unit, specifically for:
[0151] The student classification cost matrix corresponding to the candidate student prediction result and the teacher classification cost matrix corresponding to the candidate teacher prediction result are determined based on the target classification label in the target label.
[0152] The student regression box cost matrix corresponding to the candidate student prediction result and the teacher regression box cost matrix corresponding to the candidate teacher prediction result are determined based on the target regression box label in the target label; wherein, the regression box cost matrix includes at least the regression box distance cost matrix and the regression box overlap cost matrix;
[0153] The target student cost matrix corresponding to the candidate student prediction result is determined based on the student classification cost matrix and the student regression box cost matrix, and the target teacher cost matrix corresponding to the candidate teacher prediction result is determined based on the teacher classification cost matrix and the teacher regression box cost matrix.
[0154] The training apparatus for the above-described object detection model can execute the training method for the object detection model provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the training method for the object detection model provided in any embodiment of this disclosure.
[0155] Figure 7 This is a schematic diagram of a target detection device according to an embodiment of the present disclosure. This device can execute the target detection method involved in any embodiment of the present disclosure; see reference. Figure 7 The target detection device 700 includes an image acquisition module 710 and a detection result determination module 720.
[0156] Image acquisition module 710 is used to acquire the image to be detected.
[0157] The detection result determination module 720 is used to input the image to be detected into a pre-trained student detection model to obtain the output of the student detection model as the target detection result; wherein, the student detection model is obtained by the device according to any one of claims 9-15.
[0158] The target detection device described above can execute the target detection method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the target detection method provided in any embodiment of this disclosure.
[0159] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0160] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0161] Figure 8A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0162] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.
[0163] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0164] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as the training method for an object detection model. For example, in some embodiments, the training method for an object detection model can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the training method for the object detection model described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the training of the object detection model by any other suitable means (e.g., by means of firmware).
[0165] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0166] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0167] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0168] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0169] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0170] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0171] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0172] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for training an object detection model, comprising: The target image is input into the student detection model and the teacher detection model respectively to obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model. Determine the student matching information of the target label in the target image and the candidate student features, as well as the teacher matching information of the candidate teacher features; If the student matching information successfully matches any target label in the target image, then the student label corresponding to the candidate student feature is determined to be a foreground feature student label; if the student matching information fails to match any target label in the target image, then the student label corresponding to the candidate student feature is determined to be a background feature student label. If the teacher matching information successfully matches any target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be the foreground feature teacher label; If the teacher matching information fails to match the target label in the target image, then the teacher label corresponding to the candidate teacher feature is determined to be the background feature teacher label; wherein, the target label refers to the label result of the target to be detected in the target image, and the target label includes the target classification label and the target regression box label. The student label is used to represent the target label of the candidate student feature output by the student detection model, and the teacher label is used to represent the target label of the candidate teacher feature output by the teacher detection model. Based on the student labels and the teacher labels, candidate student features and candidate teacher features with matching relationships are determined; wherein, the candidate student features and candidate teacher features with matching relationships correspond to the same target to be detected in the target image. The student detection model is trained based on the matching candidate student features and candidate teacher features.
2. The method according to claim 1, wherein, Based on the student tags and the teacher tags, candidate student features and candidate teacher features with matching relationships are determined, including: Identify at least one candidate student feature and at least one candidate teacher feature that are the same as the student label and the teacher label, and define them as candidate student features and candidate teacher features with a matching relationship.
3. The method according to claim 1, wherein, Based on the student tags and the teacher tags, candidate student features and candidate teacher features with matching relationships are determined, including: Based on the foreground feature student labels, foreground candidate student features are determined, and based on the foreground feature teacher labels, foreground candidate student features and foreground candidate teacher features with matching relationships are determined; Background candidate student features are determined based on the background feature student labels, and background candidate student features and background candidate teacher features with matching relationships are determined based on the background feature teacher labels.
4. The method according to claim 1, wherein, Determining student matching information between the target label in the target image and the candidate student features, and teacher matching information between the candidate teacher features and the candidate teacher features, includes: Based on the student detection model and the candidate student features, the predicted results of the candidate students corresponding to the candidate student features are determined, and based on the teacher detection model and the candidate teacher features, the predicted results of the candidate teachers corresponding to the candidate teacher features are determined; The target student cost matrix corresponding to the candidate student prediction result and the target teacher cost matrix corresponding to the candidate teacher prediction result are determined based on the target labels in the target image. Based on the Hungarian matching method, student matching information of the candidate student features corresponding to the candidate student prediction results is determined according to the target student cost matrix and the target label, and teacher matching information of the candidate teacher features corresponding to the candidate teacher prediction results is determined according to the target teacher cost matrix and the target label.
5. The method according to claim 4, wherein, Determining the target student cost matrix corresponding to the candidate student prediction result and the target teacher cost matrix corresponding to the candidate teacher prediction result based on the target label in the target image includes: The student classification cost matrix corresponding to the candidate student prediction result and the teacher classification cost matrix corresponding to the candidate teacher prediction result are determined based on the target classification label in the target label. The student regression box cost matrix corresponding to the candidate student prediction result and the teacher regression box cost matrix corresponding to the candidate teacher prediction result are determined based on the target regression box label in the target label; wherein, the regression box cost matrix includes at least the regression box distance cost matrix and the regression box overlap cost matrix; The target student cost matrix corresponding to the candidate student prediction result is determined based on the student classification cost matrix and the student regression box cost matrix, and the target teacher cost matrix corresponding to the candidate teacher prediction result is determined based on the teacher classification cost matrix and the teacher regression box cost matrix.
6. A target detection method, comprising: Acquire the image to be detected; The image to be detected is input into a pre-trained student detection model, and the output of the student detection model is the target detection result; wherein the training method of the student detection model is the method of any one of claims 1-5.
7. A training device for an object detection model, comprising: The feature determination module is used to input the target image into the student detection model and the teacher detection model respectively, and obtain the candidate student features output by the student detection model and the candidate teacher features output by the teacher detection model. A label determination module is used to determine, based on target labels in the target image, student labels corresponding to candidate student features and teacher labels corresponding to candidate teacher features, respectively. Target labels refer to the labeling results of the targets to be detected in the target image, including target classification labels and target regression box labels. Student labels are used to characterize the target labels matching candidate student features output by the student detection model, and teacher labels are used to characterize the target labels matching candidate teacher features output by the teacher detection model. The label determination module includes: a matching information determination unit, used to determine student matching information between target labels in the target image and candidate student features, and teacher matching information between target labels and candidate teacher features; and a label determination unit, used to determine the candidate student... The tag determination unit is configured to: determine the student tag corresponding to the candidate student feature and the teacher tag corresponding to the candidate teacher feature based on the teacher matching information; the tag determination unit is specifically configured to: if the student matching information matches any target tag in the target image, determine the student tag corresponding to the candidate student feature as a foreground feature student tag; if the student matching information fails to match any target tag in the target image, determine the student tag corresponding to the candidate student feature as a background feature student tag; if the teacher matching information matches any target tag in the target image, determine the teacher tag corresponding to the candidate teacher feature as a foreground feature teacher tag; if the teacher matching information fails to match any target tag in the target image, determine the teacher tag corresponding to the candidate teacher feature as a background feature teacher tag; The feature matching module is used to determine candidate student features and candidate teacher features that have a matching relationship based on the student labels and the teacher labels; wherein the candidate student features and candidate teacher features that have a matching relationship correspond to the same target to be detected in the target image; The model training module is used to train the student detection model based on the matching candidate student features and candidate teacher features.
8. The apparatus according to claim 7, wherein, The feature matching module is specifically used for: Identify at least one candidate student feature and at least one candidate teacher feature that are the same as the student label and the teacher label, and define them as candidate student features and candidate teacher features with a matching relationship.
9. The apparatus according to claim 7, wherein, The feature matching module is specifically used for: Based on the foreground feature student labels, foreground candidate student features are determined, and based on the foreground feature teacher labels, foreground candidate student features and foreground candidate teacher features with matching relationships are determined; Background candidate student features are determined based on the background feature student labels, and background candidate student features and background candidate teacher features with matching relationships are determined based on the background feature teacher labels.
10. The apparatus according to claim 7, wherein, The matching information determination unit includes: The prediction result determination subunit is used to determine the candidate student prediction result corresponding to the candidate student feature based on the student detection model and the candidate student feature, and to determine the candidate teacher prediction result corresponding to the candidate teacher feature based on the teacher detection model and the candidate teacher feature; The cost matrix determination subunit is used to determine the target student cost matrix corresponding to the candidate student prediction result and the target teacher cost matrix corresponding to the candidate teacher prediction result based on the target label in the target image. The matching information determination subunit is used to determine, based on the Hungarian matching method, the student matching information corresponding to the candidate student features of the candidate student prediction result according to the target student cost matrix and the target label, and the teacher matching information corresponding to the candidate teacher prediction result according to the target teacher cost matrix and the target label.
11. The apparatus according to claim 10, wherein, The cost matrix determines the sub-units, specifically for: The student classification cost matrix corresponding to the candidate student prediction result and the teacher classification cost matrix corresponding to the candidate teacher prediction result are determined based on the target classification label in the target label. The student regression box cost matrix corresponding to the candidate student prediction result and the teacher regression box cost matrix corresponding to the candidate teacher prediction result are determined based on the target regression box label in the target label; wherein, the regression box cost matrix includes at least the regression box distance cost matrix and the regression box overlap cost matrix; The target student cost matrix corresponding to the candidate student prediction result is determined based on the student classification cost matrix and the student regression box cost matrix, and the target teacher cost matrix corresponding to the candidate teacher prediction result is determined based on the teacher classification cost matrix and the teacher regression box cost matrix.
12. A target detection device, comprising: The image acquisition module is used to acquire the image to be detected; The detection result determination module is used to input the image to be detected into a pre-trained student detection model to obtain the output of the student detection model as the target detection result; wherein the student detection model is obtained by the apparatus according to any one of claims 7-11.
13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5 or the method of claim 6.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-5 or the method according to claim 6.
15. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1-5 or the method according to claim 6.
Citation Information
Patent Citations
Distillation learning method and device, computer equipment and storage medium
CN111898735A
Knowledge distillation method, device, equipment and medium based on structured instance diagram
CN113255915A
