Content recognition model processing method, content recognition method, equipment and storage medium
By optimizing the content recognition model through iterative training and knowledge distillation, combined with data enhancement and label prediction, it solves the problem of poor recognition results in traditional recognition tasks and achieves fine-grained recognition of image content.
Patent Information
- Application Number
- CN202410747554.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-30
AI Technical Summary
Traditional image content recognition tasks are difficult to identify specific violations of image content in a fine-grained manner, resulting in poor recognition results.
By obtaining the content recognition model to be trained, including the pre-trained backbone model and the branch model to be trained, iterative training and knowledge distillation are performed, combined with data enhancement and label prediction models, to optimize the content recognition model to improve recognition performance.
The performance of the content recognition model is significantly improved, fine-grained recognition of image content is achieved, and the recognition effect is improved.
Smart Images

Figure CN118570548A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a content recognition model processing method, a content recognition method, an apparatus, a computer device, a storage medium, and a computer program product. Background Art
[0002] As security audits of image and video content are gaining more and more attention, and as artificial intelligence technology develops rapidly, security audit staff are beginning to use artificial intelligence technology to implement image content recognition tasks. Image content recognition tasks are to identify abstract concept categories of objects in images (such as normal behavior, illegal behavior, etc.).
[0003] Since image content recognition tasks usually involve multiple entities and it is difficult to extract common image features from the abstract concepts expressed by the entities, content recognition tasks are very difficult. Therefore, traditional image content recognition tasks usually use artificial intelligence models to perform simple content category classification on images, which cannot identify specific violations of image content in a fine-grained manner, reducing the image content recognition effect. Summary of the invention
[0004] Based on this, it is necessary to provide a content recognition model processing method, a content recognition method, an apparatus, a computer device, a computer-readable storage medium and a computer program product to address the above technical issues.
[0005] In a first aspect, the present application provides a content recognition model processing method. The method comprises:
[0006] Acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained;
[0007] Iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image to obtain a trained branch model;
[0008] Based on a historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model;
[0009] The content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model.
[0010] In one embodiment, iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image includes:
[0011] encoding the sample image through the pre-trained backbone model to obtain embedded features of the sample image;
[0012] Performing content recognition on the sample image and the embedded features through the branch model to be trained to obtain a predicted content label of the sample image;
[0013] The model parameters of the branch model to be trained are iteratively updated according to the predicted content label and the sample content label.
[0014] In one embodiment, based on a historical content recognition model used for content recognition, knowledge distillation is performed on the trained branch model in the content recognition model, including:
[0015] Inputting an enhanced image obtained by performing data enhancement on the sample image into the historical content recognition model to obtain a predicted content label of the enhanced image output by the historical content recognition model;
[0016] Processing the enhanced image by the pre-trained trunk model and the trained branch model respectively to obtain a predicted content label of the enhanced image output by the trained branch model and a confidence level of the predicted content label of the enhanced image output by the trained branch model;
[0017] The trained branch model in the content recognition model is iteratively trained according to the predicted content label of the enhanced image output by the historical content recognition model and the confidence of the predicted content label of the enhanced image output by the trained branch model, as well as the predicted content label of the enhanced image output by the trained branch model and the sample content label corresponding to the enhanced image.
[0018] In one embodiment, it also includes:
[0019] Removing the selected area in the sample image to obtain the enhanced image;
[0020] Alternatively, pixel blending processing is performed on any two of the sample images to obtain the enhanced image;
[0021] Alternatively, pixel replacement processing is performed on a selected area in the sample image to obtain the enhanced image.
[0022] In one embodiment, it also includes:
[0023] Inputting the sample images into a plurality of pre-trained label prediction models respectively to obtain a plurality of candidate content labels of the sample images and a confidence level of each of the candidate content labels;
[0024] Based on the confidence of the candidate content labels, a sample content label corresponding to the sample image is determined from a plurality of the candidate content labels.
[0025] In one embodiment, the pre-trained label prediction model is obtained by:
[0026] Based on the sample image and the target content label corresponding to the sample image, the label prediction model to be trained is trained to obtain a first label prediction model; the labeling accuracy of the target content label is better than the labeling accuracy of the sample content label;
[0027] Annotating the sample image by using the first label prediction model to obtain a sample content label corresponding to the sample image; training the label prediction model to be trained based on the sample image, the sample content label and the target content label to obtain a second label prediction model;
[0028] Based on the sample image and the target content label, the second label prediction model is fine-tuned to obtain the pre-trained label prediction model.
[0029] In one embodiment, determining the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model includes:
[0030] Inputting the test image into the current content recognition model to obtain a first predicted content label of the test image; inputting the test image into the historical content recognition model to obtain a second predicted content label of the test image;
[0031] determining a first performance evaluation result of the current content recognition model according to a difference between the first predicted content label and the target content label corresponding to the test image, and determining a second performance evaluation result of the historical recognition model according to a difference between the second predicted content label and the target content label corresponding to the test image;
[0032] According to the first performance evaluation result and the second performance evaluation result, a content recognition model with better performance is selected from the current content recognition model and the historical content recognition model as a target content recognition model.
[0033] In one embodiment, after determining the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model, the method further includes:
[0034] Performing model encapsulation processing on the target content recognition model to obtain an encapsulated target content recognition model;
[0035] The encapsulated target content recognition model is deployed in the target scene.
[0036] In a second aspect, the present application also provides a content identification method. The method comprises:
[0037] Classify the image to be identified by using an image classification model to obtain a classification result of the image to be identified;
[0038] If the classification result indicates that the security audit of the image to be identified fails, content identification is performed on the image to be identified by a target content identification model to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the steps of the content identification model processing method described in the first aspect;
[0039] The image to be identified is processed according to the target predicted content label.
[0040] In a third aspect, the present application also provides a content recognition model processing device. The device comprises:
[0041] A data acquisition module, used to acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained;
[0042] A model training module, used for iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image, to obtain a trained branch model;
[0043] A model distillation module, which is used for a historical content recognition model that performs content recognition based on history, and performs knowledge distillation on the trained branch model in the content recognition model to obtain a trained current content recognition model;
[0044] The model determination module is used to determine the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model.
[0045] In a fourth aspect, the present application further provides a content identification device. The device comprises:
[0046] An image classification module is used to classify the image to be identified through an image classification model to obtain a classification result of the image to be identified;
[0047] a content recognition module, configured to perform content recognition on the image to be recognized by using a target content recognition model to obtain a target predicted content label of the image to be recognized if the classification result indicates that the image to be recognized has failed the security review; the target content recognition model is trained by the steps of the content recognition model processing method described in the first aspect;
[0048] The image processing module is used to process the image to be identified according to the target predicted content label.
[0049] In a fifth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0050] Acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained;
[0051] Iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image to obtain a trained branch model;
[0052] Based on a historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model;
[0053] The content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model.
[0054] In a sixth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0055] Classify the image to be identified by using an image classification model to obtain a classification result of the image to be identified;
[0056] If the classification result indicates that the security audit of the image to be identified fails, content identification is performed on the image to be identified by a target content identification model to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the steps of the content identification model processing method described in the first aspect;
[0057] The image to be identified is processed according to the target predicted content label.
[0058] In a seventh aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0059] Acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained;
[0060] Iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image to obtain a trained branch model;
[0061] Based on a historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model;
[0062] The content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model.
[0063] In an eighth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0064] Classify the image to be identified by using an image classification model to obtain a classification result of the image to be identified;
[0065] If the classification result indicates that the security audit of the image to be identified fails, content identification is performed on the image to be identified by a target content identification model to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the steps of the content identification model processing method described in the first aspect;
[0066] The image to be identified is processed according to the target predicted content label.
[0067] In a ninth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0068] Acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained;
[0069] Iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image to obtain a trained branch model;
[0070] Based on a historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model;
[0071] The content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model.
[0072] In a tenth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0073] Classify the image to be identified by using an image classification model to obtain a classification result of the image to be identified;
[0074] If the classification result indicates that the security audit of the image to be identified fails, content identification is performed on the image to be identified by a target content identification model to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the steps of the content identification model processing method described in the first aspect;
[0075] The image to be identified is processed according to the target predicted content label.
[0076] The above-mentioned content recognition model processing method, content recognition method, device, computer equipment, storage medium and computer program product obtain a content recognition model to be trained, the content recognition model includes a pre-trained trunk model and a branch model to be trained; according to the sample image and the sample content label corresponding to the sample image, the branch model to be trained in the content recognition model is iteratively trained to obtain a trained branch model; based on the historical content recognition model for content recognition in history, the trained branch model in the content recognition model is knowledge distilled to obtain a trained current content recognition model; the content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model. By adopting this method, the trained branch model is first obtained by processing the sample image, and then the experience of the historical content recognition model is transferred to the trained branch model through the knowledge distillation technology, which greatly improves the model performance of the trained branch model, and then by comparing the model performance of the current content recognition model and the historical content recognition model, the model with better performance is selected as the target content recognition model, thereby realizing iterative optimization of the content recognition model. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] Figure 1 A flowchart of a content identification model processing method in one embodiment;
[0078] Figure 2A flowchart of a content identification model processing process in one embodiment;
[0079] Figure 3 A schematic diagram of a flow chart of steps for obtaining a trained branch model in one embodiment;
[0080] Figure 4 A schematic diagram of the structure of a content identification model in one embodiment;
[0081] Figure 5 A schematic diagram of a knowledge distillation process for a trained branch model in one embodiment;
[0082] Figure 6 A schematic diagram of a process of obtaining a sample content label corresponding to a sample image in one embodiment;
[0083] Figure 7 A flowchart of a content recognition model processing method in another embodiment;
[0084] Figure 8 A flowchart of a content identification model processing method in one embodiment;
[0085] Fig. 9 A flowchart of a content recognition model processing method in another embodiment;
[0086] Fig.10 is a structural block diagram of a content recognition model processing device in one embodiment;
[0087] Fig.11 is a structural block diagram of a content recognition model processing device in one embodiment;
[0088] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0089] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0090] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0091] In one embodiment, Figure 1As shown, a content recognition model processing method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0092] Step S101, obtaining a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained.
[0093] The backbone model is the Backbone in the content recognition model, which is used to provide the embedding (the process of mapping a high-dimensional image to a low-dimensional image) with generalization, encoding and migration capabilities. The branch model is the Head in the content recognition model; the branch model includes a classification model and a detection model. The classification Head is mainly used to detect (one or more) content categories of the image and the scores corresponding to (one or more) content categories; the detection Head is mainly used to detect (one or more) sensitive parts in the image and the scores corresponding to (one or more) sensitive parts.
[0094] Specifically, Figure 2 The figure is a flowchart of the content recognition model processing process. The terminal can use AIGC (Artificial Intelligence Generated Content) technology to generate images containing sensitive behaviors (such as behaviors that violate public order and morality, illegal behaviors, or illegal behaviors) as sample images. The terminal processes the sample content labels corresponding to each sample image by means of data reflux, and then uses the sample images and sample content labels to construct training sets and test sets. Among them, the terminal uses the sample content labels obtained by weak labeling to train the semi-supervised label prediction model, and uses the semi-supervised label prediction model to label the collected sample images, thereby forming data reflux.
[0095] Among them, sample images refer to image data used to train content recognition models. Sample images can be set according to recognition requirements. For example, if the content recognition model is trained to identify sensitive behaviors (such as behaviors that violate public order and good morals, illegal behaviors, or illegal behaviors), images containing such sensitive behaviors can be obtained as sample images. Sample content labels refer to labels used to describe relevant information such as the category of content involved in the sample image, the score corresponding to the category, etc.; for example, sample content labels include the category of the content involved, the category of sensitive parts, etc. The same is true for predicted content labels.
[0096] Furthermore, the terminal can build a pre-trained backbone model based on the visual encoder of CLIP (Contrastive Language-Image Pre-training); on the basis of the backbone model, a classification model and a detection model are added as branch models, that is, the classification model and the detection model share a backbone model to reduce the number of parameters of the backbone model; the classification model in the branch model can be constructed based on a conventional image classification Head, and the classification model includes a fully connected layer, a Softmax (an activation function) layer, a multi-layer perceptron, a Dropout (random inactivation) layer, a Batch Normalization (batch normalization) layer and an auxiliary classifier layer; the detection model can be modified based on the Detection Transformer (DETR) model, discarding the CNN (Convolutional Neural Networks) backbone in the DETR model, and only retaining the Transformer Encoder (an encoder), Transformer Decoder (a decoder) and FFN (Feedforward Neural Network) prediction layer as the detection model.
[0097] Step S102, iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image, to obtain a trained branch model.
[0098] It should be noted that the branch model in the content recognition model is a plug-in structure. One or more branch models can be added according to actual needs. During the training process, only the model parameters of the branch model are updated, and the model parameters of the trunk model are not updated. In addition, the model parameters of each branch model can be updated independently, that is, the model parameters of only one branch model can be updated at a time.
[0099] Specifically, the terminal inputs the sample image into the pre-trained backbone model of the content recognition model, and then inputs the output result of the backbone network and the sample image into the branch model to be trained of the content recognition model, and then the branch model to be trained outputs the predicted content label of the sample image. Based on the difference between the predicted content label of the sample image and the sample content label, the terminal iteratively updates the model parameters of the branch model to be trained to obtain the trained branch model.
[0100] Step S103, based on the historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model.
[0101] The historical content recognition model refers to the content recognition model that has been deployed and put into use in the past. The content recognition model refers to the model used to identify sensitive behaviors in images (such as behaviors that violate public order and good morals, illegal behaviors, or illegal behaviors).
[0102] Specifically, after training and a period of use, the historical content recognition model has acquired rich experience in content recognition in actual application scenarios. In order to avoid the poor processing effect of the trained branch model on the old data of the actual application scenario, the terminal also uses multiple historical content recognition models as teacher models and the trained branch model as the student model. The knowledge of multiple historical content recognition models is used to guide the re-training of the trained branch model, so that the trained branch model not only has good content recognition capabilities for new sample images, but also has excellent content recognition capabilities for old data in actual application scenarios. The pre-trained trunk model and the trained branch model are connected to form the current content recognition model.
[0103] Step S104: determine the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model.
[0104] The target content recognition model refers to a content recognition model with better performance obtained through this processing.
[0105] Specifically, the terminal uses a test set to test the model performance of the current content recognition model and the historical content recognition model respectively; based on the model performance, the best one is selected as the target content recognition model.
[0106] In the above-mentioned content recognition model processing method, the trained branch model is first obtained by using sample image processing, and then the experience of the historical content recognition model is transferred to the trained branch model through knowledge distillation technology, which greatly improves the model performance of the trained branch model. Then, by comparing the model performance of the current content recognition model and the historical content recognition model, the model with better model performance is selected as the target content recognition model, thereby realizing iterative optimization of the content recognition model.
[0107] In one embodiment, Figure 3 As shown, the above step S102, according to the sample image and the sample content label corresponding to the sample image, iteratively trains the branch model to be trained in the content recognition model, which specifically includes the following contents:
[0108] Step S301, encoding the sample image through the pre-trained backbone model to obtain the embedded features of the sample image.
[0109] Specifically, the terminal removes the text encoder in the traditional CLIP model to reduce the number of parameters of the backbone model, and encodes the sample image through the visual encoder in the CLIP model (i.e., the pre-trained backbone model). The visual encoder of the CLIP model has the ability of abstract semantic understanding and can embed the image into a shared feature space, making the features of related images closer in the feature space, and finally outputting the embedded features of the sample image.
[0110] Step S302: Perform content recognition on the sample image and the embedded features through the branch model to be trained to obtain a predicted content label of the sample image.
[0111] Specifically, the terminal inputs the sample image and the embedded features output by the pre-trained backbone network into the branch model to be trained, and the branch model to be trained outputs the predicted content category of the sample image and the predicted category score corresponding to the predicted content category, as well as the predicted sensitive part and the predicted part score corresponding to the predicted sensitive part; the terminal can use the predicted content category and the predicted category score, as well as the predicted sensitive part and the predicted part score corresponding to the predicted sensitive part as predicted content labels.
[0112] In actual applications, the terminal can also build a content recognition model based on the Vision Transformer (ViT) framework to identify and score sensitive behaviors of input images through the VIT framework-assisted branch model. Compared with the traditional CNN model, the above-mentioned content recognition model based on the VIT framework has better processing performance for visual tasks, especially when the amount of data is larger, the advantage of the content recognition model based on the VIT framework over the CNN model is more obvious.
[0113] Step S303: iteratively update the model parameters of the branch model to be trained according to the predicted content label and the sample content label.
[0114] Specifically, the terminal calculates the loss value of each branch model to be trained based on the predicted content label and sample content label output by each branch model to be trained; and then updates the model parameters of the branch model to be trained based on the loss value to obtain the trained branch model. It should be noted that during the training of the branch model, the model parameters of the pre-trained trunk model are not updated.
[0115] For example, Figure 4 It is a structural diagram of the content recognition model, such as Figure 4As shown, the terminal inputs the output results of the trunk model into each branch model connected to the branch model, wherein the branch model includes classification model 1, classification model 2, detection model 1 and detection model 2. Classification model 1 is used to output the scores of images (such as sample images, images to be identified) in predicted content categories such as violation, sexy, and normal; classification model 2 is used to output the scores of images in predicted content categories such as cartoons, animations, and works of art; detection model 1 is used to output the scores of images in sensitive parts of the human body such as the chest, buttocks, and triangle area; detection model 2 is used to output the scores of images in sensitive parts of the human body such as limbs.
[0116] In this embodiment, the sample image is encoded by a pre-trained backbone model with strong abstract semantic understanding ability to obtain embedded features related to sensitive tasks in the image; then, the sample image and the embedded features are subjected to content recognition through the branch model to be trained to obtain a predicted content label of the sample image, and the predicted content label and the sample content label are used to update the model parameters of the branch model to be trained, so that the trained branch model can perform content recognition for specific predicted content categories or sensitive parts, thereby improving the processing capability of the branch model for image recognition.
[0117] In one embodiment, the above-mentioned step S103 performs knowledge distillation on the trained branch model in the content recognition model based on the historical content recognition model used for content recognition, which specifically includes the following contents: inputting the enhanced image obtained by data enhancement of the sample image into the historical content recognition model to obtain the predicted content label of the enhanced image output by the historical content recognition model; processing the enhanced image by the pre-trained trunk model and the trained branch model respectively to obtain the predicted content label of the enhanced image output by the trained branch model, and the confidence of the predicted content label of the enhanced image output by the trained branch model; iteratively training the trained branch model in the content recognition model according to the predicted content label of the enhanced image output by the historical content recognition model and the confidence of the predicted content label of the enhanced image output by the trained branch model, as well as the predicted content label of the enhanced image output by the trained branch model and the sample content label corresponding to the enhanced image.
[0118] Specifically, Figure 5 This is a schematic diagram of the knowledge distillation process for the trained branch model. Figure 5As shown, the terminal first performs data enhancement on the sample image in different directions through a variety of data enhancement algorithms to obtain rich and diverse enhanced images. Then the terminal uses the normalization layer (Softmax function) of the historical content recognition model to output the predicted content label of the enhanced image. The predicted content label of the enhanced image output by the normalization layer of the historical content recognition model can be set as the soft label corresponding to the enhanced image. The normalization layer (Softmax function) of the pre-trained trunk model and the trained branch model outputs the predicted content label of the enhanced image and the predicted content label confidence of the enhanced image. The predicted content label confidence of the enhanced image output by the normalization layer of the trained branch model can be set as the predicted soft label of the enhanced image, and the predicted content label of the enhanced image output by the normalization layer of the trained branch model can also be set as the predicted hard label. The terminal calculates the first loss value of the trained branch model according to the soft label and the predicted soft label; calculates the second loss value of the trained branch model according to the predicted hard label and the sample content label corresponding to the enhanced image; and performs weighted summation of the first loss value and the second loss value to obtain the target loss value of the trained branch model. The terminal iteratively updates the model parameters of the trained branch model based on the target loss value. After multiple rounds of iterations, the terminal obtains the trained branch model.
[0119] In this embodiment, the knowledge distillation process is performed on the trained branch model using the enhanced image, which can improve the generalization performance of the trained branch model and improve the adaptability of the trained branch model to perform content recognition tasks on different types of images. The experience of the historical content recognition model is transferred to the trained branch model through the knowledge distillation technology, which greatly improves the model performance of the trained branch model.
[0120] In one embodiment, it also includes: removing the selected area in the sample image to obtain an enhanced image; or, performing pixel blending processing on any two sample images to obtain an enhanced image; or, performing pixel replacement processing on the selected area in the sample image to obtain an enhanced image.
[0121] Specifically, the terminal can perform data enhancement on the sample image through the Random Erasing algorithm; the terminal randomly selects a rectangular area in the sample image and sets the pixel value of the rectangular area to random noise or zero, and the terminal obtains an enhanced image of the randomly erased area. Further, the terminal can perform data enhancement on the sample image through the RandomMixup algorithm; the terminal randomly selects two different sample images from multiple sample images, linearly mixes their pixel values in a certain proportion, and mixes their sample content labels in the same proportion, and the terminal obtains an enhanced image of the randomly mixed area. Further, the terminal can perform data enhancement on the sample image through the RandomCutmix algorithm; the terminal randomly selects two different sample images from multiple sample images, randomly selects a rectangular area, and replaces the pixel values in the rectangular area with the pixel values of the corresponding area of another sample image, and the terminal obtains an enhanced image of the randomly cut and mixed area.
[0122] In this embodiment, the enhanced image training branch model is obtained by processing with a random erasing algorithm, so that the branch model can learn to perform content recognition processing when some information is missing. The enhanced image training branch model is obtained by processing with a random mixing algorithm, so that the branch model can better learn the relationship between different labels. The enhanced image training branch model is obtained by processing with a random fitting mixing algorithm, so that the branch model can enhance its attention to local information of the image, thereby improving the robustness and generalization ability of the trained branch model.
[0123] In one embodiment, the method further includes: inputting the sample image into a plurality of pre-trained label prediction models respectively to obtain a plurality of candidate content labels of the sample image and the confidence of each candidate content label; and determining a sample content label corresponding to the sample image from the plurality of candidate content labels based on the confidence of the candidate content label.
[0124] The label prediction model refers to a model used to label sample images. The label prediction model can label the content category, sensitive parts and other information corresponding to the sample image.
[0125] Specifically, the terminal inputs the sample image into multiple pre-trained label prediction models respectively, obtains the candidate content label output by each pre-trained label prediction model and the confidence of the candidate content label. Based on the confidence of each candidate content label, the terminal selects the candidate content label with the highest confidence from the multiple candidate content labels and sets it as the sample content label corresponding to the sample image.
[0126] In actual applications, the terminal can build a label prediction model for annotating content categories through ResNet-152 (residual network), Swin-Large (a large deep neural network model based on Transformer architecture) and ensemble (integrated model). The terminal can also build a label prediction model for annotating sensitive parts through Co-DETR (a collaborative target detection model), Internlmage-H (an image processing model) and ensemble. The label prediction model is different from the content recognition model. The label prediction model is built based on a large model with a large number of parameters, while the content recognition model is built using a model with a small number of parameters and strong semantic understanding ability, so as to reduce the application cost of the content recognition model and improve the recognition speed of the content recognition model.
[0127] In this embodiment, multiple pre-trained label prediction models are used to obtain multiple candidate content labels of the sample image and the confidence of each candidate content label; then based on the confidence of the candidate content label, the sample content label corresponding to the sample image is determined from the multiple candidate content labels, thereby realizing automatic labeling of the sample image and providing accurate and reliable label information for the subsequent training of the content recognition model.
[0128] In one embodiment, the pre-trained label prediction model is obtained in the following manner: based on the sample image and the target content label corresponding to the sample image, the label prediction model to be trained is trained to obtain a first label prediction model; the labeling accuracy of the target content label is better than the labeling accuracy of the sample content label; the sample image is labeled by the first label prediction model to obtain the sample content label corresponding to the sample image; based on the sample image, the sample content label and the target content label, the label prediction model to be trained is trained to obtain a second label prediction model; based on the sample image and the target content label, the second label prediction model is fine-tuned to obtain the pre-trained label prediction model.
[0129] Specifically, Figure 6A flowchart for obtaining sample content labels corresponding to sample images. The terminal preferentially uses difficult samples that have a greater effect on model iteration as sample images, which can be obtained through manual review, random inspection, reporting, etc.; among them, there are three types of difficult samples: one is illegal images that cannot be identified by the historical content recognition model; the second is illegal images that can be identified by the historical content recognition model but have a relatively low score; the third is images that are misidentified by the historical content recognition model, that is, the image itself is not illegal, but is identified as illegal by the historical content recognition model. Obtain the target content label by manually annotating the sample image; iteratively train the label prediction model to be trained based on the sample image and the target content label corresponding to the sample image, and set the trained label prediction model as the first label prediction model. The terminal inputs the unlabeled sample image into multiple first label prediction models to annotate the unlabeled sample image through multiple first label prediction models to obtain its corresponding sample content label. The terminal constructs a mixed training set using sample images with manually labeled target content labels and sample images with model labeled sample content labels; the sample content labels can be regarded as weak labels in semi-supervised learning, and the terminal performs incremental training on the label prediction model to be trained based on the mixed training set, and sets the trained label prediction model as the second label prediction model. In addition, the second label prediction model can also participate in the process of labeling unlabeled sample images together with the first label prediction model, and the principle of this process is the same as that of the above step S101. Finally, the terminal uses sample images with manually labeled target content labels to fine-tune the second label prediction model that has undergone multiple trainings to obtain a pre-trained label prediction model.
[0130] In this embodiment, a first label prediction model is trained based on sample images and target content labels with higher annotation accuracy; then, sample content labels are annotated by multiple first label prediction models; semi-supervised learning is performed based on sample images, sample content labels and target content labels to obtain a second label prediction model; finally, based on the sample images and target content labels, the second label prediction model is fine-tuned and trained so that the pre-trained label prediction model can accurately annotate the sample content labels of the sample images.
[0131] In one embodiment, the above step S104, in which the content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model, specifically includes the following contents: inputting the test image into the current content recognition model to obtain a first predicted content label of the test image; inputting the test image into the historical content recognition model to obtain a second predicted content label of the test image; determining a first performance evaluation result of the current content recognition model based on the difference between the first predicted content label and the target content label corresponding to the test image, and determining a second performance evaluation result of the historical recognition model based on the difference between the second predicted content label and the target content label corresponding to the test image; and selecting the content recognition model with better performance from the current content recognition model and the historical content recognition model as the target content recognition model based on the first performance evaluation result and the second performance evaluation result.
[0132] Specifically, the terminal obtains a first performance evaluation result of the current content recognition model through a test image test. Similarly, the terminal obtains a second performance evaluation result of the historical content recognition model through a test image test. The terminal compares the first performance evaluation result and the second performance evaluation result; if the first performance evaluation result is better than the second performance evaluation result, the current content recognition model is set as the target content recognition model; if the second performance evaluation result is better than the first performance evaluation result, the historical content recognition model is set as the target content recognition model.
[0133] In this embodiment, after the current content recognition model is newly obtained, the performance of the current content recognition model and the historical recognition model are evaluated and compared, so as to select the best one from the current content recognition model and the historical content recognition model as the target content recognition model, thereby realizing the continuous improvement and optimization of the content recognition model.
[0134] In one embodiment, in the above step S104, after determining the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model, it also includes: performing model encapsulation processing on the target content recognition model to obtain an encapsulated target content recognition model; and deploying the encapsulated target content recognition model to the target scene.
[0135] The target scene may be a scene for performing sensitive behavior recognition on online images.
[0136] Specifically, after obtaining the target content recognition model, the terminal can also quantify the target content recognition model, reduce the number of parameters, adapt the service, and encapsulate the processed target content recognition model to obtain a packaged target content recognition model; deploy the packaged target content recognition model to the target scene to continue to provide content recognition services (such as services for identifying sensitive behaviors) in the target scene through the target content recognition model.
[0137] In this embodiment, by encapsulating the target content recognition model, the number of parameters of the target content recognition model can be further reduced, the application cost of the target content recognition model can be reduced, and then the target content recognition model with better model performance can be used to continue to provide content recognition services for the target scene.
[0138] In one embodiment, Figure 7 As shown, another content recognition model processing method is provided, which is described by taking the method applied to a terminal as an example, and includes the following steps:
[0139] Step S701: input the sample image into a plurality of pre-trained label prediction models respectively to obtain a plurality of candidate content labels of the sample image and the confidence of each candidate content label.
[0140] Step S702 : determining a sample content label corresponding to the sample image from a plurality of candidate content labels based on the confidence of the candidate content labels.
[0141] Step S703, iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image, to obtain a trained branch model.
[0142] Step S704, based on the historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model.
[0143] Step S705: determine the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model.
[0144] Step S706, performing model encapsulation processing on the target content recognition model to obtain an encapsulated target content recognition model; and deploying the encapsulated target content recognition model to the target scene.
[0145] The above-mentioned content recognition model processing method can achieve the following beneficial effects: first, the trained branch model is obtained by using sample image processing, and then the experience of the historical content recognition model is transferred to the trained branch model through knowledge distillation technology, which greatly improves the model performance of the trained branch model. Then, by comparing the model performance of the current content recognition model and the historical content recognition model, the model with better performance is selected as the target content recognition model, thereby realizing iterative optimization of the content recognition model.
[0146] In one embodiment, Figure 8 As shown, a content identification method is provided. This embodiment takes the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0147] Step S801, classify the image to be identified through the image classification model to obtain the classification result of the image to be identified.
[0148] The image classification model refers to a model used to perform coarse-grained classification processing on an image (eg, an image to be identified).
[0149] Specifically, the terminal inputs the image to be identified into the image classification model, and the image classification model outputs the classification result of the image to be identified. The classification result includes categories that are more coarse-grained than content labels, such as normal, illegal, and vulgar.
[0150] Step S802, if the classification result indicates that the security review of the image to be identified has not passed, the target content identification model is used to perform content identification on the image to be identified to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the above-mentioned content identification model processing method.
[0151] Specifically, if the terminal detects that the classification result of the image to be identified is not normal, it indicates that the security review of the image to be identified has failed. Then the terminal inputs the image to be identified into the target content recognition model deployed in the target scene for content recognition, and the target content recognition model outputs the target predicted content label of the image to be identified.
[0152] Step S803: Process the image to be identified according to the target predicted content label.
[0153] Specifically, the terminal can set different audit policies for different target prediction content tags, such as setting the audit policy according to the score in the target prediction content tag, or setting the audit policy according to the content type in the target prediction content tag. The terminal processes the image to be identified according to the audit policy corresponding to the target prediction content tag, such as removing the image to be identified, or replacing the image to be identified with an image that has passed the security audit.
[0154] In the above content recognition method, the image to be recognized is classified and processed by the image classification model to obtain the classification result of the image to be recognized; if the classification result indicates that the security audit of the image to be recognized is not passed, the target content recognition model is used to perform content recognition on the image to be recognized to obtain the target predicted content label of the image to be recognized; and then the image to be recognized is processed according to the target predicted content label. With this method, the image classification model is used to quickly filter out the images to be recognized that have passed the security audit, so that the deployed target content recognition model can be used to perform fine-grained content recognition on the images to be recognized that have not passed the security audit, so as to more accurately and comprehensively analyze the content type and sensitive part type of the image to be recognized, and then different processing measures are taken for the image to be recognized according to the actual situation of the target predicted content label, which improves the accuracy of content recognition of the image to be recognized and the processing efficiency of the image to be recognized.
[0155] In order to more clearly illustrate the content recognition method provided by the embodiment of the present disclosure, the above content recognition method is specifically described below with a specific embodiment. Fig. 9 As shown, another content identification method is provided, which can be applied to a terminal, and specifically includes the following contents:
[0156] For the images and video data uploaded in music-type computer products (such as music applications, music applets, etc.), the terminal first roughly classifies the normal images through the image classification model, and then uses the target content recognition model to identify and process the remaining illegal images for sensitive behaviors (such as behaviors that violate public order and good morals, illegal behaviors, or illegal behaviors), and obtains the scores of illegal images under different content types and sensitive part types, such as human body part scores, action type scores, object type scores, cartoon type scores, and AIGC type scores, and then the terminal obtains the target predicted content label of the illegal image. The terminal can also use the policy engine to determine the appropriate review strategy based on the content type, sensitive part type, and score of the illegal image, and execute the processing of the illegal image according to the review strategy, such as performing manual review processing or algorithm automatic processing.
[0157] In this embodiment, the deployed target content recognition model is used to perform fine-grained sensitive behavior recognition on images that fail the security review, so as to more accurately and comprehensively analyze the content type and sensitive part type of the image, and then take different processing measures for the image according to the actual situation of the target predicted content label, thereby improving the refinement of image recognition while also improving the efficiency of image identification and processing.
[0158] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0159] Based on the same inventive concept, the embodiment of the present application also provides a content recognition model processing device for implementing the content recognition model processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more content recognition model processing device embodiments provided below can refer to the limitations on the content recognition model processing method above, and will not be repeated here.
[0160] In one embodiment, Fig.10 As shown, a content recognition model processing device 1000 is provided, comprising: a data acquisition module 1001, a model training module 1002, a model distillation module 1003 and a model determination module 1004, wherein:
[0161] The data acquisition module 1001 is used to acquire a content recognition model to be trained. The content recognition model includes a pre-trained trunk model and a branch model to be trained.
[0162] The model training module 1002 is used to iteratively train the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image, so as to obtain the trained branch model.
[0163] The model distillation module 1003 is used for the historical content recognition model that performs content recognition based on history, and performs knowledge distillation on the trained branch model in the content recognition model to obtain the trained current content recognition model.
[0164] The model determination module 1004 is used to determine the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model.
[0165] In one embodiment, the model training module 1002 is also used to encode the sample image through the pre-trained trunk model to obtain the embedded features of the sample image; perform content recognition on the sample image and the embedded features through the branch model to be trained to obtain the predicted content label of the sample image; and iteratively update the model parameters of the branch model to be trained based on the predicted content label and the sample content label.
[0166] In one embodiment, the model distillation module 1003 is further used to input the enhanced image obtained by data enhancement of the sample image into the historical content recognition model to obtain the predicted content label of the enhanced image output by the historical content recognition model; process the enhanced image through the pre-trained trunk model and the trained branch model respectively to obtain the predicted content label of the enhanced image output by the trained branch model, and the confidence of the predicted content label of the enhanced image output by the trained branch model; iteratively train the trained branch model in the content recognition model according to the predicted content label of the enhanced image output by the historical content recognition model and the confidence of the predicted content label of the enhanced image output by the trained branch model, as well as the predicted content label of the enhanced image output by the trained branch model and the sample content label corresponding to the enhanced image.
[0167] In one embodiment, the content recognition model processing device 1000 also includes a data enhancement module, which is used to remove the selected area in the sample image to obtain an enhanced image; or, perform pixel blending processing on any two sample images to obtain an enhanced image; or, perform pixel replacement processing on the selected area in the sample image to obtain an enhanced image.
[0168] In one embodiment, the data acquisition module 1001 is further used to input the sample image into multiple pre-trained label prediction models respectively to obtain multiple candidate content labels of the sample image and the confidence of each candidate content label; based on the confidence of the candidate content label, determine the sample content label corresponding to the sample image from the multiple candidate content labels.
[0169] In one embodiment, the content recognition model processing device 1000 also includes a label processing module, which is used to train the label prediction model to be trained based on the sample image and the target content label corresponding to the sample image to obtain a first label prediction model; the labeling accuracy of the target content label is better than the labeling accuracy of the sample content label; the sample image is labeled by the first label prediction model to obtain the sample content label corresponding to the sample image; based on the sample image, the sample content label and the target content label, the label prediction model to be trained is trained to obtain a second label prediction model; based on the sample image and the target content label, the second label prediction model is fine-tuned to obtain a pre-trained label prediction model.
[0170] In one embodiment, the model determination module 1005 is also used to input the test image into the current content recognition model to obtain a first predicted content label of the test image; input the test image into the historical content recognition model to obtain a second predicted content label of the test image; determine a first performance evaluation result of the current content recognition model based on the difference between the first predicted content label and the target content label corresponding to the test image, and determine a second performance evaluation result of the historical recognition model based on the difference between the second predicted content label and the target content label corresponding to the test image; and select a content recognition model with better performance from the current content recognition model and the historical content recognition model as the target content recognition model based on the first performance evaluation result and the second performance evaluation result.
[0171] In one embodiment, the content recognition model processing device 1000 further includes a model deployment module, which is used to perform model encapsulation processing on the target content recognition model to obtain an encapsulated target content recognition model; and deploy the encapsulated target content recognition model to the target scene.
[0172] In one embodiment, Fig.11 As shown, a content recognition device 1100 is provided, comprising: an image classification module 1101, a content recognition module 1102 and an image processing module 1103, wherein:
[0173] The image classification module 1101 is used to classify the image to be identified through an image classification model to obtain a classification result of the image to be identified.
[0174] The content recognition module 1102 is used to perform content recognition on the image to be recognized by using a target content recognition model to obtain a target predicted content label of the image to be recognized if the classification result indicates that the security review of the image to be recognized has not passed.
[0175] The image processing module 1103 is used to process the image to be identified according to the target predicted content label.
[0176] The above-mentioned content recognition model processing device and each module in the content recognition device can be implemented in whole or in part by software, hardware and their combination. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0177] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a content recognition model processing method is implemented.
[0178] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0179] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0180] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0181] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0182] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0183] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0184] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A content recognition model processing method, characterized in that: The method comprises: Acquire a content recognition model to be trained, wherein the content recognition model includes a pre-trained trunk model and a branch model to be trained; Iteratively training the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image to obtain a trained branch model; Based on a historical content recognition model that performs content recognition in history, knowledge distillation is performed on the trained branch model in the content recognition model to obtain a trained current content recognition model; The content recognition model with better performance between the current content recognition model and the historical content recognition model is determined as the target content recognition model.
2. The method according to claim 1, characterized in that The iterative training of the branch model to be trained in the content recognition model according to the sample image and the sample content label corresponding to the sample image includes: encoding the sample image through the pre-trained backbone model to obtain embedded features of the sample image; Performing content recognition on the sample image and the embedded features through the branch model to be trained to obtain a predicted content label of the sample image; The model parameters of the branch model to be trained are iteratively updated according to the predicted content label and the sample content label.
3. The method according to claim 1, characterized in that The historical content recognition model for content recognition based on history performs knowledge distillation on the trained branch model in the content recognition model, including: Inputting an enhanced image obtained by performing data enhancement on the sample image into the historical content recognition model to obtain a predicted content label of the enhanced image output by the historical content recognition model; Processing the enhanced image by the pre-trained trunk model and the trained branch model respectively to obtain a predicted content label of the enhanced image output by the trained branch model and a confidence level of the predicted content label of the enhanced image output by the trained branch model; The trained branch model in the content recognition model is iteratively trained according to the predicted content label of the enhanced image output by the historical content recognition model and the confidence of the predicted content label of the enhanced image output by the trained branch model, as well as the predicted content label of the enhanced image output by the trained branch model and the sample content label corresponding to the enhanced image.
4. The method according to claim 3, characterized in that Also includes: Removing the selected area in the sample image to obtain the enhanced image; Alternatively, pixel blending processing is performed on any two of the sample images to obtain the enhanced image; Alternatively, pixel replacement processing is performed on a selected area in the sample image to obtain the enhanced image.
5. The method according to claim 1, characterized in that Also includes: Inputting the sample images into a plurality of pre-trained label prediction models respectively to obtain a plurality of candidate content labels of the sample images and a confidence level of each of the candidate content labels; Based on the confidence of the candidate content labels, a sample content label corresponding to the sample image is determined from a plurality of the candidate content labels.
6. The method according to claim 5, characterized in that The pre-trained label prediction model is obtained in the following way: Based on the sample image and the target content label corresponding to the sample image, the label prediction model to be trained is trained to obtain a first label prediction model; the labeling accuracy of the target content label is better than the labeling accuracy of the sample content label; Annotating the sample image by using the first label prediction model to obtain a sample content label corresponding to the sample image; training the label prediction model to be trained based on the sample image, the sample content label and the target content label to obtain a second label prediction model; Based on the sample image and the target content label, the second label prediction model is fine-tuned to obtain the pre-trained label prediction model.
7. The method according to claim 1, characterized in that The step of determining the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model includes: Inputting the test image into the current content recognition model to obtain a first predicted content label of the test image; inputting the test image into the historical content recognition model to obtain a second predicted content label of the test image; determining a first performance evaluation result of the current content recognition model according to a difference between the first predicted content label and the target content label corresponding to the test image, and determining a second performance evaluation result of the historical recognition model according to a difference between the second predicted content label and the target content label corresponding to the test image; According to the first performance evaluation result and the second performance evaluation result, a content recognition model with better performance is selected from the current content recognition model and the historical content recognition model as a target content recognition model.
8. The method according to any one of claims 1 to 7, characterized in that: After determining the content recognition model with better performance between the current content recognition model and the historical content recognition model as the target content recognition model, the method further includes: Performing model encapsulation processing on the target content recognition model to obtain an encapsulated target content recognition model; The encapsulated target content recognition model is deployed in the target scene.
9. A content identification method, characterized in that: The method comprises: Classify the image to be identified by using an image classification model to obtain a classification result of the image to be identified; If the classification result indicates that the security audit of the image to be identified has failed, content identification is performed on the image to be identified by a target content identification model to obtain a target predicted content label of the image to be identified; the target content identification model is trained by the steps of the content identification model processing method described in any one of claims 1 to 8; The image to be identified is processed according to the target predicted content label.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the content recognition model processing method described in any one of claims 1 to 8 or the steps of the content recognition method described in any one of claims 9 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the content recognition model processing method described in any one of claims 1 to 8 or the steps of the content recognition method described in any one of claims 9 are implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the content recognition model processing method described in any one of claims 1 to 8 or the steps of the content recognition method described in any one of claims 9 are implemented.
Citation Information
Patent Citations
Image processing and image classification method and device, equipment and storage medium
CN114693993A
Image recognition method and device, training method and device, electronic equipment and storage medium
CN116758618A
Incremental learning method based on knowledge distillation and parameter isolation
CN116883783A
Training method of image processing model, image processing method, equipment and medium
CN117391176A
Method for training text recognition model, method for recognizing text, and device for recognizing text
JP2022177242A
