Target detection model training method, target detection method and target detection device
By introducing the category weight matrix into the teacher and student networks of the target detection model and dynamically updating it, the problem of insufficient performance of the semi-supervised target detection model in new category detection is solved, and accurate detection and performance improvement of new categories are achieved.
Patent Information
- Application Number
- CN202410188128.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-20
- Publication Date
- 2024-09-17
AI Technical Summary
Existing semi-supervised target detection models have limited performance in discovering and learning new categories in the target domain, and cannot be applied to image detection other than known categories, resulting in a decrease in detection accuracy.
The category weight matrix is introduced into the teacher network and student network of the target detection model, and the category weight matrix is dynamically updated to include the weight of new categories, thereby realizing the discovery and prediction of new categories and improving model performance.
By continuously updating the category weight matrix, the model can master the knowledge of new categories during the training process, improve the detection accuracy and performance of new categories, and accurately identify images of new categories.
Smart Images

Figure CN118657968A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a target detection model training method, a target detection method and a device. Background Art
[0002] Semi-supervised Object Detection (SSOD) is one of the most promising learning paradigms, which can utilize a large amount of unlabeled data to bypass the labeling cost and combine labeled and unlabeled data to train object detection models for performing object detection tasks. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a target detection model training method, a target detection method and a device, which are used to realize the discovery and prediction of new categories in the target domain during the semi-supervised training process of the target detection model, thereby improving the performance of the target detection model.
[0004] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0005] In a first aspect, an embodiment of the present application provides a method for training a target detection model, wherein the target detection model includes a teacher network and a student network, and the method includes:
[0006] Obtaining a first target detection result of the student network on an image set, the image set including unlabeled images and labeled images, the first target detection result including a first probability of each image in a known category, the first probability being obtained by classifying each image based on a category weight matrix of the student network;
[0007] Obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category;
[0008] Based on the first target detection result, the second target detection result, and the label of the labeled image, the network in the target detection model and the category weight matrix of the network are updated and trained.
[0009] In a second aspect, an embodiment of the present application provides a target detection method, including:
[0010] Acquire the target image to be detected;
[0011] Performing target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network;
[0012] Among them, the target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model described in the first aspect.
[0013] In a third aspect, an embodiment of the present application provides a training device for a target detection model, wherein the target detection model includes a teacher network and a student network, and the device includes:
[0014] A first acquisition unit is used to acquire a first target detection result of the student network on an image set, wherein the image set includes unlabeled images and labeled images, and the first target detection result includes a first probability of each image in a known category, wherein the first probability is obtained by classifying each image based on a category weight matrix of the student network;
[0015] A second acquisition unit is used to obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category;
[0016] A training unit is used to update and train the network in the target detection model and the category weight matrix of the network based on the first target detection result, the second target detection result and the label of the labeled image.
[0017] In a fourth aspect, an embodiment of the present application provides a target detection device, including:
[0018] A third acquisition unit, used to acquire a target image to be detected;
[0019] A detection unit, configured to perform target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network;
[0020] The target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model described in the first aspect.
[0021] In a fifth aspect, an embodiment of the present application provides an electronic device, including:
[0022] processor;
[0023] a memory for storing instructions executable by the processor;
[0024] The processor is configured to execute the instructions to implement the target detection model training method as described in the first aspect; or, the processor is configured to execute the instructions to implement the target detection method as described in the second aspect.
[0025] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the training method of the target detection model as described in the first aspect; or, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to execute the target detection method as described in the second aspect.
[0026] In the seventh aspect, an embodiment of the present application provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the method described in the first aspect or the second aspect.
[0027] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0028] A category weight matrix is introduced in both the teacher network and the student network of the target detection model to represent the weights of known categories; in the process of target detection on the input image, each network uses the introduced category weight matrix to classify the input image and predicts the probability that the input image belongs to a known category; on this basis, based on the target detection results output by each network, the category weight matrix of each network is dynamically updated, that is, when it is determined that the input image does not belong to a known category based on the target detection results, the category weight matrix will be updated so that the updated category weight matrix contains the weight of the new category, so that the result obtained by each network for classifying the input image also includes the probability that the input image belongs to the new category, that is, the discovery and prediction of the new category is realized; the category weight matrix of each network is continuously updated in the above manner, so that each network can master the knowledge of discovering and predicting new categories during the training process, so that the trained target detection model can realize the discovery and prediction of new categories, and the performance is greatly improved. Even if the image to be detected belongs to a new category, it can output a target detection result with high accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0030] Figure 1 A flowchart of a method for training a target detection model provided for one embodiment of the present application;
[0031] Figure 2 A flowchart of a method for training a target detection model provided in another embodiment of the present application;
[0032] Figure 3 A flowchart of a method for training a target detection model provided in yet another embodiment of the present application;
[0033] Figure 4 A schematic diagram of a supervised learning process of a student network provided for one embodiment of the present application;
[0034] Figure 5 A schematic diagram of a flow chart of a target detection method provided for one embodiment of the present application;
[0035] Figure 6 A flowchart of a target detection method provided for another embodiment of the present application;
[0036] Figure 7 A schematic diagram of the structure of a training device for a target detection model provided in one embodiment of the present application;
[0037] Figure 8 A schematic diagram of the structure of a target detection device provided for one embodiment of the present application;
[0038] Fig. 9 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0040] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0041] In the semi-supervised target detection task in the related art, if new categories that do not exist in the source domain appear in the target domain and the number of samples of the new categories is limited, the performance of the trained target detection model will be severely limited. For example, the labeled data set includes labeled data of k (k ≥ 2) categories, but the unlabeled data set may contain unlabeled data of new categories. However, the target detection model in the related art cannot discover and learn new categories during the training process, which leads to the limited performance of the trained target detection model. It can only perform target detection within the range of k categories and cannot be applied to target detection of images other than k categories, affecting the detection accuracy.
[0042] To this end, an embodiment of the present application proposes a training method for a target detection model, in which a category weight matrix is introduced in both the teacher network and the student network of the target detection model to represent the weights of known categories; in the process of target detection on the input image, each network uses the introduced category weight matrix to classify the input image and predicts the probability that the input image belongs to a known category; on this basis, based on the target detection results output by each network, the category weight matrix of each network is dynamically updated, that is, when it is determined based on the target detection results that the input image does not belong to a known category, the category weight matrix will be updated so that the updated category weight matrix includes the weight of the new category, so that the result obtained by each network for classifying the input image also includes the probability that the input image belongs to the new category, that is, the discovery and prediction of the new category is realized; the category weight matrix of each network is continuously updated in the above manner, so that each network masters the knowledge of discovering and predicting new categories during the training process, so that the trained target detection model can realize the discovery and prediction of new categories, and the performance is greatly improved. Even if the image to be detected belongs to a new category, it can output a target detection result with high accuracy.
[0043] On this basis, an embodiment of the present application also proposes a target detection method, which performs target detection on a target image using a target detection model trained by the above-mentioned training method. Even if the target image belongs to a new category, it can be accurately discovered by the target detection model, thereby accurately identifying the category of the target image and improving the target detection accuracy.
[0044] It should be understood that the training method of the target detection model and the target detection method provided in the embodiments of the present application can be performed by an electronic device or software installed in an electronic device. The so-called electronic device here may include a terminal device, such as a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc.; or, the electronic device may also include a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0045] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0046] See also Figure 1 , is a flow chart of a method for training a target detection model provided by an embodiment of the present application, the method comprising the following steps:
[0047] S102, obtaining the first target detection result of the student network on the image set.
[0048] The image set includes unlabeled images and labeled images. Unlabeled images refer to images without labels, and unlabeled images can be randomly extracted from a preset unlabeled image set. Labeled images refer to images with labels, and labeled images can be randomly extracted from a preset labeled image set. In practical applications, the target detection model will undergo multiple rounds of update training. During each round of update training, some unlabeled images can be randomly extracted from the unlabeled image set, and some labeled images can be randomly extracted from the labeled image set, and then the extracted unlabeled images and labeled images are combined into the image set of this round of update training.
[0049] In the above S102, by inputting the image set into the student network for target detection, a first target detection result can be obtained. The first target detection result includes the first probability of each image in a known category, and the known category refers to the known category contained in the image set. In the first round of update training of the target detection model, the known category includes the category of labeled images in the image set. For example, the image set includes k (k is a positive integer) categories of labeled images, then the known categories include these k categories, and the first target detection result includes the first probability of each image in the image set in these k categories.
[0050] In order to enable the student network to learn to discover and predict new categories during the training process, the embodiment of the present application introduces a category weight matrix in the student network, which represents the weight of the known categories. The first probability of each image in the known category is obtained by classifying the image based on the category weight matrix of the student network. For example, the known categories include categories 1 to k, then the category weight matrix of the student network includes k columns of elements, and the i-th (1≤i≤k) represents the weight of the student network category i.
[0051] In an embodiment of the present application, the category weight matrix of the student network can be dynamically updated during the training process. That is, when it is determined that the input image does not belong to a known category based on the target detection result output by the student network, the category weight matrix will be updated so that the updated category weight matrix includes the weight of the new category. In this way, the result obtained by the student network for classifying the input image also includes the probability that the input image belongs to the new category, thereby enabling the student network to discover and predict new categories.
[0052] In an embodiment of the present application, in order to improve the classification accuracy of the student network for the input image, thereby improving the target detection accuracy of the student network for the input image, in one embodiment, the first probability of each image in the image set in a known category can be determined in the following manner: extracting the image features of each image; performing a dot product operation on the category weight matrix of the student network and the transpose of the image features to obtain a similarity matrix, which represents the similarity between the extracted image features and the known categories; classifying each image based on the similarity matrix to obtain the first probability of each image in the known category.
[0053] As an example, the above image feature extraction operation can be implemented by the fully connected layer in the student network, and the above classification operation can be implemented by the classification layer in the student network. Figure 2As shown in the figure, the student network uses a two-stage target detector Fast R-CNN. The first stage target detector is the Region Proposal Network (RPN), which extracts multiple candidate boxes where the detection target may exist from the input image. The second stage target detector extracts the region of interest (ROI) containing the detection target from the multiple candidate boxes. Then, after the ROI is subjected to feature extraction by the first and second fully connected layers, the image features are extracted from the region of interest; further, the class weight matrix of the student network is multiplied by the transpose of the image features to obtain the similarity matrix; finally, the classification layer uses the softmax activation function to map the similarity matrix to obtain the first probability of the input image in the known category. In addition, after the ROI is subjected to feature extraction by the first and third fully connected layers, the corresponding image features are extracted from the region of interest; further, the image features are subjected to boundary regression processing to obtain the predicted position of the detection target in the input image.
[0054] It is worth noting that the student network also uses a two-stage target detector such as YOLO, and the embodiment of the present application does not limit the structure of the student network.
[0055] In another embodiment, in order to make both the image features and the category weight matrix located in a specified area, such as [-1,1], so that the first probability obtained is more accurate, the category weight matrix of the student network and the transpose of the image features are normalized before the dot product operation is performed. Specifically, the first probability of each image in the image set in a known category can be determined as follows: extract the image features of each image; normalize the category weight matrix and image features of the student network; perform a dot product operation on the normalized category weight matrix and the normalized image features to obtain a similarity matrix, which represents the similarity between the extracted image features and the known categories; classify each image based on the similarity matrix to obtain the first probability of each image in the known category.
[0056] Still Figure 2Taking the student network shown in the figure as an example, the number of known categories is k, the dimension of the category weight matrix is 1×k, and each element in the category weight matrix corresponds to the weight of a known category. After the input image is processed by the two-stage target detector, the region of interest containing the detected target in the input image is obtained; then, after the region of interest is subjected to feature extraction by the first fully connected layer and the second fully connected layer, the image features are extracted from the region of interest, and the image features include m row vectors, each row vector represents a sub-feature; further, after the category weight matrix of the student network and the image features are normalized, the normalized category weight matrix and the transpose of the normalized image features are multiplied by a point multiplication operation to obtain a similarity matrix, in which the i-th row and j-th column elements in the similarity matrix represent the similarity between the i-th existing category and the j-th sub-feature; finally, the classification layer uses the softmax activation function to map the similarity matrix to obtain the first probability of the input image in the known category.
[0057] In the above implementation, the normalization process may adopt the L2 normalization method. In this case, the normalization process of the image features may be implemented by the following formula (1), and the normalization process of the class weight matrix may be implemented by the following formula (2).
[0058]
[0059]
[0060] in, represents the normalized image features, f i Represents image features, represents the normalized category weight matrix, w represents the category weight matrix, and ξ is a very small decimal, which is used to avoid the problem of the denominator being 0 in the reverse derivative calculation.
[0061] Of course, it should be understood that in practical applications, the first target detection result may also include the position of the detected target contained in each image in the image set. In addition, in order to further enhance the performance of the target detection model during the training process, such as Figure 2 As shown, the unlabeled images in the image set can be strongly enhanced and then input into the student network for target detection to add a higher degree of noise to the unlabeled images, and the labeled images in the image set can be weakly enhanced and then input into the student network for target detection to add a lower degree of noise to the labeled images to improve the denoising ability of the student network.
[0062] S104, obtaining the second target detection result of the teacher network for the unlabeled image.
[0063] The teacher network and the student network can be identical in structure and also have the function of object detection. By inputting the unlabeled image in the image set into the teacher network for object detection, a second object detection result of the unlabeled image can be obtained. The second object detection result includes a second probability of the unlabeled image in a known category.
[0064] Similar to the student network, in order to enable the teacher network to learn to discover and predict new categories during the training process, the embodiment of the present application introduces a category weight matrix in the student network, which also represents the weights of known categories. The second probability of an unlabeled image in a known category is obtained by classifying the unlabeled image based on the category weight matrix of the teacher network. Among them, the category weight matrix of the teacher network can be the same as the category weight matrix of the student network.
[0065] The category weight matrix of the teacher network can also be dynamically updated during the training process. That is, when the input image is determined not to belong to a known category based on the target detection result output by the teacher network, or when the category weight matrix of the student network is updated, the category weight matrix of the teacher network will be updated so that the updated category weight matrix of the teacher network contains the weights of the new category. In this way, the result obtained by the teacher network for classifying the input image also includes the probability that the unlabeled image belongs to the new category, thereby realizing the discovery and prediction of the new category by the teacher network.
[0066] In the embodiment of the present application, the target detection process of the teacher network for the unlabeled image is similar to the target detection process of the student network for the image set, and will not be described in detail. Figure 2 As shown, the teacher network uses a two-stage target detector FastR-CNN. The first-stage target detector is RPN, which extracts multiple candidate boxes where the detection target may exist from the unlabeled image. The second-stage target detector extracts the ROI containing the detection target from the multiple candidate boxes. Then, after feature extraction by the first fully connected layer and the second fully connected layer, the image features are extracted from the region of interest; further, the category weight matrix and image features of the teacher network are normalized, and the normalized category weight matrix and the transpose of the image features are multiplied to obtain a similarity matrix, which represents the similarity between the image features extracted from the unlabeled image and the known categories; finally, the classification layer uses the softmax activation function to map the similarity matrix to obtain the second probability of the unlabeled image in the known category.
[0067] Of course, it should be understood that in practical applications, the second target detection result may also include the position of the detected target contained in the unlabeled image. In addition, in order to further enhance the performance of the target detection model during the training process, such as Figure 2As shown, the unlabeled image can be weakly enhanced and then input into the teacher network for target detection, and a lower degree of noise can be added to the unlabeled image to improve the denoising ability of the teacher network.
[0068] S106, based on the first target detection result, the second target detection result and the label of the labeled image, update and train the network and the category weight matrix of the network in the target detection model.
[0069] The label of the labeled image includes the category label and position label of the labeled image. The category label is used to indicate the category of the detected target in the labeled image, referred to as the category of the labeled image. The position label is used to indicate the location of the detected target in the labeled image.
[0070] Updating and training each network refers to updating and training the network parameters of each network, such as the number of network layers contained in each network, the connection relationship between nodes in the network layer, and the connection weights. Since the difference between the detection result of the unlabeled image in the first target detection result and the second target detection result can reflect the unsupervised training effect of the target detection model, and the difference between the detection result of the labeled image in the first target detection result and the label of the labeled image can reflect the supervised training effect of the target detection model, based on the first target detection result, the second target detection result and the label of the labeled image, the teacher network and the student network are updated and trained so that the two can learn the knowledge of target detection on the input image during the training process, thereby continuously improving the detection accuracy of each network.
[0071] Since the first target detection result includes the first probability of the unlabeled image in the known category in the image set, and the second target detection result includes the second probability of the unlabeled image in the known category, if either of the two probabilities is too small, it can be determined that the unlabeled image may belong to a new category outside the known category. By updating the category weight matrix of each network, the updated category weight matrix includes the weight of the new category, and then each network masters the knowledge of discovering and predicting new categories during the training process, so that each trained network can realize the discovery and prediction of new categories, and the performance is greatly improved. Even if the image to be detected belongs to a new category, it can output a highly accurate target detection result.
[0072] In order to improve the training efficiency, in one embodiment, the above S106 may include the following steps:
[0073] S162, based on the first probability of the unlabeled image in the known category, the category weight matrix of the student network is updated. As an example, if the first probability of the unlabeled image in the known category is less than the category threshold of the known category, it can be determined that the unlabeled image belongs to a new category outside the known category, and then the new category is added to the known category to achieve the update of the known category; then, based on the new category, the category weight matrix of the student network is updated. Among them, the category threshold of the known category can be a pre-set fixed value, or an adaptive threshold can be used, such as a network parameter of the student network, which is continuously updated during the semi-supervised training process.
[0074] For example, the known categories include k (k ≥ 2) categories, which are marked as category 1 to category k. If the first probabilities of the unlabeled image in category 1 to category k are all less than the category thresholds of the corresponding categories, it can be determined that the unlabeled image does not belong to category 1 to category k, and then the number of known categories is increased by 1, and the new category is marked as category k+1. Furthermore, a column of elements is added to the category weight matrix of the student network, and the values of the column elements are randomly initialized to represent the weights of category k+1, thereby updating the category weight matrix. Of course, the weights of category k+1 will be continuously updated during subsequent training.
[0075] For example, corresponding weights are randomly generated for new categories, and the weights of new categories are added to the category weight matrix of student categories; and based on the first probability and second probability of unlabeled images in known categories, the first probability of labeled images in known categories, and the category labels of labeled images, the weights of existing categories other than new categories in the category weight matrix of the student network are updated.
[0076] Specifically, in addition to increasing the weight of category k+1 in the category weight matrix of the student network, the classification loss of the target detection model can also be determined based on the difference between the first probability and the second probability of the unlabeled image in the known category and the difference between the first probability and the category label of the labeled image in the known category; then, the classification loss is reduced to the target, and the weights of category 1 to category k in the category weight matrix are adjusted based on the classification loss.
[0077] In the updating process of the above-mentioned category weight matrix, not only the corresponding weights are randomly generated for the new categories, but also the weights of the existing categories except the new categories are updated based on the classification loss of the student network. This not only enables the updated category weight matrix to more accurately reflect the image features of the input image and the similarity between each category, but also accelerates the convergence of the student network and improves the training efficiency.
[0078] S164, based on the updated category weight matrix of the student network, the category weight matrix of the teacher network is updated.
[0079] As an example, the updated student network category weight matrix can be used as the updated teacher network category weight, thereby ensuring that the teacher network category weight matrix is consistent with the student network category weight.
[0080] As another example, the category weight matrix of the teacher network may be updated based on the category weight matrix of the updated student network using an exponential moving average (EMA) algorithm.
[0081] S166, updating the student network based on the first target detection result, the second target detection result, and the label of the labeled image.
[0082] As an example, based on the first probability of the labeled image in the known category and the category label of the labeled image, a first classification loss is determined, and the first classification loss represents the classification loss generated by the target detection model in the supervised learning process; based on the first probability and the second probability of the unlabeled image in the known category, a second classification loss is determined, and the second classification loss represents the classification loss generated by the target detection model in the unsupervised learning process; based on the weighted sum of the first classification loss and the second classification loss, the network parameters of the student network are updated. For example, based on the weighted sum of the first classification loss and the second classification loss, the network parameters of the student network are updated using a back propagation algorithm.
[0083] For example, the first classification loss can be obtained by using a cross entropy loss function to calculate the first probability of a labeled image in a known category and the category loss of the labeled image, such as shown in formula (3).
[0084]
[0085] in, represents the first classification loss, represents the category label of the labeled image, represents exponential operation, represents the first probability of the labeled image in the jth known category, and exp represents the exponential operation.
[0086] In the process of calculating the first classification loss through the above-mentioned cross entropy loss function, the first probability is too small to be close to 1, and the more the number of existing categories, the smaller the first probability, which will cause the calculated first classification loss to be inaccurate, thereby affecting the subsequent update effect of each network and category weight matrix. In view of this, the training method of the target detection model provided in the embodiment of the present application also introduces a scaling factor in the above-mentioned cross entropy loss function when calculating the first classification loss, so as to avoid the problem of inaccurate first classification loss caused by the first probability being too small. Specifically, the first classification loss is determined in the following manner: an exponential operation is performed based on the category label and scaling factor of the labeled image to obtain a first operation result; based on the first probability of the labeled image in the known category, the predicted category of the labeled image is determined from the known categories; an exponential operation is performed based on the predicted category and the scaling factor to obtain a second operation result; based on the ratio of the first operation result to the second operation result, the first classification loss is determined.
[0087] More specifically, the first classification loss can be calculated by the following formula (4):
[0088]
[0089] in, represents the first classification loss, m represents the number of labeled images contained in the image set, s represents the scaling factor, K represents the number of known categories, represents the first probability of the i-th labeled image in category k, represents the first operation result, Indicates the second operation result.
[0090] As another example, in the process of updating the network parameters of the student network, not only the classification loss of the target detection model but also the position detection loss of the target detection model are considered. Specifically, the supervised loss of the target detection model is calculated by the following formula (5), and the unsupervised loss of the target detection model is calculated by the following formula (6); further, the supervised loss and the unsupervised loss are weighted summed by the following formula (7) to obtain the total loss of the target detection model; finally, based on the total loss of the target detection model, the back propagation algorithm is used to update the network parameters of the student network.
[0091]
[0092]
[0093] L total =L s +λL u (7)
[0094] Among them, L urepresents the unsupervised loss; represents the jth unlabeled image in the image set; Indicates a category pseudo label corresponding to the unlabeled image, where the category pseudo label can be determined based on a first probability of the unlabeled image in a known category; Represents the category prediction loss corresponding to the first-level detection of the unlabeled image, which is used to represent the difference between the predicted category and the category pseudo-label obtained after the first-level detection of the labeled image; represents the position pseudo label corresponding to the unlabeled image; Represents the position prediction loss corresponding to the first-level detection of the unlabeled image, which is used to represent the difference between the predicted position and the position pseudo-label obtained after the first-level detection of the unlabeled image; Represents the category prediction loss corresponding to the second-level detection of the unlabeled image, which is used to represent the difference between the predicted category and the category pseudo-label obtained after the second-level detection of the unlabeled image; represents the position prediction loss corresponding to the second-level detection of the unlabeled image, which is used to represent the difference between the predicted position and the position pseudo-label obtained after the second-level detection of the unlabeled image; B 1 represents the number of unlabeled images contained in the image set; L total Represents the total loss.
[0095] S168, based on the updated student network, the teacher network is updated.
[0096] As an example, the network parameters of the updated student network can be used as the network parameters of the updated teacher network, thereby ensuring that the student network and the teacher network are consistent in results.
[0097] As another example, the EMA algorithm can be used to update the network parameters of the teacher network based on the updated network parameters of the student network. For example, the network parameters of the teacher network are updated by the following formula (8).
[0098] Θ t =αΘ t +(1-α)Θ s (8)
[0099] Among them, Θ t represents the network parameters of the teacher network, Θ s represents the network parameters of the student network, α represents the weight, and the weight can be set according to actual needs, which is not limited in the embodiments of the present application.
[0100] In this implementation, the training efficiency is higher by first updating the category weight matrix and network parameters of the student network, and then updating the category weight matrix and network parameters of the teacher network based on the updated category weight matrix and network parameters of the student network.
[0101] The present application only shows a specific implementation of the above S106. Of course, it should be understood that the above S106 can also be implemented in other ways, and the embodiments of the present application are not limited to this. For example, the updating method of the category weight matrix and network parameters of the teacher network is similar to the updating method of the category weight matrix and network parameters of the student network, that is, based on the first probability of the unlabeled image in the known category, the category weight matrix of the teacher network is updated, and based on the first target detection result, the second target detection result and the label of the labeled image, the network parameters of the teacher network are updated, and so on.
[0102] It is worth noting that the above S102 to S106 are only an update training process for the target detection model. In actual applications, the target detection model can be updated and trained multiple times until the preset training stop condition is met. The preset training stop condition can be set according to actual needs, for example, when the number of update training times reaches the preset maximum training times Max iter The embodiments of the present application are not limited to this.
[0103] The training method of the target detection model provided in the embodiment of the present application introduces a category weight matrix in both the teacher network and the student network of the target detection model to represent the weights of known categories; in the process of target detection on the input image, each network uses the introduced category weight matrix to classify the input image and predicts the probability that the input image belongs to a known category; on this basis, based on the target detection results output by each network, the category weight matrix of each network is dynamically updated, that is, when it is determined that the input image does not belong to a known category based on the target detection results, the category weight matrix will be updated so that the updated category weight matrix includes the weight of the new category, so that the result obtained by each network for classifying the input image also includes the probability that the input image belongs to the new category, that is, the discovery and prediction of the new category is realized; the category weight matrix of each network is continuously updated in the above manner, so that each network masters the knowledge of discovering and predicting new categories during the training process, so that the trained target detection model can realize the discovery and prediction of new categories, and the performance is greatly improved. Even if the image to be detected belongs to a new category, it can output a target detection result with high accuracy.
[0104] In the training method of the target detection model provided in the embodiment of the present application, during the first round of update training of the target detection model, the category weights introduced into the student network and the teacher network can be obtained by random initialization, or can also be obtained by supervised training of the student network.
[0105] See also Figure 3 , is a flow chart of a method for training a target detection model provided by another embodiment of the present application. Compared with Figure 1 The method shown in the figure adopts a two-stage training scheme. In the first stage, the class weight matrix of the network of the target detection model is obtained by supervised training of the base network, and the trained base network is used as the student network in the target detection model. In the second stage, the student network and the teacher network are semi-supervisedly trained based on the image set. Figure 3 As shown, the method comprises the following steps:
[0106] S302, obtaining the third target detection result of the basic network for K labeled images.
[0107] The basic network has target detection capability. The basic network can adopt various network architectures commonly used in the art, such as a two-stage Fast R-CNN architecture, etc., which is not limited in the embodiments of the present application.
[0108] The third target detection result includes a third probability of each labeled image in the K categories. The third probability is obtained by classifying the labeled image based on the initial category weight matrix, where the initial category weight matrix represents the weights of the K categories. The initial category weights are generated by random initialization.
[0109] The specific implementation of S302 is the same as Figure 1 The specific implementation of S102 in the illustrated embodiment is similar. Figure 4 As shown in the figure, the basic network adopts the two-stage target detector Fast R-CNN. After each labeled image is processed by the two-stage target detector, the region of interest containing the detection target in each labeled image is obtained; then, after feature extraction by the first fully connected layer and the second fully connected layer, the image features are extracted from the region of interest; further, after the category weight matrix of the student network and the extracted image features are normalized, the point multiplication operation is performed on the transpose of the normalized category weight matrix and the normalized image features to obtain the similarity matrix; finally, the classification layer uses the softmax activation function to map the similarity matrix to obtain the third probability of each labeled image in K categories.
[0110] S304: Based on the third target detection result and the label of the labeled image, the initial category weight matrix and the basic network are updated.
[0111] The specific implementation of S304 is the same as Figure 1 The specific implementation of S106 in the illustrated embodiment is similar. For example, based on the third target detection result and the label of the labeled image, the supervised loss of the basic network is determined; then, based on the supervised loss of the basic network, the back propagation algorithm is used to update the initial category weight matrix and the network parameters of the basic network.
[0112] S306, using the updated initial category weight matrix as the category weight matrix of the network of the target detection model.
[0113] S308, using the updated target network as the student network in the target detection model.
[0114] S310, obtaining the first target detection result of the student network on the image set.
[0115] S312, obtaining the second target detection result of the teacher network for the unlabeled image.
[0116] S314: Based on the first target detection result, the second target detection result, and the label of the labeled image, update and train the network and the category weight matrix of the network in the target detection model.
[0117] The training method of the target detection model provided in this embodiment, through the supervised training of the basic network in the first stage, enables the basic network to have a target detection capability with a certain accuracy, and the updated initial category weight matrix has a memory effect on the categories of labeled images in the image set, and can accurately represent the weights of the existing categories in the image set; on this basis, the trained basic network is used as the student network in the target detection model, and semi-supervised training is performed on the student network and the teacher network based on the image set, which can not only accelerate the convergence of the target detection model and improve the training efficiency, but also improve the performance of the target detection model.
[0118] The present application also provides a target detection method, which can perform target detection on a target image to be detected based on a target detection model trained by the above target detection model training method. Figure 5 , is a flow chart of a target detection method provided by an embodiment of the present application, the method may include the following steps:
[0119] S502: Acquire a target image to be detected.
[0120] S504, performing target detection on the target image through the target network of the target detection model to obtain a detection result of the target image.
[0121] The detection result includes the predicted probability of the target image in the known category, which is obtained by classifying the target image based on the category weight matrix of the target network. Of course, the detection result can also include the predicted position of the detected target in the target image.
[0122] The target detection model includes a teacher network and a student network. The target network includes at least one of the teacher network and the student network.
[0123] In one embodiment, if Figure 6 As shown, the target network can use a two-stage target detector Fast R-CNN. The first-stage target detector is RPN, which extracts multiple candidate boxes where the detection target may exist from the target image, and the second-stage target detector extracts the ROI containing the detection target from the multiple candidate boxes. After the ROI is subjected to feature extraction by the first fully connected layer and the second fully connected layer, the first image feature is extracted from the region of interest; further, after the category weight matrix of the target network and the first image feature are normalized, the normalized category weight matrix and the transpose of the normalized first image feature are multiplied to obtain a similarity matrix; finally, the classification layer uses the softmax activation function to map the similarity matrix to obtain the predicted probability of the target image in the known category. At the same time, after the ROI is subjected to feature extraction by the first fully connected layer and the third fully connected layer, the second image feature is extracted from the region of interest; further, the second image feature is subjected to boundary regression processing to obtain the predicted position of the detection target in the target image.
[0124] Optionally, the target image can be weakly enhanced, and then the category of the detection target in the weakly enhanced target image can be detected by the target network to obtain the category detection result corresponding to the target image, and the position detection result corresponding to the target image can be obtained by detecting the position of the detection target contained in the target image.
[0125] The target detection method provided in the embodiment of the present application performs target detection on the target image using the target detection model trained by the above-mentioned training method. Even if the target image belongs to a new category, it can be accurately discovered by the target detection model, thereby accurately identifying the category of the target image and improving the target detection accuracy.
[0126] The above is a description of a specific embodiment of the specification. 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 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.
[0127] With the above Figure 1 Corresponding to the training method of the target detection model shown in FIG. 1 , the present application embodiment also proposes a training device for a target detection model, wherein the target detection model includes a teacher network and a student network. Figure 7 , is a structural diagram of a training device 700 for a target detection model provided in an embodiment of the present application, the device 700 includes: a first acquisition unit 710, a second acquisition unit 720 and a training unit 730.
[0128] The first acquisition unit 710 is used to obtain a first target detection result of the student network on an image set, where the image set includes unlabeled images and labeled images. The first target detection result includes a first probability of each image in a known category, where the first probability is obtained by classifying each image based on a category weight matrix of the student network.
[0129] The second acquisition unit 720 is used to obtain a second target detection result of the teacher network on the unlabeled image, where the second target detection result includes a second probability of the unlabeled image being in the known category.
[0130] The training unit 730 is used to update and train the network in the target detection model and the category weight matrix of the network based on the first target detection result, the second target detection result and the label of the labeled image.
[0131] Obviously, the training device of the target detection model provided in the embodiment of the present application can be used as Figure 1 The execution body of the training method of the target detection model shown, for example Figure 1 In the training method of the target detection model shown in FIG. 1 , step S102 can be performed by Figure 7 The first acquisition unit 710 in the training device of the target detection model shown in FIG. 1 is executed, and step S104 can be performed by Figure 7 The second acquisition unit 720 in the training device of the target detection model shown in FIG. 1 is executed, and step S106 can be performed by Figure 7 The training unit 730 in the training device of the target detection model shown is executed.
[0132] According to another embodiment of the present application, Figure 7The various units in the training device of the target detection model shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the training device of the target detection model may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0133] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 1 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 7 The training device of the target detection model shown in, and the training method of the target detection model to implement the embodiment of the present application. The computer program can be recorded on, for example, a computer-readable storage medium, and transferred to an electronic device through a computer-readable storage medium and run therein.
[0134] With the above Figure 5 Corresponding to the target detection method shown, the present application embodiment also proposes a target detection device. Figure 8 , is a structural schematic diagram of a target detection device 800 provided in an embodiment of the present application, and the device 800 includes: a third acquisition unit 810 and a detection unit 820.
[0135] The third acquisition unit 810 is used to acquire the target image to be detected.
[0136] The detection unit 820 is used to perform target detection on the target image through the target network of the target detection model to obtain the detection result of the target image, wherein the detection result includes the predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on the category weight matrix of the target network.
[0137] Among them, the target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model provided in the embodiment of the present application.
[0138] Obviously, the target detection device provided in the embodiment of the present application can be used as Figure 5 The execution body of the target detection method shown is, for example Figure 5 In the target detection method shown in FIG. 1 , step S502 may be performed by Figure 8 The third acquisition unit 810 in the target detection device shown in FIG. 1 is executed, and step S504 can be performed by Figure 8 The detection unit 820 in the target detection device shown is executed.
[0139] According to another embodiment of the present application, Figure 8 The various units in the target detection device shown can be respectively or all merged into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of the present application, the target detection device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0140] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 5 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 8 The target detection device shown in and the target detection method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and transferred to an electronic device through the computer-readable storage medium and run therein.
[0141] Fig. 9 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Fig. 9At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0142] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0143] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0144] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a training device for the target detection model at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0145] Obtaining a first target detection result of the student network on an image set, the image set including unlabeled images and labeled images, the first target detection result including a first probability of each image in a known category, the first probability being obtained by classifying each image based on a category weight matrix of the student network;
[0146] Obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category;
[0147] Based on the first target detection result, the second target detection result, and the label of the labeled image, the network in the target detection model and the category weight matrix of the network are updated and trained.
[0148] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a target detection device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0149] Acquire the target image to be detected;
[0150] Performing target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network;
[0151] Among them, the target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model provided in the embodiment of the present application.
[0152] The above application Figure 1 The method performed by the training device of the target detection model disclosed in the embodiment shown, or the above-mentioned method of the present application Figure 5The method performed by the target detection device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0153] The electronic device may also perform Figure 1 The method and the training device of the target detection model are implemented in Figures 1 to 4 Alternatively, the electronic device may also perform the functions of the embodiments shown. Figure 5 The method and the training device of the target detection model are implemented in Figure 5 , Figure 6 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0154] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0155] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0156] Obtaining a first target detection result of the student network on an image set, the image set including unlabeled images and labeled images, the first target detection result including a first probability of each image in a known category, the first probability being obtained by classifying each image based on a category weight matrix of the student network;
[0157] Obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category;
[0158] Based on the first target detection result, the second target detection result, and the label of the labeled image, the network in the target detection model and the category weight matrix of the network are updated and trained.
[0159] Alternatively, when the instruction is executed by a portable electronic device including a plurality of application programs, the portable electronic device can execute Figure 5 The method of the embodiment shown is specifically used to perform the following operations:
[0160] Acquire the target image to be detected;
[0161] Performing target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network;
[0162] Among them, the target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model provided in the embodiment of the present application.
[0163] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps in the training method of the target detection model or the target detection method provided in the embodiment of the present application.
[0164] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0165] 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.
[0166] 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 tape 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.
[0167] 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.
[0168] Each embodiment in this specification 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.
Claims
1. A training method for a target detection model, It is characterized in that The target detection model includes a teacher network and a student network, and the method includes: Obtaining a first target detection result of the student network on an image set, the image set including unlabeled images and labeled images, the first target detection result including a first probability of each image in a known category, the first probability being obtained by classifying each image based on a category weight matrix of the student network; Obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category; Based on the first target detection result, the second target detection result, and the label of the labeled image, the network in the target detection model and the category weight matrix of the network are updated and trained.
2. The method according to claim 1, It is characterized in that The updating of the network in the target detection model and the category weight matrix of the network based on the first target detection result, the second target detection result and the label of the labeled image includes: Based on the first probability of the unlabeled image in the known category, the category weight matrix of the student network is updated, and based on the updated category weight matrix of the student network, the category weight matrix of the teacher network is updated; The student network is updated based on the first target detection result, the second target detection result, and the label of the labeled image, and the teacher network is updated based on the updated student network.
3. The method according to claim 2, It is characterized in that The updating of the category weight matrix of the student network based on the first probability of the unlabeled image in the known category comprises: If the first probability of the unlabeled image in the known category is less than the category threshold of the known category, adding a new category to the known category; Based on the new categories, the category weight matrix of the student network is updated.
4. The method according to claim 3, It is characterized in that The label includes a category label; and the updating of the category weight matrix of the student network based on the new category includes: Randomly generate corresponding weights for the new categories, and add the weights of the new categories to the category weight matrix of the student network; Based on the first probability and the second probability of the unlabeled image in the known category, the first probability of the labeled image in the known category and the category label of the labeled image, the weight of the known category in the category weight matrix of the student network is updated.
5. The method according to claim 2, It is characterized in that The label includes a category label; and updating the student network based on the first target detection result, the second target detection result, and the label of the labeled image includes: Determining a first classification loss based on a first probability of the labeled image in the known category and a category label of the labeled image; Determining a second classification loss based on the first probability and the second probability of the unlabeled image in the known category; The student network is updated based on a weighted sum of the first classification loss and the second classification loss.
6. The method according to claim 5, It is characterized in that Determining a first classification loss based on a first probability of the labeled image in the known category and a category label of the labeled image comprises: Performing an exponential operation based on the category label and the scaling factor of the labeled image to obtain a first operation result; Determining a predicted category of the labeled image from the known categories based on a first probability of the labeled image being in the known categories; Performing an exponential operation based on the predicted category and the scaling factor to obtain a second operation result; The first classification loss is determined based on a ratio of the first operation result to the second operation result.
7. The method according to claim 1, It is characterized in that The first probability of each image in a known category is determined as follows: Extracting image features of each image; Performing a dot product operation on the category weight matrix of the student network and the image features to obtain a similarity matrix, wherein the similarity matrix represents the similarity between the image features and the known categories; Each of the images is classified based on the similarity matrix to obtain a first probability of each of the images being in the known category.
8. The method according to any one of claims 1 to 7, It is characterized in that The image set includes labeled images of K categories; Before obtaining the first target detection result of the student network on the image set, the method further includes: Obtaining a third target detection result of the basic network for the K labeled images, wherein the third target detection result includes a third probability of each labeled image in the K categories, and the third probability is obtained by classifying the labeled images based on an initial category weight matrix; Based on the third target detection result and the label of the labeled image, updating the initial category weight matrix and the basic network; The updated initial category weight matrix is used as the category weight matrix of the network of the target detection model, and the updated target network is used as the student network in the target detection model.
9. A target detection method, It is characterized in that include: Acquire the target image to be detected; Performing target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network; The target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model described in any one of claims 1 to 8.
10. A training device for a target detection model, It is characterized in that The target detection model includes a teacher network and a student network, and the method includes: A first acquisition unit is used to acquire a first target detection result of the student network on an image set, wherein the image set includes unlabeled images and labeled images, and the first target detection result includes a first probability of each image in a known category, wherein the first probability is obtained by classifying each image based on a category weight matrix of the student network; A second acquisition unit is used to obtain a second target detection result of the teacher network on the unlabeled image, wherein the second target detection result includes a second probability of the unlabeled image in the known category; A training unit is used to update and train the network in the target detection model and the category weight matrix of the network based on the first target detection result, the second target detection result and the label of the labeled image.
11. A target detection device, It is characterized in that include: A third acquisition unit, used to acquire a target image to be detected; A detection unit, configured to perform target detection on the target image through a target network of a target detection model to obtain a detection result of the target image, wherein the detection result includes a predicted probability of the target image in a known category, and the predicted probability is obtained by classifying the target image based on a category weight matrix of the target network; The target network includes at least one of a teacher network and a student network, and the target detection model is trained based on the training method of the target detection model described in any one of claims 1 to 8.
12. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the target detection model training method as described in any one of claims 1 to 8; or, the processor is configured to execute the instructions to implement the target detection method as described in claim 9.
13. A computer-readable storage medium, It is characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the training method of the target detection model as described in any one of claims 1 to 8; or, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the target detection method as described in claim 9.
14. A computer program product, It is characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the method according to any one of claims 1 to 8 or claim 9.
Citation Information
Patent Citations
Semi-supervised target detection model training method and device, equipment and medium
CN115953633A
Semi-supervised model training method, image recognition method and device
CN116935146A
Cited By
Training method and apparatus for generalized category discovery model, recognition method and apparatus, and device and medium
WO2026103555A1
