Training method and apparatus for image detection model, and image detection method and apparatus

By introducing auxiliary balanced classifiers and semi-supervised learning methods into the image detection model to balance the regional category tendencies, the problem of model prediction bias caused by category imbalance in the existing technology is solved, and the accuracy and performance of the image detection model are improved.

WO2024217463A1PCT designated stage expired Publication Date: 2024-10-24MASHANG CONSUMER FINANCE CO LTD

Patent Information

Application Number
PCT/CN2024/088376
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-21
Filing Date
2024-04-17
Publication Date
2024-10-24

AI Technical Summary

Technical Problem

In the existing technology, image detection models trained based on unbalanced category data sets have low accuracy. Especially in semi-supervised learning, the model tends to be in categories with a large amount of data, resulting in serious prediction deviations of the classifier.

Method used

By introducing an auxiliary balanced classifier into the image detection model, the auxiliary classification algorithm is used to predict the distribution of annotated data, and compared with the real labels, the auxiliary classification loss function is calculated, a semi-supervised image classifier is trained by combining annotated data and unlabeled data, and the total The loss function updates the model parameters to balance the regional category tendency and reduce the model performance deviation caused by category imbalance.

Benefits of technology

It improves the training balance and accuracy of the image detection model, reduces the model performance deviation caused by category imbalance, and improves the overall performance of the image detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024088376_24102024_PF_FP_ABST
    Figure CN2024088376_24102024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are a training method and apparatus for an image detection model, and an image detection method and apparatus. The training method for an image detection model comprises: inputting sample image data into an image detection model to be trained, wherein the sample image data comprises a first sample image and a second sample image; performing image detection on the first sample image, so as to obtain a first detection result; performing image detection on the second sample image, so as to obtain a second detection result, wherein the first detection result comprises classification information of the first sample image, and the second detection result comprises classification information of the second sample image; determining a semi-supervised image detection loss function according to the first detection result and the second detection result; and then determining a target loss function of the image detection model, and performing iterative adjustment on a model parameter of the image detection model according to the target loss function. The present application can improve the accuracy of an image detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Image detection model training method, image detection method and device

[0001] This application claims priority to Chinese patent application number 202310443541.0, filed on April 21, 2023, entitled “Training method for image detection model, image detection method and device”, the contents of which are incorporated herein by reference. Technical Field

[0002] The present application relates to the field of image processing technology, and in particular to a training method for an image detection model, an image detection method, and an image detection device. Background Art

[0003] Currently, in the field of artificial intelligence, many semi-supervised learning methods based on deep neural networks have been proposed. These methods utilize unlabeled data to improve the performance of deep neural networks when only a small amount of labeled data is available. These algorithms have demonstrated effective performance in various tasks. However, in some cases, semi-supervised learning methods assume that the category distribution of a dataset is balanced. In practice, the category distribution of datasets is imbalanced, for example, with a large number of positive samples and a small number of negative samples. Classifiers trained on such imbalanced datasets tend to favor the category with the larger amount of data, a problem exacerbated by semi-supervised learning.

[0004] Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide an image detection model training method, an image detection method and an image detection device.

[0006] In a first aspect, an embodiment of the present application provides a method for training an image detection model, comprising:

[0007] Inputting sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, performing image detection on the first sample image to obtain a first detection result; and performing image detection on the second sample image to obtain a second detection result; the first detection result including classification information of the first sample image, and the second detection result including classification information of the second sample image;

[0008] Determining a semi-supervised image detection loss function of the image detection model to be trained based on the first detection result and the second detection result; and

[0009] According to the semi-supervised image detection loss function, the target loss function of the image detection model to be trained is determined, and the model parameters of the image detection model to be trained are iteratively adjusted according to the target loss function to obtain a trained image detection model.

[0010] In a second aspect, an embodiment of the present application provides a method for training an image detection model, comprising:

[0011] Acquire sample image data; the sample image data includes a first sample image with label information and a second sample image without label information; the label information includes: a sample target area and classification information of the sample target area;

[0012] Inputting the sample image data into the image detection model to be trained, performing image detection on the first sample image to obtain a first detection result corresponding to the first sample image; and performing image detection on the second sample image to obtain a second detection result corresponding to the second sample image; the first detection result includes auxiliary balanced classification information corresponding to the first sample image, and the second detection result includes auxiliary balanced classification information corresponding to the second sample image; the auxiliary balanced classification information is used to balance the regional category propensity of the image detection model to be trained; the regional category propensity is related to the number of target areas belonging to each regional category in the sample image data;

[0013] Determining, according to the first detection result and the second detection result, a semi-supervised auxiliary balance loss function and a semi-supervised image detection loss function corresponding to the image detection model to be trained; the semi-supervised auxiliary balance loss function is determined based on the auxiliary balance classification information;

[0014] According to the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, the target loss function of the image detection model to be trained is determined, and the model parameters of the image detection model to be trained are iteratively adjusted according to the target loss function to obtain the trained image detection model.

[0015] In a third aspect, an embodiment of the present application provides an image detection method, comprising:

[0016] Acquire the target image;

[0017] The target image is input into the trained image detection model, the target area in the target image is detected, and the target area is classified to obtain area classification information corresponding to the target area; wherein, the trained image detection model is trained according to the training method of the image detection model described in the first aspect or the second aspect above.

[0018] In a fourth aspect, an embodiment of the present application provides a training device for an image detection model, comprising:

[0019] a first detection module, configured to input sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, perform image detection on the first sample image to obtain a first detection result, and perform image detection on the second sample image to obtain a second detection result; the first detection result including classification information of the first sample image, and the second detection result including classification information of the second sample image;

[0020] A first determination module is used to determine a semi-supervised image detection loss function of the image detection model to be trained based on the first detection result and the second detection result;

[0021] A training module is used to determine the target loss function of the image detection model to be trained based on the semi-supervised image detection loss function, and iteratively adjust the model parameters of the image detection model to be trained based on the target loss function to obtain a trained image detection model.

[0022] In a fifth aspect, an embodiment of the present application provides a training device for an image detection model, comprising:

[0023] A first acquisition module is configured to acquire sample image data; the sample image data includes a first sample image with label information and a second sample image without label information; the label information includes: a sample target area and classification information of the sample target area;

[0024] a first detection module configured to input the sample image data into an image detection model to be trained, perform image detection on the first sample image to obtain a first detection result corresponding to the first sample image; and perform image detection on the second sample image to obtain a second detection result corresponding to the second sample image; the first detection result includes auxiliary balanced classification information corresponding to the first sample image, and the second detection result includes auxiliary balanced classification information corresponding to the second sample image; the auxiliary balanced classification information is used to balance the regional category propensity of the image detection model to be trained; the regional category propensity is related to the number of target areas belonging to each regional category in the sample image data;

[0025] a first determining module, configured to determine, based on the first detection result and the second detection result, a semi-supervised auxiliary balance loss function and a semi-supervised image detection loss function corresponding to the image detection model to be trained; the semi-supervised auxiliary balance loss function is determined based on the auxiliary balance classification information;

[0026] A training module is used to determine the target loss function of the image detection model to be trained based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, and iteratively adjust the model parameters of the image detection model to be trained based on the target loss function to obtain a trained image detection model.

[0027] In a sixth aspect, an embodiment of the present application provides an image detection device, comprising:

[0028] A second acquisition module is used to acquire a target image;

[0029] The second detection module is used to input the target image into the trained image detection model, detect the target area in the target image, and perform region classification on the target area to obtain region classification information corresponding to the target area; wherein, the trained image detection model is trained according to the training method of the image detection model described in the first aspect or the second aspect above.

[0030] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory electrically connected to the processor, the memory storing a computer program, the processor being used to call and execute the computer program from the memory to implement the training method of the image detection model described in the first or second aspect above, or the processor being used to call and execute the computer program from the memory to implement the image detection method described in the third aspect above.

[0031] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program can be executed by a processor to implement the training method of the image detection model described in the first or second aspect above, or the computer program can be executed by a processor to implement the image detection method described in the third aspect above.

[0032] In the ninth aspect, an embodiment of the present application provides a computer program, which can be executed by a processor to implement the training method of the image detection model described in the first or second aspect above, or the computer program can be executed by a processor to implement the image detection method described in the third aspect above.

[0033] In the tenth aspect, an embodiment of the present application provides a computer program product, including a computer program, which can be executed by a processor to implement the training method of the image detection model described in the first or second aspect above, or the computer program can be executed by a processor to implement the image detection method described in the third aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate one or more embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0035] FIG1 is a schematic flowchart of a method for training an image detection model according to an embodiment of the present application;

[0036] FIG2 is a schematic flowchart of another method for training an image detection model according to an embodiment of the present application;

[0037] FIG3 is a schematic diagram of a network structure of a student model in an image detection model according to an embodiment of the present application;

[0038] FIG4 is a schematic diagram of a network structure of a teacher model in an image detection model according to an embodiment of the present application;

[0039] FIG5 is a schematic diagram of a training method for an image detection model according to an embodiment of the present application;

[0040] FIG6 is a schematic flow chart of an image detection method according to an embodiment of the present application;

[0041] FIG7 is a schematic diagram of an image detection method according to an embodiment of the present application;

[0042] FIG8 is a schematic block diagram of a training device for an image detection model according to an embodiment of the present application;

[0043] FIG9 is a schematic block diagram of a training device for another image detection model according to an embodiment of the present application;

[0044] FIG10 is a schematic block diagram of an image detection device according to an embodiment of the present application;

[0045] FIG11 is a schematic block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0046] The embodiments of the present application provide a training method for an image detection model, an image detection method, and an apparatus for image detection, to solve the problem in the prior art of low accuracy of models trained based on class-imbalanced datasets.

[0047] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0048] In the field of artificial intelligence, semi-supervised learning methods are typically based on the assumption that the category distribution of a dataset is balanced. However, in real applications, the category distribution of datasets is often imbalanced, for example, with a higher number of positive samples and a lower number of negative samples. Classifiers trained on datasets with imbalanced categories tend to favor categories with more data. In other words, the trained classifier is more likely to classify or predict the target data as belonging to the category with more data during the training phase. This problem is exacerbated in semi-supervised learning. When semi-supervised learning uses predicted labels from unlabeled data for training, the predicted labels become even more imbalanced because the semi-supervised learning algorithm is trained on datasets with imbalanced categories.

[0049] To address the above technical issues, related technologies have proposed a semi-supervised learning algorithm for class imbalance. Taking an image detection model as an example, an auxiliary balanced classifier is added to the semi-supervised model. First, the labeled data in the image dataset is weakly augmented. The auxiliary classification algorithm is used to predict the distribution of the labeled data, which is then compared with the true labels of the labeled data to calculate the auxiliary classification loss function. Next, the unlabeled data in the image dataset is weakly and strongly augmented. The auxiliary classifier is used to predict the weakly and strongly augmented data, respectively, to obtain auxiliary classification predictions. The auxiliary classification predictions corresponding to the weakly augmented data are used as pseudo-labels for the unlabeled data. Simultaneously, a semi-supervised image classifier is trained on the labeled and unlabeled data, and the classification loss function of the semi-supervised image classifier is calculated. The total loss function is then calculated based on the auxiliary classification loss function and the classification loss function of the semi-supervised image classifier, and the model parameters are updated using a backward derivation method. Obviously, this approach, while addressing the class imbalance problem, does not consider the issue of semi-supervised object detection and is only applicable to scenarios where a semi-supervised model is used for binary classification of data. Compared with the semi-supervised classification problem, the semi-supervised target detection problem is more complicated. During the model training process, not only the auxiliary balanced classification problem needs to be considered, but also the classification of the foreground and background in the image, the classification of the region of interest, and bounding box regression. Therefore, the model network structure and loss function involved in the semi-supervised classification problem and the semi-supervised target detection problem are different. The above technical solution cannot be directly applied to the semi-supervised target detection model.

[0050] The training method of the image detection model provided in the embodiment of the present application is to input sample image data into the image detection model to be trained, perform image detection on the first sample image to obtain a first detection result, and perform image detection on the second sample image to obtain a second detection result. Then, based on the first detection result and the second detection result, the semi-supervised image detection loss function of the image detection model to be trained is determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised image detection loss function. The model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain a trained image detection model. The first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image. Since the classification information is used to balance the regional category propensity of the image detection model to be trained, and the regional category propensity is related to the number of target regions belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role in the classification results of sample image data with imbalanced categories. For example, it provides a negative auxiliary balancing effect on regional categories with a relatively large amount of data, and a positive auxiliary balancing effect on regional categories with a relatively small amount of data. This prevents the image detection model from being biased towards regional categories with a relatively large amount of data during training, and guides the training direction of the image detection model to be more balanced. During the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model.

[0051] The image detection model training method and image detection method provided in the embodiments of the present application can be executed by an electronic device or by software installed in the electronic device. Specifically, the electronic device can be a terminal device or a server device. Among them, the terminal device can include a smartphone, a laptop computer, a smart wearable device, a vehicle terminal, etc., and the server device can include an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.

