Eye bag repairing method based on deep reinforcement learning
Through the deep reinforcement learning network, the characteristics of eye bags are extracted and repaired, combined with the optimization of loss function, the problem of unnatural eye bag repair in the existing technology is solved, and efficient and accurate eye bag repair effect is achieved.
Patent Information
- Application Number
- CN202411332500.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-07
AI Technical Summary
The existing eye bag repair algorithm cannot effectively preserve the skin texture details, and the repair results are inconsistent with the color of the surrounding skin, resulting in unnatural repair effects.
Using a deep reinforcement learning method, the feature extraction subnet in the pre-trained deep reinforcement learning network extracts the eye bag area features, and the strategy subnet is used to match suitable repair actions, such as Gaussian filtering, local texture generation and brightness adjustment, The eye bag area is repaired, combined with MSE loss and L1 loss evaluation, and the policy network parameters are updated until the predetermined target is reached.
It achieves a more natural and realistic eye bag repair effect, ensuring the accuracy and naturalness of the repair process, and meeting users' high requirements for beauty technology.
Smart Images

Figure CN119273592A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of local image processing, and in particular to an eye bag repair method based on deep reinforcement learning. Background Art
[0002] With the development of digital image processing technology, portrait beautification has become one of the important applications in the field of digital photography. However, most of the existing eye bag removal algorithms rely on manually designed rules or image processing technology (such as low-frequency filtering, etc.), lack a comprehensive understanding of the eye bag problem and accurate processing methods, and are prone to problems such as incomplete removal and failure to retain skin texture details. Therefore, a more intelligent and accurate algorithm is needed to solve the above problems.
[0003] Existing methods for removing eye bags often rely on facial key points and eye bag masks to extract eye bags and then use some image processing techniques to remove them (such as low-frequency filtering, etc.), which will make the eye bags not removed cleanly and often fail to restore the texture details of the skin. In recent years, there have been some face image editing methods based on reinforcement learning, the purpose of which is to use reinforcement learning to select and optimize the facial attributes that need to be reconstructed, thereby further guiding the generator to generate higher quality face images. However, the above schemes rely on the generator to obtain beautified images, and the generated results have more uncertainty. In addition, the reinforcement learning network is only used to select and optimize facial attributes, and does not play a direct role in the generated image results. Summary of the invention
[0004] In view of this, the purpose of the present invention is to propose an eye bag repair method based on deep reinforcement learning, which can solve the problems of traditional eye bag repair algorithms being unable to retain skin texture details and inconsistent with surrounding skin color, and achieve a more natural and realistic eye bag repair effect to meet users' high requirements for beauty technology.
[0005] According to one aspect of the present invention, a method for repairing eye bags based on deep reinforcement learning is provided, comprising:
[0006] Inputting the image to be processed into a feature extraction subnetwork in a pre-trained deep reinforcement learning network to extract features of the eye bag region;
[0007] Based on the eye bag region feature, the strategy sub-network in the deep reinforcement learning network matches the repair action corresponding to the feature;
[0008] The eye bag area is repaired based on the repair action.
[0009] In the above technical solution, the feature extraction subnetwork extracts features of the eye bag area in the input image through a convolutional neural network to ensure that the repair operation is targeted and effective; the strategy subnetwork matches the most suitable repair action based on the extracted features. The repair action may include Gaussian filtering, local texture generation, brightness adjustment and other different operations, which are suitable for different types of eye bag repair needs; by applying these repair actions, the eye bag area is gradually repaired to improve the naturalness and accuracy of the overall repair effect. This process realizes self-optimization of the network through a deep reinforcement learning mechanism, further improving the effect and efficiency of the repair.
[0010] In some embodiments, the eye bag area is repaired based on the repair action, and then the method further includes:
[0011] MSE loss and L1 loss are used to evaluate the repaired eye bag area. If the predetermined repair target is achieved, the result is output; otherwise,
[0012] Update the parameters and historical experience of the strategy network, and based on the features of the eye bag area, re-match the repair action corresponding to the feature, and repair the eye bag area based on the repair action;
[0013] Repeat the above steps until the predetermined repair target is reached.
[0014] In the above technical solution, by using MSE loss and L1 loss to evaluate the repaired eye bag area, the difference between the repair effect and the target can be accurately measured to ensure the accuracy and naturalness of the repair effect. If the evaluation result does not meet the predetermined repair target, the system will update the parameters of the policy network through the reinforcement learning mechanism, and optimize and adjust it based on historical experience to better match the appropriate repair action. This process continuously optimizes the performance of the policy network in each iteration to ensure that the repair action is more in line with the characteristics of the eye bag area, and ultimately achieves efficient and accurate eye bag repair until the predetermined goal is met.
[0015] In some embodiments, the restoration action includes Gaussian filtering, local texture generation, and brightness adjustment.
[0016] In the above technical solution, the Gaussian filter in the repair action is used to smooth the eye bag area, reduce the unevenness of the local texture, and achieve a softening effect; the local texture generation restores the details of the repair area by generating natural textures to avoid visual unnaturalness caused by excessive smoothing; the brightness adjustment is used to balance the brightness difference between the eye bag area and the surrounding skin, so that the repaired area is more coordinated with the overall face. Through these diverse repair actions, the system can flexibly respond to different types of eye bag problems and ensure that the repair effect is more natural and realistic.
[0017] In some embodiments, the training set of the deep reinforcement learning network is constructed using the following steps:
[0018] Collecting a first target image without eye bags and a source data pair, the source data pair being a pair of existing images with eye bags and images without eye bags;
[0019] An alignment matrix is calculated according to the image of the source data pair, the target image and the source data pair are aligned, the difference of the source data pair is calculated to obtain an eye bag image, and the eye bag image is fused with the target image to obtain a second target image with eye bags;
[0020] The training set is constructed based on the above method.
[0021] The advantage of this training set construction method in the above technical solution is that by utilizing the alignment and fusion operations of the first target image without eye bags and the source data pair, a variety of images with eye bags are generated, thereby enriching the training data set and increasing the generalization ability of the model. By accurately aligning the source data pairs and calculating the differences to generate the eye bag image, the fidelity of the eye bag features is ensured, making the training data more realistic. By fusion with the target image, images of different types of eye bags are generated, so that the policy network can learn the features corresponding to a variety of repair actions, improving the flexibility and accuracy of repair. At the same time, for the policy network in this case, this training set construction method helps the policy network to identify and process eye bag features of different degrees and types, so that the most appropriate repair action can be selected. By learning repair patterns from a variety of eye bag images, the policy network can more efficiently cope with a variety of eye bag situations in actual images, making the repair process more natural and accurate.
[0022] According to another aspect of the present invention, a training method for a deep reinforcement learning model is provided, wherein the deep reinforcement learning model includes a feature extraction subnetwork, a policy network, and a repair subnetwork; the method includes the following steps:
[0023] Collect a first target image without eye bags and a source data pair, where the source data pair is a pair of existing images with eye bags and images without eye bags; calculate an alignment matrix based on the images of the source data pair, align the target image and the source data pair, calculate the difference of the source data pair to obtain an eye bag image, and fuse the eye bag image with the target image to obtain a second target image with eye bags; construct a training set based on the above method;
[0024] Input the second target image into the feature extraction subnetwork to extract the features of the eye bag area;
[0025] Based on the eye bag region feature, the strategy sub-network matches the repair action corresponding to the feature;
[0026] Repair the eye bag area based on the repair action and superimpose it on the second target image;
[0027] Calculate the loss value based on the first target atlas and the second target atlas;
[0028] The deep reinforcement learning model is trained based on the loss value.
[0029] In the above technical scheme, in order to better use the above method, the present application proposes a training method for a deep reinforcement learning model, and each module corresponds to each step of the above method. The specific principles have been described above and will not be repeated here.
[0030] According to another aspect of the present invention, there is provided an eye bag repair device based on deep reinforcement learning, based on the above method; comprising:
[0031] A feature extraction module, used for inputting the image to be processed into a feature extraction sub-network in a pre-trained deep reinforcement learning network to extract features of the eye bag area;
[0032] A strategy module, configured to match a repair action corresponding to the feature of the eye bag region by a strategy sub-network in the deep reinforcement learning network;
[0033] The repair module repairs the eye bag area based on the repair action.
[0034] In the above technical scheme, in order to better use the above method, the present application proposes an eye bag repair device based on deep reinforcement learning. Each module corresponds to each step of the above method. The specific principles have been described above and will not be repeated here.
[0035] According to another aspect of the present invention, there is provided an eye bag repair device based on deep reinforcement learning, comprising:
[0036] at least one processor and a memory communicatively coupled to the at least one processor;
[0037] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above method.
[0038] In the above technical solution, in order to better run and process the method, the above method is stored in a memory, and the stored method is executed by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0039] According to another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program, wherein the computer program implements the above method when executed by a processor.
[0040] In the above technical solution, in order to better run and use the method, the above method is stored in a computer-readable storage medium, and the above method is implemented by a processor. It should be noted that the principle and effect of each step have been described above and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] 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 of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 This is one of the flow charts of an embodiment of an eye bag repair method based on deep reinforcement learning of the present invention;
[0043] Figure 2 This is a second flow chart of an embodiment of an eye bag repair method based on deep reinforcement learning of the present invention;
[0044] Figure 3 This is a flow chart of an embodiment of an eye bag repair method based on deep reinforcement learning according to the present invention;
[0045] Figure 4 It is a flowchart of an embodiment of a training method for a deep reinforcement learning model of the present invention;
[0046] Figure 5 It is a structural schematic diagram of an embodiment of an eye bag repair device based on deep reinforcement learning of the present invention; DETAILED DESCRIPTION
[0047] The present invention will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only used to illustrate the present invention, but are not intended to limit the scope of the present invention. Similarly, the following examples are only partial embodiments of the present invention rather than all embodiments, and all other embodiments obtained by those of ordinary skill in the art without creative work are within the scope of protection of the present invention.
[0048] The present invention provides an eye bag repair method based on deep reinforcement learning, which can solve the problems of traditional eye bag repair algorithms being unable to retain skin texture details and being inconsistent with the surrounding skin color, and achieve a more natural and realistic eye bag repair effect to meet users' high requirements for beauty technology.
[0049] Embodiment 1
[0050] See also Figure 1, a method for repairing eye bags based on deep reinforcement learning, comprising:
[0051] S11, inputting the image to be processed into a feature extraction subnetwork in a pre-trained deep reinforcement learning network to extract features of the eye bag region;
[0052] S12, based on the eye bag region feature, the strategy sub-network in the deep reinforcement learning network matches the repair action corresponding to the feature;
[0053] S13: Repair the eye bag area based on the repair action.
[0054] In this embodiment, S3, repairing the eye bag area based on the repair action, and then further comprising:
[0055] MSE loss and L1 loss are used to evaluate the repaired eye bag area. If the predetermined repair target is achieved, the result is output; otherwise,
[0056] Update the parameters and historical experience of the strategy network, and based on the features of the eye bag area, re-match the repair action corresponding to the feature, and repair the eye bag area based on the repair action;
[0057] Repeat the above steps until the predetermined repair target is reached.
[0058] In this embodiment, the repairing action includes Gaussian filtering, local texture generation, and brightness adjustment.
[0059] In this embodiment, the training set of the deep reinforcement learning network is constructed using the following steps:
[0060] S111, collecting a first target image without eye bags and a source data pair, where the source data pair is a pair of existing images with eye bags and images with eye bags removed;
[0061] S112, calculating an alignment matrix according to the image of the source data pair, aligning the target image with the source data pair, calculating the difference of the source data pair to obtain an eye bag image, and fusing the eye bag image with the target image to obtain a second target image with eye bags;
[0062] S113. Construct a training set based on the above method.
[0063] In order to better explain the present invention, a specific example will be used for explanation. Figure 2 , Figure 3 , as follows:
[0064] 1) Make model training data pairs
[0065] The data pairs for model training come from two sources: 1. existing images with eye bags and images with eye bags removed; 2. adding eye bags to images with eye bags removed to form new data pairs.
[0066] The method of attaching eye bags to the image after removing eye bags to form a new data pair:
[0067] 1. Prepare an image without eye bags (hereinafter referred to as the target image) and a pair of existing images with eye bags and images without eye bags (hereinafter referred to as the source data pair);
[0068] 2. Calculate the alignment matrix based on the image of the source data pair and align the target image with the source data pair;
[0069] 3. Calculate the difference of the source data pair to obtain the eye bags, and fuse the eye bags with the target image to obtain the target image with eye bags.
[0070] 2) Model training process
[0071] The training process of the model follows the forward and gradient backpropagation mechanism of the basic convolutional neural network. The general workflow is as follows: first, an input portrait with eye bags is obtained, then the eye bag area is cropped based on the key points of the face, and then the eye bag area is repaired using a reinforcement learning-based method. Finally, the repaired eye bag area is output and the loss between it and the original eye bag area is calculated to update the deep reinforcement learning network.
[0072] 3) Eye bag repair method based on deep reinforcement learning
[0073] As shown below, the eye bag repair method based on deep reinforcement learning includes the following steps:
[0074] 1. Obtain features of the eye bag area: Use a pre-trained convolutional neural network to obtain features of the eye bag area;
[0075] 2. The policy network selects the repair action: According to the characteristics of the eye bag area, the policy network selects the appropriate repair action, including Gaussian filtering, local texture generation, brightness adjustment, etc.;
[0076] 3. Apply actions to repair eye bags: Perform repair operations on the eye bag area according to the repair actions selected by the policy network;
[0077] 4. Evaluate the restoration effect: Use MSE loss and L1 loss to evaluate the restored eye bag area and measure the performance of the policy network;
[0078] Among them, MSE loss is expressed as:
[0079]
[0080] L1 loss is expressed as:
[0081]
[0082] In the above two formulas, n represents the number of samples. represents the true value of the i-th sample, Represents the predicted value of the i-th sample.
[0083] 5. Determine whether the restoration goal has been achieved: Based on the evaluation results, determine whether the restoration effect meets the predetermined restoration goal;
[0084] 6. Output the repaired eye bag area: If the repair effect meets the requirements, the repaired eye bag area is output to complete the repair process; otherwise, go to the next step to update the strategy network and historical experience.
[0085] 7. Update the strategy network and historical experience: According to the evaluation results of the repair effect, update the parameters of the strategy network and historical experience to optimize the repair strategy to make it more accurate and effective.
[0086] 8. Loop execution: The entire process is a loop execution process until the predetermined repair goal is achieved. In each loop, the repair strategy is continuously optimized by continuously updating the strategy network and historical experience to achieve a more accurate and natural eye bag repair effect.
[0087] Based on one of the embodiments, the present invention has the following advantages:
[0088] 1. Automated processing: No need for users to manually select the eye bag area, the algorithm can automatically identify and repair it;
[0089] 2. Intelligent repair: Based on reinforcement learning methods, the repair process is more intelligent and natural;
[0090] 3. Strong adaptability: Able to adaptively adjust the processing effect according to different situations and adapt to various shooting conditions.
[0091] Embodiment 2
[0092] See also Figure 4 A training method for a deep reinforcement learning model, the deep reinforcement learning model includes a feature extraction subnetwork, a policy network, and a repair subnetwork; the method includes the following steps:
[0093] S21, collecting a first target image without eye bags and a source data pair, where the source data pair is a pair of existing images with eye bags and an image without eye bags; calculating an alignment matrix based on the images of the source data pair, aligning the target image and the source data pair, calculating the difference of the source data pair to obtain an eye bag image, and fusing the eye bag image with the target image to obtain a second target image with eye bags; constructing a training set based on the above method;
[0094] S22, inputting the second target image into the feature extraction sub-network to extract eye bag area features;
[0095] S23, based on the eye bag region feature, the strategy sub-network matches a repair action corresponding to the feature;
[0096] S24, repairing the eye bag area based on the repairing action and superimposing it on the second target image;
[0097] S25, calculating a loss value based on the second target graph of the first target graph set;
[0098] S26. Training the deep reinforcement learning model based on the loss value.
[0099] In this embodiment, the repairing action includes Gaussian filtering, local texture generation, and brightness adjustment.
[0100] Embodiment 3
[0101] See also Figure 5 , an eye bag repair device based on deep reinforcement learning, based on the above method; comprising:
[0102] A feature extraction module, used for inputting the image to be processed into a feature extraction sub-network in a pre-trained deep reinforcement learning network to extract features of the eye bag area;
[0103] A strategy module, configured to match a repair action corresponding to the feature of the eye bag region by a strategy sub-network in the deep reinforcement learning network;
[0104] The repair module repairs the eye bag area based on the repair action.
[0105] In the above technical scheme, in order to better use the method described in one of the embodiments, the present application proposes an eye bag repair device based on deep reinforcement learning, and each module corresponds to each step of the method described in one of the embodiments. The specific principles have been described above and will not be repeated here.
[0106] Embodiment 4
[0107] An eye bag repair device based on deep reinforcement learning, comprising:
[0108] at least one processor and a memory communicatively coupled to the at least one processor;
[0109] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in one of the embodiments.
[0110] In the above technical solution, in order to better run and process the method described in one of the embodiments, the above method is stored in a memory, and a processor is used to execute the stored method. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0111] Embodiment 5
[0112] A computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0113] In the above technical solution, in order to better run and use the method described in one of the embodiments, the above method is stored in a computer-readable storage medium, and a processor is used to implement the method described in one of the embodiments. It should be noted that the principle and effect of each step have been described above and will not be described in detail here.
[0114] The above descriptions are only some embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent device or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for repairing eye bags based on deep reinforcement learning, characterized in that: The method comprises: Inputting the image to be processed into a feature extraction subnetwork in a pre-trained deep reinforcement learning network to extract features of the eye bag region; Based on the eye bag region feature, the strategy sub-network in the deep reinforcement learning network matches the repair action corresponding to the feature; The eye bag area is repaired based on the repair action.
2. The eye bag repair method based on deep reinforcement learning as claimed in claim 1, characterized in that: Based on this repair action, the eye bag area is repaired, and then it also includes: MSEloss and L1 loss are used to evaluate the repaired eye bag area. If the predetermined repair target is achieved, the result is output; otherwise, Update the parameters and historical experience of the strategy network, and based on the features of the eye bag area, re-match the repair action corresponding to the feature, and repair the eye bag area based on the repair action; Repeat the above steps until the predetermined repair target is reached.
3. The eye bag repair method based on deep reinforcement learning as claimed in claim 1, characterized in that: The repairing action includes Gaussian filtering, local texture generation, and brightness adjustment.
4. The eye bag repair method based on deep reinforcement learning as claimed in claim 1, characterized in that: The training set of the deep reinforcement learning network is constructed using the following steps: Collecting a first target image without eye bags and a source data pair, the source data pair being a pair of existing images with eye bags and images without eye bags; An alignment matrix is calculated according to the image of the source data pair, the target image and the source data pair are aligned, the difference of the source data pair is calculated to obtain an eye bag image, and the eye bag image is fused with the target image to obtain a second target image with eye bags; The training set is constructed based on the above method.
5. A training method for a deep reinforcement learning model, characterized in that: The deep reinforcement learning model includes a feature extraction subnetwork, a strategy network, and a repair subnetwork; the method includes the following steps: A first target image without eye bags and a source data pair are collected, where the source data pair is a pair of existing images with eye bags and an image without eye bags; an alignment matrix is calculated based on the images of the source data pair, the target image and the source data pair are aligned, the difference of the source data pair is calculated to obtain an eye bag image, and the eye bag image is fused with the target image to obtain a second target image with eye bags; Construct a training set based on the above method; Input the second target image into the feature extraction subnetwork to extract the features of the eye bag area; Based on the eye bag region feature, the strategy sub-network matches the repair action corresponding to the feature; Repair the eye bag area based on the repair action and superimpose it on the second target image; Calculate the loss value based on the first target atlas and the second target atlas; The deep reinforcement learning model is trained based on the loss value.
6. A method for training a deep reinforcement learning model as claimed in claim 5, characterized in that: The repairing action includes Gaussian filtering, local texture generation, and brightness adjustment.
7. An eye bag repair device based on deep reinforcement learning, characterized in that: Based on the method according to any one of claims 1 to 4; Includes connections: A feature extraction module, used for inputting the image to be processed into a feature extraction sub-network in a pre-trained deep reinforcement learning network to extract features of the eye bag area; A strategy module, configured to match a repair action corresponding to the feature of the eye bag region by a strategy sub-network in the deep reinforcement learning network; The repair module repairs the eye bag area based on the repair action.
8. An eye bag repair device based on deep reinforcement learning, characterized in that: include: at least one processor and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.