Face abnormal expression recognition processing method and device
By using the ResNet50 network model to identify and judge the eyes and mouth features of the faces in the posters, the problem of abnormal expressions in the automated production of posters is solved, the quality and screening efficiency of the posters are improved, and the consistency of the poster image and the protection of the brand image are ensured.
Patent Information
- Application Number
- CN202410820832.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-10
AI Technical Summary
With the existing technology, in the automated production of posters in the TV or movie industry, abnormal expressions of celebrities are prone to occur during frame capture processing, which affects the image of the poster, resulting in a low screening rate and difficulty in effective identification and correction.
The pre-trained ResNet50 network model is used to identify the eyes and mouth features of the face in the poster image to determine whether it meets the preset requirements, including the state of the eyes and the expression of the mouth, and then determine whether the image is available.
The screening rate for posters has been improved to ensure that the facial expressions in the posters are natural and appropriate, to avoid the spread of low-quality or abnormal expressions, protect the brand image and improve production efficiency.
Smart Images

Figure CN118629079A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to a method, device, intelligent terminal and storage medium for identifying and processing abnormal facial expressions. Background Art
[0002] In the process of automated poster production in the TV or movie industry, the existing technology often uses a solution to cut frames of the entire film playback medium to identify whether there is a star in the corresponding cut frame. If there is a star, it can be used as the basic poster material. However, in this process, since the video is dynamic, it is very easy to cut frames to show abnormal expressions of stars, which affects their image and is not suitable for poster use.
[0003] Therefore, the existing technology still needs to be improved and developed. Summary of the invention
[0004] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a method, device, intelligent terminal and storage medium for identifying and processing abnormal facial expressions are provided. The present invention can identify whether the expression of the head portrait of a person in the image is abnormal, so as to quickly confirm whether it can be used as a poster, thereby improving the screening rate of poster use and providing convenience for users.
[0005] The technical solution adopted by the present invention to solve the problem is as follows:
[0006] A method for recognizing and processing abnormal facial expressions, comprising:
[0007] Get a poster image containing a human face portrait;
[0008] Using a pre-trained abnormal facial expression detection model, the face portrait on the poster image is detected to detect whether the quality characteristics of the poster image meet the preset requirements, whether the eye characteristics of the face portrait are abnormal, and whether the mouth characteristics of the face portrait are abnormal;
[0009] When it is detected that the quality characteristics of the poster image do not meet the preset requirements, and / or the eye characteristics of the facial avatar are detected to be abnormal, and / or the mouth characteristics of the facial avatar are detected to be abnormal, it is determined that the current poster image containing the facial avatar is unavailable.
[0010] The method for identifying and processing abnormal facial expressions, wherein the training step of the abnormal facial expression detection model comprises:
[0011] Preselect a specified number of labels of poster images containing human face portraits for annotation, wherein the annotation dimensions include: the first column marks whether the eyes are abnormal, the second column marks whether the mouth is abnormal, and the third column marks whether the image is normal;
[0012] After labeling, a labeled data set is obtained, and the labeled data set is divided into a training set and a test set data set;
[0013] The training set is input into the ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model.
[0014] The method for identifying abnormal facial expressions, wherein the steps of obtaining a labeled data set after labeling and dividing the labeled data set into a training set and a test set data set include:
[0015] Read all images and labels in the labeled dataset;
[0016] Read the image and transform it;
[0017] The preprocessing operations of the training set and the test set are defined, and the labeled data set is created as the training set and the test set data set.
[0018] The method for identifying abnormal facial expressions, wherein the step of inputting the training set into a ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model comprises:
[0019] Create training set and test set data loaders based on the divided training set and test set data sets;
[0020] Create a ResNet50 network model;
[0021] Create a ResNet50 network model, define loss function and optimizer;
[0022] And for the created ResNet50 network model, define the loss functions of coarse granularity, eye features and mouth features, and perform back propagation and parameter update.
[0023] The data of the training set is input into the defined ResNet50 network model for training to obtain the pre-trained abnormal facial expression detection model.
[0024] The method for identifying abnormal facial expressions, wherein the first column marking whether the eyes are abnormal includes:
[0025] When the eyes of a poster image containing a human face are detected to be half open and half closed, they are marked as 0 in the first column;
[0026] When the eyes of a poster image containing a human face are detected to be closed, it is marked as 1 in the first column;
[0027] When the eyes of a poster image containing a human face are detected to be open, it is marked as 2 in the first column;
[0028] When the eyes of a poster image containing a human face are detected to be squinting, it is marked as 3 in the first column;
[0029] When the eyes of a poster image containing a human face are detected as uncertain, they are marked as 4 in the first column;
[0030] When the eyes of a poster image containing a human face are detected as occluded, it is marked as 5 in the first column;
[0031] The second column indicates whether the mouth is abnormal and includes:
[0032] When the mouth of a poster image containing a human face is detected as pouting, it is marked as 0 in the second column;
[0033] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 1 in the second column;
[0034] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 2 in the second column;
[0035] When the mouth of a poster image containing a human face is detected to be wide open, it is marked as 3 in the second column;
[0036] When the mouth of a poster image containing a human face is detected to be slightly open, it is marked as 4 in the second column;
[0037] When the mouth of a poster image containing a human face is detected to be closed, it is marked as 5 in the second column;
[0038] The third column marks whether the image is normal and includes:
[0039] When the poster image containing a face portrait is detected as normal, it is marked as 0 in the third column;
[0040] When a poster image containing a human face portrait is detected as an anomaly, it is marked as 1 in the third column.
[0041] The method for identifying and processing abnormal facial expressions, wherein the steps of detecting the face portrait on the poster image through a pre-trained abnormal facial expression detection model, detecting whether the quality characteristics of the poster image meet the preset requirements, detecting whether the eye characteristics of the face portrait are abnormal, and detecting whether the mouth characteristics of the face portrait are abnormal include:
[0042] Detecting the face portrait on the poster image using a pre-trained abnormal facial expression detection model;
[0043] Performing coarse-grained image quality detection and judgment on the quality characteristics of the poster image to determine whether the quality characteristics of the poster image meet preset requirements;
[0044] Performing fine-grained eye feature judgment on the eye features of the face avatar in the poster image to determine whether the eye features of the face avatar are abnormal; wherein the determination of whether the eye features are abnormal includes: detecting whether the eye features are: half-open and half-closed state, closed eye state, open eye state, squinting state, uncertain state, and / or blocked state;
[0045] Performing fine-grained mouth feature judgment on the mouth features of the face avatar in the poster image to determine whether the mouth features of the face avatar are abnormal, wherein the judgment of whether the mouth features are abnormal includes: detecting whether the mouth features are: pouting state, grinning state, grinning state, wide open state, slightly open state and / or closed state.
[0046] The method for identifying abnormal facial expressions, wherein the step of determining that the current poster image containing the face avatar is unavailable when the quality feature of the poster image is detected to be not in compliance with preset requirements, and / or the eye feature of the face avatar is detected to be abnormal, and / or the mouth feature of the face avatar is detected to be abnormal, comprises:
[0047] When it is detected that the quality characteristics of the poster image do not meet the preset requirements, the preset requirements include: the resolution is too low than a predetermined value, blurry, distorted;
[0048] and / or when it is detected that the eye feature of the face avatar is abnormal, the abnormal eye feature includes an eye closed state, an eye half-open and half-closed state, an eye blinking state, and / or an eye blocked state;
[0049] and / or detecting that a mouth feature of the face avatar is abnormal, wherein the abnormal state of the mouth feature includes a pouting state, a grinning state, an open state and / or a closed state;
[0050] It is determined that the current poster image containing the face portrait is unavailable.
[0051] A device for identifying and processing abnormal facial expressions, wherein the device comprises:
[0052] An acquisition module, used for acquiring a poster image containing a human face portrait;
[0053] A network model detection module is used to detect the face portrait on the poster image through a pre-trained abnormal facial expression detection model to detect whether the quality characteristics of the poster image meet the preset requirements, detect whether the eye characteristics of the face portrait are abnormal, and detect whether the mouth characteristics of the face portrait are abnormal;
[0054] The face abnormality judgment module is used to determine that the poster image currently containing the face avatar is unavailable when the quality characteristics of the poster image are detected to be inconsistent with preset requirements, and / or the eye characteristics of the face avatar are detected to be abnormal, and / or the mouth characteristics of the face avatar are detected to be abnormal.
[0055] An intelligent terminal includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, including the method for executing any one of the methods described above.
[0056] A non-transitory computer-readable storage medium, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the methods described above.
[0057] Beneficial effects of the invention: The invention provides a method, device, intelligent terminal and storage medium for identifying and processing abnormal facial expressions. The invention can identify whether the expression of a person's head portrait in an image is abnormal, so as to quickly confirm whether it can be used as a poster, thereby improving the screening rate of poster use and providing convenience for users. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 It is a flowchart of a method for identifying and processing abnormal facial expressions provided by an embodiment of the present invention.
[0060] Figure 2 It is a schematic diagram of an abnormal facial expression recognition model processing method provided by an embodiment of the present invention.
[0061] Figure 3 It is a principle block diagram of an embodiment of a device for identifying and processing abnormal facial expressions provided by the present invention.
[0062] Figure 4 It is a block diagram of the internal structure principle of the intelligent terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0064] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0065] In the process of automated poster production in the television industry, the medium in which the entire film is played is used for frame processing to identify whether there are stars in the corresponding frames. If there are stars, they can be used as basic poster material.
[0066] The present invention is explained by taking the process of automated production of posters in the television or film industry as an example. In the automated production process, abnormal facial expression recognition technology is used to identify whether subtle facial expressions are abnormal, so as to screen out pictures with inappropriate expressions. For example, the moment when a person is about to open his mouth to speak, roll his eyes, or pout, can all be identified as abnormal expressions.
[0067] like Figure 1 As shown, a method for identifying abnormal facial expressions in Embodiment 1 of the present invention comprises the following steps:
[0068] Step S100, obtaining a poster image containing a face portrait;
[0069] In the embodiment of the present invention, poster generation is taken as an example to first obtain a poster image containing a face portrait. During specific implementation, the entire film or TV broadcast medium for which a poster needs to be generated can be subjected to frame capture processing to identify whether a star exists in the corresponding frame. If a star exists, the frame can be used as a basic poster material to obtain a poster image containing a face portrait.
[0070] Step S200, using a pre-trained abnormal facial expression detection model to detect the face portrait on the poster image, to detect whether the quality characteristics of the poster image meet the preset requirements, to detect whether the eye characteristics of the face portrait are abnormal, and to detect whether the mouth characteristics of the face portrait are abnormal;
[0071] In the step embodiment of the present invention, a pre-trained abnormal facial expression detection model is used to detect the face portrait on the poster image. First, the quality characteristics of the poster image are detected by the pre-trained abnormal facial expression detection model, such as checking the clarity and contrast of the image. Then, the model will analyze whether the eye characteristics of the face portrait are abnormal, such as detecting whether the eyes are closed, whether the blinking frequency is abnormal, etc. Finally, the model will detect whether the mouth characteristics of the face portrait are abnormal, such as detecting whether the expression of the mouth is appropriate, whether the degree of opening is abnormal, etc.
[0072] The embodiment of the present invention detects abnormal facial expressions through a pre-trained abnormal facial expression detection model, which helps to improve the quality of poster images and the authenticity of facial expressions. Through automated detection and analysis, image quality problems or abnormal facial expressions can be discovered in a timely manner, helping the producer to make corrections in a timely manner, thereby improving the overall visual effect and viewing experience.
[0073] For example, in advertising poster design, using a facial abnormal expression detection model can ensure that the facial expressions in the posters are natural and meet the design requirements. If the eye features of a facial avatar are detected to be abnormal, it may indicate that the image has problems such as blinking or closing the eyes, and needs to be replaced. Similarly, if the mouth features of a facial avatar are detected to be abnormal, it may indicate that the mouth shape or expression of the image does not meet expectations and also needs to be replaced. Through this automated anomaly detection method, problems can be discovered in time during the design stage and replaced or corrected, improving the quality and effect of advertising posters.
[0074] Step S300: When it is detected that the quality characteristics of the poster image do not meet the preset requirements, and / or the eye characteristics of the face avatar are detected to be abnormal, and / or the mouth characteristics of the face avatar are detected to be abnormal, it is determined that the current poster image containing the face avatar is unavailable.
[0075] In the embodiment of this step, when it is detected that the quality characteristics of the poster image do not meet the preset requirements, or the eye characteristics or mouth characteristics of the face avatar are abnormal, the present invention will determine that the poster image currently containing the face avatar is unavailable. Such a judgment is to ensure that when the poster image is displayed or released, the image quality and the authenticity of the facial expression are guaranteed to avoid problems that may cause negative impressions to the audience.
[0076] It can be seen that the embodiment of the present invention can prevent low-quality or abnormal expression poster images from being misused or spread through this strict judgment mechanism, thereby protecting the brand image and advertising effect. This also helps to improve the professional level and work efficiency of production staff, because they can find and correct problems in a timely manner to ensure the production of high-quality works.
[0077] For example, when a poster image is generated using an automated generation method, it contains a face avatar used to convey the emotion and information of the product. During the poster generation process, these poster images are detected using a face abnormal expression detection model. If the eye features of a poster image are abnormal, which may be caused by the closed eyes or blinking of the face avatar, the present invention will determine that the image is unusable to avoid the appearance of expressions that do not meet the requirements when it is published. This processing method can ensure that the poster images finally presented to the audience are of high quality and meet the requirements, thereby improving the advertising and marketing effects.
[0078] Furthermore, the method for recognizing abnormal facial expressions described in the embodiment of the present invention refers to Figure 2 As shown, the training steps of the abnormal facial expression detection model include:
[0079] S201, pre-selecting a specified number of labels of poster images containing human face portraits for annotation, wherein the annotation dimensions include: the first column annotating whether the eyes are abnormal, the second column annotating whether the mouth is abnormal, and the third column annotating whether the image is normal;
[0080] Specifically, regarding data annotation, in this embodiment, labels of 5,000 posters of celebrities can be annotated. Celebrities cover men, women, young and old, and are mainly divided into three dimensions, as shown in Table 1 below:
[0081] Table 1
[0082]
[0083] As shown in Table 1 above, the first column marking whether the eye is abnormal includes:
[0084] When the eyes of a poster image containing a human face are detected to be half open and half closed, they are marked as 0 in the first column;
[0085] When the eyes of a poster image containing a human face are detected to be closed, it is marked as 1 in the first column;
[0086] When the eyes of a poster image containing a human face are detected to be open, it is marked as 2 in the first column;
[0087] When the eyes of a poster image containing a human face are detected to be squinting, it is marked as 3 in the first column;
[0088] When the eyes of a poster image containing a human face are detected as uncertain, they are marked as 4 in the first column;
[0089] When the eyes of a poster image containing a human face are detected as occluded, it is marked as 5 in the first column;
[0090] The second column indicates whether the mouth is abnormal and includes:
[0091] When the mouth of a poster image containing a human face is detected as pouting, it is marked as 0 in the second column;
[0092] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 1 in the second column;
[0093] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 2 in the second column;
[0094] When the mouth of a poster image containing a human face is detected to be wide open, it is marked as 3 in the second column;
[0095] When the mouth of a poster image containing a human face is detected to be slightly open, it is marked as 4 in the second column;
[0096] When the mouth of a poster image containing a human face is detected to be closed, it is marked as 5 in the second column;
[0097] The third column marks whether the image is normal or not, including:
[0098] When the poster image containing a face portrait is detected as normal, it is marked as 0 in the third column;
[0099] When a poster image containing a human face is detected as abnormal, it is marked as 1 in the third column.
[0100] After labeling, we obtain the labeled dataset.
[0101] S202, after labeling, obtain a labeled data set, and divide the labeled data set into a training set and a test set data set;
[0102] In this step, the labeled data set is used to train the model and evaluate the performance of the model. The labeled data set obtained after labeling includes the input data and the corresponding label or category information, which is the key data required for training and testing the model.
[0103] The purpose of dividing the labeled dataset into a training set and a test set is to better evaluate the performance and generalization ability of the model. The training set is used to train the parameters of the model, while the test set is used to evaluate the performance of the model on unseen data.
[0104] This step embodiment divides the labeled data set into a training set and a test set, so as to better evaluate the performance of the model on unseen data, thereby better understanding the generalization ability of the model.
[0105] For example, there is a data set containing 5,000 posters of celebrities, and the characters in each poster need to be labeled. These posters can be labeled to obtain a data set containing pictures and corresponding labels. Then this data set can be divided into a training set of 4,000 pictures and a test set of 1,000 pictures. Then the training set can be used to train a model for character classification, such as using a convolutional neural network (CNN) model. Finally, the test set can be used to evaluate the performance of the model to see whether the model can accurately classify these celebrities, so as to evaluate the generalization ability of the model.
[0106] Through such an annotation and data set division process, the present invention can obtain a model that performs well on the character star poster data set, which is used to identify and classify various different character stars. At the same time, through data set division, we can also better evaluate the performance of the model and provide a reference for further optimization and improvement of the model.
[0107] S203, inputting the training set into a ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model.
[0108] In the model training stage of the embodiment of the present invention, Figure 2 As shown, a ResNet50 network can be used to train a facial abnormal expression detection model, which is divided into three layers of FC. The core checks are:
[0109] FC1: coarse-grained network, global judgment mean pooling, and normal or abnormal judgment of global feature vectors;
[0110] FC2: fine-grained, for judging eye features, including half-closed, half-open, closed, open, squinting, uncertain, and occluded;
[0111] FC2: fine-grained, fine-grained, mouth feature judgment, including: pouting, grinning, grinning, open, slightly open, closed, and occluded.
[0112] Furthermore, the step of obtaining a labeled data set after labeling and dividing the labeled data set into a training set and a test set data set in the embodiment of the present invention specifically includes:
[0113] S2021. Read all images and labels in the annotated dataset;
[0114] Specifically, you can write code to read all the images and corresponding label information in the annotated dataset. This can be achieved by using libraries in Python (such as PIL, opencv, etc.). You can load the image data into memory and keep the corresponding labels in a data structure, such as a list or dictionary.
[0115] S2022, read the image and transform it;
[0116] When training a deep learning model, the embodiment of the present invention needs to perform some preprocessing operations on the image, such as scaling, cropping, rotating, flipping, etc. This helps to increase the diversity of data and improve the generalization ability of the model. Libraries such as opencv or PIL can be used to read image files and apply the required transformation operations.
[0117] S2023. Define preprocessing operations for a training set and a test set, and create the labeled data set into a training set and a test set data set.
[0118] In this step embodiment, it is necessary to define preprocessing operations to standardize, normalize or perform other necessary processing on the image data; divide the data set into a training set and a test set, usually in a ratio of 4:1 or 8:2; then load and process the images and labels in the data set in a set format (such as the data set format of TensorFlow or PyTorch) for subsequent model training.
[0119] In this embodiment, by reading and preprocessing the data set, training data suitable for the deep learning model can be prepared, which is helpful for model learning. Dividing the data set into a training set and a test set helps to evaluate the model performance and prevent overfitting.
[0120] For example, when there are 5,000 posters of celebrities and corresponding label datasets, you can use Python code to read these images and label information. Then perform some transformations on the images, such as scaling to a uniform size, normalizing pixel values, etc. Next, you can define preprocessing operations for the training set and test set, dividing the dataset into a training set of 4,000 images and a test set of 1,000 images. Finally, convert the dataset into a data format acceptable to the model for training and testing deep learning models.
[0121] Through these steps, neat and standardized data is provided for model training, which helps to improve the learning effect and generalization ability of the model.
[0122] The example code of the abnormal facial expression detection model training process in this embodiment is as follows: importtorch
[0123] import torch.nn as nn
[0124] import torch.optim as optim
[0125] import torchvision.models as models
[0126] import torchvision.transforms as transforms
[0127] import numpy as np
[0128] import os
[0129] import cv2
[0130] class FacialExpressionDataset(torch.utils.data.Dataset):
[0131] def __init__(self, root_dir, transform=None):
[0132] self.root_dir = root_dir
[0133] self.transform = transform
[0134] self.images = []
[0135] self.coarse_labels = []
[0136] self.eye_labels = []
[0137] self.mouth_labels = []
[0138] # Read all the images and labels in the dataset. For example:
[0139] with open(os.path.join(root_dir, 'labels.txt'), 'r') as f:
[0140] lines = f.readlines()
[0141] for line in lines:
[0142] filename, coarse_label, eye_label, mouth_label = line.strip().split()
[0143] image_path = os.path.join(root_dir, 'images', filename)
[0144] self.images.append(image_path)
[0145] self.coarse_labels.append(int(coarse_label))
[0146] self.eye_labels.append(int(eye_label))
[0147] self.mouth_labels.append(int(mouth_label))
[0148] def __len__(self):
[0149] return len(self.images)
[0150] def __getitem__(self, idx):
[0151] image_path = self.images[idx]
[0152] coarse_label = self.coarse_labels[idx]
[0153] eye_label = self.eye_labels[idx]
[0154] mouth_label = self.mouth_labels[idx].
[0155] # Read the image and perform transformations as an example below:
[0156] image = cv2.imread(image_path)
[0157] if self.transform:
[0158] image = self.transform(image)
[0159] return image,coarse_label,eye_label,mouth_label
[0160] #Define the preprocessing operations for the training set and test set as follows:
[0161] train_transform=transforms.Compose([
[0162] transforms.ToPILImage(),
[0163] transforms.RandomHorizontalFlip(),
[0164] transforms.Resize((224,224)),
[0165] transforms.ToTensor(),
[0166] transforms.Normalize(mean=[0.485,0.456,0.406],std=[0.229,0.224,0.225]) ])
[0168] test_transform=transforms.Compose([
[0169] transforms.ToPILImage(),
[0170] transforms.Resize((224,224)),
[0171] transforms.ToTensor(),
[0172] transforms.Normalize(mean=[0.485,0.456,0.406],std=[0.229,0.224,0.225]) ])
[0174] Furthermore, in the method for identifying abnormal facial expressions, the step of inputting the training set into a ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model comprises:
[0175] S2031. Create training set and test set data loaders according to the divided training set and test set data sets;
[0176] In this step, you need to load the divided training set and test set data into the model for training and testing. You can use the data loader function provided by deep learning frameworks such as PyTorch or TensorFlow to create a data loader to efficiently load and process data.
[0177] S2032. Create a ResNet50 network model;
[0178] ResNet50 is a deep residual neural network suitable for image recognition tasks. In this step, you need to create a ResNet50 network model according to the task requirements. You can use the pre-trained models provided in PyTorch or TensorFlow or implement it yourself.
[0179] S2033. Create a ResNet50 network model, define loss function and optimizer;
[0180] In the embodiment of the present invention, when training a deep learning model, it is necessary to define a loss function to measure the difference between the model output and the true label, and select an optimizer to update the model parameters to minimize the loss function. Common loss functions include cross entropy loss functions, and optimizers can be selected from Adam, SGD, etc.
[0181] S2034, and for the created ResNet50 network model, define the loss functions of coarse granularity, eye features and mouth features and perform back propagation and parameter update;
[0182] In the task of detecting abnormal facial expressions, this embodiment defines loss functions for different parts, such as coarse granularity, eye features, and mouth features. This helps the model learn facial expression features better. During the training process, the present invention updates the model parameters through back propagation and optimizer, allowing the model to gradually converge to the optimal solution.
[0183] S2035, training the ResNet50 network model after inputting the data of the training set to obtain the pre-trained abnormal facial expression detection model.
[0184] This step embodiment is to train the defined ResNet50 network model with the training set data. Through multiple iterations of training, the model will gradually learn the characteristics of abnormal facial expressions, and finally obtain a pre-trained abnormal facial expression detection model.
[0185] It can be seen that in this embodiment, by creating a data loader and defining a network model, the training data can be processed more efficiently and a deep learning model can be constructed. Defining loss functions for different parts helps the model to better learn facial expression features and improve detection accuracy. By training the model to obtain a pre-trained abnormal facial expression detection model, this model can be used in practical applications to detect abnormal facial expressions, improving efficiency and accuracy.
[0186] For example, according to the above steps, the data loader for the training set and the test set is created, the ResNet50 network model is defined, and the loss functions of the coarse granularity, eye features and mouth features are set. By training the data of the training set and the ResNet50 network model, the present invention finally obtains a pre-trained abnormal facial expression detection model. This model can be used to detect abnormal expressions in facial images. Through this process, the present invention has completed the whole process from data preparation, model definition to training, and successfully obtained a pre-trained abnormal facial expression detection model. Among them, the example of creating the training set and the test set data set is:
[0187] #Create training and test datasets
[0188] train_dataset=FacialExpressionDataset(root_dir='train',transform=train_transform)
[0189] test_dataset=FacialExpressionDataset(root_dir='test', transform=test_transform).
[0190] The examples for creating training set and test set data loaders are as follows:
[0191] #Create training set and test set data loader
[0192] train_loader=torch.utils.data.DataLoader(train_dataset,batch_size=32,shuffle=True)
[0193] test_loader=torch.utils.data.DataLoader(test_dataset,batch_size=32,shuffle=False).
[0194] The creation model is:
[0195] #Create model
[0196] model=models.resnet50(pretrained=True)
[0197] num_features=model.fc.in_features
[0198] model.fc=nn.Linear(num_features,2)
[0199] model.fc_eye=nn.Linear(num_features,6)
[0200] model.fc_mouth=nn.Linear(num_features,7).
[0201] The loss function and optimizer are defined as follows:
[0202] #Define loss function and optimizer
[0203] criterion_coarse=nn.CrossEntropyLoss()
[0204] criterion_eye=nn.CrossEntropyLoss()
[0205] criterion_mouth=nn.CrossEntropyLoss()
[0206] optimizer=optim.SGD(model.parameters(),lr=0.001,momentum=0.9)
[0207] The training model is exemplified as follows:
[0208] #Train model
[0209] for epoch in range(10):
[0210] running_loss_coarse=0.0
[0211] running_loss_eye=0.0
[0212] running_loss_mouth=0.0
[0213] for i, (inputs, coarse_labels, eye_labels, mouth_labels) in enumerate(train_loader, 0):
[0214] optimizer.zero_grad()
[0215] outputs = model(inputs)
[0216] # Define the loss functions for coarse-grained, eye feature, and mouth feature, and perform backpropagation and parameter update loss_coarse = criterion_coarse(outputs, coarse_labels)
[0217] loss_eye = criterion_eye(model.fc_eye(outputs), eye_labels)
[0218] loss_mouth = criterion_mouth(model.fc_mouth(outputs), mouth_labels)
[0219] loss = loss_coarse + loss_eye + loss_mouth
[0220] loss.backward()
[0221] optimizer.step()
[0222] running_loss_coarse += loss_coarse.item()
[0223] running_loss_eye += loss_eye.item()
[0224] running_loss_mouth += loss_mouth.item()
[0225] print('Epoch %d, coarse_loss: %.3f, eye_loss: %.3f, mouth_loss: %.3f' % (epoch + 1, running_loss_coarse / len(train_loader), running_loss_eye / len(train_loader), running_loss_mouth / len(train_loader)))。
[0226] Among them, the test is performed on the test set and the accuracy is shown as follows:
[0227] #Test on the test set and display the accuracy
[0228] correct_coarse=0
[0229] correct_eye=0
[0230] correct_mouth=0
[0231] total=0
[0232] with torch.no_grad():
[0233] for data in test_loader:
[0234] images,coarse_labels,eye_labels,mouth_labels=data
[0235] outputs = model(images)
[0236] _,predicted_coarse=torch.max(outputs.data,1)
[0237] _,predicted_eye=torch.max(model.fc_eye(outputs).data,1)
[0238] _,predicted_mouth=torch.max(model.fc_mouth(outputs).data,1)
[0239] total+=coarse_labels.size(0)
[0240] correct_coarse+=(predicted_coarse==coarse_labels).sum().item()
[0241] correct_eye+=(predicted_eye==eye_labels).sum().item()
[0242] correct_mouth+=(predicted_mouth==mouth_labels).sum().item()print('Coarse-grained Test Accuracy:%.2f%%'%(100*correct_coarse / total))print('Fine-grained Eye Test Accuracy:%.2f%%'%(100*correct_eye / total))print('Fine-grained Mouth Test Accuracy:%.2f%%'%(100*correct_mouth / total)).
[0243] Furthermore, in the method for identifying abnormal facial expressions, step S200 specifically includes:
[0244] S201, detecting the face portrait on the poster image by using a pre-trained abnormal facial expression detection model;
[0245] In this step, the abnormal facial expression detection model pre-trained in advance is used to detect the face portrait on the pre-selected poster image. The specific detection is shown in steps S202-S204.
[0246] S202, performing a coarse-grained image quality detection and judgment on the quality characteristics of the poster image to determine whether the quality characteristics of the poster image meet preset requirements;
[0247] In the present invention, in order to evaluate whether the quality characteristics of the poster image meet the preset requirements, a coarse-grained image quality detection is used. This detection method can judge the overall quality of the image through some basic image quality characteristics (such as clarity, contrast, brightness, color saturation, etc.) without in-depth analysis of the details of each pixel.
[0248] Specifically, regarding clarity detection, the clarity index of the image (such as the Sobel operator, the Laplacian operator, etc.) can be calculated to evaluate whether the photo is clear and whether the text is clearly readable.
[0249] As for contrast and brightness evaluation, we can detect whether the contrast and brightness levels of the poster image meet the requirements to ensure that the image has sufficient visual appeal. As for color saturation evaluation, we can analyze the color distribution and saturation in the poster image to determine whether the colors are vivid and bright, meeting the promotional needs.
[0250] Through these evaluation steps, a brief image quality judgment can be obtained to determine whether the overall quality characteristics of the poster image meet the expected requirements.
[0251] This step can timely detect the quality characteristics of the image through coarse-grained image quality detection, ensuring that the final poster meets the preset requirements and improves the overall publicity effect.
[0252] S203, performing fine-grained eye feature judgment on the eye features of the face avatar in the poster image to determine whether the eye features of the face avatar are abnormal; wherein the determination of whether the eye features are abnormal includes: detecting whether the eye features are: half-open and half-closed state, closed eye state, open eye state, squinting state, uncertain state, and / or blocked state;
[0253] In this step, a fine-grained eye feature judgment is performed on the eye features of the face avatar in the poster image. By performing a fine-grained judgment on the eye features, it is possible to detect whether there are abnormal expressions in the eyes of the face avatar, and then evaluate the authenticity and emotional expression of the image.
[0254] In this embodiment, the judgment on whether the eye features are abnormal may include the following states:
[0255] Half-open state: the eyes are neither completely closed nor fully open.
[0256] Eyes closed state: the state in which eyes are completely closed.
[0257] Open eyes state: the state where the eyes are fully open.
[0258] Squinting state: a state in which the eyes are slightly closed.
[0259] Uncertain state: A state where the eye features cannot clearly determine the state.
[0260] Occlusion state: The state where the eyes are blocked by other objects or occluders.
[0261] For example, when a poster includes a portrait of a person, it is possible to determine whether there is an abnormal state by making a fine-grained judgment on the eye features in the face portrait. If the eyes in the portrait are half-open and half-closed, it may indicate that the person is tired or confused. In this case, the present invention determines that there is an abnormal state because this may not be consistent with the designed publicity effect. If the eyes are completely blocked, it is also judged as abnormal because it will cause unclear facial expressions and affect the overall visual effect. Therefore, when one or more of the half-open and half-closed state, closed eyes, squinting state, and blocked state are detected for the eye features, it can be judged as an abnormal state.
[0262] This step can detect abnormal conditions of the eyes in the image by judging the eye features in a fine-grained manner, thereby improving the authenticity and expressiveness of the image.
[0263] S204, performing fine-grained mouth feature judgment on the mouth feature of the face avatar in the poster image to determine whether the mouth feature of the face avatar is abnormal, wherein the judgment of whether the mouth feature is abnormal includes: detecting whether the mouth feature is: pouting state, grinning state, grinning state, open state, slightly open state and / or closed state.
[0264] In the embodiment of this step, a fine-grained mouth feature judgment is performed on the mouth feature of the face avatar in the poster image. By performing a fine-grained judgment on the mouth feature, the emotional expression and conformity of the face avatar can be evaluated to ensure that the poster design meets the expected effect.
[0265] The judgment of whether the mouth features are abnormal can include the following states:
[0266] Pouting state: The mouth is slightly open, showing a pouting state.
[0267] Grinning state: showing teeth, with corners of the mouth raised, showing a grinning state.
[0268] Toothy grin state: The mouth is wide open with teeth showing, showing a happy smile.
[0269] Wide open state: the mouth is fully open.
[0270] Slightly open state: the state of mouth being slightly open.
[0271] Closed state: The mouth is completely closed.
[0272] When the mouth state is one or more of the following: pouting state, grinning state, open state, and closed state, it is judged that the mouth feature is abnormal.
[0273] For example, if the fine-grained judgment finds that the head portrait of a person is in a state of grinning, it may be more in line with the desired promotional effect of the poster and express joy and friendliness, so the mouth feature is judged to be normal. On the contrary, if the head portrait shows a state of grinning, it is judged to be abnormal because it does not match the theme of the poster and the image needs to be adjusted.
[0274] The present invention can more accurately capture the emotional expression of the face by judging the mouth features at a fine-grained level, thereby improving the overall publicity effect. This helps ensure that the poster image meets the expected requirements and enhances the visual appeal.
[0275] More specifically, in the method for identifying abnormal facial expressions, step S300 specifically includes:
[0276] S301, when it is detected that the quality characteristics of the poster image do not meet the preset requirements, the preset requirements include: resolution is too low than a predetermined value, blur, distortion;
[0277] In this step, when it is detected that the quality characteristics of the poster image do not meet the preset requirements, that is, the resolution is too lower than the preset value, blurred or distorted, which may affect the visual effect of the poster and the clarity of the information conveyed, it is judged as abnormal, and the current poster image containing the face portrait is determined to be unavailable.
[0278] S302, and / or when it is detected that the eye feature of the face avatar is abnormal, the abnormal eye feature includes an eye closed state, an eye half-open and half-closed state, an eye blinking state, and / or an eye blocked state;
[0279] When the eye features in the face avatar are abnormal, such as eyes closed, eyes half-open and half-closed, eyes blinking or eyes blocked, this will also affect the viewer's understanding and connection with the character's emotions, and it is also judged as abnormal, and the current poster image containing the face avatar is determined to be unavailable.
[0280] S303, and / or detecting that the mouth feature of the face avatar is abnormal, wherein the abnormal state of the mouth feature includes a pouting state, a grinning state, an open state and / or a closed state;
[0281] Similarly, if the mouth features of a facial portrait are abnormal, such as pouting, grinning, open or closed, it will also affect the accuracy and visual effect of the character's expression.
[0282] S304: It is determined that the poster image currently including the human face portrait is unavailable.
[0283] In the above case, it is determined that the poster image currently including the face portrait is unavailable.
[0284] For example, when screening posters, it is found that the face image is blurred due to low resolution, and the eye features of the person are abnormal, with the eyes half open and half closed. In addition, the mouth features are also abnormal and are closed. According to step S304, it may be determined that the poster image containing the face image is unusable and needs to be replaced, adjusted or repaired.
[0285] It can be seen that through the application of the above steps, the quality and effect of poster design can be effectively controlled and improved, so as to better attract the attention of the target audience and convey the intended message.
[0286] Of course, in another embodiment of the present invention, the poster image can also be detected for abnormality by using the abnormality detection confidence. Figure 2The three FC networks shown will have a confidence result.
[0287] The so-called anomaly detection confidence refers to the confidence or credibility given to each detection result when performing anomaly detection. In the present invention, anomaly detection uses various models and algorithms to detect anomalies in data, such as abnormal images, abnormal user behaviors, etc.
[0288] When the system detects anomalies in a piece of data, it will give a judgment result and a confidence score, which indicates the system's confidence in the result. The higher the confidence, the more likely the system believes that the test result is correct; while the lower the confidence, the lower the system's certainty about the test result, which may require further verification or adjustment.
[0289] The confidence level of anomaly detection can help us better understand and trust the system's detection results, and can also guide subsequent decisions and actions. Usually, we hope that the system can give high-confidence anomaly detection results so that we can promptly detect and handle anomalies in the data and take appropriate measures.
[0290] For example, in this embodiment, when detecting the face in the image, if the abnormal detection confidence exceeds 0.8, the poster can be judged to be unusable. 0.8 actually means that there is more than 80% confidence in judging that the current facial expression is an abnormal expression.
[0291] Exemplary Devices
[0292] like Figure 3 As shown, an embodiment of the present invention provides a device for identifying and processing abnormal facial expressions, the device comprising:
[0293] An acquisition module 310 is used to acquire a poster image containing a face portrait;
[0294] The network model detection module 320 is used to detect the face portrait on the poster image through a pre-trained abnormal facial expression detection model to detect whether the quality characteristics of the poster image meet the preset requirements, detect whether the eye characteristics of the face portrait are abnormal, and detect whether the mouth characteristics of the face portrait are abnormal;
[0295] The face abnormality judgment module 330 is used to determine that the current poster image containing the face avatar is unavailable when the quality characteristics of the poster image are detected to be inconsistent with preset requirements, and / or the eye characteristics of the face avatar are detected to be abnormal, and / or the mouth characteristics of the face avatar are detected to be abnormal, as described above.
[0296] Based on the above embodiments, the present invention further provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 4 As shown. The intelligent terminal can be a stress test server for stress testing of an Internet production environment, including a processor, a memory, a network interface, a display screen, and a database connected via a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal 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 network interface of the intelligent terminal is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for recognizing and processing abnormal facial expressions is implemented. The database of the intelligent terminal is used to store a program for recognizing and processing abnormal facial expressions.
[0297] Those skilled in the art will understand that Figure 4 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. The specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0298] In one embodiment, a smart terminal is provided, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations:
[0299] Get a poster image containing a human face portrait;
[0300] Using a pre-trained abnormal facial expression detection model, the face portrait on the poster image is detected to detect whether the quality characteristics of the poster image meet the preset requirements, whether the eye characteristics of the face portrait are abnormal, and whether the mouth characteristics of the face portrait are abnormal;
[0301] When it is detected that the quality characteristics of the poster image do not meet the preset requirements, and / or the eye characteristics of the facial avatar are detected to be abnormal, and / or the mouth characteristics of the facial avatar are detected to be abnormal, it is determined that the current poster image containing the facial avatar is unavailable, as described above.
[0302] The training steps of the abnormal facial expression detection model include:
[0303] Preselect a specified number of labels of poster images containing human face portraits for annotation, wherein the annotation dimensions include: the first column marks whether the eyes are abnormal, the second column marks whether the mouth is abnormal, and the third column marks whether the image is normal;
[0304] After labeling, a labeled data set is obtained, and the labeled data set is divided into a training set and a test set data set;
[0305] The training set is input into the ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model.
[0306] The steps of obtaining a labeled data set after labeling and dividing the labeled data set into a training set and a test set data set include:
[0307] Read all images and labels in the labeled dataset;
[0308] Read the image and transform it;
[0309] The preprocessing operations of the training set and the test set are defined, and the labeled data set is created as the training set and the test set data set.
[0310] The step of inputting the training set into a ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model comprises:
[0311] Create training set and test set data loaders based on the divided training set and test set data sets;
[0312] Create a ResNet50 network model;
[0313] Create a ResNet50 network model, define loss function and optimizer;
[0314] And for the created ResNet50 network model, define the loss functions of coarse granularity, eye features and mouth features, and perform back propagation and parameter update.
[0315] The data of the training set is input into the defined ResNet50 network model for training to obtain the pre-trained abnormal facial expression detection model.
[0316] Among them, the first column marking whether the eyes are abnormal includes:
[0317] When the eyes of a poster image containing a human face are detected to be half open and half closed, they are marked as 0 in the first column;
[0318] When the eyes of a poster image containing a human face are detected to be closed, it is marked as 1 in the first column;
[0319] When the eyes of a poster image containing a human face are detected to be open, it is marked as 2 in the first column;
[0320] When the eyes of a poster image containing a human face are detected to be squinting, it is marked as 3 in the first column;
[0321] When the eyes of a poster image containing a human face are detected as uncertain, they are marked as 4 in the first column;
[0322] When the eyes of a poster image containing a human face are detected as occluded, it is marked as 5 in the first column;
[0323] The second column indicates whether the mouth is abnormal and includes:
[0324] When the mouth of a poster image containing a human face is detected as pouting, it is marked as 0 in the second column;
[0325] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 1 in the second column;
[0326] When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 2 in the second column;
[0327] When the mouth of a poster image containing a human face is detected to be wide open, it is marked as 3 in the second column;
[0328] When the mouth of a poster image containing a human face is detected to be slightly open, it is marked as 4 in the second column;
[0329] When the mouth of a poster image containing a human face is detected to be closed, it is marked as 5 in the second column;
[0330] The third column marks whether the image is normal or not, including:
[0331] When the poster image containing a face portrait is detected as normal, it is marked as 0 in the third column;
[0332] When a poster image containing a human face portrait is detected as an anomaly, it is marked as 1 in the third column.
[0333] The steps of detecting the face portrait on the poster image by using a pre-trained abnormal facial expression detection model, detecting whether the quality characteristics of the poster image meet the preset requirements, detecting whether the eye characteristics of the face portrait are abnormal, and detecting whether the mouth characteristics of the face portrait are abnormal include:
[0334] Detecting the face portrait on the poster image using a pre-trained abnormal facial expression detection model;
[0335] Performing coarse-grained image quality detection and judgment on the quality characteristics of the poster image to determine whether the quality characteristics of the poster image meet preset requirements;
[0336] Performing fine-grained eye feature judgment on the eye features of the face avatar in the poster image to determine whether the eye features of the face avatar are abnormal; wherein the determination of whether the eye features are abnormal includes: detecting whether the eye features are: half-open and half-closed state, closed eye state, open eye state, squinting state, uncertain state, and / or blocked state;
[0337] Performing fine-grained mouth feature judgment on the mouth features of the face avatar in the poster image to determine whether the mouth features of the face avatar are abnormal, wherein the judgment of whether the mouth features are abnormal includes: detecting whether the mouth features are: pouting state, grinning state, grinning state, wide open state, slightly open state and / or closed state.
[0338] The step of determining that the current poster image containing the face avatar is unavailable when the quality feature of the poster image is detected to not meet the preset requirements, and / or the eye feature of the face avatar is detected to be abnormal, and / or the mouth feature of the face avatar is detected to be abnormal includes:
[0339] When it is detected that the quality characteristics of the poster image do not meet the preset requirements, the preset requirements include: the resolution is too low than a predetermined value, blurry, distorted;
[0340] and / or when it is detected that the eye feature of the face avatar is abnormal, the abnormal eye feature includes an eye closed state, an eye half-open and half-closed state, an eye blinking state, and / or an eye blocked state;
[0341] and / or detecting that a mouth feature of the face avatar is abnormal, wherein the abnormal state of the mouth feature includes a pouting state, a grinning state, an open state and / or a closed state;
[0342] It is determined that the poster image currently including the human face portrait is unavailable, as described above.
[0343] 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 memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0344] In summary, the present invention provides a method, device, intelligent terminal and storage medium for identifying and processing abnormal facial expressions. The present invention can identify whether the expression of a person's portrait in an image is abnormal, so as to quickly confirm whether it can be used as a poster, thereby improving the poster use screening rate and providing convenience for users.
Claims
1. A method for recognizing abnormal facial expressions, characterized in that: include: Get a poster image containing a human face portrait; Using a pre-trained abnormal facial expression detection model, the face portrait on the poster image is detected to detect whether the quality characteristics of the poster image meet the preset requirements, whether the eye characteristics of the face portrait are abnormal, and whether the mouth characteristics of the face portrait are abnormal; When it is detected that the quality characteristics of the poster image do not meet the preset requirements, and / or the eye characteristics of the facial avatar are detected to be abnormal, and / or the mouth characteristics of the facial avatar are detected to be abnormal, it is determined that the current poster image containing the facial avatar is unavailable.
2. The method for identifying abnormal facial expressions according to claim 1, wherein: The training steps of the abnormal facial expression detection model include: Preselect a specified number of labels of poster images containing human face portraits for annotation, wherein the annotation dimensions include: the first column marks whether the eyes are abnormal, the second column marks whether the mouth is abnormal, and the third column marks whether the image is normal; After labeling, a labeled data set is obtained, and the labeled data set is divided into a training set and a test set data set; The training set is input into the ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model.
3. The method for identifying abnormal facial expressions according to claim 2, wherein: The steps of obtaining a labeled data set after labeling and dividing the labeled data set into a training set and a test set data set include: Read all images and labels in the labeled dataset; Read the image and transform it; The preprocessing operations of the training set and the test set are defined, and the labeled data set is created as the training set and the test set data set.
4. The method for identifying abnormal facial expressions according to claim 3, characterized in that: The step of inputting the training set into the ResNet50 network for training to obtain a pre-trained abnormal facial expression detection model comprises: Create training set and test set data loaders based on the divided training set and test set data sets; Create a ResNet50 network model; Create a ResNet50 network model, define loss function and optimizer; And for the created ResNet50 network model, define the loss functions of coarse granularity, eye features and mouth features, and perform back propagation and parameter update. The data of the training set is input into the defined ResNet50 network model for training to obtain the pre-trained abnormal facial expression detection model.
5. The method for recognizing abnormal facial expressions according to claim 2, wherein: The first column indicates whether the eye is abnormal and includes: When the eyes of a poster image containing a human face are detected to be half open and half closed, they are marked as 0 in the first column; When the eyes of a poster image containing a human face are detected to be closed, it is marked as 1 in the first column; When the eyes of a poster image containing a human face are detected to be open, it is marked as 2 in the first column; When the eyes of a poster image containing a human face are detected to be squinting, it is marked as 3 in the first column; When the eyes of a poster image containing a human face are detected as uncertain, they are marked as 4 in the first column; When the eyes of a poster image containing a human face are detected as occluded, it is marked as 5 in the first column; The second column indicates whether the mouth is abnormal and includes: When the mouth of a poster image containing a human face is detected as pouting, it is marked as 0 in the second column; When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 1 in the second column; When the mouth of a poster image containing a human face is detected to be grinning, it is marked as 2 in the second column; When the mouth of a poster image containing a human face is detected to be wide open, it is marked as 3 in the second column; When the mouth of a poster image containing a human face is detected to be slightly open, it is marked as 4 in the second column; When the mouth of a poster image containing a human face is detected to be closed, it is marked as 5 in the second column; The third column marks whether the image is normal and includes: When the poster image containing a face portrait is detected as normal, it is marked as 0 in the third column; When a poster image containing a human face portrait is detected as an anomaly, it is marked as 1 in the third column.
6. The method for recognizing abnormal facial expressions according to claim 1, characterized in that: The steps of detecting the face portrait on the poster image by using a pre-trained abnormal facial expression detection model to detect whether the quality characteristics of the poster image meet the preset requirements, detecting whether the eye characteristics of the face portrait are abnormal, and detecting whether the mouth characteristics of the face portrait are abnormal include: Detecting the face portrait on the poster image using a pre-trained abnormal facial expression detection model; Performing coarse-grained image quality detection and judgment on the quality characteristics of the poster image to determine whether the quality characteristics of the poster image meet preset requirements; Performing fine-grained eye feature judgment on the eye features of the face avatar in the poster image to determine whether the eye features of the face avatar are abnormal; wherein the determination of whether the eye features are abnormal includes: detecting whether the eye features are: half-open and half-closed state, closed eye state, open eye state, squinting state, uncertain state, and / or blocked state; Performing fine-grained mouth feature judgment on the mouth features of the face avatar in the poster image to determine whether the mouth features of the face avatar are abnormal, wherein the judgment of whether the mouth features are abnormal includes: detecting whether the mouth features are: pouting state, grinning state, grinning state, wide open state, slightly open state and / or closed state.
7. The method for recognizing abnormal facial expressions according to claim 1, characterized in that: The step of determining that the current poster image containing the face avatar is unavailable when the quality feature of the poster image is detected to not meet the preset requirements, and / or the eye feature of the face avatar is detected to be abnormal, and / or the mouth feature of the face avatar is detected to be abnormal includes: When it is detected that the quality characteristics of the poster image do not meet the preset requirements, the preset requirements include: the resolution is too low than a predetermined value, blurry, distorted; and / or when it is detected that the eye feature of the face avatar is abnormal, the abnormal eye feature includes an eye closed state, an eye half-open and half-closed state, an eye blinking state, and / or an eye blocked state; and / or detecting that a mouth feature of the face avatar is abnormal, wherein the abnormal state of the mouth feature includes a pouting state, a grinning state, an open state and / or a closed state; It is determined that the current poster image containing the face portrait is unavailable.
8. A device for recognizing and processing abnormal facial expressions, characterized in that: The device comprises: An acquisition module, used for acquiring a poster image containing a human face portrait; A network model detection module is used to detect the face portrait on the poster image through a pre-trained abnormal facial expression detection model to detect whether the quality characteristics of the poster image meet the preset requirements, detect whether the eye characteristics of the face portrait are abnormal, and detect whether the mouth characteristics of the face portrait are abnormal; The face abnormality judgment module is used to determine that the poster image currently containing the face avatar is unavailable when the quality characteristics of the poster image are detected to be inconsistent with preset requirements, and / or the eye characteristics of the face avatar are detected to be abnormal, and / or the mouth characteristics of the face avatar are detected to be abnormal.
9. An intelligent terminal, characterized in that: The device comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs include being used to execute the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Face image screening method and device, electronic equipment and storage medium
CN112507985A
Film and television poster automatic generation method and system based on deep learning
CN113010711A
Television detail page background discoloration processing method, device, equipment and medium
CN113207023A
SE-ResNet network-based race identification method and device and computer storage medium
CN114155573A
Face abnormal expression recognition method and device, electronic equipment and storage medium
CN115880742A