[0052] FIG1 is a schematic flow chart of a method for training an image detection model according to an embodiment of the present application. As shown in FIG1 , the method includes the following steps:

[0053] S104, inputting sample image data into the image detection model to be trained, the sample image data including a first sample image and a second sample image, performing image detection on the first sample image to obtain a first detection result; and performing image detection on the second sample image to obtain a second detection result; the first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image.

[0054] The training method for the image detection model provided in the embodiments of the present application can be applied to scenarios where the sample image data has an imbalanced category. In this scenario, the first sample image and / or the second sample image included in the sample image data have an imbalanced category. Category imbalance refers to an imbalance in the number of target regions belonging to the same region category. In addition, the present application does not limit the number of sample images; it can be any suitable number suitable for semi-supervised learning.

[0055] S106: Determine a semi-supervised image detection loss function of the image detection model to be trained based on the first detection result and the second detection result.

[0056] The semi-supervised image detection loss function includes a supervised image detection loss function and an unsupervised image detection loss function. The calculation method of each loss function will be described in detail in the following embodiments.

[0057] S108, determining a target loss function of the image detection model to be trained according to the semi-supervised image detection loss function, and iteratively adjusting model parameters of the image detection model to be trained according to the target loss function to obtain a trained image detection model.

[0058] Adopting the technical solution of the embodiment of the present application, by inputting sample image data into the image detection model to be trained, image detection is performed on the first sample image to obtain a first detection result, and image detection is performed on the second sample image to obtain a second detection result. Then, based on the first detection result and the second detection result, the semi-supervised auxiliary image detection loss function of the image detection model to be trained is determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised image detection loss function, and the model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain the trained image detection model. During the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model. The training method of the image detection model provided by the present application is described above with reference to Figure 1. The above process is described in detail below in conjunction with Figure 2.

[0059] FIG2 is a schematic flow chart of another method for training an image detection model according to an embodiment of the present application. As shown in FIG2 , the method includes the following steps:

[0060] S202 , acquiring sample image data; the sample image data includes a first sample image with label information and a second sample image without label information; the label information includes: a sample target area and classification information of the sample target area.

[0061] Among them, each sample image (first sample image or second sample image) includes multiple region proposal networks (RPNs) for distinguishing the foreground and background. The area within the bounding box can be called a candidate region, and the region of interest (ROI) screened out in the candidate region is the sample target region. The classification information of the sample target region is used to identify the region category corresponding to the sample target region. The region category can be identified according to the image category in the sample target region. For example, if the image in the sample target region is a cat, then the classification information of the sample region is information that can identify a cat. The representation form of the classification information is not limited, for example, it can be a picture, text, letters, symbols, etc.

[0062] The training method of the image detection model provided in the embodiment of the present application can be applied to scenarios where the sample image data categories are unbalanced. In this scenario, there is a category imbalance in the first sample image and / or the second sample image included in the sample image data, and category imbalance refers to an uneven distribution of the number of target areas belonging to the same area category. Taking the first sample image as an example, the first sample image includes multiple target areas, and each target area corresponds to its own area category. It is assumed that the area categories corresponding to the multiple target areas include area category A and area category B. If the number of target areas belonging to area category A is much greater than the number of target areas belonging to area category B, or the number of target areas belonging to area category B is much greater than the number of target areas belonging to area category A, it means that there is a category imbalance in the multiple target areas included in the first sample image.

[0063] S204: Input the sample image data into the image detection model to be trained, perform image detection on the first sample image, and obtain a first detection result corresponding to the first sample image; and perform image detection on the second sample image to obtain a second detection result corresponding to the second sample image; the first detection result includes auxiliary balance classification information corresponding to the first sample image, and the second detection result includes auxiliary balance classification information corresponding to the second sample image.

[0064] Among them, the auxiliary balancing classification information is used to balance the regional category tendency of the image detection model to be trained, and the regional category tendency is related to the number of target areas belonging to each regional category in the sample image data. Under normal circumstances, the regional category tendency of the image detection model to be trained is inclined to the regional category with a large amount of data (that is, the number of target areas belonging to this regional category is large). For example, in the first sample image, the number of target areas belonging to regional category A is much greater than the number of target areas belonging to regional category B. Then, the regional category tendency of the image detection model to be trained is more inclined to regional category A, that is, the trained image detection model has a greater probability of judging or predicting the target image as regional category A with a large amount of data in the training stage. In this case, the role of the auxiliary balancing classification information is to make the regional category tendency of the image detection model to be trained approach regional category B. That is, a reverse auxiliary balancing effect is given to the regional category with a large amount of data, and a positive auxiliary balancing effect is given to the regional category with a small amount of data, so that the image detection model to be trained no longer tends to regional category A. The method of using the auxiliary balancing classification information to balance the regional category tendency of the image detection model to be trained will be described in detail in the following embodiments and will not be repeated here.

[0065] In addition to the auxiliary balance classification information corresponding to the first sample image, the first detection result may also include the first target region and the first target region classification information in the first sample image. In addition to the auxiliary balance classification information corresponding to the second sample image, the second detection result may also include the second target region, the second target region classification information, the third target region, and the third target region classification information in the second sample image.

[0066] The second target area and the third target area are both target areas identified from the second sample image. The difference lies in that the second target area and the third target area are extracted in different ways. Optionally, after the second sample image is processed in different ways, the target areas in the processed second sample image are respectively detected to obtain the second target area and the third target area.

[0067] The characterization method of the first target area, the second target area and the third target area is not limited. Optionally, coordinate data can be used to characterize each target area. For example, the coordinate system and coordinate origin corresponding to the sample image (the first sample image or the second sample image) are predetermined, and each pixel point in the sample image corresponds to its own coordinates. After detecting the target area (the first target area, the second target area or the third target area) in the sample image, the target area can be characterized by the coordinates corresponding to the pixels (all pixels or key pixels) in the target area. For example, if the target area is a rectangular area, the pixel coordinates at the four vertices of the target area can be used to characterize the target area. It should be noted that the shape of the target area here is a rectangle and the use of the pixel coordinates at the four vertices of the target area to characterize the target area is merely illustrative and not restrictive. This application does not limit the shape of the target area and the characterization method of the target area.

[0068] S206: Determine a semi-supervised auxiliary balance loss function and a semi-supervised image detection loss function corresponding to the image detection model to be trained based on the first detection result and the second detection result, wherein the semi-supervised auxiliary balance loss function is determined based on the auxiliary balance classification information.

[0069] The semi-supervised auxiliary balance loss function includes a supervised auxiliary balance loss function and an unsupervised auxiliary balance loss function. The semi-supervised image detection loss function includes a supervised image detection loss function and an unsupervised image detection loss function. The calculation methods of each loss function will be described in detail in the following embodiments.

[0070] S208, determining the target loss function of the image detection model to be trained based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, and iteratively adjusting the model parameters of the image detection model to be trained based on the target loss function to obtain the trained image detection model.

[0071] Adopting the technical solution of the embodiment of the present application, by obtaining sample image data, including a first sample image with label information and a second sample image without label information, the sample image data is input into the image detection model to be trained, image detection is performed on the first sample image to obtain a first detection result corresponding to the first sample image, and image detection is performed on the second sample image to obtain a second detection result corresponding to the second sample image. Then, based on the first detection result and the second detection result, the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function corresponding to the image detection model to be trained are determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, and the model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain the trained image detection model. Among them, the first detection result includes the auxiliary balance classification information corresponding to the first sample image, and the second detection result includes the auxiliary balance classification information corresponding to the second sample image. Since the auxiliary balanced classification information is used to balance the regional category tendency of the image detection model to be trained, and the regional category tendency is related to the number of target areas belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role for the classification results of the sample image data with imbalanced categories. For example, a negative auxiliary balancing effect is given to the regional category with a large amount of data (i.e., the number of target areas belonging to this regional category is large), and a positive auxiliary balancing effect is given to the regional category with a small amount of data (i.e., the number of target areas belonging to this regional category is small), so that the image detection model is no longer biased towards the regional category with a large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. In addition, since the target loss function of the image detection model is not only related to the semi-supervised image detection loss function, but also to the semi-supervised auxiliary balanced loss function related to the auxiliary balanced classification, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance during the training process, but also take into account the training of the image detection target, thereby improving the model performance and accuracy of the trained image detection model.

[0072] In one embodiment, the image detection model to be trained includes a student model. Sample image data is input into the image detection model to be trained, and image detection is performed on a first sample image using the student model to obtain a first detection result corresponding to the first sample image. Specifically, the first detection result can be obtained by following the steps A1-A2:

[0073] Step A1: perform weak enhancement processing on the first sample image.

[0074] The purpose of image enhancement is to improve the visual effect of an image, purposefully emphasize the overall or local characteristics of the image, make an originally unclear image clearer or emphasize certain interesting features, amplify the differences between the features of different objects in the image, and suppress features of no interest, thereby improving image quality, enriching the amount of information, and enhancing image interpretation and recognition. Image enhancement can be divided into weak enhancement and strong enhancement. Weak enhancement processing methods include: rotating the image, translating the image, etc.; strong enhancement processing methods include: transforming the grayscale value of the image, converting the image in RGB (i.e., red, yellow, and blue) space to HSV (i.e., hue, saturation, and brightness) space, etc.

[0075] In step A2, the weakly enhanced first sample image is input into the student model, first feature information corresponding to the first sample image is determined, and a first detection result corresponding to the first sample image is determined based on the first feature information.

[0076] The first feature information includes: a first image feature of the first sample image, an image feature of the first candidate region in the first sample image, and classification information of the first candidate region corresponding to the first candidate region. The first detection result determined by the student model includes: an image feature of the first target region in the first sample image, classification information of the first target region, and auxiliary balancing classification information corresponding to the first sample image.

[0077] Since the first detection result is obtained by detecting the first sample image with label information, it belongs to the supervised training method. Therefore, the first detection result can be used to calculate the supervised loss function of the image detection model, such as the supervised auxiliary balance loss function and the supervised image detection loss function. During the training process of the image detection model, the model parameters of the student model are also adjusted as part of the image detection model parameters. In other words, as the number of iterations continues to increase, the model performance of the student model will become better and better.

[0078] Figure 3 is a schematic diagram of the network structure of a student model in an image detection model according to an embodiment of the present application. As shown in Figure 3, the student model includes: a first feature extraction layer, a first candidate region prediction layer, a first fully connected layer, a first target region regression layer, a first target region classification layer, and a first auxiliary balanced classifier. After the weakly enhanced first sample image is input into the student model, the execution actions of each layer in the student model are as follows:

[0079] The first feature extraction layer performs feature extraction on the weakly enhanced first sample image to obtain first image features.

[0080] The first candidate region prediction layer identifies image features of the first candidate region in the first sample image according to the first image features, and classifies the first candidate region to obtain classification information of the first candidate region.

[0081] The first image features, the image features of the first candidate region, and the classification information of the first candidate region are fully connected through the first fully connected layer to obtain first feature information. The first feature information can be understood as a representation of comprehensive feature information obtained by fusing the first image features, the image features of the first candidate region, and the classification information of the first candidate region. The first feature information includes the first image features, the image features of the first candidate region, and the classification information of the first candidate region.

[0082] The image features of the first target region included in the first sample image are determined according to the first feature information through the first target region regression layer.

[0083] The first target region classification layer is used to classify the first target region according to the first feature information to obtain first target region classification information.

[0084] The auxiliary balanced classification information corresponding to the first sample image is determined by the first auxiliary balanced classifier according to the weakly enhanced first sample image and the first feature information.

[0085] Optionally, the student model can use Faster RCNN (Faster RCNN model). Faster RCNN can detect all candidate regions in any image and give region proposals in the image based on the candidate regions, that is, detect the target region of interest in all candidate regions. The student model's target detection mainly has two stages. The first stage is to detect the RPN (Region Proposal Network) in the image. The area within the region candidate box can be called the candidate region. The second stage is to filter out the ROI (Region Of Interest) from the candidate region. The region of interest filtered out in the candidate region is the sample target region. Based on this, the student model mainly learns the detection capabilities of the above two stages during the training process.

[0086] In this embodiment, image detection is performed on a first sample image using a student model to obtain a first detection result corresponding to the first sample image. This first detection result can be used to calculate the target loss function of the image detection model to be trained. Since the model parameters of the student model are adjusted as part of the image detection model parameters during the training process of the image detection model, the model performance of the student model will improve with increasing iterations. Furthermore, the first detection result output by the student model will become increasingly accurate, thereby continuously accelerating the training of the image detection model.

[0087] In one embodiment, the first sample image corresponds to multiple first region categories. The first auxiliary balanced classifier in the student model may perform the following steps when determining the auxiliary balanced classification information corresponding to the first sample image based on the weakly enhanced first sample image and the first feature information:

[0088] First, according to the first object region classification information corresponding to each first object region in the first sample image, the number of first object regions belonging to each first region category is determined.

