Image risk control method and device, medium and electronic equipment
By uniformly extracting the multi-dimensional features of the image and fusion model losses, the high cost of manual labeling and noise in image risk control in the prior art is solved, and more accurate risk control results are achieved.
Patent Information
- Application Number
- CN202411273219.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-09-11
AI Technical Summary
In the prior art, due to the high cost of manual labeling and data noise in image risk control, the model training cost is high and the output results are inconsistent, and the risk control effect is poor.
By uniformly extracting the multi-dimensional image features of the sample, it is possible to simultaneously predict the overall image classification and detect the target object in the image through different subsequent model branch layers, and the losses of different model branch layers are fused into a comprehensive loss. Use mutual reference to avoid conflicting task results.
The effect of content risk prevention and control is improved, and the generated risk control results are more accurate, avoiding the problems of noise and high costs in model training.
Smart Images

Figure CN119516239A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to computer technology, and in particular to an image risk control method, device, medium and electronic equipment. Background Art
[0002] At present, with the rapid development of the Internet, the amount of user-generated content has increased dramatically, including but not limited to images, videos, audio, and text, etc. In order to ensure the security and compliance of the network environment, it is particularly important to prevent and control the risks of these contents.
[0003] In the prior art, risks come in various forms, and these risks require both accurate classification and accurate target detection. For example, when performing risk control on images, it is necessary to classify the images for risk control and identify the risky targets in the images. Since there are multiple risk control requirements, different models usually need to be trained to meet each risk control requirement.
[0004] However, due to the high cost of manual labeling and the fact that even labeled data may contain noise, the cost of training different models separately is high, and it is easy for the model output results to conflict, resulting in poor risk control effects. For example, the target is detected as a dangerous item, but the image classification result shows that the user behavior in the image is risky.
[0005] In order to solve the above problems, the present invention proposes an image risk control method, which can significantly improve the effect of content risk prevention and control.
[0006] Due to the drawbacks of manual labeling, unlabeled data accounts for the majority of the datasets available for training, and even labeled data may contain noise. This poses a challenge to model training, because traditional supervised learning methods cannot effectively utilize unlabeled data, and the noise in labeled data will affect the accuracy of the model. Summary of the invention
[0007] The embodiments of this specification provide an image risk control method, which uniformly extracts the multi-dimensional image features of the sample, so that the prediction of the overall image classification and the detection of the target in the image can be performed simultaneously through the subsequent different model branch layers, and because the losses of the different model branch layers are integrated into a comprehensive loss during training, the target detection results and the overall image classification refer to each other during the model training process, avoiding the situation where different models are trained to perform different tasks and the task results conflict. Therefore, when the image risk control model trained based on this process is used for risk control, the risk control results given are more accurate, which can significantly improve the effect of content risk prevention and control. The method includes:
[0008] Determine a training sample constructed based on the image data, and an image risk control model to be trained, wherein the image risk control model consists of a feature extraction layer, a target detection layer, and an image classification layer;
[0009] Inputting the training samples into the image risk control model to be trained, and determining the image features of the multi-dimensional sizes of the image data through the feature extraction layer of the image risk control model;
[0010] Input the multi-dimensional image features into the target detection layer and the image classification layer respectively, determine the predicted detection box and the detection box classification output by the target detection layer, and determine the image classification result output by the image classification layer;
[0011] According to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, the comprehensive loss is determined, and the image risk control model is trained based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and according to the detection box, detection box classification and image classification results output by the image risk control model, the risk target object and image risk type of the image to be risk controlled are determined to perform risk control.
[0012] Furthermore, in some embodiments,
[0013] The target detection layer includes a feature fusion subnet, a bounding box prediction subnet, and a bounding box classification subnet;
[0014] Inputting the multi-dimensional image features into the target detection layer, and determining the predicted detection frame and the detection frame classification output by the target detection layer, specifically includes:
[0015] Inputting the multi-dimensional image features into the target detection layer, and determining each fused image feature through the feature fusion subnet of the target detection layer;
[0016] Input the fused image features into the bounding box prediction subnet of the target detection layer to determine the predicted detection box of each target of the training sample, and input the fused image features into the bounding box classification subnet of the target detection layer to determine the risk classification result of each predicted detection box as the detection box classification.
[0017] Furthermore, in some embodiments,
[0018] Determine the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training sample, specifically including:
[0019] Determining the image risk classification of the training sample according to the annotation of the training sample;
[0020] Determining an image classification loss according to the image classification result output by the image classification layer and the difference in image risk classification of the training samples;
[0021] Determining, according to the annotations of the training samples, a bounding box of a risk target in the training samples and a risk classification of the risk target;
[0022] Determine the target classification loss according to the difference between the predicted detection box output by the target detection layer and the bounding box of the risk target in the training sample, and the difference between the detection box classification output by the target detection layer and the risk classification of the risk target in the training sample;
[0023] A comprehensive loss is determined according to the image classification loss and the object classification loss.
[0024] Furthermore, in some embodiments,
[0025] Determine the training samples constructed based on the image data, including:
[0026] Acquire labeled image data as labeled samples, and acquire unlabeled image data as unlabeled samples;
[0027] Determine the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training sample, specifically including:
[0028] The image risk control model is trained in an iterative manner, and for each iteration process, an output of the image risk control model for the unlabeled sample in a previous iteration process of the iteration process is determined, as well as a confidence level of the output;
[0029] Determine a pseudo-annotated sample from the unannotated samples according to the confidence and the expected confidence threshold of the iterative process, and use the output of the pseudo-annotated sample in the previous iterative process as a label;
[0030] During this round of iteration, based on the determined pseudo-annotated samples and the annotated samples, a comprehensive loss is determined according to the output of the object detection layer, the output of the image classification layer and the corresponding annotations.
[0031] Furthermore, in some embodiments,
[0032] Before determining the pseudo-labeled samples from the unlabeled samples according to the confidence and the expected confidence threshold of the iterative process, the method further includes:
[0033] Determine the number of unlabeled samples used for training the image risk control model in the previous iteration process of the iteration process;
[0034] According to the previous round of iteration process, the image risk control model determines a confidence reference value for the confidence of the output of the unlabeled sample;
[0035] According to the quantity and the confidence reference value, an expected confidence threshold for this round of iteration process is determined.
[0036] Furthermore, in some embodiments,
[0037] Based on the determined pseudo-annotated samples and the annotated samples, a comprehensive loss is determined according to the output of the target detection layer, the output of the image classification layer and the corresponding annotations, specifically including:
[0038] Based on the determined pseudo-annotated samples, determining a function value of a cross entropy loss function according to an output of the target detection layer, an output of the image classification layer, and an annotation of the pseudo-annotated samples;
[0039] Based on the labeled samples, determining a function value of a symmetric cross entropy loss function according to an output of the target detection layer, an output of the image classification layer, and labels of the labeled samples;
[0040] According to the function value of the cross entropy loss function and the function value of the symmetric cross entropy loss function, a comprehensive loss function value is determined, and based on the comprehensive loss function value, the model parameters of the image risk control model are adjusted.
[0041] Furthermore, in some embodiments,
[0042] Based on the labeled samples, according to the output of the target detection layer, the output of the image classification layer and the labels of the labeled samples, determining the function value of the symmetric cross entropy loss function specifically includes:
[0043] Based on the annotations of the labeled samples, determining positive samples and negative samples corresponding to the labeled samples;
[0044] Determine a first function value according to an output of the image risk control model for the positive sample and a first difference between the annotation, wherein the first difference is positively correlated with the first function value;
[0045] determining a second function value according to a second difference between an output of the image risk control model for the positive sample and an output of the image risk control model for the negative sample, wherein the second difference is negatively correlated with the second function value;
[0046] A function value of a symmetric cross entropy loss function is determined according to the first function value and the second function value.
[0047] Furthermore, in some embodiments,
[0048] The method further comprises:
[0049] For each training sample, based on the annotation of the training sample, determine other samples whose risk classification of the risk target is consistent with that of the training sample;
[0050] The training sample is used as an anchor sample, and a reference sample is determined according to other determined training samples, and at least one sample combination corresponding to the training sample is obtained by combining;
[0051] Inputting the training sample into the image risk control model to be trained, and determining the image features of the multi-dimensional size of the image data through the feature extraction layer of the image risk control model, specifically including:
[0052] Inputting the sample combination into the image risk control model to be trained, and determining the multi-dimensional image features of the anchor sample and the reference sample in the sample combination respectively through the feature extraction layer of the image risk control model;
[0053] Inputting the multi-dimensional image features into the target detection layer, and determining the predicted detection frame and the detection frame classification output by the target detection layer, specifically includes:
[0054] Inputting the reference sample in the sample combination into the reference subnet of the target detection layer to determine the common features of the significant targets in the reference sample;
[0055] The anchor samples and the common features in the sample combination are input into the segmentation subnet of the target detection layer, and the output predicted detection box and detection box classification are determined as the predicted detection box and detection box classification of the training sample.
[0056] The embodiment of the present specification also provides an image wind control device, the device comprising:
[0057] A preparation module determines a training sample constructed based on image data and an image risk control model to be trained, wherein the image risk control model consists of a feature extraction layer, a target detection layer, and an image classification layer;
[0058] A feature extraction module inputs the training sample into the image risk control model to be trained, and determines the image features of the multi-dimensional size of the image data through the feature extraction layer of the image risk control model;
[0059] A classification module, inputting the multi-dimensional image features into the target detection layer and the image classification layer respectively, determining the predicted detection box and the detection box classification output by the target detection layer, and determining the image classification result output by the image classification layer;
[0060] The training and risk control module determines the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, and trains the image risk control model based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and the risk target object and image risk type of the image to be risk controlled are determined according to the detection box, detection box classification and image classification results output by the image risk control model to perform risk control.
[0061] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0062] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0063] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0064] In the embodiments of this specification, by uniformly extracting the multi-dimensional image features of the sample, it is possible to simultaneously predict the overall classification of the image and detect the target in the image through subsequent different model branch layers, and because the losses of different model branch layers are integrated into a comprehensive loss during training, the results of target detection and the overall classification of the image refer to each other during the model training process, avoiding the situation where different models are trained to perform different tasks and the task results conflict. Therefore, when the image risk control model trained based on this process is used for risk control, the risk control results given are more accurate, which can significantly improve the effect of content risk prevention and control. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A flowchart of an image risk control method is provided for the embodiments of this specification;
[0066] Figure 2 A schematic diagram of an image risk control model structure provided in an embodiment of this specification;
[0067] Figure 3 A schematic diagram of the structure of a target detection layer provided in an embodiment of this specification;
[0068] Figure 4 A schematic diagram of the structure of an image wind control device provided in an embodiment of this specification;
[0069] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0071] In order to ensure the security and compliance of the network environment, it is necessary to conduct risk control on user-generated content in response to the current situation of a sharp increase in the amount of user-generated content. In the case of image risk control, since images contain a lot of content and are usually complex, they are highly hidden. Therefore, whether there are risks in the image as a whole and whether there are risky targets in the image need to be identified and targeted for risk control. For example, the image itself may look fine as a whole, but there is risky content in the corner of the image. If risk control is only performed on the image as a whole, this hidden risk content is likely to be ignored.
[0072] Therefore, for different types of image risk control, it is usually necessary to establish a large number of training samples in a targeted manner to train the risk control model for each type of image risk control task. However, due to the high cost of manual labeling and the fact that even labeled data may contain noise, the cost of training different models separately is high, and it is easy for the model output results to conflict, resulting in poor risk control results.
[0073] Based on this, please see Figure 1 , which is a flowchart of an image risk control method provided in the embodiment of this specification. Figure 1 The process shown is described in detail, and the image risk control method may specifically include the following steps:
[0074] S100: Determine training samples constructed based on image data and an image risk control model to be trained, wherein the image risk control model consists of a feature extraction layer, a target detection layer, and an image classification layer.
[0075] In one or more embodiments of this specification, for the convenience of description, a single entity server is used as an example to perform image risk control. Of course, the server can be a single device or a distributed system composed of multiple devices, and this specification does not limit this.
[0076] In one or more embodiments of this specification, the server may first determine the training samples constructed based on the image data, and the image risk control model to be trained. In addition, in order to solve the problem that the risk control results of the prior art conflict with each other when training multiple models by task, in the embodiments of this specification, the training samples need to be labeled for different tasks. In the implementation of this specification, the image risk control model to be trained is used at least for image classification and target object detection, so as to determine the risk control result of the image based on the image risk classification obtained by image classification and the type of risk target in the image obtained by target object detection.
[0077] Specifically, the server may first determine each training sample. For each training sample, the annotation of the training sample includes: the image risk classification of the training sample, the bounding box of the risk target in the training sample, and the risk classification of the risk target.
[0078] Among them, the image risk classification of the training sample, that is, for the preset image risk type, which risk type does the training sample correspond to. The bounding box of the risk target in the training sample, that is, the location of the risky target contained in the training sample, and the risk classification of the risky target, that is, the risk classification of the risk target. It should be noted that, in general, the image risk classification of the image matches the risk classification of the risk target in the image. For example, the image risk classification includes A, B, and C, among which, in the A-type image risk classification, it is generally necessary to indicate that the image as a whole belongs to the A-type image risk classification because of the existence of the corresponding target. However, in some cases, the image may also contain targets corresponding to other image risk classifications. In this case, it is necessary to comprehensively consider the image risk classification and the target detection results during risk control to determine the final risk control result.
[0079] In addition, the server can also determine the image risk control model to be trained, which is composed of a feature extraction layer, a target detection layer and an image classification layer.
[0080] S102: Input the training samples into the image risk control model to be trained, and determine the multi-dimensional image features of the image data through the feature extraction layer of the image risk control model.
[0081] In one or more embodiments of the present specification, after determining the training samples, the server can determine the multi-dimensional image features of the image data by inputting the training samples into the feature extraction layer of the image risk control model. The feature extraction layer is a network composed of a series of convolutional layers and pooling layers, which is used to extract the image features of the input image.
[0082] Specifically, the feature extraction layer is a pyramid structure, which is used to extract the feature pyramid of the input image. Therefore, for each input training sample, the feature extraction layer can output the image features of the multi-dimensional size corresponding to the training sample.
[0083] That is to say, a series of image features with different resolutions are extracted through each layer to capture the multi-scale information in the image. And generally, the image features extracted from higher layers contain more abstract features. In some architectures, features can also be refined from the top layer to the bottom layer, which helps to enhance the detection ability of small objects. Since objects of different sizes may have different manifestations in the image, the feature pyramid can help the image risk control model better identify objects of different scales. And for objects of different sizes, the feature pyramid provides more contextual information, making the image risk control model more robust and less susceptible to changes in target size. In addition, due to different image processing tasks, the requirements for image features are not the same. In order to support the image risk control model to simultaneously realize image risk classification and target detection, the image features of different dimensions extracted by the feature extraction layer are more convenient for other layers of the image risk control model to realize different image processing tasks.
[0084] Figure 2 The structural diagram of the image risk control model provided in the embodiment of this specification shows that the image risk control model is composed of a feature extraction layer, a target detection layer and an image classification layer, wherein the feature extraction layer is a pyramid structure for extracting image features of different dimensions, while the target detection layer and the image classification layer are two parallel network structures, which are used for image risk classification and target object detection, respectively.
[0085] S104: Input the multi-dimensional image features into the target detection layer and the image classification layer respectively, determine the predicted detection box and the detection box classification output by the target detection layer, and determine the image classification result output by the image classification layer.
[0086] In one or more embodiments of the present specification, after the server obtains the multi-dimensional image features of the training sample, the server can determine the target detection result and the image classification result through the target detection layer and the image classification layer of the image risk control model respectively. Among them, the target detection layer is used to determine the predicted detection frame and the detection frame classification of the training sample, that is, the location of the target object predicted to be at risk in the image data, and the risk type of the target object at risk. The image classification layer is used to determine the image classification result of the training sample, that is, considering the image data as a whole, the risk type of the image data.
[0087] Specifically, in an embodiment of the present specification, the target detection layer may include a feature fusion subnet, a bounding box prediction subnet, and a bounding box classification subnet. The server may input the image features of multi-dimensional sizes into the target detection layer, and determine each fused image feature through the feature fusion subnet of the target detection layer. The fused image features are input into the bounding box prediction subnet of the target detection layer to determine the predicted detection box of each target of the training sample, and the fused image features are input into the bounding box classification subnet of the target detection layer to determine the risk classification result of each predicted detection box as the detection box classification.
[0088] Similarly, for the image classification layer, the image classification layer may also include a feature fusion subnet and a classifier. Then the server may input the image features of multi-dimensional sizes into the image classification layer, and determine each fused image feature through the feature fusion subnet of the image classification layer. The fused image features are input into the classifier of the image classification layer to determine the image classification result of the training sample.
[0089] S106: Determine the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, and train the image risk control model based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and based on the detection box, detection box classification and image classification results output by the image risk control model, the risk target object and image risk type of the image to be risk controlled are determined to perform risk control.
[0090] In one or more embodiments of the present specification, after determining the output of the target detection layer and the output of the image classification layer, the server can determine the comprehensive loss based on the annotation of the training sample, and adjust the model parameters of the image risk control model with the minimum comprehensive loss as the optimization goal, and train the image risk control model. Because whether it is an image classification task or a target object detection task, when training the image risk control model, the gradient of the model parameters is determined based on the comprehensive loss determined by the losses of the two tasks. Moreover, both tasks are predicted based on the image features extracted by the same feature extraction layer, thereby avoiding conflicts between the output results. This allows the image risk control model to be used to output matching target detection results and image classification results based on an input image data.
[0091] Specifically, the server can determine the image risk classification of the training sample based on the annotation of the training sample, and determine the image classification loss based on the image classification result output by the image classification layer and the difference in the image risk classification of the training sample. In addition, the server can also determine the bounding box of the risk target in the training sample and the risk classification of the risk target based on the annotation of the training sample. And determine the target classification loss based on the difference between the predicted detection box output by the target detection layer and the bounding box of the risk target in the training sample, and the difference between the detection box classification output by the target detection layer and the risk classification of the risk target in the training sample. Finally, the server can determine the comprehensive loss based on the image classification loss and the target classification loss.
[0092] Among them, the image classification loss and the target classification loss can both be based on the cross entropy loss function, according to the model output results and the annotations of the training samples, to determine the function value, and according to the two function values, to determine the comprehensive loss function value, and based on the comprehensive loss function value, adjust the model parameters of the image risk control model. Moreover, generally speaking, the closer the model output is to the annotation, the more accurate the model output is, so the minimum comprehensive loss function value is usually used as the optimization goal to determine the adjustment gradient of the model parameters.
[0093] Optionally, after the server has trained the image risk control model, it can use the image risk control model to perform risk control on image data. Specifically, for image data in user-generated content, the business server can use the image data as the image to be risk controlled. Then, the trained image risk control model is called, and the image to be risk controlled is input into the image risk control model. Then, the detection box, detection box classification, and image classification results output by the two layers of the image risk control model are received, and the risk category of the target object contained in the image to be risk controlled and the image classification result of the image to be risk controlled are determined. Finally, based on the risk target object of the image to be risk controlled and the image risk type, determine what type of risk the image to be risk controlled belongs to and what kind of risk control is to be performed.
[0094] In the embodiments of this specification, there is no restriction on how to perform risk control specifically, but as mentioned above, the risk control result determined by the image risk control model does not have any conflicting conditions, which is conducive to accurate risk control. For example, when it is determined based on the image classification result that the image to be risk-controlled belongs to the low-risk category, the identified target objects with risks can be covered. This allows the image to be risk-controlled without risk parts to be displayed to other users. Or when the image classification result determines that the image to be risk-controlled belongs to the high-risk category, the entire image is prohibited from being displayed, and so on.
[0095] based on Figure 1The image risk control method shown in the figure, by uniformly extracting the multi-dimensional image features of the samples, can simultaneously predict the overall classification of the image and detect the target in the image through the subsequent different model branch layers, and because the losses of different model branch layers are integrated into a comprehensive loss during training, the target detection results and the overall classification of the image can refer to each other during the model training process, avoiding the situation where different models are trained to perform different tasks and the task results conflict. Therefore, when the image risk control model trained based on this process is used for risk control, the risk control results given are more accurate, which can significantly improve the effect of content risk prevention and control.
[0096] In addition, the difficulty of manually labeling training samples for multiple tasks is higher than that of manually labeling training samples for a single task. In addition, in order to ensure that the output results of the trained image risk control model do not conflict with each other, the multi-task labeling of the training samples also needs to be consistent. This leads to higher requirements for manual labeling and greater reliance on expert experience, which inevitably affects the accuracy of labeling.
[0097] It can be seen that in the scenario provided in this specification, the labeling of training samples is more difficult than in common scenarios. Therefore, at the same labor cost and time cost, the number of labeled training samples is smaller. In order to avoid insufficient training caused by small sample problems, or falling into the situation of local optimal solution. In one or more embodiments of this specification, in step S100, the server can also obtain labeled image data as labeled samples, and obtain unlabeled image data as unlabeled samples. That is, when training the image risk control model in this specification, a self-supervision method can be adopted.
[0098] In the process of iteratively training the image risk control model, the server can determine the unlabeled samples that can be used for self-supervision from the unlabeled samples before each round of iteration, and use them to train the image risk control model.
[0099] Specifically, the server can determine, for each iteration process, the output of the image risk control model for unlabeled samples in the previous iteration process of the iteration process, and determine the confidence of the output. That is to say, for each unlabeled sample, the server can also input the unlabeled sample into the image risk control model to be trained, and determine the output result of the image risk control model. But more importantly, the server can determine the confidence of the output of the image risk control model, that is, the confidence of the output result of the image risk control model for each unlabeled sample. So that the output of those unlabeled samples can be determined to be sufficiently accurate based on the confidence, and can be used as "labeled samples" for subsequent iterative training processes.
[0100] Afterwards, the server may determine a pseudo-annotated sample from the unannotated samples according to the confidence and the expected confidence threshold of the iterative process, and use the output of the pseudo-annotated sample in the previous iterative process as the label.
[0101] As mentioned above, as long as the confidence level is high enough, we can believe to a certain extent that the output of the unlabeled samples of the previous round of the image risk control model is sufficiently accurate. The output can be used as a label, and the corresponding unlabeled samples can be used as pseudo-labeled samples.
[0102] Specifically, in one or more embodiments of this specification, the server may use a preset confidence expectation threshold to filter out pseudo-annotated samples, but the accuracy of the model output changes with training. In this embodiment of this specification, pseudo-annotated samples need to be added to the training faster to avoid overfitting of the training. Because once overfitting occurs, the confidence of the model output is also for the overfitting situation, and the annotations of the pseudo-annotated samples filtered out are not accurate enough.
[0103] Therefore, the server can adopt a dynamically adjusted confidence expectation threshold and determine the confidence expectation threshold every round or every few rounds. The server can determine the number of unlabeled samples used to train the image risk control model in the previous iteration of the current iteration, and determine a confidence reference value based on the confidence of the output of the image risk control model for the unlabeled samples in the previous iteration, and determine the confidence expectation threshold of the current iteration based on the number and the confidence reference value.
[0104] For example, the confidence expectation threshold is determined in the following manner.
[0105]
[0106] Among them, τ represents the expected confidence threshold, and t represents the number of iterations. When t=0, the expected confidence threshold is 1 / C, and C represents the number of categories, that is, the total number of different categories in the annotations of the training samples. For example, on the CIFAR-10 dataset, C will be equal to 10 because the dataset contains 10 different categories. λ is a preset hyperparameter, which specifically refers to the momentum decay coefficient of the exponential moving average (EMA), which is a value between 0 and 1. EMA is a method for calculating the weighted average of a sequence, in which newer observations have greater weights than older observations. The value of λ determines the degree of influence of the state at the previous moment on the current state. If λ is close to 1, more historical information is retained; if λ is close to 0, more attention is paid to new information. μB is the total number of training samples, and in the embodiment of this specification, it is the total number of unlabeled samples. max(q b) represents the maximum value of the predicted probability of the image risk control model for the bth unlabeled sample. Specifically, q b is the probability distribution of the image risk control model predicting the unlabeled sample ub, and max(q b ) is the maximum probability value selected from this probability distribution. In addition, q b It is expressed as pm(y|Ω(ub)), which is the probability distribution of the model output on the unlabeled sample ub after strong augmentation. max(qb) is used to determine whether the confidence of a sample is high enough to generate a pseudo-label. If max(qb) is greater than the set threshold τ, then the unlabeled sample will be assigned a pseudo-label for training. In short, max(q b ) is the model’s predicted probability of the most likely category for the unlabeled sample ub.
[0107] Finally, in this round of iteration, based on the determined pseudo-annotated samples and annotated samples, the comprehensive loss is determined according to the output of the target detection layer, the output of the image classification layer, and the corresponding annotations. That is, the image risk control model is trained in a supervised training manner using pseudo-annotated samples and the original annotated samples.
[0108] In addition, it should be noted that in one or more embodiments of the present specification, the pseudo-annotated sample can be used to determine both the image classification loss and the target classification loss, or only used to determine one of the losses.
[0109] Furthermore, in one or more embodiments of the present specification, the server may further fine-tune the confidence expectation threshold based on the local threshold. Specifically, the server may determine the fine-tuning value using the following method:
[0110]
[0111] Among them, q b (C) indicates the probability that the image risk control model predicts that the bth unlabeled sample ub belongs to category c. qb itself is in vector form, which indicates the probability distribution of the image risk control model output for the unlabeled sample ub, and q b (C) refers specifically to the probability value corresponding to category c in the distribution. Then the adjusted confidence expectation threshold is fine-tuned as:
[0112]
[0113] Among them, [C] represents a category set, and C represents a specific category.
[0114] Through the above process, the confidence expectation threshold can be automatically adjusted to make the determined pseudo-labeled samples more accurate. Generally speaking, as the iteration process increases, the model parameters are adjusted more accurately, and the confidence expectation threshold will become higher and higher, making the training effect better. At the same time, since it is equivalent to flexibly increasing the number of training samples, it also avoids the small sample problem.
[0115] In addition, for labeled samples, their labels are generally manually labeled based on expert experience as mentioned above. However, for multi-task and non-conflicting labeling requirements, it is difficult to avoid inaccurate manual labeling, which means that there is actually noise in the labeled samples, that is, there are labeled samples with labeling errors.
[0116] In order to further reduce the impact of noise on the training effect, in one or more embodiments of this specification, the server can also determine the function value of the symmetric cross entropy loss function (SCE) for the labeled samples for training the image risk control model. For the pseudo-labeled samples, since the confidence of their labels is adjusted at any time, and since it is not fixed even if there is noise, the function value of the cross entropy loss function can be directly used to train the image risk control model.
[0117] Specifically, the server may determine the function value of the cross entropy loss function based on the determined pseudo-annotated samples, according to the output of the target detection layer, the output of the image classification layer, and the annotations of the pseudo-annotated samples.
[0118] Based on the labeled samples, the function value of the symmetric cross entropy loss function is determined according to the output of the target detection layer, the output of the image classification layer and the labels of the labeled samples.
[0119] Finally, according to the function value of the cross entropy loss function and the function value of the symmetric cross entropy loss function, the comprehensive loss function value is determined, and based on the comprehensive loss function value, the model parameters of the image risk control model are adjusted.
[0120] Among them, the symmetric cross entropy loss function combines the cross entropy losses in two directions to improve the robustness and generalization ability of the model. Compared with the traditional cross entropy loss function, it is usually used in supervised learning, especially classification problems. It measures the difference between the probability distribution predicted by the model and the probability distribution of the true annotation. For a given sample, if the true annotation is a one-hot encoded vector, then the cross entropy loss function can be defined as:
[0121] H(y,p)=-∑ylogp
[0122] Among them, y is the real label, and p is the probability distribution predicted by the model. In order to solve the problem of noisy labeling, the inverse cross entropy is also introduced:
[0123] H(p,y)=-∑plogy′
[0124] Among them, y' represents the probability distribution obtained by some means (such as softening one-hot encoding) from the true label, so that y' and p are both probability distributions. Combining the cross entropy in these two directions, we get the symmetric cross entropy loss function:
[0125] SCE=H(y,p)+αH(p,y)
[0126] Among them, α is a hyperparameter used to balance the contribution of the two loss terms. By symmetrically considering the relationship between the true annotation and the model prediction, the model can not only fit the training data, but also better handle uncertainty and noise, thereby improving the overall performance of the model.
[0127] Furthermore, in this specification, in order to further improve the intra-class compactness and inter-class distinction of features, when the server determines the cross entropy functions in two directions in the above-mentioned symmetric cross entropy loss function, it can also adjust the function value based on the inter-class differences and intra-class differences.
[0128] Specifically, the server may determine positive samples and negative samples corresponding to the labeled samples based on the labels of the labeled samples. Each labeled sample is used as a standard sample, and the positive sample refers to a sample belonging to the same category as the standard sample. For example, positive samples refer to samples aj that belong to the same category as the standard sample ai. Negative samples refer to samples that do not belong to the same category as the standard sample. For example, negative samples refer to samples ak that do not belong to the same category as the standard sample ai.
[0129] Afterwards, the server may determine the first function value according to the output of the image risk control model for the positive sample and the first difference of the annotation of the positive sample. The first difference is positively correlated with the first function value. And, determine the second function value according to the second difference of the output of the image risk control model for the positive sample and the output of the image risk control model for the negative sample. The second difference is negatively correlated with the second function value.
[0130] Finally, the function value of the symmetric cross entropy loss function is determined according to the first function value and the second function value of each labeled sample. The function value of the symmetric cross entropy loss function reflects the class structure in the data set of labeled samples, that is, the labeled samples in the same class are closer, and the labeled samples in different classes are farther away.
[0131] In addition, in one or more embodiments of the present specification, the target detection layer of the image risk control model may also use images containing significant targets to assist in training the target detection layer.
[0132] Specifically, first, the server may determine, for each training sample, other samples whose risk classification of the risk target is consistent with the training sample according to the label of the training sample. The server may determine other samples that are consistent with the training sample only for the labeled samples.
[0133] Secondly, the server can use the training sample as an anchor sample, determine the reference sample based on the other determined training samples, and combine to obtain at least one sample combination corresponding to the training sample. That is, for each labeled sample, a sample combination can be determined, and the sample combination includes an anchor sample and multiple reference samples. Of course, there can be at least one reference sample, but generally speaking, there will not be only one other sample of the same classification.
[0134] Then, when extracting image features through the feature extraction layer of the image risk control model, it is necessary to extract multi-dimensional image features for each image in the sample combination. That is, the sample combination is input into the image risk control model to be trained, and the multi-dimensional image features of the anchor sample and the reference sample in the sample combination are determined through the feature extraction layer of the image risk control model.
[0135] Afterwards, when the image features are input into the target detection layer, the server can input the reference sample in the sample combination into the reference subnet of the target detection layer to determine the common features of the significant target objects in the reference sample. The task of the reference subnet is to extract the common representation of the target object from the reference sample.
[0136] And, the anchor sample and the common feature in the sample combination are input into the segmentation subnet of the target detection layer, and the output predicted detection box and detection box classification are determined as the predicted detection box and detection box classification of the training sample. The segmentation subnet is an image segmentation network, which is used to identify and segment the target object in the anchor sample under the guidance of the common representation provided by the reference subnet.
[0137] The reference subnet is used to input the image features of each dimension of a set of reference samples. The extracted image features and the annotations of the reference samples are masked and pooled to obtain the common representation of the target object.
[0138] The segmentation subnet inputs the multi-dimensional image features of the anchor sample. Using the common representation generated by the reference subnet, a pixel-level prior mask is generated through the Referring Mask Generation (RMG) module. The Referring Feature Enrichment (RFE) module then enhances the features to highlight the target object in the anchor sample. Finally, a segmentation mask of the target object is generated.
[0139] Figure 3 The structural diagram of the target detection layer provided in this specification shows that the reference samples and anchor samples input into the target detection layer are image features, and the reference subnet extracts common features and inputs RMG to obtain the prior mask. RFE generates the segmentation mask of the target object according to the prior mask and the image features of the anchor sample.
[0140] See also Figure 4 , is a schematic diagram of the structure of an image wind control device provided in an embodiment of this specification. Figure 4 As shown, the image risk control device can be implemented as all or part of the electronic device through software, hardware or a combination of both. According to some embodiments, the image risk control includes a preparation module 401, a feature extraction module 402, a classification module 403, and a training and risk control module 404, specifically including:
[0141] Preparation module 401, determining training samples constructed based on image data and an image risk control model to be trained, wherein the image risk control model is composed of a feature extraction layer, a target detection layer, and an image classification layer;
[0142] The feature extraction module 402 inputs the training sample into the image risk control model to be trained, and determines the image features of the multi-dimensional size of the image data through the feature extraction layer of the image risk control model;
[0143] The classification module 403 inputs the multi-dimensional image features into the target detection layer and the image classification layer respectively, determines the predicted detection box and the detection box classification output by the target detection layer, and determines the image classification result output by the image classification layer;
[0144] The training and risk control module 404 determines the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, and trains the image risk control model based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and the risk target and image risk type of the image to be risk controlled are determined according to the detection box, detection box classification and image classification results output by the image risk control model to perform risk control.
[0145] Optionally, the target detection layer includes a feature fusion subnet, a bounding box prediction subnet and a bounding box classification subnet. The classification module 403 inputs the image features of the multi-dimensional size into the target detection layer, determines each fused image feature through the feature fusion subnet of the target detection layer, inputs each fused image feature into the bounding box prediction subnet of the target detection layer, determines the predicted detection box of each target of the training sample, and inputs each fused image feature into the bounding box classification subnet of the target detection layer to determine the risk classification result of each predicted detection box as the detection box classification.
[0146] Optionally, the training and risk control module 404 determines the image risk classification of the training sample based on the annotation of the training sample, determines the image classification loss based on the image classification result output by the image classification layer and the difference between the image risk classification of the training sample, determines the bounding box of the risk target in the training sample and the risk classification of the risk target based on the annotation of the training sample, determines the target classification loss based on the difference between the predicted detection box output by the target detection layer and the bounding box of the risk target in the training sample, and the difference between the detection box classification output by the target detection layer and the risk classification of the risk target in the training sample, and determines the comprehensive loss based on the image classification loss and the target classification loss.
[0147] Optionally, the preparation module 401 obtains labeled image data as labeled samples, and obtains unlabeled image data as unlabeled samples, and the training and risk control module 404 iteratively trains the image risk control model, and for each iteration process, determines the output of the image risk control model for the unlabeled samples in the previous iteration process of the iteration process, and the confidence of the output, and determines pseudo-labeled samples from the unlabeled samples according to the confidence and the expected confidence threshold of the iteration process, and uses the output of the pseudo-labeled samples in the previous iteration process as the annotation, and in the iteration process, determines the comprehensive loss based on the determined pseudo-labeled samples and the labeled samples, according to the output of the target detection layer, the output of the image classification layer and the corresponding annotations.
[0148] Optionally, the training and risk control module 404 determines the number of unlabeled samples used to train the image risk control model in the previous iterative process of this iterative process, determines a confidence reference value for the confidence of the output of the image risk control model for the unlabeled samples in the previous iterative process, and determines an expected confidence threshold for this iterative process based on the number and the confidence reference value.
[0149] Optionally, the training and risk control module 404 determines the function value of the cross entropy loss function based on the determined pseudo-annotated samples, according to the output of the target detection layer, the output of the image classification layer, and the annotations of the pseudo-annotated samples; determines the function value of the symmetric cross entropy loss function based on the labeled samples, according to the output of the target detection layer, the output of the image classification layer, and the annotations of the labeled samples; determines a comprehensive loss function value based on the function value of the cross entropy loss function and the function value of the symmetric cross entropy loss function; and adjusts the model parameters of the image risk control model based on the comprehensive loss function value.
[0150] Optionally, the training and risk control module 404 determines the positive samples and negative samples corresponding to the labeled samples based on the annotations of the labeled samples, determines a first function value according to a first difference between an output of the image risk control model for the positive sample and the annotation, and the first difference is positively correlated with the first function value, determines a second function value according to a second difference between an output of the image risk control model for the positive sample and an output of the image risk control model for the negative sample, and the second difference is negatively correlated with the second function value, and determines the function value of the symmetric cross entropy loss function according to the first function value and the second function value.
[0151] Optionally, the preparation module 401 determines, for each training sample, other samples whose risk classification of the risk target is consistent with that of the training sample according to the annotation of the training sample, uses the training sample as an anchor sample, determines a reference sample according to the other determined training samples, and combines them to obtain at least one sample combination corresponding to the training sample;
[0152] The feature extraction module 402 inputs the sample combination into the image risk control model to be trained, and determines the multi-dimensional image features of the anchor sample and the reference sample in the sample combination through the feature extraction layer of the image risk control model;
[0153] The classification module 403 inputs the reference sample in the sample combination into the reference subnet of the target detection layer, determines the common features of the salient targets in the reference sample, inputs the anchor sample and the common features in the sample combination into the segmentation subnet of the target detection layer, determines the output predicted detection box and detection box classification as the predicted detection box and detection box classification of the training sample.
[0154] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0155] The present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 1 The method of the embodiment shown in the figure can be specifically executed by referring to Figure 1 The specific description of the illustrated embodiment will not be repeated here.
[0156] The present specification also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 1 The method of the embodiment shown in the figure can be specifically executed by referring to Figure 1 The specific description of the illustrated embodiment will not be repeated here.
[0157] The embodiments of this specification also provide Figure 5 The structural diagram of the electronic device shown in FIG. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned image risk control method.
[0158] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the executor of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0159] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0160] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0161] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0162] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0163] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0164] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0165] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0167] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0168] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0169] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0170] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0171] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] This specification 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. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0173] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0174] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. An image risk control method, the method comprising: Determine a training sample constructed based on the image data, and an image risk control model to be trained, wherein the image risk control model consists of a feature extraction layer, a target detection layer, and an image classification layer; Inputting the training samples into the image risk control model to be trained, and determining the image features of the multi-dimensional sizes of the image data through the feature extraction layer of the image risk control model; Input the multi-dimensional image features into the target detection layer and the image classification layer respectively, determine the predicted detection box and the detection box classification output by the target detection layer, and determine the image classification result output by the image classification layer; According to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, the comprehensive loss is determined, and the image risk control model is trained based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and according to the detection box, detection box classification and image classification results output by the image risk control model, the risk target object and image risk type of the image to be risk controlled are determined to perform risk control.
2. The method according to claim 1, wherein the target detection layer comprises a feature fusion subnet, a bounding box prediction subnet, and a bounding box classification subnet; Inputting the multi-dimensional image features into the target detection layer, and determining the predicted detection frame and the detection frame classification output by the target detection layer, specifically includes: Inputting the multi-dimensional image features into the target detection layer, and determining each fused image feature through the feature fusion subnet of the target detection layer; Input the fused image features into the bounding box prediction subnet of the target detection layer to determine the predicted detection box of each target of the training sample, and input the fused image features into the bounding box classification subnet of the target detection layer to determine the risk classification result of each predicted detection box as the detection box classification.
3. The method according to claim 1, determining the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training sample, specifically comprising: Determining the image risk classification of the training sample according to the annotation of the training sample; Determining an image classification loss according to the image classification result output by the image classification layer and the difference in image risk classification of the training samples; Determining, according to the annotations of the training samples, a bounding box of a risk target in the training samples and a risk classification of the risk target; Determine the target classification loss according to the difference between the predicted detection box output by the target detection layer and the bounding box of the risk target in the training sample, and the difference between the detection box classification output by the target detection layer and the risk classification of the risk target in the training sample; A comprehensive loss is determined according to the image classification loss and the object classification loss.
4. The method of claim 1, wherein determining the training sample constructed based on the image data comprises: Acquire labeled image data as labeled samples, and acquire unlabeled image data as unlabeled samples; Determine the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training sample, specifically including: The image risk control model is trained in an iterative manner, and for each iteration process, an output of the image risk control model for the unlabeled sample in a previous iteration process of the iteration process is determined, as well as a confidence level of the output; Determine a pseudo-annotated sample from the unannotated samples according to the confidence and the expected confidence threshold of the iterative process, and use the output of the pseudo-annotated sample in the previous iterative process as a label; During this round of iteration, based on the determined pseudo-annotated samples and the annotated samples, a comprehensive loss is determined according to the output of the object detection layer, the output of the image classification layer and the corresponding annotations.
5. The method according to claim 4, before determining the pseudo-annotated samples from the unannotated samples according to the confidence and the expected confidence threshold of the iterative process, the method further comprises: Determine the number of unlabeled samples used for training the image risk control model in the previous iteration process of the iteration process; According to the previous round of iteration process, the image risk control model determines a confidence reference value for the confidence of the output of the unlabeled sample; According to the quantity and the confidence reference value, an expected confidence threshold for this round of iteration process is determined.
6. The method according to claim 4, based on the determined pseudo-annotated samples and the annotated samples, determining the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the corresponding annotations, specifically comprising: Based on the determined pseudo-annotated samples, determining a function value of a cross entropy loss function according to an output of the target detection layer, an output of the image classification layer, and an annotation of the pseudo-annotated samples; Based on the labeled samples, determining a function value of a symmetric cross entropy loss function according to an output of the target detection layer, an output of the image classification layer, and labels of the labeled samples; According to the function value of the cross entropy loss function and the function value of the symmetric cross entropy loss function, a comprehensive loss function value is determined, and based on the comprehensive loss function value, the model parameters of the image risk control model are adjusted.
7. The method according to claim 6, based on the labeled samples, determining the function value of the symmetric cross entropy loss function according to the output of the target detection layer, the output of the image classification layer and the labels of the labeled samples, specifically comprising: Based on the annotations of the labeled samples, determining positive samples and negative samples corresponding to the labeled samples; Determine a first function value according to an output of the image risk control model for the positive sample and a first difference between the annotation, wherein the first difference is positively correlated with the first function value; determining a second function value according to a second difference between an output of the image risk control model for the positive sample and an output of the image risk control model for the negative sample, wherein the second difference is negatively correlated with the second function value; A function value of a symmetric cross entropy loss function is determined according to the first function value and the second function value.
8. The method of claim 1, further comprising: For each training sample, based on the annotation of the training sample, determine other samples whose risk classification of the risk target is consistent with that of the training sample; The training sample is used as an anchor sample, and a reference sample is determined according to other determined training samples, and at least one sample combination corresponding to the training sample is obtained by combining; Inputting the training sample into the image risk control model to be trained, and determining the multi-dimensional image features of the image data through the feature extraction layer of the image risk control model, specifically including: Inputting the sample combination into the image risk control model to be trained, and determining the multi-dimensional image features of the anchor sample and the reference sample in the sample combination respectively through the feature extraction layer of the image risk control model; Inputting the multi-dimensional image features into the target detection layer, and determining the predicted detection frame and the detection frame classification output by the target detection layer, specifically includes: Inputting the reference sample in the sample combination into the reference subnet of the target detection layer to determine the common features of the significant targets in the reference sample; The anchor samples and the common features in the sample combination are input into the segmentation subnet of the target detection layer, and the output predicted detection box and detection box classification are determined as the predicted detection box and detection box classification of the training sample.
9. An image wind control device, comprising A preparation module determines a training sample constructed based on image data and an image risk control model to be trained, wherein the image risk control model consists of a feature extraction layer, a target detection layer, and an image classification layer; A feature extraction module inputs the training sample into the image risk control model to be trained, and determines the image features of the multi-dimensional size of the image data through the feature extraction layer of the image risk control model; A classification module, inputting the multi-dimensional image features into the target detection layer and the image classification layer respectively, determining the predicted detection box and the detection box classification output by the target detection layer, and determining the image classification result output by the image classification layer; The training and risk control module determines the comprehensive loss according to the output of the target detection layer, the output of the image classification layer and the annotation of the training samples, and trains the image risk control model based on the comprehensive loss. The trained image risk control model is used to perform image risk control tasks. The image to be risk controlled is input into the image risk control model, and the risk target object and image risk type of the image to be risk controlled are determined according to the detection box, detection box classification and image classification results output by the image risk control model to perform risk control.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
11. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 8.
12. A computer program product having at least one instruction stored thereon, characterized in that: When the at least one instruction is executed by the processor, the steps of the method described in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Target detection method and device
CN116012811A
Abnormality detection model training method and device, equipment and storage medium
CN116152933A
Model training method and device, electronic equipment and storage medium
CN117475253A
End-to-end weakly supervised semantic segmentation and labeling method for pathological image
WO2024060416A1