Target detection model training method, target detection method and target detection device
By using the target confidence in the target detection model to jointly train the teacher model and the student model, and dynamically updating the confidence, the problem of pseudo-label inaccuracy is solved, the accuracy and generalization ability of the model are improved, and the existing problems are solved. The problem of low model accuracy in technology.
Patent Information
- Application Number
- CN202410175878.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-07
- Publication Date
- 2024-09-17
AI Technical Summary
In the semi-supervised training of existing target detection models, the accuracy of the model is reduced due to inaccurate pseudo labels. Existing methods such as DARP and Label matching have limitations and cannot effectively improve the accuracy of pseudo labels.
By using the target confidence to jointly train the initial teacher model and the student model, the target confidence is dynamically updated to improve the accuracy of pseudo labels, thereby reducing propagation errors and improving model accuracy.
It improves the accuracy of the target detection model, reduces the risk of overfitting of the model in new data domains, and improves the generalization ability.
Smart Images

Figure CN118657967A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a target detection model training method, a target detection method and a device. Background Art
[0002] In the field of artificial intelligence, since the amount of unlabeled data is much larger than the amount of labeled data, semi-supervised training is widely used. The training of target detection models is one of the typical examples of semi-supervised training. At present, during the training of target detection models, loss calculation is usually performed based on the pseudo-labels output by the model. However, the pseudo-labels output by the model may not be accurate, which will lead to subsequent propagation errors and reduce the accuracy of the trained target detection model. Therefore, how to improve the accuracy of pseudo-labels and thus improve the accuracy of the model is a technical problem that needs to be solved. Summary of the invention
[0003] The present application provides a target detection model training method, a target detection method and a device to improve the accuracy of the target detection model.
[0004] In a first aspect, an embodiment of the present application provides a method for training a target detection model, comprising:
[0005] The initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images and unlabeled sample images; the joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on an update condition;
[0006] If it is determined according to the target loss that the training end condition is met, the teacher model or the student model when the training end condition is met is determined as the target detection model.
[0007] It can be seen that in the embodiment of the present application, since the target confidence is dynamically updated based on the update condition, it is ensured that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0008] In a second aspect, an embodiment of the present application provides a target detection method, including:
[0009] Acquire the image to be detected;
[0010] The target detection model is used to perform target detection processing on the image to be detected to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in the first aspect above.
[0011] It can be seen that in the embodiment of the present application, since the target detection model used for target detection processing is dynamically updated based on the update conditions during the training process, it is ensured that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the highly accurate target detection model, thereby improving the accuracy of the target detection results.
[0012] In a third aspect, an embodiment of the present application provides a training device for a target detection model, comprising:
[0013] A training module, used for performing joint training processing on an initial teacher model and an initial student model using target confidence, labeled sample images and unlabeled sample images; the joint training processing includes: performing target detection processing on the unlabeled sample images according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample images; performing target detection processing on the unlabeled sample images and the labeled sample images by the initial student model to obtain a second target detection result of the unlabeled sample images and a third target detection result of the labeled sample images; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on an update condition;
[0014] A determination module is used to determine the teacher model or the student model that meets the training end condition as the target detection model if it is determined according to the target loss that the training end condition is met.
[0015] In a fourth aspect, an embodiment of the present application provides a target detection device, including:
[0016] An acquisition module, used for acquiring an image to be detected;
[0017] A detection module is used to perform target detection processing on the image to be detected through a target detection model to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in the first aspect above.
[0018] In a fifth aspect, an embodiment of the present application provides an electronic device, including:
[0019] A processor; and a memory arranged to store computer-executable instructions, wherein the executable instructions are configured to be executed by the processor, and the executable instructions include steps for executing the training method of the target detection model provided in the first aspect above, or the executable instructions include steps for executing the target detection method provided in the second aspect above.
[0020] In a sixth aspect, an embodiment of the present application provides a storage medium, which is used to store computer-executable instructions, wherein the executable instructions enable a computer to execute the training method of a target detection model provided in the first aspect, or the executable instructions enable a computer to execute the target detection method provided in the second aspect.
[0021] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the training method of the target detection model provided in the first aspect above, or the executable instructions enable the computer to execute the target detection method provided in the second aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate one or more embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 A first flow chart of a method for training a target detection model provided in an embodiment of the present application;
[0024] Figure 2 A schematic diagram of a method for training a target detection model provided in an embodiment of the present application;
[0025] Figure 3 A second flow chart of a method for training a target detection model provided in an embodiment of the present application;
[0026] Figure 4 A third flow chart of a method for training a target detection model provided in an embodiment of the present application;
[0027] Figure 5 A schematic diagram of a target confidence update process provided in an embodiment of the present application;
[0028] Figure 6 A fourth flow chart of a method for training a target detection model provided in an embodiment of the present application;
[0029] Figure 7 A schematic diagram of a process flow of a target detection method provided in an embodiment of the present application;
[0030] Figure 8 A schematic diagram of the module composition of a training device for a target detection model provided in an embodiment of the present application;
[0031] Fig. 9 A schematic diagram of the module composition of a target detection device provided in an embodiment of the present application;
[0032] Fig.10 A schematic diagram of the structure of an electronic device provided for one or more embodiments of the present application. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present application, the technical solutions in one or more embodiments of the present application will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on one or more embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0034] At present, in the process of semi-supervised training, loss calculation is usually performed only based on the pseudo-labels output by the model. However, the pseudo-labels output by the model may not be accurate, which will lead to subsequent propagation errors and reduce the accuracy of the model. In order to solve this technical problem, the DARP (Distribution Aligning Refinery of Pseudo-label) method and the Label matching method are proposed in the prior art. Among them, DARP improves the original biased pseudo-label to match the true category distribution. However, this process requires first understanding the true category distribution of unlabeled data, which is impossible in actual tasks. In order to alleviate this limitation, DARP further proposes to estimate the category distribution by assuming that the confusion matrix between labeled data and unlabeled data is the same. However, this assumption is also inappropriate because the trained model often overfits small labeled data sets and obtains a nearly perfect confusion matrix, which cannot be well generalized to unlabeled data, and DARP cannot be directly applied to semi-supervised target detection. Label matching is a semi-supervised training method based on a fixed threshold. This method needs to rely on labeled data to count the category ratio of each category. However, for actual target detection data sets and open domain data sets, relying on labeled data to count the category ratio cannot truly reflect the category ratio of unlabeled data. Therefore, the Label matching method has limitations and is only feasible when the labeled data and the unlabeled data follow the same distribution. It can be seen that the above-mentioned DARP method and the Label matching method do not really solve the technical problem that the model accuracy is reduced due to inaccurate pseudo labels. Based on this, an embodiment of the present application provides a training method for a target detection model, in which the initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images, and unlabeled sample images; wherein the joint training process includes: performing target detection processing on the unlabeled sample image according to the dynamically updated target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining the target loss according to the first target detection result, the second target detection result, and the third target detection result; and when it is determined that the training end condition is met according to the target loss, the teacher model or the student model that meets the training end condition is determined as the target detection model.During the training process, since the target confidence is dynamically updated based on the update conditions, it is guaranteed that the target confidence can change as the performance of the teacher model improves, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0035] Specifically, Figure 1 A flowchart of a method for training a target detection model provided in one or more embodiments of the present application is provided. Figure 1 The method can be executed by an electronic device, more specifically, by a training device for a target detection model in an electronic device (hereinafter referred to as a training device). The electronic device can be a terminal device or a server. The terminal device can be a mobile phone, a tablet computer, a desktop computer, a portable notebook, etc. The server can be an independent server, a server cluster composed of multiple servers, or a cloud server for cloud computing processing. Figure 1 As shown, the method comprises the following steps:
[0036] Step S102, using the target confidence, labeled sample images and unlabeled sample images to perform joint training processing on the initial teacher model and the initial student model; the joint training processing includes: performing target detection processing on the unlabeled sample images according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample images; performing target detection processing on the unlabeled sample images and the labeled sample images by the initial student model to obtain a second target detection result of the unlabeled sample images and a third target detection result of the labeled sample images; determining the target loss according to the first target detection result, the second target detection result and the third target detection result; and dynamically updating the target confidence based on the update condition;
[0037] The initial student model may be obtained by supervised training in advance, that is, before step S102, the following steps may be included: iteratively training the student model to be trained using labeled sample images to obtain an initial student model; and setting the model parameters of the teacher model to be trained as the model parameters of the initial student model to obtain an initial teacher model. The specific process of supervised training may refer to the relevant technology, which will not be described in detail in this application. Figure 2 As shown in FIG. 1 , the model structure of the initial student model is the same as that of the initial teacher model, both of which include an RPN module and a ROI module.
[0038] In one or more embodiments of the present application, both the labeled sample image and the unlabeled sample image may include at least one target object. Accordingly, the first target detection result and the second target detection result may include category information of the target category to which each target object in the unlabeled sample image belongs in N preset categories, and the position information of each target object in the labeled sample image. The third target detection result may include category information of the target category to which the target object in the labeled sample image belongs in N preset categories, and the position information of the target object in the labeled sample image. Among them, the position information may include the coordinates of the four vertices of the quadrilateral bounding box. The category information in the first target detection result obtained by the initial teacher model can also be called a classification pseudo-label, and the position information in the first target detection result obtained by the initial teacher model can also be called a bounding box pseudo-label.
[0039] Considering that in practical applications, as the number of training rounds increases, the accuracy of the model becomes higher and higher, training based on a fixed confidence level is often not helpful for further improving the accuracy of the model. Based on this, in an embodiment of the present application, the target confidence level is dynamically updated based on the update condition, so that the target confidence level can change with the improvement of the accuracy of the teacher model, thereby matching the performance of the teacher model; further, when the teacher model is trained using the target confidence level, the accuracy of the pseudo-label in the first target detection result of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the first target detection result, and thus improving the model performance.
[0040] Step S104: If it is determined according to the target loss that the training end condition is met, the teacher model or student module that meets the training end condition is determined as the target detection model.
[0041] Specifically, if the target loss is less than the preset loss, it is determined that the training end condition is met, and the teacher model or the student model when the training end condition is met is determined as the target detection model.
[0042] Further, such as Figure 2 As shown in FIG, when the target loss determines that the training end condition is not met, the current student model is back-propagated according to the target loss, and the model parameters of the student model are updated; and the model parameters of the current teacher model are updated according to the model parameters of the current student model using the exponential moving average (EMA). The update strategy of the model parameters of the teacher model can be expressed as Θ t =ηΘ t +(1-η)Θ s , where Θ t represents the model parameters of the teacher model, Θ sRepresents the model parameters of the student model, and η represents the preset parameters; based on the update strategy, the model parameters of the teacher model can be slowly updated according to the model parameters of the student model to ensure the accuracy of the update. It should be pointed out that the model parameters of the updated teacher model are the same as the model parameters of the student model. For the specific implementation process of the exponential moving average, reference can be made to the relevant technology, which will not be described in detail in this application.
[0043] It can be understood that since the initial teacher model and the initial student model have the same model structure and the same model parameters, when determining that the training end conditions are met, the teacher model when the training end conditions are met can be determined as the target detection model, or the student model when the training end conditions are met can be determined as the target detection model.
[0044] In one or more embodiments of the present application, the target detection processing is performed on the unlabeled sample image according to the target confidence by the initial teacher model to obtain the first target detection result of the unlabeled sample image; the target detection processing is performed on the unlabeled sample image and the labeled sample image by the initial student model to obtain the second target detection result of the unlabeled sample image and the third target detection result of the labeled sample image; the target loss is determined according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, the teacher model or the student model that meets the training end condition is determined as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. In the training process, since the target confidence is dynamically updated based on the update condition, it is guaranteed that the target confidence can change with the improvement of the performance of the teacher model, so as to match the performance of the teacher model; and then when the target confidence is used to train the teacher model, the accuracy of the pseudo-label in the detection result of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back propagating based on the target loss, and improving the accuracy of the target detection model.
[0045] In one or more embodiments of the present application, during the joint training process, the teacher model is trained using unlabeled sample images, and the student model is trained using unlabeled sample images and labeled sample images. Figure 3 As shown, step S102 may include the following steps S1022 to S1026:
[0046] Step S1022, performing target detection processing on the unlabeled sample image according to the target confidence by using the initial teacher model to obtain a first target detection result of the unlabeled sample image;
[0047] In order to improve the generalization and robustness of the model, Figure 2 As shown in , when the initial teacher model is trained using unlabeled sample images, the unlabeled sample images are firstly subjected to a first weak enhancement process. Figure 4 As shown, step S1022 may include the following steps S1022-2 to S1022-6:
[0048] Step S1022-2, obtaining M unlabeled sample images from the training sample set, performing a first weak enhancement process on the M unlabeled sample images, and obtaining M first unlabeled sample images; M is an integer greater than 1;
[0049] Among them, the first weak enhancement processing may include random horizontal flipping, resizing, etc., and the specific method of the first weak enhancement processing is not specifically limited in the present application.
[0050] Step S1022-4, inputting the M first unlabeled sample images into the teacher model for target detection processing, and obtaining a first probability set for each first unlabeled sample image; the first probability set includes a first probability that each target object in the first unlabeled sample image belongs to each preset category in N preset categories;
[0051] like Figure 2 As shown, the teacher model may include an RPN module and an ROI head module. During the target detection process, the RPN module performs foreground and background detection on the first unlabeled sample image to obtain a first detection result; the ROI head module performs linear classification and bounding box regression processing on the target object in the foreground based on the first detection result to obtain a first probability set of the first unlabeled sample image and the first position information of the bounding box of each target object. The specific detection process of the RPN module and the ROI head module can refer to the relevant technology, which will not be described in detail in this application.
[0052] It can be understood that when the first unlabeled sample image includes multiple target objects, multiple first probability sets can be obtained; the N first probabilities in each first probability set correspond to the N preset categories one by one, that is, the first probability is the probability that the target object belongs to the corresponding preset category. For example, N is 10, and the preset categories are category 1, category 2...category 10; the first unlabeled sample image 1 includes target object 1 and target object 2, then the target detection process can obtain the first probability set of target object 1 and the first position information of the bounding box of target object 1, the first probability set of target object 2 and the first position information of the bounding box of target object 2. Among them, the first probability set of target object 1 includes the first probability that target object 1 belongs to category 1, the first probability that target object 1 belongs to category 2...the first probability that target object 1 belongs to category 10; the first probability set of target object 2 includes the first probability that target object 2 belongs to category 1, the first probability that target object 2 belongs to category 2...the first probability that target object 2 belongs to category 10.
[0053] Step S1022-6: for each first unlabeled sample image, determine a first target detection result of the first unlabeled sample image according to the target confidence and the first probability set.
[0054] In order to balance the class distances between different preset categories, implicit sampling balance is achieved. In one or more embodiments of the present application, the target confidence includes N confidence thresholds corresponding to N preset categories. Accordingly, in step S1022-6, the first target detection result of the first unlabeled sample image is determined according to the target confidence and the first probability set, which may include: for each target object in the first unlabeled sample image, determining the maximum first probability among the N first probabilities of the target object; if it is determined that the maximum first probability is greater than the confidence threshold of the corresponding preset category, the maximum first probability is determined as the target probability of the target object; according to the preset categories corresponding to each target probability, the first target detection result of the first unlabeled sample image is determined.
[0055] Specifically, for each target object in each first unlabeled sample image, the N first probabilities in the first probability set of the target object are sorted to obtain the maximum first probability; the maximum first probability is compared with the confidence threshold of the corresponding preset category. If the comparison result indicates that the maximum first probability is greater than the confidence threshold of the corresponding preset category, the maximum first probability is determined as the target probability of the target object; and the first category information of the preset category corresponding to each target probability (i.e., the classification pseudo-label) and the first position information of the bounding box of the target object (i.e., the bounding box pseudo-label) are determined as the first target detection result of the first unlabeled sample image.
[0056] As an example, N=3, N preset categories include category 1, category 2 and category 3, the confidence threshold of category 1 is 0.92, the confidence threshold of category 2 is 0.85, and the confidence threshold of category 3 is 0.78; the first unlabeled sample image includes target object 1, and in the first probability set of target object 1, the first probability corresponding to category 1 is 0.05, the first probability corresponding to category 2 is 0.87, and the first probability corresponding to category 3 is 0.08. The first probabilities in the first probability set of target object 1 are sorted, and the maximum first probability is 0.87; since the maximum first probability of 0.87 is greater than the corresponding confidence threshold of 0.85 of category 2, category 2 corresponding to the first probability 0.87 is determined as the predicted category of the target object, and the category information of category 2 and the first position information of the bounding box of target object 1 are determined as the first target detection result of the first unlabeled sample image.
[0057] Step S1024, performing target detection processing on the unlabeled sample image and the labeled sample image through the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image;
[0058] In order to improve the generalization and robustness of the model, Figure 2 As shown in , when the initial student model is trained using the unlabeled sample images and the labeled sample images, the unlabeled sample images are first strongly enhanced, and the labeled sample images are secondly weakly enhanced. Figure 4 As shown, step S1024 may include the following steps S1024-2 to S1024-6:
[0059] Step S1024-2, performing strong enhancement processing on the M unlabeled sample images to obtain M second unlabeled sample images;
[0060] The strong enhancement process may include occlusion, cutting, etc., and the specific method of the strong enhancement process is not specifically limited in the present application. It should be noted that step S1024-2 may also be performed simultaneously with the aforementioned first weak enhancement process.
[0061] Step S1024-4, obtaining P labeled sample images from the training sample set, performing a second weak enhancement process on the P labeled sample images, and obtaining P target labeled sample images;
[0062] Wherein, P is an integer greater than 1. The second weak enhancement process may be the same as or different from the aforementioned first weak enhancement process, which is not specifically limited in the present application.
[0063] Step S1024-6, input the second unlabeled sample image and the target labeled sample image into the initial student model for target detection processing, and obtain a second target detection result of the second unlabeled sample image and a third target detection result of the target labeled sample image.
[0064] like Figure 2 As shown, the structure of the initial student model is the same as that of the initial teacher model, that is, it includes an RPN module and an ROI head module. Accordingly, the target detection processing of the initial student model may include: performing foreground and background detection on the second unlabeled sample image and the target labeled sample image through the RPN module to obtain the second detection result of the second unlabeled sample image and the third detection result of the target labeled sample image; performing linear classification and bounding box regression processing on the target object in the corresponding foreground based on the second detection result and the third detection result through the ROI head module to obtain the second target detection result of the second unlabeled sample image and the third target detection result of the target labeled sample image. Among them, the second target detection result includes the second category information of the target preset category to which each target object in the second unlabeled sample image belongs in the N preset categories, and the second position information of the bounding box of each target object; the third target detection result includes the third category information of the target preset category to which each target object in the target labeled sample image belongs in the N preset categories, and the third position information of the bounding box of each target object.
[0065] Step S1026, determining the target loss according to the first target detection result, the second target detection result and the third target detection result.
[0066] Therefore, in the joint training process, the target confidence and then the unlabeled sample images are used to train the initial teacher model, which improves the accuracy of the first target detection result, that is, the accuracy of the pseudo-label in the first target detection result is improved; and then in the subsequent loss calculation and back propagation, the loss error and propagation error are reduced, which can improve the accuracy of the target detection model.
[0067] Furthermore, in order to make the target confidence match the performance of the initial teacher model, in one or more embodiments of the present application, the method may also include: recording training rounds; and if it is determined based on the training rounds that the update conditions for the target confidence are met, updating the target confidence.
[0068] In some implementations, the target confidence may be updated once every first preset number of training rounds, for example, once every five training rounds, etc. Correspondingly, if it is determined that the recorded training rounds are an integer multiple of the preset number, it is determined that the update condition of the target confidence is met, and the target confidence is updated.
[0069] In some embodiments, Figure 5 As shown, updating the target confidence may include the following steps A2 to A8:
[0070] Step A2, inputting each unlabeled sample image into the teacher model that meets the update condition to perform target detection processing, and obtaining a fourth target detection result for each unlabeled sample image; the fourth target detection result includes a second probability of each target object in the unlabeled sample image belonging to a target category in N preset categories;
[0071] In order to ensure the accuracy of the target confidence, in one or more embodiments of the present application, when the update condition is met, each unlabeled sample image is obtained from the training sample set, and each unlabeled sample image is input into the teacher model when the update condition is met to perform target detection processing, and the third target detection result of each unlabeled sample image is obtained. The third target detection result includes the second probability of each target object in the unlabeled sample image belonging to the target category in N preset categories.
[0072] Step A4, generating a probability matrix according to the second probability; the N rows in the probability matrix correspond to the N preset categories one by one, or the N columns in the probability matrix correspond to the N preset categories one by one;
[0073] Taking the one-to-one correspondence between N rows in the probability matrix and N preset categories as an example, for each target object in each unlabeled sample image, the target row corresponding to the target category to which the target object belongs is queried from the probability matrix, and the second probability that the target object belongs to the target category is added to the target row. In other words, each row in the probability matrix corresponds to a preset category, and the elements in each row are the second probabilities that the target object belongs to the preset category.
[0074] Step A6, for each preset category, determining a new confidence threshold of the preset category according to the target proportion and the first number of second probabilities corresponding to the preset category in the probability matrix;
[0075] Specifically, for each preset category, the second probabilities corresponding to the preset categories in the probability matrix are sorted to obtain a sorting result; the target number is determined according to the target ratio and the first number of the second probabilities corresponding to the preset categories; the second probability corresponding to the target number in the sorting result is determined as a new confidence threshold of the preset category.
[0076] More specifically, for each preset category, the second probability corresponding to the preset category in the probability matrix is sorted to obtain a sorting result; and the first number of the second probability corresponding to the preset category in the probability matrix is determined, and the first number is multiplied by the target ratio to obtain the target number; the second probability whose position number is the target number in the sorting result is determined as the new confidence threshold of the corresponding preset category. It should be pointed out that when the second probability is sorted in descending order, the second probability whose position number is the target number in the sorting result is determined as the new confidence threshold of the corresponding preset category in order from left to right; when the second probability is sorted in ascending order, the second probability whose position number is the target number in the sorting result is determined as the new confidence threshold of the corresponding preset category in order from right to left. When the result of multiplying the first number by the target ratio is a decimal, the result of the multiplication can be rounded to obtain the target value. The rounding process can be rounding up or rounding down, which can be set by itself according to needs in actual applications.
[0077] As an example, the target ratio is 25%, the rounding process is rounding up, the sorting process is descending sorting, the N preset categories include category 1, and from left to right, the second probabilities corresponding to category 1 in the probability matrix are: 0.73, 0.45, 0.68, 0.82, 0.49, 0.74, and the descending sorting results are: 0.82, 0.74, 0.68, 0.49, 0.45; from left to right, the position numbers are 0, 1, 2, 3, 4, 5; the first quantity is 6, the target quantity = 6*25% = 1.5, then the target quantity is 2, and the second probability numbered 2, 0.74, is determined as the new confidence threshold of category 1.
[0078] In one or more embodiments of the present application, an initial ratio can be preset, and when it is determined that the ratio update condition is met, the current ratio is updated. In some embodiments, the current ratio may be updated every second preset number of training rounds and when the current ratio has not reached the maximum ratio. For example, the current ratio is updated every 8 training rounds. Accordingly, the target ratio may be the current ratio or the updated ratio of the current ratio. The current ratio is denoted as a, and the updated ratio = a + 5%. In some embodiments, the initial ratio may be 20% and the maximum ratio may be 50%.
[0079] Step A8: determine N new confidence thresholds as updated target confidences.
[0080] Therefore, by updating the confidence threshold to obtain the updated target confidence, the accuracy of the target confidence can be guaranteed, thereby improving the accuracy of the detection results obtained by joint training based on the target confidence and the accuracy of the target loss determined based on the detection results.
[0081] Considering that in the training process of the existing target detection model, the loss is calculated only based on the pseudo-labels output by the model, which easily causes overfitting of the target detection model, that is, the target detection model has a high detection performance for the training set, but cannot better adapt to the new data domain, resulting in low accuracy of the target detection result when performing target detection based on the new data domain. Based on this, in one or more embodiments of the present application, in the aforementioned step S1026, determining the target loss based on the first target detection result, the second target detection result, and the third target detection result may include: determining the target loss based on the first target detection result, the second target detection result, the third target detection result, and the target data; the target data is used to reduce the complexity of the initial teacher model and the initial student model.
[0082] Specifically, after the first target detection result is obtained through joint training, the target data is determined based on the first target detection result, and the target loss is determined based on the first target detection result, the second target detection result, the third target detection result and the target data. More specifically, Figure 6 As shown, step S1026 may include the following steps S1026-2 to S1026-6:
[0083] Step S1026-2, obtaining a first probability set corresponding to the first target detection result;
[0084] It can be understood that, in the process of training the initial teacher model using the unlabeled sample images, a first probability set corresponding to the second target detection result can be obtained.
[0085] Step S1026-4, determining first data according to the first probability set and the N preset categories, and determining the first data as target data; or determining second data according to the first probability set and the N preset categories, and determining the second data as target data;
[0086] In some embodiments, the first data may be data determined based on a first regularization term, which may also be referred to as a label regularization term, which is determined based on a first probability set and N preset categories while fixing the model parameters of the current student model. In some embodiments, determining the first data based on the first probability set and N preset categories may include: determining, based on the first probability set, an initial cost value corresponding to each preset category of the unlabeled sample image to obtain N initial cost values; determining, based on the N initial cost values, a target cost value for each preset category of the unlabeled sample image to obtain N target cost values; and determining the first data based on the N target cost values.
[0087] In some implementations, the initial cost value corresponding to the unlabeled sample image may be determined based on the following formulas 1 to 3 according to the first probability set:
[0088] Formula 1:
[0089] in, Represents the jth unlabeled sample image among M unlabeled sample images; represents the initial cost value that the jth unlabeled sample image among M unlabeled sample images belongs to the preset category c; c represents that N is any preset category among the preset categories; Θ s are the model parameters of the student model; represents the model parameter Θ in the student model s The probability that the jth unlabeled sample image belongs to the preset category c can be obtained in the first probability set; exp(-k c ) represents the confidence threshold of the preset category c; α≥0 is the weight coefficient; log represents the logarithmic operation. It can be obtained by the following formula 2: It can be obtained by the following formula 3.
[0090] Formula 2:
[0091] Formula 3:
[0092] It can be understood that since c has N values, for each value of c (ie, each preset category), the corresponding first probability can be obtained in the first probability set. Therefore, for each first probability set, N values can be calculated based on formula 3. Then, based on formula 1, N initial cost values can be obtained.
[0093] Further, according to the N initial cost values, determining the target cost value of the unlabeled sample image belonging to each preset category to obtain the N target cost values may include: determining a cost value threshold, for each initial cost value, if the initial cost value is less than the cost value threshold, determining the initial cost value as the target cost value of the unlabeled sample image belonging to the corresponding preset category, otherwise determining zero as the target cost value of the unlabeled sample image belonging to the corresponding preset category. The process of determining the target cost value can be expressed by the following formula 4:
[0094] Formula 4:
[0095] in, represents the target cost value, It represents the cost value threshold, which can be calculated by the above formulas 1 to 3.
[0096] Further, determining the first regularization term according to the N target cost values may include: determining an average value of the N target cost values, and determining the average value as the first regularization term.
[0097] In some embodiments, the second data may be data determined based on a second regularization term, the second regularization term may also be referred to as a model regularization term, and the second regularization term may be any one of L2 regularization, negative entropy regularization, and KL divergence regularization.
[0098] When the second regularization term is L2 regularization, the second data may be determined based on the following formula 5:
[0099] Formula 5:
[0100] When the second regularization term is negative entropy regularization, the second data may be determined based on the following formula 6:
[0101] Formula 6:
[0102] When the second regularization term is KL divergence regularization, the second data may be determined based on the following formula 7:
[0103] Formula 7:
[0104] In the above formulas 5 to 7, represents the second regularization term; represents the jth unlabeled sample image among M unlabeled sample images; Θ s represents the model parameters of the student model; represents the probability that the j-th unlabeled sample image belongs to the preset category c, which can be obtained from the first probability set; log represents logarithmic operation.
[0105] It should be noted that, in practical applications, any one of the above-mentioned first data and second data can be determined as target data; and the first data or the second data can also be alternately determined as the target regularization term according to the first preset rule. When the second data is determined as the target data, any one of the above-mentioned L2 regularization, negative entropy regularization, and KL divergence regularization can be determined as the second regularization term, and the L2 regularization, negative entropy regularization, or KL divergence regularization can also be alternately determined as the second regularization term according to the second preset rule. Among them, the first preset rule and the second preset rule can be set as needed in practical applications. For example, the first preset rule is to determine the first data as the target data when the training round is an odd number; when the training round is an even number, the second regularization term is determined as the target data. The second preset rule is to determine each of the L2 regularization, negative entropy regularization, and KL divergence regularization as the second regularization term in turn.
[0106] Step S1026-6, determining the target loss based on the first target detection result, the second target detection result, the third target detection result and the target data.
[0107] In some embodiments, the first loss can be determined based on the third target detection result according to the first loss function; the second loss can be determined based on the first target detection result, the second target detection result and the target value according to the second loss function; the target loss can be determined based on the first loss and the second loss according to the third loss function. Among them, the first loss can include supervised classification loss and supervised regression loss; the second loss can include unsupervised classification loss and unsupervised regression loss. It can be understood that since the student model is back-propagated based on the target loss, the target data constrains the student model to avoid overfitting of the student model, thereby avoiding overfitting of the teacher model.
[0108] In some embodiments, the first loss function may be:
[0109] The second loss function can be:
[0110] The third loss function can be: total =L s +λL u .
[0111] Among them, L sIndicates the first loss; L u Indicates the second loss; L total represents the target loss, represents the i-th labeled sample image among P labeled sample images, represents the label of the i-th labeled sample image among P labeled sample images; Θ s represents the model parameters of the student model; represents the model parameter Θ in the student model s , the probability that the i-th labeled sample image among the P labeled sample images belongs to the preset category c can be obtained from a third probability set corresponding to the third target detection result, where the third probability set includes N third probabilities corresponding one-to-one to the N preset categories; represents the jth unlabeled sample image among M unlabeled sample images; The category pseudo label represents the classification information of the jth unlabeled sample image among the M unlabeled sample images in the RPN stage (i.e., the binary classification information of foreground or background); Represents the first position information (i.e., the bounding box pseudo label) in the first target detection result of the j-th unlabeled sample image among the M unlabeled sample images, and the second position information in the second target detection result; Represents the first category information in the first target detection result of the j-th unlabeled sample image among the M unlabeled sample images (the classification results for N preset categories, i.e., the category pseudo-label), and the second category information in the second target detection result; represents the model parameter Θ in the student model s Under the above situation, the probability that the jth unlabeled sample image among the M unlabeled sample images belongs to the preset category c can be obtained in the first probability set; exp(-k c ) represents the confidence threshold of the preset category c; represents the classification loss at the RPN stage, represents the bounding box regression loss in the RPN stage; Represents the classification loss at the ROI stage; represents the bounding box regression loss at the ROI stage; represents the target data; α≥0, is the weight coefficient.
[0112] Therefore, determining the target loss based on the target data can reduce the complexity of the initial teacher model and the initial student model. The lower the complexity of the model, the stronger its generalization ability in the new data domain, that is, it is less likely to have overfitting problems. Therefore, determining the target loss based on the target data can reduce the overfitting risk of the target detection model and improve the generalization ability and accuracy of the target detection model.
[0113] In one or more embodiments of the present application, the target detection processing is performed on the unlabeled sample image according to the target confidence by the initial teacher model to obtain the first target detection result of the unlabeled sample image; the target detection processing is performed on the unlabeled sample image and the labeled sample image by the initial student model to obtain the second target detection result of the unlabeled sample image and the third target detection result of the labeled sample image; the target loss is determined according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, the teacher model or the student model that meets the training end condition is determined as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. In the training process, since the target confidence is dynamically updated based on the update condition, it is guaranteed that the target confidence can change with the improvement of the performance of the teacher model, so as to match the performance of the teacher model; and then when the target confidence is used to train the teacher model, the accuracy of the pseudo-label in the detection result of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back propagating based on the target loss, and improving the accuracy of the target detection model.
[0114] Corresponding to the training method of the target detection model described above, based on the same technical concept, one or more embodiments of the present application further provide a target detection method. Figure 7 A flowchart of a target detection method provided by one or more embodiments of the present application is provided. Figure 7 The method can be performed by the electronic device itself, specifically by the target detection device in the electronic device. The electronic device can be a terminal device or a server. The terminal device can be a mobile phone, a tablet computer, a desktop computer, a portable notebook, etc. The server can be an independent server or a server cluster composed of multiple servers. Figure 7 As shown, the method comprises the following steps:
[0115] Step S202, obtaining an image to be detected;
[0116] Step S204: performing target detection processing on the image to be detected by using the target detection model to obtain a fifth target detection result.
[0117] Among them, the target detection model is obtained by training according to the training method of the target detection model provided by any of the aforementioned embodiments. In the training process of the target detection model, if the teacher model is determined as the target detection model, step S204 may include: performing a first weak enhancement process on the image to be detected to obtain a target image; inputting the target image into the target detection model for target detection processing to obtain a fifth target detection result. In the training process of the target detection model, if the student model is determined as the target detection model, step S204 may include: performing a strong enhancement process on the image to be detected to obtain a target image; inputting the target image into the target detection model for target detection processing to obtain a fifth target detection result. The fifth target detection result includes the fifth category information of the target preset category to which the target object in the image to be detected belongs in N preset categories, and the fifth position information of the bounding box of the object to be detected.
[0118] In one or more embodiments of the present application, when the target graphic to be detected is obtained, the target image is input into the target detection model for target detection processing to obtain a fifth target detection result. Since the target detection model used for target detection processing is dynamically updated based on the update conditions during the training process, it is ensured that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the highly accurate target detection model, thereby improving the accuracy of the target detection results.
[0119] Corresponding to the target detection model training method described above, based on the same technical concept, one or more embodiments of the present application also provide a target detection model training device. Figure 8 A schematic diagram of the module composition of a training device for a target detection model provided in one or more embodiments of the present application, such as Figure 8 As shown, the device comprises:
[0120] The training module 301 is used to perform joint training processing on the initial teacher model and the initial student model using the target confidence, the labeled sample image and the unlabeled sample image; the joint training processing includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining the target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on the update condition;
[0121] The determination module 302 is used to determine the teacher model or the student model that meets the training end condition as the target detection model if it is determined that the training end condition is met according to the target loss.
[0122] The training device of the target detection model provided in the embodiment of the present application performs target detection processing on the unlabeled sample image according to the target confidence through the initial teacher model to obtain the first target detection result of the unlabeled sample image; performs target detection processing on the unlabeled sample image and the labeled sample image through the initial student model to obtain the second target detection result of the unlabeled sample image and the third target detection result of the labeled sample image; determines the target loss according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, determines the teacher model or the student model that meets the training end condition as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. During the training process, since the target confidence is dynamically updated based on the update conditions, it is guaranteed that the target confidence can change as the performance of the teacher model improves, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0123] It should be noted that the embodiment of the training device for the target detection model in the present application and the embodiment of the training method for the target detection model in the present application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding training method for the target detection model mentioned above, and the repeated parts will not be repeated.
[0124] Each module in the training device of the above target detection model can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the terminal device or the processor on the server in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0125] Furthermore, corresponding to the target detection method described above, based on the same technical concept, one or more embodiments of the present application also provide a target detection device. Fig. 9 A schematic diagram of the module composition of a target detection device provided in one or more embodiments of the present application, such as Fig. 9 As shown, the device comprises:
[0126] An acquisition module 401 is used to acquire an image to be detected;
[0127] The detection module 402 is used to perform target detection processing on the image to be detected through a target detection model to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in any of the above embodiments.
[0128] The target detection device provided by the embodiment of the present application, when acquiring the target graphic to be detected, inputs the target image into the target detection model for target detection processing, and obtains the fifth target detection result. Since the target detection model used for target detection processing is dynamically updated based on the update condition during the training process, it is guaranteed that the target confidence can change with the improvement of the performance of the teacher model, so as to match the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-label in the detection result of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the target detection model with high accuracy, which improves the accuracy of the target detection result.
[0129] It should be noted that the embodiment of the target detection device in the present application and the embodiment of the target detection method in the present application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding target detection method mentioned above, and the repeated parts will not be repeated.
[0130] Each module in the above-mentioned target detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device or the processor on the server side in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server side in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0131] Furthermore, corresponding to the training method of the target detection model and the target detection method described above, based on the same technical concept, one or more embodiments of the present application also provide an electronic device, which is used to execute the training method of the target detection model described above. Fig.10 A schematic diagram of the structure of an electronic device provided for one or more embodiments of the present application.
[0132] like Fig.10 As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 501 and memory 502, and the memory 502 may store one or more storage applications or data. Among them, the memory 502 can be a temporary storage or a permanent storage. The application stored in the memory 502 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 501 can be configured to communicate with the memory 502 to execute a series of computer executable instructions in the memory 502 on the electronic device. The electronic device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input and output interfaces 505, one or more keyboards 506, etc.
[0133] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions:
[0134] The initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images and unlabeled sample images; the joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on an update condition;
[0135] If it is determined according to the target loss that the training end condition is met, the teacher model or the student model when the training end condition is met is determined as the target detection model.
[0136] The electronic device provided by one or more embodiments of the present application performs target detection processing on an unlabeled sample image according to target confidence through an initial teacher model to obtain a first target detection result of the unlabeled sample image; performs target detection processing on an unlabeled sample image and a labeled sample image through an initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determines the target loss according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, determines the teacher model or the student model that meets the training end condition as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. During the training process, since the target confidence is dynamically updated based on the update conditions, it is guaranteed that the target confidence can change as the performance of the teacher model improves, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0137] In another specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:
[0138] Acquire the image to be detected;
[0139] The target detection model is used to perform target detection processing on the image to be detected to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in any of the aforementioned embodiments.
[0140] When the target graphics to be detected are obtained, the target image is input into the target detection model for target detection processing to obtain the fifth target detection result. Since the target detection model used for target detection processing is dynamically updated based on the update conditions during the training process, it is ensured that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the highly accurate target detection model, thereby improving the accuracy of the target detection results.
[0141] It should be noted that the embodiments of the electronic device in the present application and the embodiments of the training method of the target detection model and the target detection method in the present application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the aforementioned corresponding training method of the target detection model and the implementation of the target detection method, and the repeated parts will not be repeated.
[0142] Furthermore, corresponding to the training method of the target detection model and the target detection method described above, based on the same technical concept, one or more embodiments of the present application further provide a storage medium for storing computer executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented:
[0143] The initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images and unlabeled sample images; the joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on an update condition;
[0144] If it is determined according to the target loss that the training end condition is met, the teacher model or the student model when the training end condition is met is determined as the target detection model.
[0145] When the computer executable instructions stored in the storage medium provided by one or more embodiments of the present application are executed by the processor, the initial teacher model performs target detection processing on the unlabeled sample image according to the target confidence, and obtains the first target detection result of the unlabeled sample image; the initial student model performs target detection processing on the unlabeled sample image and the labeled sample image, and obtains the second target detection result of the unlabeled sample image and the third target detection result of the labeled sample image; the target loss is determined according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, the teacher model or the student model that meets the training end condition is determined as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. During the training process, since the target confidence is dynamically updated based on the update conditions, it is guaranteed that the target confidence can change as the performance of the teacher model improves, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0146] In another specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented:
[0147] Acquire the image to be detected;
[0148] The target detection model is used to perform target detection processing on the image to be detected to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in any of the aforementioned embodiments.
[0149] When the computer executable instructions stored in the storage medium provided by one or more embodiments of the present application are executed by the processor, when the target graphic to be detected is obtained, the target image is input into the target detection model for target detection processing to obtain the fifth target detection result. Since the target detection model used for target detection processing is dynamically updated based on the update conditions during the training process, it is ensured that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the highly accurate target detection model, thereby improving the accuracy of the target detection results.
[0150] It should be noted that the embodiments of the storage medium in the present application and the embodiments of the training method of the target detection model and the target detection method in the present application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the aforementioned corresponding training method of the target detection model and the implementation of the target detection method, and the repeated parts will not be repeated.
[0151] Furthermore, corresponding to the training method of the target detection model and the target detection method described above, based on the same technical concept, one or more embodiments of the present application also provide a computer program product, which includes a computer program. When the computer program is executed by a processor, the following process can be implemented:
[0152] The initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images and unlabeled sample images; the joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; the target confidence is dynamically updated based on an update condition;
[0153] If it is determined according to the target loss that the training end condition is met, the teacher model or the student model when the training end condition is met is determined as the target detection model.
[0154] When the computer program in the computer program product provided by one or more embodiments of the present application is executed by a processor, the initial teacher model performs target detection processing on the unlabeled sample image according to the target confidence, and obtains the first target detection result of the unlabeled sample image; the initial student model performs target detection processing on the unlabeled sample image and the labeled sample image, and obtains the second target detection result of the unlabeled sample image and the third target detection result of the labeled sample image; the target loss is determined according to the first target detection result, the second target detection result and the third target detection result; and when the target loss meets the training end condition, the teacher model or the student model that meets the training end condition is determined as the target detection model. Among them, the target confidence is dynamically updated based on the update condition; the target data is used to reduce the complexity of the initial teacher model and the initial student model. During the training process, since the target confidence is dynamically updated based on the update conditions, it is guaranteed that the target confidence can change as the performance of the teacher model improves, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection results, reducing the propagation error during back propagation based on the target loss, and improving the accuracy of the target detection model.
[0155] In another specific embodiment, when the computer program in the computer program product is executed by a processor, the following process can be implemented:
[0156] Acquire the image to be detected;
[0157] The target detection model is used to perform target detection processing on the image to be detected to obtain a fifth target detection result; the target detection model is trained according to the training method of the target detection model provided in any of the aforementioned embodiments.
[0158] When the computer program in the computer program product provided by one or more embodiments of the present application is executed by the processor, when the target graphic to be detected is obtained, the target image is input into the target detection model for target detection processing to obtain the fifth target detection result. Since the target detection model used for target detection processing is dynamically updated based on the update conditions during the training process, it is guaranteed that the target confidence can change with the improvement of the performance of the teacher model, thereby matching the performance of the teacher model; and then when the teacher model is trained using the target confidence, the accuracy of the pseudo-labels in the detection results of the teacher model can be improved, thereby improving the accuracy of the target loss determined based on the detection result, reducing the propagation error when back-propagating based on the target loss, and improving the accuracy of the target detection model. Then, target detection processing is performed based on the highly accurate target detection model, thereby improving the accuracy of the target detection results.
[0159] It should be noted that the embodiments of the computer program product in the present application and the embodiments of the target detection model training method and the target detection method in the present application are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the aforementioned corresponding target detection model training method and target detection method implementation, and the repeated parts will not be repeated.
[0160] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0161] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0162] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0163] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0164] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0165] Those skilled in the art will appreciate that one or more embodiments of the present application may be provided as methods, systems or computer program products. Therefore, one or more embodiments of the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0166] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0170] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0171] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0172] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0173] One or more embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present application may also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0174] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0175] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A method for training a target detection model, characterized in that: include: The initial teacher model and the initial student model are jointly trained using target confidence, labeled sample images, and unlabeled sample images; The joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; and dynamically updating the target confidence based on an update condition; If it is determined according to the target loss that the training end condition is met, the teacher model or the student model when the training end condition is met is determined as the target detection model.
2. The method according to claim 1, characterized in that: The performing target detection processing on the unlabeled sample image according to the target confidence by using the initial teacher model to obtain a first target detection result of the unlabeled sample image includes: Acquire M unlabeled sample images from a training sample set, and perform a first weak enhancement process on the M unlabeled sample images to obtain M first unlabeled sample images; M is an integer greater than 1; Input the M first unlabeled sample images into the initial teacher model for target detection processing, and obtain a first probability set for each of the first unlabeled sample images; the first probability set includes a first probability that each target object in the first unlabeled sample image belongs to each of the N preset categories; For each first unlabeled sample image, a first target detection result of the first unlabeled sample image is determined according to the target confidence and the first probability set.
3. The method according to claim 2, characterized in that The target confidence comprises N confidence thresholds corresponding to the N preset categories one by one; and determining the first target detection result of the first unlabeled sample image according to the target confidence and the first probability set comprises: For each target object in the first unlabeled sample image, determine a maximum first probability among the N first probabilities of the target object; If it is determined that the maximum first probability is greater than the confidence threshold of the corresponding preset category, the maximum first probability is determined as the target probability of the target object; A first target detection result of the first unlabeled sample image is determined according to the preset categories corresponding to the target probabilities.
4. The method according to claim 2, characterized in that: The performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image includes: Performing strong enhancement processing on the M unlabeled sample images to obtain M second unlabeled sample images; Acquire P labeled sample images from the training sample set, perform a second weak enhancement process on the P labeled sample images, and obtain P target labeled sample images; P is an integer greater than 1; The second unlabeled sample image and the target labeled sample image are input into the initial student model for target detection processing to obtain a second target detection result of the second unlabeled sample image and a third target detection result of the target labeled sample image.
5. The method according to claim 1, characterized in that The method further comprises: Record training rounds; and, If it is determined according to the training rounds that the update condition of the target confidence is met, the target confidence is updated.
6. The method according to claim 5, characterized in that The target confidence includes confidence thresholds corresponding to the N preset categories one by one; and the updating process of the target confidence includes: Input each of the unlabeled sample images into the teacher model that satisfies the update condition to perform target detection processing, and obtain a fourth target detection result for each of the unlabeled sample images; the fourth target detection result includes a second probability corresponding to the target category to which each target object in the unlabeled sample image belongs in N preset categories; Generate a probability matrix according to the second probability; the N rows in the probability matrix correspond to the N preset categories one-to-one, or the N columns in the probability matrix correspond to the N preset categories one-to-one; For each preset category, determining a new confidence threshold of the preset category according to the target ratio and the first number of the second probabilities corresponding to the preset category in the probability matrix; The N new confidence thresholds are determined as updated target confidences.
7. The method according to claim 6, characterized in that The determining, according to the target ratio and the first number of the second probabilities corresponding to the preset categories in the probability matrix, a new confidence threshold of the preset category includes: Sorting the second probabilities corresponding to the preset categories in the probability matrix to obtain a sorting result; Determining a target quantity according to the target ratio and a first quantity of the second probability corresponding to the preset category; The second probability corresponding to the target quantity in the sorting result is determined as a new confidence threshold of the preset category.
8. The method according to claim 2, characterized in that: The determining the target loss according to the first target detection result, the second target detection result and the third target detection result includes: A target loss is determined based on the first target detection result, the second target detection result, the third target detection result and target data; the target data is used to reduce the complexity of the initial teacher model and the initial student model.
9. The method according to claim 8, characterized in that The determining the target loss according to the first target detection result, the second target detection result, the third target detection result and the target data includes: Obtaining a first probability set corresponding to the first target detection result; Determine first data according to the first probability set and the N preset categories, and determine the first data as target data; or determine second data according to the first probability set and the N preset categories, and determine the second data as target data; A target loss is determined according to the first target detection result, the second target detection result, the third target detection result and the target data.
10. A target detection method, characterized in that: include: Acquire the image to be detected; Performing target detection processing on the image to be detected by using a target detection model to obtain a fifth target detection result; The target detection model is trained according to the target detection model training method according to any one of claims 1 to 9.
11. A training device for a target detection model, characterized in that: include: A training module, used for jointly training an initial teacher model and an initial student model using target confidence, labeled sample images, and unlabeled sample images; The joint training process includes: performing target detection processing on the unlabeled sample image according to the target confidence by the initial teacher model to obtain a first target detection result of the unlabeled sample image; performing target detection processing on the unlabeled sample image and the labeled sample image by the initial student model to obtain a second target detection result of the unlabeled sample image and a third target detection result of the labeled sample image; determining a target loss according to the first target detection result, the second target detection result and the third target detection result; and dynamically updating the target confidence based on an update condition; A determination module is used to determine the teacher model or the student model that meets the training end condition as the target detection model if it is determined according to the target loss that the training end condition is met.
12. A target detection device, characterized in that: include: An acquisition module, used for acquiring an image to be detected; A detection module, used to perform target detection processing on the image to be detected through a target detection model to obtain a fifth target detection result; The target detection model is trained according to the target detection model training method according to any one of claims 1 to 9.
13. An electronic device, characterized in that: include: processor; as well as, A memory arranged to store computer-executable instructions, wherein the executable instructions are configured to be executed by the processor, wherein the executable instructions include steps for executing the training method for the target detection model as described in any one of claims 1 to 9, or the executable instructions include steps for executing the target detection method as described in claim 10.
14. A storage medium, characterized in that: The storage medium is used to store computer-executable instructions, wherein the executable instructions enable a computer to execute the target detection model training method as described in any one of claims 1 to 9, or the executable instructions enable a computer to execute the target detection method as described in claim 10.
15. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the training method of the target detection model as described in any one of claims 1 to 9, or the executable instructions enable the computer to execute the target detection method as described in claim 10.
Citation Information
Patent Citations
Target detection model training method, target detection method and target detection device
CN117011624A
Target object detection method and apparatus, and computer device and storage medium
WO2022213879A1