[0089] Secondly, first mask data corresponding to the first sample image is determined according to the number of first object regions belonging to each first region category, where the first mask data includes a mask corresponding to each first object region.

[0090] Among them, the mask corresponding to the first target area is negatively correlated with the number of first target areas belonging to the same first area category. In this embodiment, the mask is represented in numerical form, for example, 0 and 1 are used to represent the mask corresponding to the first target area. The more first target areas belonging to the same first area category, the smaller the value of the mask corresponding to the first target area, for example, 0. The fewer first target areas belonging to the same first area category, the larger the value of the mask corresponding to the first target area, for example, 1. It should be noted that the above-mentioned mask characterization method is merely illustrative and not restrictive. Other suitable mask characterization methods can be adopted to achieve the technical effects of this application, and this application does not limit this.

[0091] Then, the auxiliary balanced classification information corresponding to the first sample image is determined according to the first mask data and the first feature information.

[0092] Optionally, a product operation is performed on the first mask data and the first feature information, and the result of the operation is determined as the auxiliary balancing classification information corresponding to the first sample image. Taking 0 and 1 as an example to represent the mask corresponding to the first target area, if the number of first target areas belonging to a certain first area category is relatively large, then the mask corresponding to the first target area is 0, and the first feature information is multiplied by 0, the result is 0, so that the auxiliary balancing classification information corresponding to the first area category with a relatively large amount of data is calculated as 0, thereby playing an effective reverse auxiliary balancing role for the first area category with a relatively large amount of data. If the number of first target areas belonging to a certain first area category is relatively small, then the mask corresponding to the first target area is 1, and the first feature information is multiplied by 1, and the result of the product is still the first feature information. This allows the first feature information corresponding to the first area category with a relatively small amount of data to be calculated as the auxiliary balancing classification information feature, thereby playing an effective positive auxiliary balancing role for the first area category with a relatively small amount of data.

[0093] In this embodiment, a Bernoulli distribution method can be used to determine the first mask data corresponding to the first sample image. That is, the mask corresponding to each first target area is 0 or 1. Optionally, if the number of first target areas belonging to a certain first area category is greater than or equal to a preset threshold, the mask corresponding to the first area category is determined to be 0, that is, the mask corresponding to each first target area belonging to the first area category is determined to be 0; if the number of first target areas belonging to a certain first area category is less than the preset threshold, the mask corresponding to the first area category is determined to be 1, that is, the mask corresponding to each first target area belonging to the first area category is determined to be 1. The first mask data can be represented as a set of masks of all first target areas corresponding to the first sample image. For example, the preset threshold is 2, and the first sample image includes 5 first target areas A to E, where the first area category corresponding to the first target area A is category 1, the first area category corresponding to the first target areas B and C is category 2, and the first area category corresponding to the first target areas D and E is category 3. It can be determined that the number of first target regions belonging to first region category 1 is 1, which is less than the preset threshold 2. Therefore, the mask corresponding to first region category 1 can be determined to be 1, that is, the mask corresponding to first target region A is 1. The number of first target regions belonging to first region category 2 is 2, which is greater than or equal to the preset threshold 2. Therefore, the mask corresponding to first region category 2 can be determined to be 0, that is, the masks corresponding to first target regions B and C are 0. The number of first target regions belonging to first region category 3 is 2, which is greater than or equal to the preset threshold 2. Therefore, the mask corresponding to first region category 3 can be determined to be 0, that is, the masks corresponding to first target regions D and E are 0. The first mask data corresponding to the first sample image can be expressed as {1, 0, 0, 0, 0}.

[0094] It should be noted that the above-mentioned representation method of the first mask data is only an illustrative example and is not limited to the set representation method. In actual applications, the representation method of the first mask data can also be other methods, such as matrix representation method, mapping relationship representation method (such as establishing a mapping relationship between the first target area and the mask), etc.

[0095] After determining the first mask data corresponding to the first sample image, a product operation is performed on the first mask data and the first feature information, wherein the first mask data and the first feature information can both be in vector form. After performing the product operation on the two vectors, the result obtained is the auxiliary balanced classification information corresponding to the first sample image.

[0096] In this embodiment, since the mask corresponding to the first target area is negatively correlated with the number of first target areas belonging to the same first area category, that is, the more first target areas belonging to the same first area category, the smaller the value of the mask corresponding to the first target area, and the fewer first target areas belonging to the same first area category, the larger the value of the mask corresponding to the first target area. Therefore, by taking the product of the first mask data and the first feature information as auxiliary balanced classification information, the first mask data can enable the auxiliary balanced classification information to have the function of balancing the regional category tendency of the image detection model, for example, it plays an effective reverse auxiliary balancing role for the first regional category with a relatively large amount of data, and plays an effective positive auxiliary balancing role for the first regional category with a relatively small amount of data. Therefore, the auxiliary balanced classification information can play an auxiliary balancing role for the classification results of sample image data with unbalanced categories, so that the image detection model is no longer biased towards the regional category with a relatively large amount of data during the training process, and guides the training direction of the image detection model to be more balanced.

[0097] In one embodiment, the image detection model to be trained includes a teacher model and a student model. The sample image data is input into the image detection model to be trained, and the second sample image is subjected to image detection by the teacher model and the student model, so as to obtain a second detection result corresponding to the second sample image. The second detection result includes: the second target area, the second target area classification information, the third target area, the third target area classification information, and the auxiliary balance classification information corresponding to the second sample image. The auxiliary balance classification information corresponding to the second sample image includes: the second auxiliary balance classification information and the third auxiliary balance classification information. Specifically, the second detection result can be obtained by following the steps B1-B3:

[0098] Step B1: perform weak enhancement processing and strong enhancement processing on the second sample image.

[0099] Among them, image enhancement can be divided into weak enhancement and strong enhancement. Weak enhancement processing methods can be, for example, rotating the image, translating the image, etc.; strong enhancement processing methods can be, for example, transforming the grayscale value of the image, converting the image in RGB (i.e., the color of the three channels of red, yellow, and blue) space into an image in HSV (i.e., hue, saturation, and brightness) space, etc.

[0100] Step B2: input the weakly enhanced second sample image into the teacher model, determine the second feature information corresponding to the second sample image, and determine the image features, second target area classification information and second auxiliary balanced classification information of the second target area in the second sample image based on the second feature information.

[0101] The second feature information includes: a second image feature of the second sample image, and classification information of the second candidate area corresponding to the second candidate area in the second sample image.

[0102] Step B3: input the strongly enhanced second sample image into the student model, determine the third feature information corresponding to the second sample image, and determine the image features, third target area classification information and third auxiliary balance classification information of the third target area in the second sample image based on the third feature information.

[0103] The third feature information includes: a third image feature of the second sample image, and third candidate region classification information corresponding to the third candidate region in the second sample image.

[0104] Since the second detection result is obtained by detecting the second sample image without label information, it belongs to the unsupervised training method. Therefore, the second detection result can be used to calculate the unsupervised loss function of the image detection model, such as the unsupervised auxiliary balance loss function and the unsupervised image detection loss function. During the training process of the image detection model, the model parameters of the teacher model are also adjusted as part of the image detection model parameters. In other words, as the number of iterations continues to increase, the model performance of the teacher model will get better and better.

[0105] In this embodiment, the second auxiliary balanced classification information output by the teacher model can be used as a pseudo-label during the image detection model training process. That is, the second auxiliary balanced classification information is determined as the auxiliary balanced classification pseudo-label for the unlabeled data (i.e., the second sample image). As the teacher model's performance improves with increasing iterations, the accuracy of the auxiliary balanced classification pseudo-label determined using the teacher model also increases, thereby continuously improving the accuracy of the image detection model and accelerating the training of the image detection model.

[0106] Figure 4 is a schematic diagram of the network structure of a teacher model in an image detection model according to an embodiment of the present application. As shown in Figure 4, the teacher model includes: a second feature extraction layer, a second candidate region prediction layer, a second fully connected layer, a second target region regression layer, a second target region classification layer, and a second auxiliary balanced classifier. After the weakly enhanced second sample image is input into the teacher model, the execution actions of each layer in the teacher model (i.e., the specific execution process of step B2) are as follows:

[0107] The second feature extraction layer performs feature extraction on the weakly enhanced second sample image to obtain second image features.

[0108] The second candidate region prediction layer identifies image features of the second candidate region in the second sample image according to the second image features, and performs region classification on the second candidate region to obtain classification information of the second candidate region.

[0109] The second image features, the second candidate regions, and the classification information of the second candidate regions are fully connected through the second fully connected layer to obtain second feature information. The second feature information can be understood as a representation of comprehensive feature information obtained by fusing the second image features, the image features of the second candidate regions, and the classification information of the second candidate regions. The second feature information includes the second image features, the image features of the second candidate regions, and the classification information of the second candidate regions.

[0110] The image features of the second target region included in the second sample image are determined according to the second feature information through the second target region regression layer.

[0111] The second target region classification layer is used to classify the second target region according to the second feature information to obtain second target region classification information.

[0112] The second auxiliary balanced classification information is determined by the second auxiliary balanced classifier according to the weakly enhanced second sample image and the second feature information.

[0113] Optionally, the teacher model can use Faster RCNN, which can detect all candidate regions in any image and give region proposals in the image based on the candidate regions, that is, detect the target regions of interest in all candidate regions. The target detection of the teacher model mainly has two stages. The first stage is to detect the RPN (Region Proposal Network) in the image. The area within the region candidate box can be called the candidate region. The second stage is to filter out the ROI (Region Of Interest) from the candidate region. The region of interest filtered out in the candidate region is the sample target region. Based on this, the teacher model mainly learns the detection capabilities of the above two stages during the training process.

[0114] In one embodiment, the second sample image corresponds to multiple second region categories. The second auxiliary balanced classifier in the teacher model may perform the following steps when determining the auxiliary balanced classification information corresponding to the second sample image (i.e., second auxiliary balanced classification information) based on the weakly enhanced second sample image and the second feature information:

[0115] First, according to the second object region classification information corresponding to each second object region in the second sample image, the number of second object regions belonging to each second region category is determined.

[0116] Secondly, according to the number of second object regions belonging to each second region category, second mask data corresponding to the second sample image is determined, where the second mask data includes a mask corresponding to each second object region.

[0117] Among them, the mask corresponding to the second target area is negatively correlated with the number of second target areas belonging to the same second area category. Taking 0 and 1 as an example to represent the mask corresponding to the second target area, the more second target areas that belong to the same second area category, the smaller the value of the mask corresponding to the second target area, for example, 0. The fewer second target areas that belong to the same second area category, the larger the value of the mask corresponding to the second target area, for example, 1. It should be noted that the above-mentioned mask characterization method is only illustrative and not restrictive. Other suitable mask characterization methods can be adopted to achieve the technical effects of this application, and this application does not limit this.

[0118] Then, second auxiliary balance classification information is determined based on the second mask data and the second feature information. Optionally, a product operation is performed on the second mask data and the second feature information, and the operation result is determined as the second auxiliary balance classification information.

[0119] Still taking the example of using 0 and 1 to represent the mask corresponding to the second target area. If the number of second target areas belonging to a certain second area category is too large, the mask corresponding to the second target area is 0, and the second feature information is multiplied by 0, the result is 0, so that the second auxiliary balance classification information corresponding to the second area category with a large amount of data is calculated as 0, thereby playing an effective reverse auxiliary balancing role for the second area category with a large amount of data. If the number of second target areas belonging to a certain second area category is too small, the mask corresponding to the second target area is 1, and the second feature information is multiplied by 1, and the result of the product is still the second feature information, which makes the second feature information corresponding to the second area category with a small amount of data be calculated as the second auxiliary balance classification information feature, thereby playing an effective positive auxiliary balancing role for the second area category with a small amount of data.

[0120] Since the second sample image does not have label information at the beginning of training, the second mask data corresponding to the second sample image can be randomly generated. After at least one iteration, the second sample image has a soft pseudo label, which is used to identify the candidate area in the second sample image and the corresponding candidate area classification information, so that more accurate second mask data can be generated for the second sample image based on the soft pseudo label of the second sample image. In other words, the second mask data is updated once after each iteration. The soft pseudo label of the second sample image can be the second auxiliary balanced classification information output by the teacher model after performing image detection on the weakly enhanced second sample image.

