Eye closing automatic processing method and system based on continuous photos
Through deep learning and face recognition technology, combined with affine transformation processing, the problem of closed eyes in group photos is automatically identified and processed, solving the problems of time-consuming, labor-intensive and insufficient accuracy of traditional methods, and achieving efficient and accurate eye-closed processing effects. .
Patent Information
- Application Number
- CN202411278348.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technology cannot effectively and automatically handle the problem of closed eyes in group photos. Traditional methods are time-consuming, labor-intensive and ineffective. Moreover, existing closed-eye detection technology is not accurate enough, especially in multi-person images, which is difficult to solve.
Adopt an automatic closed-eye processing method based on deep learning, use the face detection algorithm to locate key points, crop the eye area, determine the open and closed status through the eye-opening and closing detection model, combine with face recognition technology to find the person with closed eyes, and use affine transformation The matrix replaces the closed-eye state and performs preprocessing to eliminate the closed-eye problem.
It realizes the automatic identification and processing of people with closed eyes in group photos, improves processing efficiency and accuracy, reduces the workload of post-processing manual processing, and maintains the naturalness and realism of the photos.
Smart Images

Figure CN118799205A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photo processing, and in particular to a method and system for automatically processing closed eyes based on continuous photos. Background Art
[0002] Group photo shooting is an inevitable process in various meetings, activities, student graduations and other occasions. However, when taking group photos, we often encounter situations such as closed eyes / open mouths, which means that it is impossible to ensure that everyone has a normal expression in the same photo. Even if you take multiple photos, this problem cannot be completely solved. However, this problem has a significant impact on the quality and effect of the photo. The traditional solution is to rely on manual post-processing to manually replace the eyes or mouths of the person with closed eyes, but this method is time-consuming and labor-intensive and the effect is not good. Therefore, an automated processing method is needed to solve this problem.
[0003] Deep learning technology has developed rapidly in the past decade, and the rise of large models has been driven by the open source of large data sets and the availability of powerful computing resources. Companies have also open-sourced many large models, and everyday workers can directly train their own data sets based on these models to meet various specific applications. Face-related models continue to develop, especially face key points and face recognition technology. Thanks to ultra-large-scale data training, the accuracy can be applied to various practical applications.
[0004] For example, a Chinese invention patent with publication number CN114170069A discloses an automatic eye closure processing method based on multiple consecutive photos. However, the technology of this method for detecting open and closed eyes is relatively backward. It only adopts the traditional feature method, which is far from the accuracy required for practical applications, and can only process images of a single person. It does not explain how to solve the problem when there are multiple people in the image, and how to set the search time interval in a set of consecutive images.
[0005] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention
[0006] The embodiments of the present invention provide a method and system for automatically processing closed eyes based on continuous photos to solve the above-mentioned technical problems in the prior art.
[0007] In order to have a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not a general review, nor is it intended to identify key / important components or to describe the scope of protection of these embodiments. Its only purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.
[0008] According to a first aspect of an embodiment of the present invention, a method for automatic eye closure processing based on continuous photographs is provided.
[0009] In one embodiment, the method for automatically processing closed eyes based on continuous photos includes: Based on the face detection algorithm, locate the key points of each face in a single photo of multiple people and obtain the eye area of each face; Crop the left and right eye areas of each face, and output the open and closed judgment results of the left and right eyes respectively based on the open and closed eye detection model; Scan each face photo in the remaining multiple consecutive photos, and find the person with closed eyes based on face recognition technology; determine the open or closed state of the target person's eyes, and use the photo with open eyes as the replacement photo; Based on the affine transformation matrix, the closed-eye state in the closed-eye photo is replaced in combination with the replacement photo, and the replaced photo is preprocessed to eliminate the closed-eye state in the photo.
[0010] In one embodiment, locating the key points of each face in a single multi-person photo based on a face detection algorithm and obtaining the eye area of each face includes: Randomly select one photo from multiple consecutive photos of multiple people and input it into a pre-trained facial feature point detection model to locate the key points of each face and obtain the eye area of each face.
[0011] In one embodiment, the cropping of the left and right eye regions of each face and outputting the open and closed judgment results of the left and right eyes respectively based on the open and closed eye detection model include: Based on the image data of eye states in the database, an eye-opening and eye-closing detection model is constructed and trained to obtain a trained eye-opening and eye-closing detection model; The left eye and right eye areas in each face photo are cropped separately and input into the trained open and closed eye detection model to obtain the open and closed status judgment results of the left and right eyes.
[0012] In one embodiment, the constructing and training the eye-opening and eye-closing detection model based on the image data of the eye state in the database to obtain the trained eye-opening and eye-closing detection model includes: Based on the closed-eye face dataset, image data of the closed-eye state is obtained, and image data of the eye wearer is collected; quality adjustment, size unification and key point calibration processing are performed on the image data in sequence to obtain a processed dataset; MobileNet is selected as the backbone network. High-dimensional feature vectors are extracted from the input image using MobileNet, and the high-dimensional feature vectors are used as inputs to the four fully connected layers added. The four fully connected layers have 1024, 512, 256, and 128 neurons respectively, and the ReLU activation function is used. The activation function of the last layer is the sigmoid function. The constructed eyes open and closed detection model is trained using the processed data set, and the loss function is to minimize the error of the model in classifying the eyes open and closed states. The loss function is minimized by adjusting the network weights to obtain a trained eyes open and closed detection model.
[0013] In one embodiment, replacing the closed-eye state in the closed-eye photo based on the affine transformation matrix in combination with the replacement photo, and preprocessing the replaced photo to eliminate the closed-eye state in the photo includes: Based on the facial feature points of other open-eye images and closed-eye images of the person with closed eyes, an affine transformation matrix is calculated, and the facial organs in the target image are deformed using the affine transformation matrix to obtain a deformed target image; Correcting the colors of the source image and the deformed target image, and mixing the corrected source image and the corrected deformed target image to obtain a final replaced image; Among them, the formula of affine transformation is:
[0014] In the formula, represents the amount of translation, a 1 Indicates the horizontal scaling factor. a 4 Indicates the scaling factor in the vertical direction, a 2 represents the shear factor in the horizontal direction, a 3 represents the shear factor in the vertical direction, x and y Represents the horizontal and vertical coordinates of the transformation point. and Represents the transformed horizontal and vertical coordinates.
[0015] According to a second aspect of an embodiment of the present invention, there is provided an automatic eye closure processing system based on continuous photographs.
[0016] In one embodiment, the automatic eye closure processing system based on continuous photos includes: The eye region recognition module is used to locate the key points of each face in a single multi-person photo based on the face detection algorithm and obtain the eye region of each face; The eye-opening and eye-closing state judgment module is used to crop the left and right eye areas of each face, and output the open and closed judgment results of the left and right eyes respectively based on the eye-opening and eye-closing detection model; The replacement photo determination module is used to scan each face photo in the remaining multiple consecutive photos, find the person with closed eyes based on face recognition technology; determine the open or closed state of the target person's eyes, and use the photo with open eyes as the replacement photo; The affine transformation module is used to replace the closed-eye state in the closed-eye photo based on the affine transformation matrix and the replacement photo, and pre-process the replaced photo to eliminate the closed-eye state in the photo.
[0017] In one embodiment, the eye region recognition module locates the key points of each face in a single multi-person photo based on a face detection algorithm and obtains the eye region of each face. It randomly selects one from a plurality of consecutive multi-person photos and inputs it into a pre-trained facial feature point detection model to locate the key points of each face and obtain the eye region of each face.
[0018] In one embodiment, when the eyes open and closed state judgment module crops the left and right eye areas of each face and outputs the open and closed judgment results of the left and right eyes respectively based on the eyes open and closed detection model, the eyes open and closed detection model is constructed and trained based on the image data of the eye state in the database to obtain the trained eyes open and closed detection model; the left and right eye areas in each face photo are respectively cropped and input into the trained eyes open and closed detection model to obtain the open and closed state judgment results of the left and right eyes.
[0019] In one embodiment, the eyes-open-and-closed state judgment module constructs and trains an eyes-open-and-closed detection model based on the image data of the eye state in the database to obtain the trained eyes-open-and-closed detection model. Based on the closed-eye face data set, the image data of the closed-eye state is obtained, and the image data of the eye wearer is collected; the image data is sequentially quality adjusted, size unified, and key point calibrated to obtain a processed data set; MobileNet is selected as the backbone network, and a high-dimensional feature vector is extracted from the input image using MobileNet, and the high-dimensional feature vector is used as the input of four added fully connected layers; wherein the four fully connected layers have 1024, 512, 256, and 128 neurons, respectively, and a ReLU activation function is used, and the activation function of the last layer selects a sigmoid function; the constructed eyes-open-and-closed detection model is trained using the processed data set, and the loss function is minimized by minimizing the error of the model in the classification of eyes-open-and-closed states, and the loss function is minimized by adjusting the network weights to obtain a trained eyes-open-and-closed detection model.
[0020] In one embodiment, the affine transformation module replaces the closed-eye state in the closed-eye photo based on the affine transformation matrix in combination with the replacement photo, and pre-processes the replaced photo to complete the elimination of the closed-eye state in the photo. Then, based on the facial feature points of other open-eye images and closed-eye images of the closed-eye person found, the affine transformation matrix is calculated, and the facial organs in the target image are deformed using the affine transformation matrix to obtain a deformed target image; the colors of the source image and the deformed target image are corrected, and the corrected source image and the corrected deformed target image are mixed to obtain the final replaced image; Among them, the formula of affine transformation is:
[0021] In the formula, represents the amount of translation, a 1 Indicates the horizontal scaling factor. a 4 Indicates the scaling factor in the vertical direction, a 2 represents the shear factor in the horizontal direction, a 3 represents the shear factor in the vertical direction, x and y Represents the horizontal and vertical coordinates of the transformation point. and Represents the transformed horizontal and vertical coordinates.
[0022] According to a third aspect of an embodiment of the present invention, a computer device is provided.
[0023] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0024] According to a fourth aspect of embodiments of the present invention, a computer-readable storage medium is provided.
[0025] In one embodiment, the computer-readable storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor.
[0026] The technical solution provided by the embodiment of the present invention may have the following beneficial effects: 1) This invention uses a closed-eye processing technology based on deep learning to realize the automatic recognition and processing of people with closed eyes in group photos. Compared with traditional manual processing methods, this method has the advantages of automation and high efficiency, and can reduce the workload of post-processing.
[0027] 2) The present invention can accurately locate the eye area of each face and determine the identity of the person with closed eyes by using the facial feature point detection model and the facial recognition model. This eye-closing processing technology based on deep learning and facial recognition has advantages in accuracy and stability.
[0028] 3) The present invention uses affine transformation and post-processing technology to replace the eye area of the closed-eye person with an open-eye image, and eliminates the boundary effect after replacement through Gaussian blur and expansion processing. This can maintain the naturalness and realism of the photo.
[0029] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0031] Figure 1 is a flow chart showing a method for automatically processing closed eyes based on continuous photos according to an exemplary embodiment; Figure 2 is a structural block diagram of an automatic eye-closing processing system based on continuous photos according to an exemplary embodiment; Figure 3 The figure is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION
[0032] The following description and accompanying drawings fully illustrate the specific embodiments of this article so that those skilled in the art can practice them. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. The scope of the embodiments of this article includes the entire scope of the claims, as well as all available equivalents of the claims. Herein, the terms "first", "second", etc. are only used to distinguish one element from another, without requiring or implying any actual relationship or order between these elements. In fact, the first element can also be called the second element, and vice versa. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that the structure, device or equipment including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such structure, device or equipment. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the structure, device or equipment including the elements. Each embodiment is described in a progressive manner herein, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the embodiments can be referred to each other.
[0033] The terms "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. in this document indicate the orientation or position relationship based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing this document and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In the description of this document, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a mechanical connection or an electrical connection, it can also be the internal communication of two elements, it can be a direct connection, or it can be indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0034] As used herein, the term "plurality" means two or more than two, unless otherwise specified.
[0035] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.
[0036] In this article, the term "and / or" is a description of the association relationship between objects, indicating that three relationships may exist. For example, A and / or B means: A or B, or, A and B.
[0037] It should be understood that, although the various steps in the flow chart 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 description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-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 portion of the sub-steps or stages of other steps.
[0038] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above modules.
[0039] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0040] The terms in this embodiment are explained as follows: Facial key point detection: aims to automatically identify the locations of key points in face images. These key points usually correspond to specific locations on the face, such as eyes, nose, mouth, eyebrows, etc.
[0041] Face recognition: Confirming a person’s identity by analyzing and matching features in facial images. This usually involves comparing the input face image with face templates previously stored in a database.
[0042] Eye open / closed detection: Its purpose is to identify or detect the state of human eyes in images or videos, that is, whether the eyes are open or closed. This technology is usually used in monitoring, security, fatigue driving detection and other fields.
[0043] Figure 1 An embodiment of an automatic eye-closing processing method based on continuous photos of the present invention is shown.
[0044] In this optional embodiment, the method for automatically processing closed eyes based on continuous photos includes: Step S101: based on a face detection algorithm, locate the key points of each face in a single multi-person photo and obtain the eye area of each face; Step S103, cropping the left and right eye regions of each face, and outputting the open and closed judgment results of the left and right eyes respectively based on the open and closed eye detection model; Step S105, scanning each face photo in the remaining multiple consecutive photos, and finding the person with closed eyes based on face recognition technology; judging the eye open or closed state of the target person (i.e., the person in the remaining photos who is the same as the person with closed eyes), and using the photo with open eyes as the replacement photo; Step S107: Based on the affine transformation matrix, the closed-eye state in the closed-eye photo is replaced in combination with the replacement photo, and the replaced photo is preprocessed to eliminate the closed-eye state in the photo.
[0045] Figure 2 An embodiment of an automatic eye-closing processing system based on continuous photographs of the present invention is shown.
[0046] In this optional embodiment, the automatic eye closure processing system based on continuous photos includes: The eye region recognition module 201 is used to locate the key points of each face in a single multi-person photo based on a face detection algorithm, and obtain the eye region of each face; The eye-opening / closing state judgment module 203 is used to crop the left and right eye regions of each face, and output the eye-opening / closing judgment results of the left and right eyes respectively based on the eye-opening / closing detection model; The replacement photo determination module 205 is used to scan each face photo in the remaining multiple consecutive photos, find the person with closed eyes based on face recognition technology, determine the open or closed state of the eyes of the target person, and use the photo with open eyes as the replacement photo; The affine transformation module 207 is used to replace the closed-eye state in the closed-eye photo based on the affine transformation matrix and the replacement photo, and pre-process the replaced photo to eliminate the closed-eye state in the photo.
[0047] In order to facilitate understanding of the above technical solutions of the present invention, the above technical solutions of the present invention are further described below from the perspective of architecture and principle, as follows: In order to solve the problem of closed eyes and open mouth in multi-person images, the present invention provides an automatic closed eye processing method based on continuous photos. The method attempts to automatically identify people with closed eyes and process them into an open-eye state based on the latest deep learning combined with face recognition and other technologies. The key points of each face are located by using a facial feature point detection model to obtain the eye area of each person. Then, the left and right eye areas of each face are cropped out respectively and input into the open and closed eye detection model to determine the open and closed state of the left and right eyes. If one eye is closed, it is judged as closed eyes. Next, the closed eye person is found through the face recognition model, and it is determined whether the eyes of the target person are open. If the eyes of the target person are open, the photo is used as a replacement photo and replaced by an affine transformation. Finally, Gaussian blur and puffing are performed to eliminate the boundary influence after replacement and complete the elimination of the closed eye state in the photo. The same is true for the open mouth image.
[0048] An automatic eye-closing processing method based on continuous photos, comprising: 1. Input a picture containing multiple people, use the facial feature point detection model to locate the key points of each face, and obtain the eye area of each person. There are generally 68 key points, of which 12 are in the eye area. The facial feature point detection model uses a cascaded deep neural network model - DAN (Deep Alignment Networks). The input of each stage of DAN is the entire picture, and a key point heat map is added, which effectively overcomes the problems caused by head posture and initialization.
[0049] 2. Cut out the left and right eye areas of each face and input them into the eye-opening and eye-closing detection model, and output the open and closed judgment results of the left and right eyes respectively. The eye-opening and eye-closing detection model is trained based on our data and the open-source large model, and has high accuracy. Specifically: 1) Data collection and preprocessing: In order to train the eye-opening and eye-closing detection model, we first obtained the image data of the closed-eye state from the public dataset CEW (Closedeyes in the wild). In addition, we also collected image data of people wearing glasses to increase the model's adaptability to diverse scenes. Then we preprocessed the dataset, including image quality adjustment, size unification, and key point calibration. Key point calibration is used to accurately locate the eye area for subsequent cropping operations.
[0050] 2) Model architecture design: First, the backbone network is selected. The reason for choosing MobileNet as the backbone network is that it is lightweight and efficient, suitable for deployment on embedded devices, and has sufficient computing power to process the feature extraction of eye images. In order to enhance the model's ability to recognize the open and closed state of the eyes, MobileNet is used to extract high-dimensional feature vectors from the input image, which will be used as the input of the subsequent fully connected layer. Multiple fully connected layers can be added to gradually reduce the feature dimension and finally output the classification results of two categories. Usually, a fully connected layer is followed by an appropriate activation function to introduce nonlinearity. Four fully connected layers, with 1024, 512, 256 and 128 neurons respectively, use the ReLU activation function (Linear rectification function). The activation function of the last layer selects the sigmoid function, whose output range is between 0 and 1, which can represent the probability of each category and is suitable for binary classification problems.
[0051] 3) Training process: Selection of loss function: Select a loss function suitable for binary classification tasks, such as the cross entropy loss function, to minimize the model's error in classifying open and closed eyes. Optimizer selection: Use an optimizer (such as the Adam optimizer) to minimize the loss function by adjusting the network weights, so that the model can converge to the optimal solution more quickly.
[0052] 4) Data enhancement: In order to increase the robustness and generalization ability of the model, data enhancement techniques such as random cropping, flipping, rotation, scaling, etc. are used to increase the diversity of training samples.
[0053] The CEW closed-eyes dataset and self-collected datasets (mainly including images of people wearing glasses) were used to train the open-closed-eyes model, which was trained using a self-made 4-layer network model based on the MobileNet framework. Through the above steps, an efficient open-closed-eyes detection model was successfully built and trained, which combines the lightweight characteristics of MobileNet and the self-made deep network structure, and can accurately and quickly determine the open-closed state of the left and right eye areas of the face, and is suitable for a variety of practical application scenarios.
[0054] 3. If one of the left or right eyes is closed, it is considered closed. Scan each face in the subsequent photos and find the closed-eye person through the face recognition model. There are many open source large models for face recognition models. For example, the latest and most advanced models can be found in Alibaba's modelscope (Alibaba's large model open source model) to obtain higher recognition accuracy. Commonly used face recognition models include VGGFace, FaceNet, DeepFace, OpenFace, etc., all of which are deep learning models. It should be noted that the model needs to set a threshold to determine whether the photos belong to the same person.
[0055] 4. If the target person's eyes are open, the photo is used as a replacement photo, replaced by affine transformation and Gaussian blur and expansion processing is performed to eliminate the boundary effect after replacement and complete the elimination of the closed-eye state in the photo. The specific steps are: calculate the affine transformation matrix based on the facial feature points of the source image and the target image (that is, the other open-eye images and closed-eye images of the closed-eye person found); then, use the affine transformation matrix to deform the facial organs in the target image to obtain the deformed target image; then, correct the color to make the color of the source image and the deformed target image more consistent; finally, mix the two images to obtain the final replaced image. The formula for affine transformation is:
[0056] In the formula, represents the amount of translation, a 1 Indicates the horizontal scaling factor. a4 Indicates the scaling factor in the vertical direction, a 2 represents the shear factor in the horizontal direction, a 3 represents the shear factor in the vertical direction, x and y Represents the horizontal and vertical coordinates of the transformation point. and Represents the horizontal and vertical coordinates after transformation. By calculating the parameters, the coordinate transformation relationship of the two matrices can be obtained.
[0057] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store static information and dynamic information data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in the above method embodiment are implemented.
[0058] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention 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.
[0059] In addition, the present invention also provides a computer device, 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 embodiment when executing the computer program.
[0060] In addition, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0061] 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 at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. 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).
[0062] The present invention is not limited to the structures which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A method for automatically processing closed eyes based on continuous photos, characterized in that: include: Based on the face detection algorithm, locate the key points of each face in a single photo of multiple people and obtain the eye area of each face; Crop the left and right eye areas of each face, and output the open and closed judgment results of the left and right eyes respectively based on the open and closed eye detection model; Scan each face photo in the remaining multiple consecutive photos, and find the person with closed eyes based on face recognition technology; determine the open or closed state of the target person's eyes, and use the photo with open eyes as the replacement photo; Based on the affine transformation matrix, the closed-eye state in the closed-eye photo is replaced in combination with the replacement photo, and the replaced photo is preprocessed to eliminate the closed-eye state in the photo.
2. The method for automatically processing closed eyes based on continuous photos according to claim 1, characterized in that: The method of locating the key points of each face in a single multi-person photo based on a face detection algorithm and obtaining the eye area of each face includes: Randomly select one photo from multiple consecutive photos of multiple people and input it into a pre-trained facial feature point detection model to locate the key points of each face and obtain the eye area of each face.
3. The method for automatically processing closed eyes based on continuous photos according to claim 1, characterized in that: The cropping of the left and right eye regions of each face and outputting the open and closed judgment results of the left and right eyes respectively based on the open and closed eye detection model include: Based on the image data of eye states in the database, an eye-opening and eye-closing detection model is constructed and trained to obtain a trained eye-opening and eye-closing detection model; The left eye and right eye areas in each face photo are cropped separately and input into the trained open and closed eye detection model to obtain the open and closed status judgment results of the left and right eyes.
4. The method for automatically processing closed eyes based on continuous photos according to claim 3, characterized in that: The method of constructing and training an eye-opening and eye-closing detection model based on the image data of eye states in the database to obtain a trained eye-opening and eye-closing detection model includes: Based on the closed-eye face dataset, image data of the closed-eye state is obtained, and image data of the eye wearer is collected; quality adjustment, size unification and key point calibration processing are performed on the image data in sequence to obtain a processed dataset; MobileNet is selected as the backbone network. High-dimensional feature vectors are extracted from the input image using MobileNet, and the high-dimensional feature vectors are used as inputs to the four fully connected layers added. The four fully connected layers have 1024, 512, 256, and 128 neurons respectively, and the ReLU activation function is used. The activation function of the last layer is the sigmoid function. The constructed eyes open and closed detection model is trained using the processed data set, and the loss function is to minimize the error of the model in classifying the eyes open and closed states. The loss function is minimized by adjusting the network weights to obtain a trained eyes open and closed detection model.
5. The method for automatically processing closed eyes based on continuous photos according to claim 1, characterized in that: The method of replacing the closed-eye state in the closed-eye photo based on the affine transformation matrix and combining the replacement photo, and preprocessing the replaced photo to eliminate the closed-eye state in the photo includes: Based on the facial feature points of other open-eye images and closed-eye images of the person with closed eyes, an affine transformation matrix is calculated, and the facial organs in the target image are deformed using the affine transformation matrix to obtain a deformed target image; Correcting the colors of the source image and the deformed target image, and mixing the corrected source image and the corrected deformed target image to obtain a final replaced image; Among them, the formula of affine transformation is: ; In the formula, represents the amount of translation, a 1 represents the horizontal scaling factor, a 4 represents the vertical scaling factor, a 2 represents the shear factor in the horizontal direction, a 3 represents the shear factor in the vertical direction, x and y Represents the horizontal and vertical coordinates of the transformation point, and Represents the transformed horizontal and vertical coordinates.
6. An automatic eye-closing processing system based on continuous photos, characterized in that: include: The eye region recognition module is used to locate the key points of each face in a single multi-person photo based on the face detection algorithm and obtain the eye region of each face; The eye-opening and eye-closing state judgment module is used to crop the left and right eye areas of each face, and output the open and closed judgment results of the left and right eyes respectively based on the eye-opening and eye-closing detection model; The replacement photo determination module is used to scan each face photo in the remaining multiple consecutive photos, find the person with closed eyes based on face recognition technology; determine the open or closed state of the target person's eyes, and use the photo with open eyes as the replacement photo; The affine transformation module is used to replace the closed-eye state in the closed-eye photo based on the affine transformation matrix and the replacement photo, and pre-process the replaced photo to eliminate the closed-eye state in the photo.
7. The automatic eye-closing processing system based on continuous photos according to claim 6, characterized in that: The eye region recognition module locates the key points of each face in a single multi-person photo based on the face detection algorithm and obtains the eye region of each face. It randomly selects one from a plurality of consecutive multi-person photos and inputs it into a pre-trained face feature point detection model to locate the key points of each face and obtain the eye region of each face.
8. The automatic eye-closing processing system based on continuous photos according to claim 6, characterized in that: When the eye-opening and closing state judgment module crops the left and right eye areas of each face and outputs the opening and closing judgment results of the left and right eyes respectively based on the eye-opening and closing detection model, the eye-opening and closing detection model is constructed and trained based on the data of the eye status in the database to obtain the trained eye-opening and closing detection model; the left and right eye areas in each face photo are respectively cropped and input into the trained eye-opening and closing detection model to obtain the opening and closing state judgment results of the left and right eyes.
9. The automatic eye-closing processing system based on continuous photos according to claim 8, characterized in that: The eye-opening and closing state judgment module constructs and trains an eye-opening and closing detection model based on the image data of the eye state in the database to obtain the trained eye-opening and closing detection model. Based on the closed-eye face data set, the image data of the closed-eye state is obtained, and the image data of the eye wearer is collected; the image data is sequentially quality adjusted, size unified, and key point calibration processed to obtain a processed data set; MobileNet is selected as the backbone network, and a high-dimensional feature vector is extracted from the input image using MobileNet, and the high-dimensional feature vector is used as the input of four added fully connected layers; wherein the four fully connected layers have 1024, 512, 256 and 128 neurons respectively, and a ReLU activation function is used, and the activation function of the last layer selects a sigmoid function; the constructed eye-opening and closing detection model is trained using the processed data set, and the error of minimizing the model in the classification of the eye-opening and closing state is used as the loss function, and the loss function is minimized by adjusting the network weights to obtain a trained eye-opening and closing detection model.
10. The automatic eye-closing processing system based on continuous photos according to claim 6, characterized in that: The affine transformation module replaces the closed-eye state in the closed-eye photo based on the affine transformation matrix and the replacement photo, and pre-processes the replaced photo. When the closed-eye state in the photo is eliminated, the affine transformation matrix is calculated based on the facial feature points of other open-eye images and closed-eye images of the closed-eye person found, and the facial organs in the target image are deformed using the affine transformation matrix to obtain a deformed target image; the colors of the source image and the deformed target image are corrected, and the corrected source image and the corrected deformed target image are mixed to obtain a final replaced image; Among them, the formula of affine transformation is: ; In the formula, represents the amount of translation, a 1 represents the horizontal scaling factor, a 4 represents the vertical scaling factor, a 2 represents the shear factor in the horizontal direction, a 3 represents the shear factor in the vertical direction, x and y Represents the horizontal and vertical coordinates of the transformation point, and Represents the transformed horizontal and vertical coordinates.
Citation Information
Patent Citations
Image processing method and device and storage medium
CN110163806A
Fatigue driving detection method based on train cab scene
CN112016429A
Eye closing automatic processing method based on multiple continuous photos
CN114170069A
Bar code information reading method and device, medium and equipment
CN118114697A
Cited By
Image display processing method and electronic equipment
CN121981916A
Preview image restoration method and device, electronic equipment and computer program product
CN122530034A