[0121] In this embodiment, the Bernoulli distribution method can be used to determine the second mask data corresponding to the second sample image. That is, the mask corresponding to each second target area is 0 or 1. Optionally, if the number of second target areas belonging to a certain second area category is greater than or equal to a preset threshold, the mask corresponding to the second area category is determined to be 0, that is, the mask corresponding to each second target area belonging to the second area category is determined to be 0; if the number of second target areas belonging to a certain second area category is less than the preset threshold, the mask corresponding to the second area category is determined to be 1, that is, the mask corresponding to each second target area belonging to the second area category is determined to be 1. The second mask data can be represented as a set of masks of all second target areas corresponding to the second sample image. For example, the preset threshold is 2, and the second sample image includes 5 second target areas A to E, where the second area category corresponding to the second target area A is category 1, the second area category corresponding to the second target areas B and C is category 2, and the second area category corresponding to the second target areas D and E is category 3. It can be determined that the number of second target regions belonging to second region category 1 is 1, which is less than the preset threshold 2. Therefore, the mask corresponding to second region category 1 can be determined to be 1, that is, the mask corresponding to second target region A is 1. The number of second target regions belonging to second region category 2 is 2, which is greater than or equal to the preset threshold 2. Therefore, the mask corresponding to second region category 2 can be determined to be 0, that is, the masks corresponding to second target regions B and C are 0. The number of second target regions belonging to second region category 3 is 2, which is greater than or equal to the preset threshold 2. Therefore, the mask corresponding to second region category 3 can be determined to be 0, that is, the masks corresponding to second target regions D and E are 0. The second mask data corresponding to the second sample image can be expressed as {1, 0, 0, 0, 0}.

[0122] It should be noted that the above-mentioned representation method of the second mask data is only an illustrative example and is not limited to the set representation method. In actual applications, the representation method of the second mask data can also be other methods, such as matrix representation method, mapping relationship representation method (such as establishing a mapping relationship between the second area category and the mask), etc.

[0123] After determining the second mask data corresponding to the second sample image, a product operation is performed on the second mask data and the second feature information, wherein the second mask data and the second feature information can both be in vector form. After performing the product operation on the two vectors, the result obtained is the second auxiliary balanced classification information corresponding to the second sample image.

[0124] In this embodiment, since the mask corresponding to the second target area is negatively correlated with the number of second target areas belonging to the same second area category, that is, the more second target areas belonging to the same second area category, the smaller the value of the mask corresponding to the second target area, and the fewer second target areas belonging to the same second area category, the larger the value of the mask corresponding to the second target area, therefore, by taking the product of the second mask data and the second feature information as the second auxiliary balanced classification information, the second mask data can enable the second auxiliary balanced classification information to have the effect of balancing the regional category tendency of the image detection model, for example, it plays an effective reverse auxiliary balancing role for the second regional category with a relatively large amount of data, and plays an effective positive auxiliary balancing role for the second regional category with a relatively small amount of data. Therefore, the second auxiliary balanced classification information can play an auxiliary balancing role for the classification results of sample image data with unbalanced categories, so that the image detection model no longer tends to be biased towards the regional category with a relatively large amount of data during the training process, and guides the training direction of the image detection model to be more balanced.

[0125] In one embodiment, when executing step B3, that is, inputting the strongly enhanced second sample image into the student model, determining the third feature information corresponding to the second sample image, and determining the image features, third target region classification information, and third auxiliary balanced classification information of the third target region in the second sample image based on the third feature information, the following actions may be performed through each layer in the student model:

[0126] The second feature extraction layer performs feature extraction on the strongly enhanced second sample image to obtain third image features.

[0127] The second candidate region prediction layer identifies image features of the third candidate region in the second sample image according to the third image features, and performs region classification on the third candidate region to obtain classification information of the third candidate region.

[0128] The third image features, the image features of the third candidate region, and the classification information of the third candidate region are fully connected through the second fully connected layer to obtain third feature information. The third feature information can be understood as a representation of the comprehensive feature information obtained by fusing the third image features, the image features of the third candidate region, and the classification information of the third candidate region. The third feature information includes the third image features, the image features of the third candidate region, and the classification information of the third candidate region.

[0129] A third target region included in the second sample image is determined according to the third feature information through the second target region regression layer.

[0130] The third target region is classified according to the third feature information through the second target region classification layer to obtain third target region classification information.

[0131] The third auxiliary balanced classification information is determined by the second auxiliary balanced classifier according to the strongly enhanced second sample image and the third feature information.

[0132] In the above embodiment, the teacher model and the student model jointly perform image detection on the second sample image, wherein the teacher model performs image detection on the second sample image after weak enhancement, and the student model performs image detection on the second sample image after strong enhancement, to obtain a second detection result corresponding to the second sample image, and the second detection result can be used to calculate the target loss function of the image detection model to be trained. Since the model parameters of the student model and the teacher model are adjusted as part of the image detection model parameters during the training process of the image detection model, the model performance of the student model and the teacher model will become better and better as the number of iterations continues to increase. Furthermore, the second detection results output by the student model and the teacher model will become more and more accurate, thereby continuously accelerating the training speed of the image detection model.

[0133] In one embodiment, the semi-supervised auxiliary balance loss function includes: a supervised auxiliary balance loss function and an unsupervised auxiliary balance loss function. The semi-supervised image detection loss function includes: a supervised image detection loss function and an unsupervised image detection loss function.

[0134] When determining the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function corresponding to the image detection model to be trained based on the first detection result and the second detection result, the supervised auxiliary balance loss function and the supervised image detection loss function can be determined based on the first detection result. And the unsupervised auxiliary balance loss function and the unsupervised image detection loss function can be determined based on the second detection result.

[0135] In one embodiment, when determining the supervised auxiliary balance loss function based on the first detection result, a first cross-entropy loss value is first calculated between the first auxiliary balanced classification information and the label information corresponding to the first sample image; then, the supervised auxiliary balance loss function is determined based on the first mask data and the first cross-entropy loss value. Optionally, the supervised auxiliary balance loss function is positively correlated with the first mask data and the first cross-entropy loss value, respectively.

[0136] The first auxiliary balanced classification information is obtained by performing image detection on the weakly enhanced first sample image by the student model. The label information includes: a sample target region in the first sample image and classification information of the sample target region, where the classification information is used to identify the region category corresponding to the sample target region.

[0137] In one embodiment, after the teacher model performs image detection on the weakly enhanced second sample image, the second auxiliary balance classification information obtained includes the auxiliary balance classification probability that the second target region belongs to each second region category. Based on this, when determining the unsupervised auxiliary balance loss function based on the second detection result, the following steps can be specifically performed:

[0138] First, a second cross entropy loss value is calculated between the third auxiliary balanced classification information corresponding to the second sample image and the second auxiliary balanced classification information. The second auxiliary balanced classification information is obtained by the teacher model after performing image detection on the second sample image after weak enhancement, and the third auxiliary balanced classification information is obtained by the student model after performing image detection on the second sample image after strong enhancement.

[0139] Secondly, based on the second auxiliary balance classification information, the maximum auxiliary balance classification probability among the multiple auxiliary balance classification probabilities corresponding to each second area category is determined, and from the maximum auxiliary balance classification probability corresponding to each second area category, the target auxiliary balance classification probability greater than or equal to the preset auxiliary balance threshold is screened out.

[0140] Among them, after the second auxiliary balanced classifier in the teacher model performs image detection on the weakly enhanced second sample image, at least one second target region in the second sample image and the auxiliary balanced classification probability that each second target region belongs to each second region category can be obtained. Therefore, when determining the target auxiliary balanced classification probability, first, based on the auxiliary balanced classification probability that each second target region belongs to each second region category, multiple auxiliary balanced classification probabilities corresponding to each second region category are determined. Then, for each second region category, the maximum auxiliary balanced classification probability, that is, the auxiliary balanced classification probability with the largest value, is determined from the multiple auxiliary balanced classification probabilities corresponding to the second region category, and the maximum auxiliary balanced classification probability corresponding to each second region category is obtained. Then, it is determined whether each maximum auxiliary balanced classification probability is greater than or equal to a preset auxiliary balanced threshold, and the maximum auxiliary balanced classification probability that is greater than or equal to the preset auxiliary balanced threshold is determined as the target auxiliary balanced classification probability.

[0141] For example, the second sample image includes five second target regions A to E, and the second region categories corresponding to the second sample image include category 1, category 2, and category 3. The auxiliary balanced classification probabilities of the second target region A belonging to each second region category are 0.2, 0.2, and 0.6, respectively; the auxiliary balanced classification probabilities of the second target region B belonging to each second region category are 0.3, 0.1, and 0.6, respectively; the auxiliary balanced classification probabilities of the second target region C belonging to each second region category are 0.8, 0.1, and 0.1, respectively; the auxiliary balanced classification probabilities of the second target region D belonging to each second region category are 0.1, 0.7, and 0.2, respectively; and the auxiliary balanced classification probabilities of the second target region E belonging to each second region category are 0.2, 0.3, and 0.5, respectively. Based on the above data, multiple auxiliary balance classification probabilities corresponding to each second region category can be determined. The multiple auxiliary balance classification probabilities corresponding to second region category 1 include: 0.2, 0.3, 0.8, 0.1, and 0.2; the multiple auxiliary balance classification probabilities corresponding to second region category 2 include: 0.2, 0.1, 0.1, 0.7, and 0.3; and the multiple auxiliary balance classification probabilities corresponding to second region category 3 include: 0.6, 0.6, 0.1, 0.2, and 0.5. Furthermore, it can be determined that the maximum auxiliary balance classification probability corresponding to second region category 1 is 0.8, the maximum auxiliary balance classification probability corresponding to second region category 2 is 0.7, and the maximum auxiliary balance classification probability corresponding to second region category 3 is 0.6. Assuming a preset auxiliary balance threshold of 0.8, the maximum auxiliary balance classification probability greater than or equal to the preset auxiliary balance threshold of 0.8 is selected from the multiple maximum auxiliary balance classification probabilities described above as the target auxiliary balance classification probability, i.e., the target auxiliary balance classification probability is 0.8.

[0142] Then, an unsupervised auxiliary balanced loss function is determined based on the second mask data, the second cross entropy loss value, and the target auxiliary balanced classification probability. Optionally, the unsupervised auxiliary balanced loss function is positively correlated with the second mask data, the second cross entropy loss value, and the target auxiliary balanced classification probability, respectively.

[0143] In one embodiment, when determining the supervised image detection loss function according to the first detection result, the following steps may be performed:

[0144] First, according to the first detection result, the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function and the first target region classification loss function corresponding to the student model are determined.

[0145] Secondly, the supervised image detection loss function is determined according to the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function and the first target region classification loss function.

[0146] In this embodiment, the student model adopts the existing Faster RCNN structure. Since the learning stage of Faster RCNN includes two stages, the first stage is to detect the RPN (i.e., candidate region) in the image, and the second stage is to screen out the ROI (i.e., target region) from the candidate region, the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function, and the first target region classification loss function corresponding to the student model are related to the RPN and ROI detected by Faster RCNN. The various loss functions of Faster RCNN are existing technologies and will not be described here. Optionally, the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function, and the first target region classification loss function can be summed and the result of the summation can be used as the supervised image detection loss function corresponding to the image detection model.

[0147] In one embodiment, the second detection result further includes: a second candidate region obtained after the teacher model performs image detection on the second sample image, and second candidate region classification information corresponding to the second candidate region; and a third candidate region obtained after the student model performs image detection on the second sample image, and third candidate region classification information corresponding to the third candidate region. Based on this, when determining the unsupervised image detection loss function based on the second detection result, the following steps can be specifically performed:

[0148] First, based on the second candidate region, the third candidate region, the classification information of the second candidate region, and the classification information of the third candidate region, a second candidate region prediction loss function is determined between the teacher model and the student model. The second candidate region prediction loss function can be understood as the difference between the teacher model and the student model in detecting the candidate region in the second sample image.

[0149] Secondly, based on the second target region, the third target region, the classification information of the second target region, and the classification information of the third target region, a second target region prediction loss function is determined between the teacher model and the student model. The second target region prediction loss function can be understood as the difference between the teacher model and the student model in detecting the target region in the second sample image.

[0150] Again, the unsupervised image detection loss function is determined based on the second candidate region prediction loss function and the second target region prediction loss function.

[0151] Optionally, the sum of the second candidate region prediction loss function and the second target region prediction loss function may be determined as the unsupervised image detection loss function corresponding to the image detection model.

[0152] In one embodiment, when determining the target loss function of the image detection model to be trained based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, the sum of the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function can be determined as the target loss function. Alternatively, weights corresponding to the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function can be first determined, and then a weighted sum of the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function can be performed based on the weights, and the weighted summation result can be determined as the target loss function.

[0153] In one embodiment, when iteratively adjusting the model parameters of the image detection model to be trained according to the target loss function, the following steps may be specifically performed:

[0154] First, the model parameters of the student model are adjusted according to the target loss function.

[0155] Optionally, the student model is reversely derived according to the target loss function, thereby updating the model parameters of the student model according to the reverse derivation result.

[0156] Secondly, the model parameters of the teacher model are adjusted according to the adjusted model parameters of the student model and the preset functional relationship between the student model and the teacher model.

[0157] Optionally, after adjusting the model parameters of the student model, the model parameters of the teacher model are adjusted using EMA (exponential moving average). For example, the model parameters of the student model are denoted as Θ s , the model parameters of the teacher model are recorded as Θ t The model parameters of the student model and the model parameters of the teacher model can satisfy the following preset functional relationship: Θ t =αΘ t +(1-α)Θ s

[0158] Among them, α is a preset parameter, which can be set according to the training experience of the neural network model.

[0159] Again, based on the adjusted model parameters, determine whether the image detection model to be trained reaches the preset training target; if so, stop the iteration and obtain the trained image detection model; if not, perform the next round of iteration based on the adjusted model parameters until the image detection model to be trained reaches the preset training target.

[0160] The preset training goal may include at least one of the following: the number of iterations reaches a preset iteration threshold, and the value of the target loss function is less than or equal to a preset loss threshold.

[0161] It can be seen from the above embodiments that during the training process of the image detection model, the target loss function of the image detection model is not only related to the semi-supervised image detection loss function, but also to the semi-supervised auxiliary balance loss function related to the auxiliary balance classification, and the mask corresponding to the second region category is negatively correlated with the number of second target regions belonging to the second region category. Therefore, the auxiliary balance classification information corresponding to the second sample image can play an auxiliary balancing role in the classification results of the sample image data with unbalanced categories, that is, a reverse auxiliary balancing effect is given to the region category with a large amount of data, and a positive auxiliary balancing effect is given to the region category with a small amount of data, so that the image detection model is no longer biased towards the region category with a large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. Therefore, during the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of the image detection target, thereby improving the model performance and accuracy of the trained image detection model.

[0162] Figure 5 is a schematic diagram of a training method for an image detection model according to an embodiment of the present application. In conjunction with Figure 5, the training method for the image detection model provided by the present application is described in detail below.

[0163] As shown in Figure 5, the image detection model to be trained includes a teacher model and a student model. Both the teacher model and the student model adopt the Faster RCNN structure, specifically including: a feature extraction layer, a candidate region prediction layer, a fully connected layer, a target region regression layer, a target region classification layer and an auxiliary balanced classifier. Among them, the student model is used to perform image detection on the weakly enhanced labeled image data (such as the first sample image with label information), and to perform image detection on the strongly enhanced unlabeled image data (such as the second sample image without label information). The teacher model is used to perform image detection on the weakly enhanced unlabeled image data (such as the second sample image without label information). The image detection results output by the student model and the teacher model are used to participate in the calculation of the target loss function of the image detection model, and then the model parameters of the student model and the teacher model are adjusted according to the calculated target loss function to obtain the trained image detection model. The detailed model structure of the teacher model and the student model is not shown in Figure 5. Please refer to Figures 3 and 4 above for details.

[0164] First, sample image data is obtained; the sample image data includes a first sample image with label information and a second sample image without label information. The label information includes: the sample target area corresponding to the first sample image and the classification information of the sample target area. The model parameters of the image detection model to be trained are randomly initialized, including the model parameters Θ of the teacher model. t and the model parameters Θ of the student model sThen import the sample image data and set the iteration threshold.

[0165] Among them, the labeled image data is marked as Among them, x b is the first sample image, y b is the label information corresponding to the first sample image, including the position information of the sample target area in the first sample image, the size information of the sample target area, the classification information of the sample target area (that is, the area category corresponding to the sample target area), etc. s Indicates the number of labeled image data, that is, the number of first sample images. Unlabeled image data is marked as Among them, μ b is the second sample image, N u Indicates the number of unlabeled image data, that is, the number of second sample images. In this embodiment, the labeled image data may be a small batch of data, that is, the number of labeled image data is relatively small compared to the number of unlabeled image data (second image data).

[0166] Then, the image detection model is trained semi-supervised using the labeled image data and the unlabeled image data, including calculating the semi-supervised image detection loss function and the semi-supervised auxiliary balance loss function. Specifically, the labeled image data (i.e., the first sample image x b ) is weakly enhanced to obtain the first sample image α(x b ). For the unlabeled image data (i.e. the second sample image μ b ) are weakly enhanced and strongly enhanced respectively, and the second sample image α(μ b ) and the second sample image after strong enhancement k is an integer greater than or equal to 1. b ) is input to the student model, and the weakly enhanced second sample image α(μ b ) is input to the teacher model, and the second sample image after strong enhancement is Input to the student model. In order to increase the boundary between the decision boundary and the data points using the unlabeled image data, this embodiment performs consistency regularization on the auxiliary balanced classification prediction of the unlabeled image data. Optionally, the unlabeled image data is strongly enhanced twice to obtain the second sample image after strong enhancement and When inputting sample image data, batch input can be used. For example, the number of sample image data to be imported in each batch can be preset, including a certain amount of annotated image data and unannotated image data. The amount of annotated image data is smaller than that of unannotated image data.

[0167] The first sample image α(x b ) is input into the student model, and the first detection result corresponding to the first sample image can be obtained. The first detection result includes: the first target area in the first sample image, the classification information of the first target area, and the auxiliary balanced classification information corresponding to the first sample image (hereinafter referred to as the first auxiliary balanced classification information). In the process of using the student model to determine the first detection result, the first fully connected layer in the student model (as shown in FIG2 ) can output the first feature information corresponding to the first sample image. The first feature information can be understood as a representation of the comprehensive feature information obtained after fusing the first image feature corresponding to the first sample image, the image feature of the first candidate area, and the classification information of the first candidate area. The first feature information includes the first image feature, the image feature of the first candidate area, and the classification information of the first candidate area. The first candidate area and the classification information of the first candidate area are the prediction layer of the first candidate area in the student model for the weakly enhanced first sample image α(x b ) is used to perform image detection.

[0168] Among them, when determining the first auxiliary balance classification information, the Bernoulli distribution can be used first First mask data corresponding to the first sample image is determined. The first mask data includes masks corresponding to each first target region corresponding to the first sample image. The masks corresponding to the first target regions are negatively correlated with the number of first target regions belonging to the same first region category. A product operation is then performed on the first mask data and the first feature information, and the result is determined as the first auxiliary balanced classification information. The mask corresponding to each first target region is either 0 or 1. Optionally, if the number of first target regions belonging to a certain first region category is greater than or equal to a preset threshold, the mask corresponding to each first target region belonging to that first region category is determined to be 0; if the number of first target regions belonging to a certain first region category is less than the preset threshold, the mask corresponding to each first target region belonging to that first region category is determined to be 1. The first mask data can be represented as the set of masks of all first target regions corresponding to the first sample image. For example, if the masks of the first target regions corresponding to the first sample image are 1, 0, 0, 0, 0, respectively, the first mask data can be represented as {1, 0, 0, 0, 0}.

[0169] It can be seen that this embodiment uses Bernoulli distribution For each first sample image x b Generate 0 / 1 mask M(x b ), Bernoulli distribution The parameter setting of is inversely proportional to the number of first target areas belonging to a certain first area category. This setting makes the Bernoulli distribution The probability of generating mask 1 for the first target region in the minority class is high (i.e., the mask generated for the data corresponding to the minority class is 1, and the mask generated for the data corresponding to the majority class is 0), while the probability of generating mask 1 for the first target region in the majority class is low.

[0170] The reason for determining the product of the first mask data and the first feature information as the first auxiliary balanced classification information is that: the first target area in the category with a small amount of oversampled data, and the first target area in the category with a large amount of undersampled data. In representation learning, the techniques of oversampling and undersampling manifest as overfitting and information loss problems. In this embodiment, a 0 / 1 mask is used to determine the first auxiliary balanced classification information, and then an auxiliary balanced loss function is constructed. Since the first auxiliary balanced classification information is determined based on the first feature information, and the first feature information can characterize the first image features of the first sample image, the image features of the first candidate area, and the classification information of the first candidate area, the backbone network of the student model (i.e., the two-stage target detection network) and the first auxiliary balanced classifier can be trained on the same small batch data (i.e., labeled image data, which is relatively small compared to the number of unlabeled image data), and there will be no slowdown when multiple network structures are trained simultaneously.

[0171] The weakly enhanced second sample image α(μ b ) is input into the teacher model, and the two strongly enhanced second sample images are and Input into the student model, the second detection result corresponding to the second sample image can be obtained, and the second detection result includes: the second target area in the second sample image, the classification information of the second target area, the second auxiliary balanced classification information, the third target area, the classification information of the third target area, and the third auxiliary balanced classification information. Among them, the teacher model performs weak enhancement on the second sample image α(μ b ) to perform image detection, and obtain the second target area, second target area classification information and second auxiliary balanced classification information in the second sample image. The student model is used to detect the two strongly enhanced second sample images. and Perform image detection separately to obtain the second sample image after strong enhancement and The corresponding third target area, third target area classification information and third auxiliary balance classification information respectively.

[0172] In the process of determining the second detection result using the teacher model, the second fully connected layer in the teacher model (as shown in FIG3 ) can output the second feature information corresponding to the second sample image. The second feature information can be understood as a representation of the comprehensive feature information obtained by fusing the second image features corresponding to the second sample image, the image features of the second candidate region, and the classification information of the second candidate region. The second feature information includes the second image features, the image features of the second candidate region, and the classification information of the second candidate region. The second candidate region and the second candidate region classification information are the second candidate region prediction layer in the teacher model for the weakly enhanced second sample image α(μ b ) is used to perform image detection. The second mask data corresponding to the second sample image is multiplied by the second feature information to obtain the second auxiliary balanced classification information p corresponding to the second sample image. s (y|α(μ b )), and the second auxiliary balance classification information p s (y|α(μ b )) as the soft pseudo label q of the image detection model b .

[0173] In the process of using the student model to determine the second detection result, the first fully connected layer in the student model (as shown in Figure 3) can output the third feature information corresponding to the second sample image. The third feature information can be understood as a representation of the comprehensive feature information obtained by fusing the third image features corresponding to the third sample image, the image features of the third candidate area, and the classification information of the third candidate area. The third feature information includes the third image features, the image features of the third candidate area, and the classification information of the third candidate area. The image features and classification information of the third candidate area are the first candidate area prediction layer in the student model for the strongly enhanced second sample image. and At the same time, the first auxiliary balanced classifier in the student model is used to detect the information obtained from the image. and Perform image detection to obtain the respective predicted category distribution (i.e., the third auxiliary balanced classification information) and The third auxiliary balanced classification information is close to the soft pseudo label q b .

[0174] Similar to the method for determining the first auxiliary balanced classification information, the second auxiliary balanced classification information can be the product of the second mask data corresponding to the second sample image and the second feature information. The method for determining the second mask data has been described in detail in the above embodiment and will not be repeated here.

[0175] After obtaining the first and second detection results, a semi-supervised auxiliary balance loss function and a semi-supervised image detection loss function corresponding to the image detection model are determined based on the first and second detection results. The semi-supervised auxiliary balance loss function includes a supervised auxiliary balance loss function and an unsupervised auxiliary balance loss function. The semi-supervised image detection loss function includes a supervised image detection loss function and an unsupervised image detection loss function.

[0176] Supervised auxiliary balance loss function L cls It can be expressed as the following formula:

[0177] Among them, H is the annotation cross entropy loss, α(x b ) is the first sample image after weak enhancement, p s (y|α(x b )) is the first sample image α(x b ) is used to perform image detection to obtain the predicted class distribution, i.e., the first auxiliary balanced classification information, y b is the labeled image data x b The label information of is the ground-truth label. l represents the number of first target regions belonging to the first region category l, such as N s Indicates the total number of labeled image data, that is, the number of first sample images. In this embodiment, it is assumed that the first region categories L are arranged in descending order, such as N1≥N2≥…≥N L . M(x b ) represents the first sample image x b The corresponding first mask data. represents the number of first target areas belonging to each first area category, and B represents the total number of sample image data imported in batches, that is, the sum of the number of unlabeled image data and labeled image data imported in each batch.

[0178] Unsupervised auxiliary balance loss function L con It can be expressed as the following formula:

[0179] Among them, H is the annotation cross entropy loss, is the second sample image after strong enhancement, k=1 or 2. The second sample image after strong enhancement is trained using the first auxiliary balanced classifier The predicted class distribution obtained by image detection is the third auxiliary balanced classification information. bIt is the soft pseudo label of the image detection model, that is, the weakly enhanced second sample image α(μ b ) to obtain the second auxiliary balanced classification information p s (y|α(μ b )), It is from q b Obtained one-hot pseudo label. max(q b ) is the maximum auxiliary balanced classification probability among the multiple auxiliary balanced classification probabilities corresponding to each second region category, τ is the confidence threshold, that is, the preset auxiliary balanced threshold. I is an indicator function for indicating the maximum auxiliary balanced classification probability among the multiple auxiliary balanced classification probabilities corresponding to each second region category, τ is the confidence threshold, that is, the preset auxiliary balanced threshold. b ) to filter out the target auxiliary balance classification probability that is greater than or equal to the preset auxiliary balance threshold τ. l represents the number of first target regions belonging to the first region category l, such as N s Indicates the total number of labeled image data, that is, the number of first sample images. In this embodiment, it is assumed that the first region categories L are arranged in descending order, such as N1≥N2≥…≥N L . represents the number of second target areas belonging to each second area category, and B represents the total number of sample image data imported in batches, that is, the sum of the number of unlabeled image data and labeled image data imported in each batch.

[0180] Supervised image detection loss function L s It can be expressed as the following formula:

[0181] in, Represents the first candidate region prediction loss function corresponding to the student model, represents the first candidate region classification loss function corresponding to the student model, represents the first target region prediction loss function corresponding to the student model, Represents the first target region classification loss function corresponding to the student model.

[0182] Unsupervised image detection loss function L u It can be expressed as the following formula:

[0183] in, represents the candidate region prediction loss function between the teacher model and the student model, which can be understood as the difference between the teacher model and the student model in detecting the candidate region in the second sample image. Represents the target region prediction loss function between the teacher model and the student model, which can be understood as the difference between the teacher model and the student model in detecting the target region in the second sample image. A Represents the number of all candidate regions detected by the teacher model and the student model. Represents the second sample image α(μ after weak enhancement by the teacher model b ) outputs the candidate region classification information after image detection, Represents the second sample image α(μ after weak enhancement by the teacher model b ) outputs the candidate area (such as size, position, etc.) after image detection, and They respectively represent the candidate region classification information and the candidate region (such as size, position, etc.) output by the student model after performing image detection on the strongly enhanced second sample image. and They represent the second sample image α(μ b ) outputs the target area classification information and target area (such as size, position, etc.) after image detection. and They represent the target region classification information and target region output by the student model after performing image detection on the second sample image after strong enhancement. KL represents the KL divergence. B represents the total number of sample image data imported in batches, that is, the sum of the number of unlabeled image data and labeled image data imported in each batch.

[0184] Optionally, after the teacher model outputs the candidate regions, the Intersection over Union (IoU) can be calculated between all candidate regions and the sample candidate regions marked by the label information, and candidate regions with smaller IoU values ​​can be deleted. For example, candidate regions with an IoU value less than or equal to a preset threshold value can be deleted from all candidate regions, so that the remaining candidate regions are closer to the sample candidate regions, and only the pseudo labels corresponding to the remaining candidate regions are calculated, which speeds up the training of the image detection model. P Indicates the number of candidate regions retained. In this embodiment, only the region suggestions output by the teacher model (including candidate regions and candidate region classification information) are used, and the region suggestions output by the student model are not used. The reason is that the region suggestions predicted by the teacher model are more accurate than those predicted by the student model.

[0185] Then, the target loss function of the image detection model to be trained is determined based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function. Optionally, the target loss function L totalIt can be expressed as the following formula: total =L cls +L con +L s +λL u

[0186] Where λ is the unsupervised image detection loss function L u The weight can be set based on experience.

[0187] After obtaining the target loss function, determine whether the image detection model to be trained has achieved a preset training target. If so, stop iteration and obtain the trained image detection model. If not, adjust the model parameters and perform the next round of iteration based on the adjusted model parameters until the image detection model to be trained has achieved the preset training target. The preset training target may include at least one of the following: the number of iterations reaches a preset iteration number threshold, and the value of the target loss function is less than or equal to a preset loss threshold.

[0188] The specific process of adjusting the model parameters is as follows: reversely derive the student model based on the above-mentioned target loss function, and update the model parameters of the student model according to the reverse derivation result. Based on the adjusted model parameters of the student model and the preset functional relationship between the student model and the teacher model, the model parameters of the teacher model are adjusted. The model parameters of the student model and the model parameters of the teacher model can satisfy the following preset functional relationship: Θ t =αΘ t +(1-α)Θ s

[0189] Among them, α is a preset parameter, which can be set according to the training experience of the neural network model.

[0190] It can be seen that by adopting the training method of the image detection model provided by this embodiment, the target loss function of the image detection model is not only related to the semi-supervised image detection loss function, but also to the semi-supervised auxiliary balanced loss function related to the auxiliary balanced classification. Moreover, the auxiliary balanced classification information can play an auxiliary balancing role for the classification results of sample image data with unbalanced categories, that is, a reverse auxiliary balancing effect is given to regional categories with a relatively large amount of data, and a positive auxiliary balancing effect is given to regional categories with a relatively small amount of data, so that the image detection model is no longer biased towards regional categories with a relatively large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. Moreover, during the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model.

[0191] FIG6 is a schematic flow chart of an image detection method according to an embodiment of the present application. As shown in FIG6 , the method includes the following steps:

[0192] S602, acquiring a target image.

[0193] S604: Input the target image into the trained image detection model, detect the target area in the target image, and perform region classification on the target area to obtain region classification information corresponding to the target area.

[0194] The trained image detection model is obtained by training according to the training method of the image detection model in any of the above embodiments.

[0195] Figure 7 is a schematic principle diagram of an image detection method according to an embodiment of the present application. As shown in Figure 7, the trained image detection model only includes a teacher model. After the target image is input into the trained image detection model, the student model performs region detection on the target image to obtain the target region in the target image and the region classification information corresponding to the target region.

[0196] Using the technical solutions of the embodiments of the present application, a target image is input into a trained image detection model, the target region in the target image is detected, and the target region is classified to obtain region classification information corresponding to the target region. Because the image detection model not only overcomes the model performance deviation caused by category imbalance during training, but also takes into account the training of image detection targets, using the trained image detection model to perform region detection on the target image can ensure the accuracy of region detection.

[0197] In summary, specific embodiments of the present subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing may be advantageous.

[0198] The above is the training method of the image detection model and the image detection method provided in the embodiments of the present application. Based on the same idea, the embodiments of the present application also provide a training device for an image detection model and an image detection device.

[0199] FIG8 is a schematic block diagram of a training device for an image detection model according to an embodiment of the present application. As shown in FIG8 , the device includes:

[0200] A first detection module 81 is configured to input sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, perform image detection on the first sample image to obtain a first detection result, and perform image detection on the second sample image to obtain a second detection result; the first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image;

[0201] A first determining module 82 is configured to determine a semi-supervised image detection loss function of the image detection model to be trained based on the first detection result and the second detection result;

[0202] The training module 83 is used to determine the target loss function of the image detection model to be trained based on the semi-supervised image detection loss function, and iteratively adjust the model parameters of the image detection model to be trained based on the target loss function to obtain a trained image detection model.

[0203] In one embodiment, the image detection model to be trained includes a student model;

[0204] When the first detection module 81 inputs the sample image data into the image detection model to be trained, performs image detection on the first sample image, and obtains a first detection result, the first detection module 81 specifically performs the following steps:

[0205] performing weak enhancement processing on the first sample image;

[0206] Inputting the weakly enhanced first sample image into the student model, determining first feature information corresponding to the first sample image, and determining the first detection result based on the first feature information; the first feature information includes: a first image feature of the first sample image and classification information of a first candidate region in the first sample image;

[0207] The first detection result further includes: image features of the first target area in the first sample image and classification information of the first target area.

[0208] In one embodiment, the student model includes: a first feature extraction layer, a first candidate region prediction layer, a first fully connected layer, a first target region regression layer, a first target region classification layer, and a first auxiliary balancing classifier;

[0209] When the first detection module 81 inputs the weakly enhanced first sample image into the student model, determines the first feature information corresponding to the first sample image, and determines the first detection result based on the first feature information, the first detection module specifically performs the following steps:

[0210] The first feature extraction layer performs feature extraction on the weakly enhanced first sample image to obtain the first image feature;

[0211] The first candidate region prediction layer identifies image features of a first candidate region in the first sample image according to the first image features, and performs region classification on the first candidate region to obtain classification information of the first candidate region;

[0212] The first fully connected layer fuses the first image feature, the image feature of the first candidate region, and the classification information of the first candidate region to obtain the first feature information;

[0213] The first target region regression layer determines image features of the first target region based on the first feature information;

[0214] The first target area classification layer classifies the first target area according to the first feature information to obtain the first target area classification information;

[0215] The first auxiliary balanced classifier determines classification information corresponding to the first sample image according to the weakly enhanced first sample image and the first feature information.

[0216] In one embodiment, the first sample image corresponds to a plurality of first region categories;

[0217] When the first detection module 81 determines the classification information corresponding to the first sample image according to the weakly enhanced first sample image and the first feature information, the first detection module 81 specifically performs the following steps:

[0218] determining the number of first target areas belonging to each first area category according to the first target area classification information corresponding to each first target area;

[0219] determining first mask data of the first sample image according to the number of first target regions of each first region category, wherein the first mask data includes a mask of each first target region, and the mask of the first target region is negatively correlated with the number of first target regions belonging to the same first region category;

[0220] Classification information of the first sample image is determined according to the first mask data and the first feature information.

[0221] In one embodiment, the image detection model to be trained further includes a teacher model;

[0222] When the first detection module 81 performs image detection on the second sample image and obtains a second detection result, the first detection module 81 specifically performs the following steps:

[0223] performing weak enhancement processing and strong enhancement processing on the second sample image;

[0224] Inputting the weakly enhanced second sample image into the teacher model, determining second feature information of the second sample image, and determining image features, second target region classification information, and second classification information of a second target region in the second sample image based on the second feature information; the second feature information includes: the second image features of the second sample image and the classification information of the second candidate region in the second sample image;

[0225] Inputting the strongly enhanced second sample image into the student model, determining third feature information of the second sample image, and determining image features, third target region classification information, and third classification information of a third target region in the second sample image based on the third feature information; the third feature information includes: the third image features of the second sample image and classification information of the third candidate region in the second sample image;

[0226] The second detection result includes: image features of the second target area, classification information of the second target area, image features of the third target area, and classification information of the third target area; and the classification information of the second sample image includes: the second classification information and the third classification information.

[0227] In one embodiment, the teacher model includes: a second feature extraction layer, a second candidate region prediction layer, a second fully connected layer, a second target region regression layer, a second target region classification layer, and a second auxiliary balanced classifier;

[0228] When the first detection module 81 inputs the weakly enhanced second sample image into the teacher model, determines the second feature information corresponding to the second sample image, and determines the image features, second target region classification information, and second classification information of the second target region in the second sample image based on the second feature information, the first detection module 81 specifically performs the following steps:

[0229] The second feature extraction layer performs feature extraction on the weakly enhanced second sample image to obtain the second image feature;

[0230] The second candidate region prediction layer identifies image features of a second candidate region in the second sample image according to the second image features, and performs region classification on the second candidate region to obtain second candidate region classification information;

[0231] The second fully connected layer fuses the second image feature, the image feature of the second candidate region, and the classification information of the second candidate region to obtain the second feature information;

[0232] The second target region regression layer determines the image features of the second target region according to the second feature information;

[0233] the second target area classification layer classifies the second target area according to the second feature information to obtain second target area classification information;

[0234] The second auxiliary balanced classifier determines the second classification information according to the weakly enhanced second sample image and the second feature information.

[0235] In one embodiment, the second sample image corresponds to a plurality of second region categories;

[0236] When the first detection module 81 determines the second classification information according to the weakly enhanced second sample image and the second feature information, it specifically performs the following steps:

[0237] determining the number of second object regions belonging to each second region category according to the second object region classification information corresponding to each second object region in the second sample image;

[0238] determining second mask data of the second sample image according to the number of second target regions belonging to each second region category; the second mask data includes a mask for each second target region; and the mask corresponding to the second target region is negatively correlated with the number of second target regions belonging to the same second region category;

[0239] The second classification information is determined according to the second mask data and the second feature information.

[0240] In one embodiment, when the first detection module 81 inputs the strongly enhanced second sample image into the student model, determines the third feature information corresponding to the second sample image, and determines the third target area, the third target area classification information, and the third classification information in the second sample image based on the third feature information, the first detection module 81 specifically performs the following steps:

[0241] The second feature extraction layer performs feature extraction on the strongly enhanced second sample image to obtain the third image feature;

[0242] The second candidate region prediction layer identifies image features of a third candidate region in the second sample image according to the third image features, and performs region classification on the third candidate region to obtain classification information of the third candidate region;

[0243] The second fully connected layer fuses the third image feature, the image feature of the third candidate region, and the classification information of the third candidate region to obtain the third feature information;

[0244] The second target region regression layer determines the third target region included in the second sample image according to the third feature information;

[0245] The second target region classification layer performs region classification on the third target region according to the third feature information to obtain the third target region classification information;

[0246] The second auxiliary balanced classifier determines the third classification information according to the strongly enhanced second sample image and the third feature information.

[0247] In one embodiment, the semi-supervised image detection loss function includes: a supervised image detection loss function and an unsupervised image detection loss function;

[0248] When the first determination module 82 determines the semi-supervised image detection loss function corresponding to the image detection model to be trained based on the first detection result and the second detection result, the first determination module 82 specifically performs the following steps:

[0249] Determining the supervised image detection loss function according to the first detection result;

[0250] The unsupervised image detection loss function is determined according to the second detection result.

[0251] In one embodiment, when determining the supervised image detection loss function based on the first detection result, the first determination module 82 specifically performs the following steps:

[0252] Calculating a first cross entropy loss value between the first classification information and the label information;

[0253] The supervised image detection loss function is determined according to the first mask data and the first cross entropy loss value.

[0254] In one embodiment, the second classification information includes: a classification probability that the second target area belongs to each of the second area categories;

[0255] When determining the unsupervised image detection loss function according to the second detection result, the first determination module 82 specifically performs the following steps:

[0256] Calculating a second cross entropy loss value between the third classification information and the second classification information;

[0257] determining, based on the second classification information, a maximum classification probability among a plurality of classification probabilities corresponding to each of the second area categories, and screening out a target classification probability greater than or equal to a preset threshold from the maximum classification probability corresponding to each of the second area categories;

[0258] The unsupervised image detection loss function is determined according to the second mask data, the second cross entropy loss value, and the target classification probability.

[0259] In one embodiment, when determining the supervised image detection loss function based on the first detection result, the first determination module 82 specifically performs the following steps:

[0260] Determine, according to the first detection result, a first candidate region prediction loss function, a first candidate region classification loss function, a first target region prediction loss function, and a first target region classification loss function corresponding to the student model;

[0261] The supervised image detection loss function is determined according to the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function and the first target region classification loss function.

[0262] In one embodiment, the second detection result further includes: image features of the second candidate region and classification information of the second candidate region obtained after the teacher model performs image detection on the second sample image; and image features of the third candidate region and classification information of the third candidate region obtained after the student model performs image detection on the second sample image;

[0263] When determining the unsupervised image detection loss function according to the second detection result, the first determination module 82 specifically performs the following steps:

[0264] Determining a second candidate region prediction loss function between the teacher model and the student model according to the image features of the second candidate region, the image features of the third candidate region, the classification information of the second candidate region, and the classification information of the third candidate region;

[0265] determining a second target region prediction loss function between the teacher model and the student model based on the image features of the second target region, the image features of the third target region, the second target region classification information, and the third target region classification information;

[0266] The unsupervised image detection loss function is determined according to the second candidate region prediction loss function and the second target region prediction loss function.

[0267] In one embodiment, when the training module 83 determines the target loss function of the image detection model to be trained based on the semi-supervised image detection loss function, it specifically performs the following steps:

[0268] Determine the sum of the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function as the target loss function;

[0269] or,

[0270] Determine the weights corresponding to the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function respectively; perform weighted summation of the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function according to the weights, and determine the weighted summation result as the target loss function.

[0271] In one embodiment, when the training module 83 iteratively adjusts the model parameters of the image detection model to be trained according to the target loss function to obtain the trained image detection model, the training module 83 specifically performs the following steps:

[0272] Adjusting the model parameters of the student model according to the target loss function;

[0273] Adjusting the model parameters of the teacher model according to the adjusted model parameters of the student model and a preset functional relationship between the student model and the teacher model;

[0274] Determining whether the image detection model to be trained has achieved a preset training target based on the adjusted model parameters;

[0275] If so, the iteration is stopped to obtain the trained image detection model; if not, the next round of iteration is performed based on the adjusted model parameters until the image detection model to be trained reaches the preset training target.

[0276] Using the device of the embodiment of the present application, by inputting sample image data into the image detection model to be trained, image detection is performed on the first sample image to obtain a first detection result, and image detection is performed on the second sample image to obtain a second detection result. Then, based on the first detection result and the second detection result, the semi-supervised image detection loss function corresponding to the image detection model to be trained is determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised image detection loss function. The model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain a trained image detection model. The first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image. Since the classification information is used to balance the regional category tendencies of the image detection model to be trained, and the regional category tendencies are related to the number of target areas belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role in the classification results of the sample image data with imbalanced categories. For example, a negative auxiliary balancing effect is given to the regional categories with a relatively large amount of data (i.e., the number of target areas belonging to this regional category is relatively large), and a positive auxiliary balancing effect is given to the regional categories with a relatively small amount of data (i.e., the number of target areas belonging to this regional category is relatively small). As a result, the image detection model is no longer biased towards the regional categories with a relatively large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. During the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model.

[0277] Those skilled in the art should understand that the training device of the image detection model in Figure 8 can be used to implement the training method of the image detection model described above, and the detailed description should be similar to the description in the previous method part. To avoid tediousness, it will not be repeated here.

[0278] FIG9 is a schematic block diagram of another apparatus for training an image detection model according to an embodiment of the present application. As shown in FIG9 , the apparatus includes:

[0279] A first acquisition module 91 is configured to acquire sample image data; the sample image data includes a first sample image with label information and a second sample image without label information; the label information includes: a sample target area and classification information of the sample target area;

[0280] A first detection module 92 is configured to input the sample image data into the image detection model to be trained, perform image detection on the first sample image to obtain a first detection result corresponding to the first sample image; and perform image detection on the second sample image to obtain a second detection result corresponding to the second sample image; the first detection result includes auxiliary balanced classification information corresponding to the first sample image, and the second detection result includes auxiliary balanced classification information corresponding to the second sample image; the auxiliary balanced classification information is used to balance the regional category propensity of the image detection model to be trained; the regional category propensity is related to the number of target areas belonging to each regional category in the sample image data;

[0281] A first determining module 93 is configured to determine, based on the first detection result and the second detection result, a semi-supervised auxiliary balance loss function and a semi-supervised image detection loss function corresponding to the image detection model to be trained; the semi-supervised auxiliary balance loss function is determined based on the auxiliary balance classification information;

[0282] The training module 94 is used to determine the target loss function of the image detection model to be trained based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, and iteratively adjust the model parameters of the image detection model to be trained based on the target loss function to obtain a trained image detection model.

[0283] The detailed descriptions of the first detection module 92, the first determination module 93 and the training module 94 of this embodiment are similar to the descriptions of the first detection module 81, the first determination module 82 and the training module 83 in Figure 8, respectively. To avoid redundancy, they are not repeated here.

[0284] The device of the embodiment of the present application is used to obtain sample image data, including a first sample image with label information and a second sample image without label information, input the sample image data into the image detection model to be trained, perform image detection on the first sample image, and obtain a first detection result corresponding to the first sample image, and perform image detection on the second sample image to obtain a second detection result corresponding to the second sample image. Then, based on the first detection result and the second detection result, the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function corresponding to the image detection model to be trained are determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised auxiliary balance loss function and the semi-supervised image detection loss function, and the model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain a trained image detection model. The first detection result includes the auxiliary balance classification information corresponding to the first sample image, and the second detection result includes the auxiliary balance classification information corresponding to the second sample image. Since the auxiliary balanced classification information is used to balance the regional category tendency of the image detection model to be trained, and the regional category tendency is related to the number of target areas belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role for the classification results of the sample image data with imbalanced categories. For example, a negative auxiliary balancing effect is given to the regional category with a large amount of data (i.e., the number of target areas belonging to this regional category is large), and a positive auxiliary balancing effect is given to the regional category with a small amount of data (i.e., the number of target areas belonging to this regional category is small), so that the image detection model is no longer biased towards the regional category with a large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. In addition, since the target loss function of the image detection model is not only related to the semi-supervised image detection loss function, but also to the semi-supervised auxiliary balanced loss function related to the auxiliary balanced classification, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance during the training process, but also take into account the training of the image detection target, thereby improving the model performance and accuracy of the trained image detection model.

[0285] FIG10 is a schematic block diagram of an image detection device according to an embodiment of the present application. As shown in FIG10 , the device includes:

[0286] The second acquisition module 1001 is used to acquire a target image;

[0287] The second detection module 1002 is used to input the target image into the trained image detection model, detect the target area in the target image, and perform region classification on the target area to obtain region classification information corresponding to the target area; wherein, the trained image detection model is trained according to the training method of the image detection model described in any of the above method embodiments.

[0288] Using the device of the present invention, a target image is input into a trained image detection model, a target region in the target image is detected, and the target region is classified to obtain region classification information corresponding to the target region. Because the image detection model not only overcomes the model performance deviation caused by category imbalance during training, but also takes into account the training of image detection targets, using the trained image detection model to perform region detection on the target image can ensure the accuracy of region detection.

[0289] Those skilled in the art should understand that the image detection device in Figure 10 can be used to implement the image detection method described above, and the detailed description should be similar to the description of the method part above. To avoid redundancy, it will not be repeated here.

[0290] Based on the same idea, an embodiment of the present application also provides an electronic device, as shown in Figure 11. Electronic devices may have relatively large differences due to different configurations or performances, and may include one or more processors 1101 and memories 1102, and one or more of the memories 1102 may store applications or data. Among them, the memory 1102 may be a short-term storage memory or a persistent storage memory. The application stored in the memory 1102 may include one or more modules (not shown in the figure), each module may include a series of computer-executable instructions in the electronic device. Furthermore, the processor 1101 can be configured to communicate with the memory 1102 and execute a series of computer-executable instructions in the memory 1102 on the electronic device. The electronic device may also include one or more power supplies 1103, one or more wired or wireless network interfaces 1104, one or more input and output interfaces 1105, and one or more keyboards 1106.

[0291] Specifically, in this 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:

[0292] Inputting sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, performing image detection on the first sample image to obtain a first detection result; and performing image detection on the second sample image to obtain a second detection result; the first detection result including classification information of the first sample image, and the second detection result including classification information of the second sample image;

[0293] Determining a semi-supervised image detection loss function of the image detection model to be trained according to the first detection result and the second detection result;

[0294] According to the semi-supervised image detection loss function, the target loss function of the image detection model to be trained is determined, and the model parameters of the image detection model to be trained are iteratively adjusted according to the target loss function to obtain the trained image detection model.

[0295] Using the technical solution of the embodiment of the present application, sample image data is input into the image detection model to be trained, image detection is performed on the first sample image to obtain a first detection result, and image detection is performed on the second sample image to obtain a second detection result. Based on the first and second detection results, a semi-supervised image detection loss function of the image detection model to be trained is determined, and a target loss function of the image detection model to be trained is determined based on the semi-supervised image detection loss function. The model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain a trained image detection model. The first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image. Since the classification information is used to balance the regional category propensity of the image detection model to be trained, and the regional category propensity is related to the number of target areas belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role in the classification results of the sample image data with imbalanced categories. For example, a negative auxiliary balancing effect is given to the regional categories with a relatively large amount of data (i.e., the number of target areas belonging to this regional category is relatively large), and a positive auxiliary balancing effect is given to the regional categories with a relatively small amount of data (i.e., the number of target areas belonging to this regional category is relatively small). As a result, the image detection model is no longer biased towards the regional categories with a relatively large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. During the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model.

[0296] Specifically, in another 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:

[0297] Acquire the target image;

[0298] The target image is input into the trained image detection model, the target area in the target image is detected, and the target area is classified to obtain area classification information corresponding to the target area; wherein, the trained image detection model is trained according to the training method of the image detection model described in any of the above method embodiments.

[0299] Using the technical solutions of the embodiments of the present application, a target image is input into a trained image detection model, the target region in the target image is detected, and the target region is classified to obtain region classification information corresponding to the target region. Because the image detection model not only overcomes the model performance deviation caused by category imbalance during training, but also takes into account the training of image detection targets, using the trained image detection model to perform region detection on the target image can ensure the accuracy of region detection.

[0300] The present application also provides a computer-readable storage medium storing one or more computer programs. The one or more computer programs include instructions. When executed by an electronic device including multiple application programs, the instructions enable the electronic device to perform the various processes of the above-mentioned image detection model training method embodiment, and are specifically used to perform:

[0301] Inputting sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, performing image detection on the first sample image to obtain a first detection result; and performing image detection on the second sample image to obtain a second detection result; the first detection result including classification information of the first sample image, and the second detection result including classification information of the second sample image;

[0302] Determining a semi-supervised image detection loss function of the image detection model to be trained according to the first detection result and the second detection result;

[0303] According to the semi-supervised image detection loss function, the target loss function of the image detection model to be trained is determined, and the model parameters of the image detection model to be trained are iteratively adjusted according to the target loss function to obtain a trained image detection model.

[0304] Using the technical solution of the embodiment of the present application, by inputting sample image data into the image detection model to be trained, image detection is performed on the first sample image to obtain a first detection result, and image detection is performed on the second sample image to obtain a second detection result. Then, based on the first detection result and the second detection result, the semi-supervised image detection loss function of the image detection model to be trained is determined, and the target loss function of the image detection model to be trained is determined based on the semi-supervised image detection loss function. The model parameters of the image detection model to be trained are iteratively adjusted based on the target loss function to obtain a trained image detection model. The first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image. Since the classification information is used to balance the regional category propensity of the image detection model to be trained, and the regional category propensity is related to the number of target areas belonging to each regional category in the sample image data, the auxiliary balanced classification information can play an auxiliary balancing role in the classification results of the sample image data with imbalanced categories. For example, a negative auxiliary balancing effect is given to the regional categories with a relatively large amount of data (i.e., the number of target areas belonging to this regional category is relatively large), and a positive auxiliary balancing effect is given to the regional categories with a relatively small amount of data (i.e., the number of target areas belonging to this regional category is relatively small). As a result, the image detection model is no longer biased towards the regional categories with a relatively large amount of data during the training process, and the training direction of the image detection model is guided to be more balanced. During the training process, the image detection model can not only gradually reduce the model performance deviation caused by category imbalance, but also take into account the training of image detection targets, thereby improving the model performance and accuracy of the trained image detection model.

[0305] The present application also provides a computer-readable storage medium storing one or more computer programs. The one or more computer programs include instructions. When executed by an electronic device including multiple application programs, the instructions enable the electronic device to perform various processes of the above-mentioned image detection method embodiment, and are specifically configured to perform:

[0306] Acquire the target image;

[0307] The target image is input into the trained image detection model, the target area in the target image is detected, and the target area is classified to obtain area classification information corresponding to the target area; wherein, the trained image detection model is trained according to the training method of the image detection model described in any of the above method embodiments.

[0308] Using the technical solutions of the embodiments of the present application, a target image is input into a trained image detection model, the target region in the target image is detected, and the target region is classified to obtain region classification information corresponding to the target region. Because the image detection model not only overcomes the model performance deviation caused by category imbalance during training, but also takes into account the training of image detection targets, using the trained image detection model to perform region detection on the target image can ensure the accuracy of region detection.

[0309] The embodiments of the present application also provide a computer program, which, when executed by a processor, implements the methods described in the above-mentioned various method embodiments.

[0310] The embodiment of the present application also provides a computer program product, including a computer program, which implements the methods described in the above-mentioned various method embodiments when executed by a processor.

[0311] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having 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 smartphone, 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.

[0312] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0313] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0314] The present application is described with reference to the flow chart and / or block diagram of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized 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 processing machine or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart flow or multiple flows and / or one box or multiple boxes of the block diagram.

[0315] These computer program instructions may also be stored in a computer-readable memory that can direct 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 a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0316] 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, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0317] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.

[0318] Memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0319] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. 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 disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, 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. According to the definition in this article, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0320] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0321] 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. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0322] The various embodiments in this application are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment.

[0323] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A training method for an image detection model, comprising: Inputting sample image data into an image detection model to be trained, the sample image data including a first sample image and a second sample image, performing image detection on the first sample image to obtain a first detection result; and performing image detection on the second sample image to obtain a second detection result; the first detection result includes classification information of the first sample image, and the second detection result includes classification information of the second sample image; Determining a semi-supervised image detection loss function of the image detection model to be trained according to the first detection result and the second detection result; According to the semi-supervised image detection loss function, the target loss function of the image detection model to be trained is determined, and the model parameters of the image detection model to be trained are iteratively adjusted according to the target loss function to obtain a trained image detection model.

2. The method according to claim 1, wherein: The image detection model to be trained includes a student model; The step of inputting the sample image data into the image detection model to be trained, performing image detection on the first sample image, and obtaining a first detection result includes: Performing weak enhancement processing on the first sample image; Inputting the weakly enhanced first sample image into the student model, determining first feature information corresponding to the first sample image, and determining the first detection result according to the first feature information; the first feature information includes: a first image feature of the first sample image, and classification information of a first candidate region in the first sample image; The first detection result further includes: image features of the first target area in the first sample image and classification information of the first target area.

3. The method according to claim 2, wherein: The student model includes: a first feature extraction layer, a first candidate region prediction layer, a first fully connected layer, a first target region regression layer, a first target region classification layer and a first auxiliary balanced classifier; The step of inputting the weakly enhanced first sample image into the student model, determining first feature information corresponding to the first sample image, and determining the first detection result according to the first feature information includes: The first feature extraction layer performs feature extraction on the weakly enhanced first sample image to obtain the first image feature; The first candidate region prediction layer identifies image features of a first candidate region in the first sample image according to the first image features, and performs region classification on the first candidate region to obtain classification information of the first candidate region; The first fully connected layer fuses the first image feature, the image feature of the first candidate region, and the classification information of the first candidate region to obtain the first feature information; The first target region regression layer determines the image feature of the first target region according to the first feature information; The first target region classification layer classifies the first target region according to the first feature information to obtain the first target region classification information; The first auxiliary balanced classifier determines classification information corresponding to the first sample image according to the weakly enhanced first sample image and the first feature information.

4. The method according to claim 3, wherein: The first sample image corresponds to a plurality of first area categories; The determining, according to the weakly enhanced first sample image and the first feature information, classification information corresponding to the first sample image includes: Determining the number of first target areas belonging to each first area category according to the first target area classification information corresponding to each first target area; Determining first mask data of the first sample image according to the number of first target regions of each first region category; the first mask data includes a mask of each first target region; the mask of the first target region is negatively correlated with the number of first target regions belonging to the same first region category; Classification information of the first sample image is determined according to the first mask data and the first feature information.

5. The method according to any one of claims 2 to 4, wherein: The image detection model to be trained also includes a teacher model; The performing image detection on the second sample image to obtain a second detection result includes: performing weak enhancement processing and strong enhancement processing on the second sample image; Inputting the weakly enhanced second sample image into the teacher model, determining second feature information of the second sample image, and determining image features, second target region classification information, and second classification information of a second target region in the second sample image according to the second feature information; the second feature information includes: the second image features of the second sample image, and classification information of a second candidate region in the second sample image; Inputting the strongly enhanced second sample image into the student model, determining third feature information of the second sample image, and determining image features, third target region classification information and third classification information of a third target region in the second sample image according to the third feature information; the third feature information includes: the third image features of the second sample image, and classification information of a third candidate region in the second sample image; Among them, the second detection result includes: image features of the second target area, classification information of the second target area, image features of the third target area and classification information of the third target area; the classification information of the second sample image includes: the second classification information and the third classification information.

6. The method according to claim 5, wherein: The teacher model includes: a second feature extraction layer, a second candidate region prediction layer, a second fully connected layer, a second target region regression layer, a second target region classification layer, and a second auxiliary balanced classifier; The weakly enhanced second sample image is input into the teacher model, second feature information corresponding to the second sample image is determined, and image features, second target region classification information, and second classification information of a second target region in the second sample image are determined according to the second feature information, including: The second feature extraction layer performs feature extraction on the weakly enhanced second sample image to obtain the second image feature; The second candidate region prediction layer identifies image features of a second candidate region in the second sample image according to the second image features, and performs region classification on the second candidate region to obtain classification information of the second candidate region; The second fully connected layer fuses the second image feature, the second candidate region image feature and the second candidate region classification information to obtain the second feature information; The second target region regression layer determines the image feature of the second target region according to the second feature information; The second target region classification layer classifies the second target region according to the second feature information to obtain the second target region classification information; The second auxiliary balanced classifier determines the second classification information according to the weakly enhanced second sample image and the second feature information.

7. The method according to claim 6, wherein: The second sample image corresponds to a plurality of second area categories; The determining the second classification information according to the weakly enhanced second sample image and the second feature information includes: determining the number of second target areas belonging to each second area category according to the second target area classification information corresponding to each second target area in the second sample image; Determine second mask data of the second sample image according to the number of second target areas belonging to each second area category; the second mask data includes a mask of each second target area; the mask corresponding to the second target area is negatively correlated with the number of second target areas belonging to the same second area category; The second classification information is determined according to the second mask data and the second feature information.

8. The method according to claim 6 or 7, wherein: The step of inputting the strongly enhanced second sample image into the student model, determining third feature information corresponding to the second sample image, and determining a third target area, third target area classification information, and third classification information in the second sample image according to the third feature information includes: The second feature extraction layer performs feature extraction on the strongly enhanced second sample image to obtain the third image feature; The second candidate region prediction layer identifies image features of a third candidate region in the second sample image according to the third image features, and performs region classification on the third candidate region to obtain classification information of the third candidate region; The second fully connected layer fuses the third image feature, the image feature of the third candidate region, and the classification information of the third candidate region to obtain the third feature information; The second target region regression layer determines the third target region included in the second sample image according to the third feature information; The second target region classification layer classifies the third target region according to the third feature information to obtain the third target region classification information; The second auxiliary balanced classifier determines the third classification information according to the strongly enhanced second sample image and the third feature information.

9. The method according to any one of claims 5 to 8, wherein: The semi-supervised image detection loss function includes: a supervised image detection loss function and an unsupervised image detection loss function; The determining, according to the first detection result and the second detection result, a semi-supervised image detection loss function corresponding to the image detection model to be trained comprises: Determining the supervised image detection loss function according to the first detection result; The unsupervised image detection loss function is determined according to the second detection result.

10. The method according to claim 9, wherein: Determining the supervised image detection loss function according to the first detection result includes: Calculating a first cross entropy loss value between the first classification information and the label information; The supervised image detection loss function is determined according to the first mask data and the first cross entropy loss value.

11. The method according to claim 9, wherein: The second classification information includes: the classification probability that the second target area belongs to each of the second area categories; Determining the unsupervised image detection loss function according to the second detection result includes: Calculating a second cross entropy loss value between the third classification information and the second classification information; According to the second classification information, the maximum classification probability among the multiple classification probabilities corresponding to each of the second area categories is determined, and the target whose classification probability is greater than or equal to the preset threshold is screened out from the maximum classification probability corresponding to each of the second area categories. Classification probability; The unsupervised image detection loss function is determined according to the second mask data, the second cross entropy loss value and the target classification probability.

12. The method according to claim 9, wherein: Determining the supervised image detection loss function according to the first detection result includes: According to the first detection result, determining a first candidate region prediction loss function, a first candidate region classification loss function, a first target region prediction loss function, and a first target region classification loss function corresponding to the student model; The supervised image detection loss function is determined according to the first candidate region prediction loss function, the first candidate region classification loss function, the first target region prediction loss function and the first target region classification loss function.

13. The method according to claim 9, wherein: The second detection result also includes: image features of the second candidate region and classification information of the second candidate region obtained after the teacher model performs image detection on the second sample image; and image features of the third candidate region and classification information of the third candidate region obtained after the student model performs image detection on the second sample image; Determining the unsupervised image detection loss function according to the second detection result includes: Determining a second candidate region prediction loss function between the teacher model and the student model according to the image features of the second candidate region, the image features of the third candidate region, the classification information of the second candidate region, and the classification information of the third candidate region; Determining a second target region prediction loss function between the teacher model and the student model according to the image feature of the second target region, the image feature of the third target region, the second target region classification information, and the third target region classification information; The unsupervised image detection loss function is determined according to the second candidate region prediction loss function and the second target region prediction loss function.

14. An image detection method, comprising: Get the target image; The target image is input into a trained image detection model, a target area in the target image is detected, and the target area is classified to obtain area classification information corresponding to the target area; wherein the trained image detection model is trained according to the training method of the image detection model described in any one of claims 1 to 13.

15. A training device for an image detection model, comprising: a first detection module, configured to input sample image data into an image detection model to be trained, the sample image data comprising a first sample image and a second sample image, perform image detection on the first sample image to obtain a first detection result; and perform image detection on the second sample image to obtain a second detection result; the first detection result comprises classification information of the first sample image, and the second detection result comprises classification information of the second sample image; A first determination module, used to determine a semi-supervised image detection loss function of the image detection model to be trained according to the first detection result and the second detection result; A training module is used to determine the target loss function of the image detection model to be trained according to the semi-supervised image detection loss function, and iteratively adjust the model parameters of the image detection model to be trained according to the target loss function to obtain a trained image detection model.

16. An image detection device, comprising: A second acquisition module is used to acquire a target image; The second detection module is used to input the target image into the trained image detection model, detect the target area in the target image, and perform region classification on the target area to obtain region classification information corresponding to the target area; wherein the trained image detection model is trained according to the training method of the image detection model described in any one of claims 1 to 13.

17. An electronic device, characterized in that: It includes a processor and a memory electrically connected to the processor, the memory stores a computer program, the processor is used to call and execute the computer program from the memory to implement the training method of the image detection model as described in any one of claims 1 to 13, or the processor is used to call and execute the computer program from the memory to implement the image detection method as described in claim 14.

18. A computer-readable storage medium, characterized in that: The storage medium is used to store a computer program, which can be executed by a processor to implement the training method of the image detection model as described in any one of claims 1-13, or the computer program can be executed by a processor to implement the image detection method as described in claim 14.

19. A computer program product, comprising a computer program, wherein the computer program can be executed by a processor to implement the training method of the image detection model as described in any one of claims 1 to 13, or the computer program can be executed by the processor to implement the image detection method as described in claim 14.

20. A computer program, which can be executed by a processor to implement the training method of the image detection model as described in any one of claims 1 to 13, or, the computer program can be executed by the processor to implement the image detection method as described in claim 14.

Citation Information

Patent Citations

  • Model training method and device, target detection method and device, equipment and storage medium

    CN113920370A

  • Image classification model training method and device, image processing method and device and computing equipment

    CN114842251A

  • Image segmentation method

    CN115082800A

  • Target detection network training and target detection method, device and equipment

    CN115187772A

  • Target detection model training method and device, target detection method and device, equipment and medium

    CN115797736A

Cited By

  • Sample generation method and device, deep learning model training method and device, video stream processing method and device, equipment and medium

    CN119478583A