A face flaw digital data processing method based on a convolutional neural network

By employing a digital data processing method for facial imperfections based on convolutional neural networks, and utilizing a multi-scale pyramid framework and block-level recursive misalignment techniques, the low latency and synchronization alignment issues in high-resolution facial image imperfection repair are addressed. This results in efficient and natural imperfection repair effects, suitable for social media and mobile terminal applications.

CN121366103BActive Publication Date: 2026-04-14CLOUD ATTACK NETWORK TECH HEBEI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-10
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve low-latency processing in high-resolution scenarios when dealing with facial image defects. Furthermore, traditional methods cannot guarantee the synchronous alignment of the filling texture with the facial geometric contours, which can easily lead to disordered skin texture orientation and misaligned facial shadows.

Method used

A digital data processing method for facial imperfections based on convolutional neural networks is adopted. The method accurately detects faces through a multi-scale pyramid framework, separates structural features from texture features, and uses block-level recursive misalignment harmonicization and pseudo-random texture diffusion for repair. Combined with color consistency optimization, a natural and high-quality repair effect is generated.

Benefits of technology

It achieves near real-time facial blemish repair on mobile devices, significantly improving image quality. It is suitable for scenarios such as social photography, smart albums, and online identity verification, and has high accuracy and naturalness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121366103B_ABST
    Figure CN121366103B_ABST
Patent Text Reader

Abstract

The application discloses a kind of face flaw digital data processing methods based on convolutional neural network, it is related to electric digital data processing technical field, the method includes: step 1: after the original face flaw digital data is preprocessed, using multi-scale pyramid face detection framework determines face frame;Step 2: after face frame is cut, it is scaled according to fixed resolution, obtains standardized face digital data;Standardized face digital data is sent into convolutional neural network, in turn through multi-scale convolutional coding layer, residual focusing layer and attention fusion layer, generates structure feature digital data and texture feature digital data;Step 3: structure feature digital data and texture feature digital data are carried out block level recursive dislocation harmonic processing, and output repair feature digital data;Step 4: texture detail compensation and color consistency optimization are executed, and target repair digital data is generated.The application can significantly improve image visual sense and the practical value of application scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital data processing technology, specifically to a method for processing digital data on facial imperfections based on convolutional neural networks. Background Technology

[0002] With the continuous improvement of mobile terminal image sensor resolution and the rapid popularization of social media, facial photos have become a core carrier of personal digital identity and social expression. However, in actual shooting, due to the combined effects of optical distortion, uneven ambient lighting, diverse skin conditions, and sensor noise, facial images often contain various forms of imperfections such as blemishes, acne marks, fine lines, scars, reflections, or compression artifacts. To improve the visual quality of portrait photos, academia and industry have proposed a variety of digital processing techniques for facial imperfections. These techniques can be broadly divided into three development stages: traditional image filtering methods, texture transfer-based inpainting methods, and deep learning methods represented by convolutional neural networks.

[0003] In the traditional approach phase, common solutions involve using bilateral filtering, guided filtering, local statistical smoothing, or frequency domain separation to weaken high-frequency skin details, followed by adjusting the overall tone through histogram matching or gamma correction. These algorithms are simple to implement, computationally inexpensive, and can run in real-time on low-performance processors, thus they were widely integrated into early consumer cameras and smartphone beautification modules. However, while bilateral filtering and other linear or near-linear operators preserve edges, they struggle to distinguish between "imperfect textures" and "real textures," often resulting in side effects such as over-smoothing of skin texture, loss of detail, and inconsistent skin tone zoning. Furthermore, when imperfections are large or located in complex lighting gradient regions, traditional methods lack cross-regional color inference mechanisms, easily leaving mixed bands with inconsistent brightness.

[0004] After entering the texture transfer-based stage, researchers generally employ methods such as patch matching, graph cut optimization, or Poisson fusion to transfer texture information from healthy skin areas to blemished areas. Classic image inpainting algorithms achieve continuous filling effects by searching for source region blocks in the damaged area and using an energy minimization framework; subsequent multi-scale Poisson reconstruction maintains brightness consistency in the gradient domain, significantly mitigating edge breakage problems in the transition zone. These techniques perform well in repairing small-area, regularly shaped defects, but when faced with highly structured targets like faces containing semantic constraints on facial features, they cannot guarantee synchronous alignment between the filled texture and the facial geometry, often introducing new distortions such as disordered skin texture direction, misaligned facial shadows, or blurred facial feature edges. Furthermore, since the iterative process of patch search and energy optimization relies on a large number of pixel-level distance calculations, the algorithm complexity increases quadratically with image resolution, making it difficult to achieve low-latency processing in high-resolution scenes. Summary of the Invention

[0005] To address the aforementioned technical challenges, this paper presents a digital data processing method for facial imperfections based on convolutional neural networks. First, it achieves photometric consistency through white balance, logarithmic photometric transformation, and Gaussian noise reduction. Then, a multi-scale pyramid framework is used to accurately detect faces and crop them to generate standardized input. Subsequently, structural and texture features are separated and extracted within the network. Block-level recursive misalignment harmonicization allows these two features to be coupled and fused in multiple iterations. Finally, pseudo-random texture diffusion and color consistency optimization are used to complete detail compensation and global tone correction. This method simultaneously ensures facial geometric continuity, realistic skin texture, and natural color transitions. Furthermore, the network has a moderate number of parameters and is easy to parallelize, enabling near real-time facial imperfection repair on mobile devices, significantly improving image quality and practical application value.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0007] A method for processing digital data on facial imperfections based on convolutional neural networks, the method comprising:

[0008] Step 1: After preprocessing the original digital data of facial imperfections, the face bounding box is determined using a multi-scale pyramid face detection framework;

[0009] Step 2: After cropping the face bounding box, scale it at a fixed resolution to obtain standardized face digital data; feed the standardized face digital data into a convolutional neural network, and pass it through a multi-scale convolutional coding layer, a residual focusing layer and an attention fusion layer in sequence to generate structural feature digital data and texture feature digital data;

[0010] Step 3: Perform block-level recursive misalignment harmonization processing on the structural feature digital data and texture feature digital data, and output the repair feature digital data;

[0011] Step 4: Input the repair feature digital data into the pseudo-random texture diffusion process, perform texture detail compensation and color consistency optimization, and generate target repair digital data.

[0012] Furthermore, the preprocessing of the original digital data of facial imperfections in step 1 includes: performing white balance correction, logarithmic photometric smoothing conversion, and Gaussian noise suppression on the original digital data of facial imperfections in sequence to obtain preprocessed digital data of the face.

[0013] Furthermore, in step 1, the process of determining the face bounding box using the multi-scale pyramid face detection framework includes: continuously scaling down the preprocessed face digital data at a fixed scaling ratio to generate a multi-scale digital data sequence arranged from top to bottom; performing convolution, normalization, and activation operations sequentially on the digital data sequence at each scale to output a candidate feature plane; performing max pooling downsampling on the candidate feature plane to obtain a confidence plane; retaining the coordinates of digital data blocks with confidence scores higher than a preset confidence threshold on the confidence plane, mapping them back to the original resolution, merging all candidate rectangles, performing de-overlap filtering, and obtaining the face bounding box.

[0014] Furthermore, step 3 specifically includes:

[0015] Step 3.1: Divide the structural feature digital data and the texture feature digital data into equal-sized blocks according to a consistent grid, including structural blocks and texture blocks, and write the structural blocks and texture blocks into an interleaved index queue in an alternating order;

[0016] Step 3.2: Slide the staggered window on the staggered index queue according to the preset movement rules to generate a staggered window, perform the staggered convolution operation on each staggered window to output a harmonic block, and append the harmonic block to the tail of the staggered index queue in sequence;

[0017] Step 3.3: When the length of the interleaved index queue is less than twice the initial length, perform dynamic queue expansion until the length of the interleaved index queue exceeds the set threshold; then perform bi-state alignment mapping, selecting mutually mapped structure blocks, texture blocks, or harmonic blocks in pairs; first perform forward convolution fusion, then perform reverse convolution fusion to obtain fused blocks, until the current recursive loop counter square root round ends;

[0018] Step 3.4: Calculate the average pixel confidence of each fusion block, and divide the interleaved index queue into high-confidence and low-confidence segments according to the average pixel confidence; keep the original resolution and grid coordinates of the fusion blocks in the high-confidence segment, write them directly into the candidate repair plane, and lock their boundaries; pass the fusion blocks in the low-confidence segment through a shift filter, write them into the candidate repair plane, and lock their boundaries.

[0019] Step 3.5: Perform bidirectional edge smoothing fusion at the boundary between the high-confidence segment and the low-confidence segment, and transition the edge pixels of adjacent blocks in a weighted average manner to eliminate block edges and obtain repair feature digital data.

[0020] Furthermore, in step 3.2, the length of the misaligned window is set to 4 consecutive blocks; the sliding step is set to 1 block, that is, after each sliding, the queue head pointer moves 1 position towards the queue tail; when the 4 blocks in the misaligned window are recorded as the first to the fourth block according to their original sequence numbers, the second and fourth blocks are shifted to the right by 1 grid unit, the third block is shifted down by 1 grid unit, and the first block remains in its original position, thus forming a stepped misaligned layout.

[0021] Furthermore, in step 3.2, the process of performing misaligned convolution operations on each misaligned window to output a harmonic block includes: establishing two convolutional scanning paths within the misaligned window: the horizontal scanning path expands along the overlapping area of ​​adjacent blocks in the same row, and the vertical scanning path expands along the overlapping area of ​​adjacent blocks in the same column; configuring independent convolutional kernel groups for the horizontal and vertical scanning paths respectively, with the size of each group of convolutional kernels uniformly set to 3 by 3 pixels; firstly performing a complete convolutional calculation along the horizontal scanning path to obtain the intermediate feature result in the first direction; then performing a complete convolutional calculation along the vertical scanning path to obtain the intermediate feature result in the second direction; and performing a pixel-level arithmetic average operation on the intermediate feature result in the first direction and the intermediate feature result in the second direction to obtain the harmonic block.

[0022] Furthermore, the dynamic queue expansion process in step 3.3 includes: traversing the current interleaved index queue; for structure blocks, shifting the entire block one grid cell to the right and then copying it as an expanded block; for texture blocks, performing pixel-level linear interpolation with its successor blocks and then shifting the entire block one grid cell downward to generate an expanded block; for harmonic blocks, while keeping the grid coordinates unchanged, reducing all pixel amplitudes by 10% and then copying it as an expanded block.

[0023] Furthermore, in step 3.3, after completing the dynamic queue expansion, during the two-state alignment mapping, the interleaved index queues are renumbered according to their current position order; even-numbered queue positions are marked as state one, and odd-numbered queue positions are marked as state two; starting from the head of the queue, for each block in state one position, the scan proceeds to the next nearest state two position, recording all blocks in state two positions within that scan interval; if a block of a different type than the current state block exists within the scan interval, the block of a different type and closest in Euclidean distance to the current block is selected. The block in state 2 is selected as a candidate pair; if all blocks in the scan interval are of the same type, the block in state 2 with the smallest number difference is selected as a candidate pair; for each block in state 2, scan backward to the next nearest state 1 position and record all blocks in state 1 within this scan interval; if there is a block in the scan interval with a different type than the current block in state 2, the block in state 1 with a different type and the closest Euclidean distance to the current block is selected as a candidate pair; if all blocks in the scan interval are of the same type, the block in state 1 with the smallest number difference is selected as a candidate pair.

[0024] Furthermore, for each candidate pair of blocks, the grid coordinate difference between the two blocks in the horizontal and vertical directions is calculated to obtain the horizontal deviation value and the vertical deviation value, respectively. If the horizontal deviation value or the vertical deviation value is greater than 2 grid cells, the candidate pair is determined to be a high deviation pair; otherwise, it is determined to be a low deviation pair. A local rearrangement is performed on the high deviation pair: within the scanning interval of the candidate pair, a replacement candidate block is searched bidirectionally with a step size of 1 grid cell until a replacement block with a horizontal deviation value and a vertical deviation value of no more than 2 is found. If no replacement block is found, the original high deviation pair is maintained. All candidate pairs after deviation calculation are determined to determine the final mapping relationship according to the following priority: pairs with different types and low deviation are used first; pairs with different types and high deviation are used second; and pairs with the same type are used last.

[0025] Compared with existing technologies, the advantages of this invention are as follows: By integrating the scattered and fragmented operations in traditional image restoration into a unified end-to-end process through a complete chain from photometric consistency preprocessing, multi-scale face detection, structural texture bi-branch extraction, block-level recursive misalignment reconciliation to pseudo-random texture diffusion and color consistency optimization, the accuracy and naturalness of digital data processing for facial imperfections are significantly improved. First, the multi-scale pyramid detection framework shares convolutional weights at different resolutions, enabling stable localization of facial regions under complex lighting and pose changes, providing a high-confidence cropping window for subsequent networks. Second, structural feature digital data and texture feature digital data are explicitly separated through an attention fusion layer, allowing facial geometric contours and skin details to evolve independently in a dedicated subspace, avoiding blurring caused by information crowding within the same channel. Third, the block-level recursive misalignment reconciliation mechanism utilizes staggered index queues, dynamic amplification, and bi-state alignment mapping to ensure simultaneous optimization of structural continuity and texture consistency. Simultaneously, confidence segmentation and edge smoothing eliminate block seams, generating restoration feature digital data that can be directly used for visual display. Ultimately, the pseudo-random texture diffusion process compensates for high-frequency details at the local pixel level, while the color consistency module constrains the global hue, resulting in a natural transition in brightness, hue, and saturation between the repaired and original areas, making the repair marks difficult to detect with the naked eye. The entire method employs a moderate number of network parameters and a highly parallel inference process, enabling near real-time operation on mobile devices. Balancing repair quality with computational efficiency, it is particularly suitable for scenarios such as social media photography, smart photo albums, and online identity verification, demonstrating significant application and promotion value. Attached Figure Description

[0026] Figure 1 This is a flowchart illustrating the digital data processing method for facial imperfections based on convolutional neural networks proposed in this invention.

[0027] Figure 2 This is a schematic diagram illustrating the principle of block-level recursive misalignment reconciliation processing in an embodiment of the present invention;

[0028] Figure 3 This is a schematic diagram illustrating the principle of dual-state alignment mapping in an embodiment of the present invention. Detailed Implementation

[0029] The following description is intended to disclose the invention and enable those skilled in the art to implement it. The preferred embodiments described below are merely examples, and other obvious variations will occur to those skilled in the art.

[0030] Reference Figure 1 As shown, a method for processing digital data on facial imperfections based on convolutional neural networks is described, the method comprising:

[0031] Step 1: After preprocessing the original digital data of facial imperfections, the face bounding box is determined using a multi-scale pyramid face detection framework;

[0032] The white balance correction process draws on the principle of color constancy, treating the multiplicative offset imposed by ambient light on the three color channels as a set of independent gains. It iteratively solves for the gain coefficients using the gray-world assumption and joint channel mean, then restores the channel proportions affected by the light source color temperature through pixel-by-pixel multiplication. This ensures that the preprocessed facial digital data maintains a stable color distribution under different lighting conditions, providing a comparable baseline for subsequent channel weighting in the feature dimension during convolution operations. Next, the logarithmic photometric smoothing transformation introduces the human visual approximation principle of logarithmic mapping, compressing the original linear grayscale to the logarithmic domain. Mathematically, this transforms multiplicative lighting changes into additive biases, weakening extreme gradients in bright areas and enhancing details in dark areas, resulting in a more balanced response of the convolution kernel to local gradients. Simultaneously, the smoothing factor achieves continuous interpolation in the logarithmic domain, preventing high-frequency oscillations from spreading to the receptive field of subsequent convolutional layers. Finally, Gaussian noise suppression approximates the local statistical average with an isotropic kernel function, reducing computational complexity through separable filtering, and using edge-preserving weights to weaken cross-boundary diffusion, thus preserving structural contours and texture backbone.

[0033] After completing the above three steps, the multi-scale pyramid face detection framework, based on scale space theory, constructs a top-down multi-scale digital data sequence from preprocessed face digital data at a fixed scaling ratio. Each scaling level corresponds to a combination of convolution, normalization, and activation operations. This combination essentially relies on shared convolution kernels to maintain consistent weight parameters at different resolutions, making feature extraction weakly sensitive to target size. The candidate feature plane forms a discrete scale space representation during the layer-by-layer accumulation process, capable of simultaneously capturing the global layout of large-sized faces and the local details of small-sized faces. Max pooling downsampling operation performs subsampling in the spatial dimension by taking local extrema to obtain a confidence plane. Its principle is to treat the response amplitude of convolutional features as a probabilistic measure, with the probability peak representing the most suspicious region of the face. The threshold screening stage uses confidence gating to remove low-probability blocks, ensuring that the set size of subsequent de-overlapping screening is controlled. Finally, overlapping candidate rectangles are suppressed through intersection-union ratio (IU / UGL) evaluation. The theoretical basis is that the responses generated by the same face are consistent in both scale space and location space. Replacing other overlapping rectangles with the maximum confidence rectangle can effectively reduce redundant detection. Thus, the determination of the face bounding box not only provides precise coordinates for cropping, but also suppresses background interference through scale diversification and statistical gating mechanisms. This ensures that the standardized face digital data input to the convolutional neural network conforms to the optimal assumptions of deep feature extraction in terms of luminance distribution, noise level, and spatial scale. This provides a highly consistent and robust feature modeling starting point for subsequent multi-scale convolutional coding layers, residual focusing layers, and attention fusion layers.

[0034] Step 2: After cropping the face bounding box, scale it at a fixed resolution to obtain standardized face digital data; feed the standardized face digital data into a convolutional neural network, and pass it through a multi-scale convolutional coding layer, a residual focusing layer and an attention fusion layer in sequence to generate structural feature digital data and texture feature digital data;

[0035] First, the face bounding box is cropped and scaled at a fixed resolution to obtain standardized digital face data. This operation starts with image geometric normalization and establishes a consistent spatial dimension on the pixel grid through linear interpolation resampling. This ensures that faces of any size have comparable local neighborhoods under the same convolutional kernel size, thus avoiding mismatch in receptive fields for different input sizes. At the same time, the scaling process maintains a constant aspect ratio to prevent facial structural deformation from causing feature distortion, providing geometric consistency for weight sharing in subsequent convolutional layers. Subsequently, the standardized digital face data is fed into a multi-scale convolutional coding layer. This layer constructs an incremental receptive field according to an adaptive stride and dilatancy convolution strategy. By stacking multiple sets of convolutional kernels in parallel within the same level feature map, broadband spectral feature capture is achieved, preserving fine-grained edge information of defects while integrating the overall geometric layout of the face. The depthwise separable convolution with shared weights reuses parameters across multiple branches, reducing redundant computation and maintaining feature correlation, enabling a nested progressive representation of structural and texture signals in cross-scale mapping. The high-dimensional feature tensor output by the multi-scale convolutional coding layer then enters the residual focusing layer. The residual focusing layer is theoretically supported by cross-layer identity mapping and establishes a short-range information loop between the main path and the shortcut path. It directly transmits low-level features to high-level semantic nodes through addition operations, solving the gradient vanishing problem in deep networks. At the same time, pixel-wise multiplicative gating is inserted inside the main path to dynamically emphasize the significant response of facial blemish areas. This allows the convolutional kernel to focus on irregular defect edges and texture mismatches, forming a highly sensitive feature expression for local anomalies.

[0036] The feature tensors after residual focusing enter the attention fusion layer. This layer introduces a self-attention mechanism to encode long-distance dependencies in spatial dimensions as inter-channel weight distributions, explicitly modeling the structural and textural relationships between different facial regions. The attention fusion layer calculates structural and textural correlations using a dot product similarity matrix, then generates channel weights using soft maximum normalization. The outputs of the multi-scale convolutional coding layer and the residual focusing layer are then recombined and synthesized using a weighted approach, resulting in two complementary but independent feature branches: structural feature data and texture feature data. The structural feature data focuses on recording facial contours, organ edges, and geometric consistency information, providing shape priors for subsequent block-level recursive misalignment reconciliation. The texture feature data focuses on skin texture, blemishes, and lighting details, providing rich local contrast information for texture reconstruction. Through the above four consecutive steps, step 2 achieves a seamless connection from high resolution to deep feature space while maintaining channel consistency. This enables subsequent block-level recursive misalignment harmonization processing to simultaneously utilize facial geometric framework and detail texture signals to perform fine repair on blemish areas. Ultimately, this ensures that the invention still has highly reliable repair performance and real-time operating efficiency in scenarios with complex lighting, poses, and diverse blemish types.

[0037] Step 3: Perform block-level recursive misalignment harmonization processing on the structural feature digital data and texture feature digital data, and output the repair feature digital data;

[0038] After the two types of features are divided into structural blocks and texture blocks of equal size, the algorithm first writes them into an interleaved index queue according to a fixed alternating order, retaining the original sequence number information within the queue so that the historical position of the block can be accurately tracked when the misaligned window slides. Then, a misaligned window of constant length is generated according to a preset movement rule, and each slide moves only one queue position, thus forming a smooth transition in the temporal dimension. The blocks within each misaligned window are output as harmonic blocks after being scanned by horizontal and vertical dual-path convolution. This process uses the same convolution kernel group to share weights to ensure that the feature responses in different directions maintain consistent amplitude, and reduces directional deviations through pixel-level arithmetic averaging, so that the newly generated harmonic blocks have both geometric and texture information. After the harmonic blocks are appended to the tail of the queue, the queue length increases with each cycle. To avoid feature decay and queue sparsity, the framework designs a dynamic queue expansion strategy: the structural blocks are performed as a whole translation copy, the texture blocks are performed as linear interpolation followed by translation copy, and the harmonic blocks are performed as amplitude weakening copy. The distribution differences of the three in the grid ensure that the expanded blocks provide sufficient diversity while maintaining the original queue order.

[0039] After amplification, the dual-state alignment mapping begins. The system generates state one and state two labels based on the parity of the queue position. Within the preceding and following scan intervals of the same state, it prioritizes searching for dissimilar blocks as pairing objects. If only blocks of the same type exist, it selects the one with the smallest number difference. During pairing, both horizontal and vertical deviation values ​​are evaluated. When the deviation is too large, local rearrangement is triggered to find a more suitable replacement block in the neighborhood to reduce structural tearing and texture misalignment. After all candidate pairings are mapped, the algorithm enters a bidirectional recursive loop of forward convolution fusion and backward convolution fusion. By continuously superimposing short-range and long-range convolution paths, the structural trajectory and texture vein gradually converge in multiple iterations. As the square root round of the loop counter ends, the blocks in the interleaved index queue are composed of a mixture of original blocks, amplified blocks, and fused blocks. The system calculates the average pixel confidence for each fused block and automatically divides the queue into high-confidence and low-confidence segments. Blocks in high-confidence segments are directly written into the candidate repair plane and their boundaries are locked to preserve the most reliable geometric information. Blocks in low-confidence segments are first shifted by a shift filter before being written into the candidate repair plane, using positional fine-tuning to reduce potential errors. Bidirectional edge smoothing fusion is performed at the boundaries of the two segments, using a weighted average method to generate transition bands between adjacent pixels, effectively eliminating blocky traces and maintaining color gradient continuity. The final output repair feature digital data carries both complete facial structure contours and delicate skin textures, providing high-quality input for the next pseudo-random texture diffusion process. This block-level recursive misalignment harmonic processing, through dynamic management of interleaved index queues, adaptive pairing of bi-state alignment mappings, and a progressive strategy of bidirectional convolutional fusion, achieves coupled correction of structure and texture. It not only bridges the gap between local defects and global geometry but also suppresses noise accumulation and feature drift during iteration, laying a stable and accurate intermediate feature foundation for the entire facial defect digital data processing method.

[0040] Step 4: Input the repair feature digital data into the pseudo-random texture diffusion process, perform texture detail compensation and color consistency optimization, and generate target repair digital data.

[0041] The pseudo-random texture diffusion process uses high-confidence regions in the repair feature digital data as diffusion seeds. It establishes a diffusion priority queue on the pixel grid by dividing the seed set and candidate set in one step. The queue is arranged according to pixel adjacency, and the path length between the seed pixel and the candidate pixel is considered the diffusion depth. Each candidate pixel is assigned a dynamically updated weight, which is calculated by combining spatial distance, local gradient magnitude, and structural connectivity. To avoid predictable repetitive textures, this process injects a pseudo-random displacement into each diffusion operation. The displacement vector comes from a linear congruential sequence generator, and independent seed values ​​are maintained across different image frames, ensuring that even if the same type of defect recurs, no patterned traces are generated. During diffusion, the algorithm performs pixel-by-pixel matching within the neighborhood, prioritizing candidate pixels with the highest texture similarity and smallest color difference to the seed pixel. A weighted average method is used to propagate the seed texture to the candidate position. Simultaneously, a color fusion strategy is used for real-time correction of candidate pixels: on the one hand, the color average from adjacent repaired pixels is superimposed on the three color channels of the candidate pixel; on the other hand, the target distribution of the global color histogram is used as a constraint to maintain global consistency by minimizing local color differences.

[0042] Once the diffusion front reaches the tail of the queue, the first round of texture compensation ends. The next stage is texture detail compensation. The algorithm returns to all filled pixels and checks if local high-frequency details meet a predefined threshold. If insufficient detail is found, a second diffusion is initiated. This process uses a smaller neighborhood radius and a higher texture similarity threshold, compensating only minor texture features where needed, avoiding a plastic look caused by over-smoothing. After texture detail compensation, the color consistency optimization stage begins. This stage first calculates the color distribution difference between the repaired area and the original non-blemish area, maps the difference to a unified color correction curve, and then corrects the color shift of individual channels through piecewise linear interpolation, ensuring that the facial skin maintains a smooth gradient with the surrounding area in terms of brightness, saturation, and hue. Color consistency optimization also includes cross-channel collaborative constraints, dynamically adjusting weights using inter-channel correlation coefficients to ensure no imbalance occurs between channels, such as avoiding excessive enhancement of the red channel that causes a reddish skin tone. The entire optimization process is executed multiple times in an iterative loop. After each iteration, color balance is evaluated using a global error metric function. The process stops when the error converges to a set threshold or the maximum number of iterations is reached. To ensure computational speed, the pseudo-random texture diffusion process, texture detail compensation, and color consistency optimization are all implemented in parallel on the graphics processing unit. Shared memory is used to cache local pixel blocks, reducing memory round-trip overhead. Simultaneously, intra-block parallel scanning improves diffusion and compensation efficiency. The final output target restoration digital data significantly outperforms the input restoration feature digital data in terms of spatial coherence, texture richness, and color balance, achieving seamless restoration of facial blemishes and providing a high-quality image foundation for subsequent display, storage, or further processing.

[0043] Furthermore, in the facial blemish digital data processing method based on convolutional neural networks of the present invention, the preprocessing stage is responsible for transforming the original facial blemish digital data into preprocessed facial digital data with photometric balance, noise control, and suitable dynamic range. The entire process sequentially performs white balance correction, logarithmic photometric smoothing transformation, and Gaussian noise suppression, and completes data recoding in a single pipeline. First, the white balance correction is based on the principle of color constancy. By independently solving the gain coefficients in the red, green, and blue channels, the multiplicative bias introduced by ambient lighting is canceled out. At the same time, the gray world assumption provides an initial estimate, and then an iterative refinement is performed in combination with the prior skin color in the facial region, so that the correction result satisfies global gray-level balance and maintains a natural tone in the facial skin distribution. The process begins by statistically analyzing the overall average of the original digital data of facial imperfections to obtain the average brightness of each channel. Then, the gain is calculated according to the target average ratio and multiplicative adjustment is applied to all pixels. Subsequently, candidate skin color regions are detected in the preliminary corrected image, the channel average is recalculated for the candidate regions, and the gain is finely adjusted with this average as a reference to ensure that the color of the central facial region does not shift.

[0044] After white balance correction, the system immediately enters the logarithmic photometric smoothing transformation process. This process is based on the characteristic that human vision responds logarithmically to changes in brightness. It compresses the dynamic range of bright areas and enhances details in dark areas within the logarithmic domain, giving the convolutional kernel a more balanced sensitivity to gradient signals from different lighting conditions. Specifically, the algorithm first maps the linear grayscale of each pixel to the logarithmic domain, then smooths the grayscale differences between pixels using a one-dimensional continuous interpolation function, eliminating quantization steps. Next, a local contrast-preserving gating is introduced, assigning different smoothing weights to high-contrast edges and low-contrast textures, maintaining the clarity of facial microstructures while ensuring large-scale photometric smoothing. After the logarithmic photometric smoothing transformation, the preprocessing flow enters Gaussian noise suppression. The weight distribution of the Gaussian kernel naturally satisfies the principle of spatial continuity, effectively reducing random high-frequency signals introduced by the sensor while preserving the main edge structure.

[0045] The implementation involves performing separable convolution operations on each of the three channels, with one row-wise filtering and one column-wise filtering to achieve two-dimensional smoothing. A sliding window shared buffer is used to reduce computational latency. To avoid over-smoothing of edge details, the algorithm first calculates the local gradient magnitude for each pixel and adaptively adjusts the weighted attenuation factor of the Gaussian kernel based on the magnitude, reducing the filtering radius in high-gradient regions and thus preserving facial contours and blemish edges. Thus, through white balance correction for color consistency, logarithmic photometric smoothing for dynamic range compression, and Gaussian noise suppression for noise reduction, the original facial blemish data is transformed into preprocessed facial data, possessing comprehensive characteristics of color stability, photometric balance, and discernible texture. This provides a unified and reliable input foundation for the subsequent multi-scale pyramid face detection framework and ensures that the subsequent convolutional neural network can extract features fairly from all facial samples under the same photometric and noise conditions, significantly improving the robustness and accuracy of the entire method in complex environments.

[0046] Furthermore, in multi-scale pyramid face detection, the preprocessed digital face data is first used to construct a top-down multi-scale digital data sequence according to a fixed scaling ratio. This process is based on the principle of scale-space continuity, mapping all faces that may appear at different sizes to the range covered by the receptive field of the convolutional kernel by progressively reducing the image size layer by layer. This ensures that subsequent feature extraction is weakly sensitive to target size. When each level of digital data sequence is fed into the convolution operation stage, all convolutional kernels share weight parameters, enabling the local responses extracted at different resolutions to be aligned in the same feature dimension. The normalization operation following the convolution operation corrects the mean and variance of the channel distribution, ensuring that the feature amplitude falls into a stable range and preventing gradient explosion or vanishing. The activation operation uses a nonlinear gate function to compress negative values ​​and enhance positive responses, providing discriminative capabilities for deep networks. Thus, the feature tensors generated at each scale are converged into candidate feature planes, which record the convolution response amplitudes at all spatial locations at that scale.

[0047] Subsequently, max pooling downsampling is performed on the candidate feature plane. Max pooling uses local extrema to represent the most significant facial feature responses within the window, thus generating a confidence plane. Each element in the confidence plane can be considered as a probability estimate that a face is present at that location. To filter background noise, the system applies a gating operation to the confidence plane, retaining only the coordinates of digital data blocks with confidence scores higher than a preset confidence threshold. These coordinates are then mapped back to the original resolution according to the scaling ratio, forming an initial set of candidate rectangles. Since multiple overlapping candidate rectangles may be generated for the same face at nearby scales and adjacent locations, the system performs de-overlap filtering on the initial set. The system calculates the overlap of the identified shapes using the intersection-union ratio (IoU) and progressively eliminates them according to confidence scores, always retaining the rectangle with the highest confidence score and the largest coverage area, ultimately outputting a unique face bounding box. The entire detection process, through the synergistic effect of four stages—spatial pyramid, shared convolutional weights, max pooling extreme value sampling, and confidence gating—achieves robust localization of faces under different sizes, poses, and complex lighting conditions. This provides accurate and high-confidence coordinate references for subsequent cropping and fixed-resolution scaling, ensuring the consistency and reliability of the input domain of the convolutional neural network.

[0048] Furthermore, in the digital data processing method for facial imperfections based on convolutional neural networks, block-level recursive misalignment harmonization plays a crucial role in establishing high-precision coupling between structural feature digital data and texture feature digital data. The entire process is based on a consistent grid, dividing the two feature branches into equally sized and absolutely aligned blocks. First, a strict one-to-one mapping relationship is maintained on the grid, marking blocks from structural feature digital data as structural blocks and blocks from texture feature digital data as texture blocks. The two types of blocks are written into an interleaved index queue in an alternating order, so that the queue presents an arrangement of structural blocks and texture blocks appearing alternately from the start to the end. This interleaved arrangement lays the spatial foundation for the subsequent misaligned convolution operation process, because when the sliding window moves along the queue, any consecutive block combination must simultaneously contain structural and texture information, ensuring that the harmonization stage can process shape and texture differences simultaneously.

[0049] After the interleaved index queue is initialized, the frame slides to generate misaligned windows according to preset movement rules. Each slide moves only the queue head pointer by one position, causing a slight displacement of the blocks within the window in the temporal dimension. This displacement is mapped as a stepped layout in the 2D mesh, breaking the spatial alignment between adjacent blocks and artificially creating gaps and overlapping areas across blocks. The misaligned convolution operation utilizes these overlapping areas to collect cross-block information. By executing two independent convolution scan paths in the horizontal and vertical directions, edge pixels from different blocks are merged, resulting in a harmonic block at the output. The harmonic block is immediately appended to the tail of the interleaved index queue, thereby increasing the queue length. Because the harmonic block retains both structural and texture responses, it will form misaligned windows again with new structural or texture blocks in subsequent slides, recursively producing higher-level fusion effects.

[0050] As the queue length increases, the system initiates a dynamic queue expansion strategy to avoid dilution of fusion information. During expansion, for structural blocks, the frame is directly translated and copied horizontally; for texture blocks, pixel-level linear interpolation is performed with the successor block before vertical translation and copying; for harmonic blocks, the pixel amplitude is reduced overall without changing the grid coordinates before copying. Through these three different expansion methods, the queue obtains diverse and controllable redundant information, providing richer candidate relationships for subsequent alignment mapping. Expansion continues until the queue length exceeds a set threshold, at which point the system enters the bi-state alignment mapping stage. In the mapping stage, each block is first assigned a state one or state two label according to its current position parity, and a bi-directional scanning mechanism is established within the queue: blocks in state one only search for the nearest state two block, and blocks in state two only search for the nearest state one block. Within each scan interval, the algorithm prioritizes pairing blocks of different types with the smallest Euclidean distance; if only blocks of the same type exist within the interval, the block with the smallest number difference is selected for pairing. To ensure pairing quality, the system calculates horizontal and vertical deviation values ​​in real time and performs local rearrangement on pairs with high deviations. It searches for replacement blocks with smaller deviations by searching forward or backward block by block, thereby reducing structural distortion and texture shift.

[0051] Once pairing relationships are generated, the framework first performs forward convolutional fusion between paired blocks, followed by backward convolutional fusion. Forward convolutional fusion propagates feature information along the natural order of blocks in the queue, ensuring a smooth transition of structural continuity from beginning to end. Backward convolutional fusion propagates in the opposite direction, feeding back texture details to the preceding block. This bidirectional propagation is repeated in each recursive loop, with the number of recursions determined by the square root of the loop counter. This design avoids excessive information mixing caused by deep recursions while ensuring sufficient iteration to guarantee fusion depth. After the loop ends, the fused blocks are mixed with the original and augmented blocks in the same queue. The system calculates the average pixel confidence for each fused block, serving as an objective indicator of structural consistency and texture integrity. Based on the confidence ranking, the queue is divided into high-confidence and low-confidence segments. In the high-confidence segment, the fusion block is written directly to the candidate repair plane with the original resolution and grid coordinates, and the boundary is locked immediately to protect the most stable geometric and texture information. In the low-confidence segment, the fusion block is first fine-tuned in position by a shift filter, and then written to the candidate repair plane, and the boundary is locked in the same way, thereby reducing the impact of potential position errors on the overall layout.

[0052] At the adjacent boundaries between high-confidence and low-confidence segments, the framework performs bidirectional edge smoothing fusion. This fusion operation simultaneously weights and averages edge pixels in both the horizontal and vertical directions, gradually transitioning the grayscale values ​​of boundary pixels through progressive weight allocation, ultimately eliminating blocky edges. This process ensures seamless color and texture transitions between blocks of different confidence levels within the restoration area, avoiding abrupt segmentation visual effects. After edge smoothing is completed, all blocks in the staggered index queue have found their corresponding positions in the candidate restoration plane, which is then filled with a continuous image, thus generating the restoration feature digital data.

[0053] Overall, the block-level recursive misalignment harmonic processing, from the initial interleaved writing to the final edge smoothing fusion, repeatedly interweaves structural and texture feature digital data across multiple scales and recursive stages. This iterative process weakens the differences between the two in the local coordinate system, achieving the dual constraints of structural continuity and texture consistency. Specifically, the interleaved index queue provides a unified data structure, ensuring all blocks, regardless of origin, type, or generation round, are dynamically tracked within the same sequence; misaligned windows and misaligned convolutions introduce controllable spatial displacement, creating cross-block overlapping regions to uncover hidden complementary information; dynamic queue expansion prepares a sufficiently diverse range of candidate blocks for later mapping and fusion, preventing feature decay; bi-state alignment mapping constructs symmetrical pairings through parity marking and distance metrics, reducing local mismatches; bidirectional convolutional fusion and recursive loops progressively increase fusion depth without over-smoothing details; confidence segmentation and shift filtering ensure high-quality information is prioritized and the layout remains clean; and bidirectional edge smoothing fusion eliminates all block traces in the final step, giving the repaired feature digital data continuous texture and complete contours.

[0054] Furthermore, in the staggered window mechanism, the window length is fixed at four consecutive blocks. This length ensures that the convolutional kernel has sufficient structural and texture references within the local region, while avoiding excessively wide windows that would dilute the fused content. The sliding stride is limited to one block, meaning that each slide only moves the first block out of the window and introduces the next block. The queue head pointer then moves one position towards the queue tail, thus establishing a smooth transition similar to a time series, allowing adjacent windows to share the overlapping area of ​​three blocks, ensuring continuous information progression during recursion. When the four blocks in the window are sequentially labeled as the first, second, third, and fourth blocks according to their original numbers, the algorithm applies limited displacements to them within a two-dimensional grid: the second and fourth blocks are shifted one grid cell to the right, the third block is shifted one grid cell down, and the first block remains in its original position, thus forming a stepped staggered layout. The essential purpose of this layout is to artificially create asymmetric overlapping regions across blocks, allowing the second block to share a single grid cell with the first block on the horizontal edge, and the third block to form new intersections with the second and fourth blocks in the vertical and diagonal directions. Simultaneously, the fourth block and the third block again create a horizontally shared zone. Through this stepped rhythm of "up-left—up-right—down-center—down-right," structural and texture information within the same window is forced to repeatedly intersect in the horizontal, vertical, and diagonal directions, allowing convolutional scanning to capture heterogeneous feature interactions in multiple directions during a single forward propagation. Compared to traditional neatly aligned block layouts, the stepped misalignment not only increases the effective receptive field between adjacent blocks but also avoids "hard cutting" of the convolutional kernel at block boundaries, reducing edge artifacts. Furthermore, since the misalignment operation only involves the displacement of integer grid cells, the pixel matrix of the block itself remains consistent with its logical order in the interleaved index queue, without introducing additional interpolation errors. As the window slides continuously with a step size of 1, each newly generated staggered layout will cover the other 3 blocks except for the first block that was just moved out of the previous window. Through this progressive method with a high overlap rate, the harmonic block can "inherit" the fusion features of the previous block in multiple rounds of recursion, and then superimpose the incremental information from the new block, ultimately forming a deep fusion representation that retains the historical context and continuously injects new details, laying a more solid foundation for the structural and texture collaboration of subsequent dynamic queue expansion and bi-state alignment mapping.

[0055] Furthermore, in the misaligned convolution operation process, the system first determines two convolutional scanning paths along the horizontal and vertical directions, respectively, for the stepped layout of the current misaligned window. The horizontal scanning path covers adjacent pixel regions located in the same row that overlap due to rightward translation, while the vertical scanning path covers adjacent pixel regions located in the same column that overlap due to downward translation. To align the horizontal and vertical feature sets on the same scale, the framework configures an independent set of convolutional kernels for each of the horizontal and vertical scanning paths. The size of each convolutional kernel is uniformly set to 3x3 pixels, and all convolutional kernels share the same stride and padding strategy, ensuring that the spatial dimensions of the output feature maps in both directions are completely consistent. Subsequently, the algorithm first performs a complete convolution calculation along the horizontal scanning path: sliding the 3x3 convolutional kernel within the coverage area, multiplying and accumulating each overlapping sub-region in the path, and outputting the intermediate feature result in the first direction. This result essentially captures the structural connections and texture gradients of the staggered layout in the horizontal direction, particularly enhancing the pixel similarity and grayscale gradient at the horizontal boundaries between the second and first blocks, and between the fourth and third blocks. After horizontal convolution, the system immediately repeats the same computation process along the vertical scanning path, obtaining the intermediate feature results in the second direction on the same output plane. Vertical convolution focuses on the seam details and texture extension at the vertical boundaries between the third and second blocks, and between the fourth and third blocks, compensating for the limitation of horizontal convolution in sensing the upper and lower neighborhoods.

[0056] Once the intermediate feature results from both directions are generated, the algorithm uses a pixel-level arithmetic average to fuse them: for any pixel value at the same coordinate position, the average of the output values ​​from both directions is simply calculated as the final output value, thus obtaining the harmonic block. This 1:1 weighted averaging strategy avoids any single scanning path from dominating numerically and achieves feature complementarity with minimal computational complexity. Since both horizontal and vertical convolutions use 3x3 kernel groups, their response range and weight distribution to overlapping regions are highly consistent. The pixel-level arithmetic average does not introduce scale mismatch or cause blurring after information overlap. The final harmonic block combines structural corners, texture stitching, and grayscale transition features captured in the two orthogonal directions (horizontal and vertical), making the pixels within the block exhibit both smooth horizontal extension and continuation while retaining the fine detail of vertical texture. After the harmonic block is appended to the end of the staggered index queue, it will continue to participate in higher-level convolutional fusion in the next round of staggered window sliding, gradually improving the geometric consistency and texture integrity of local facial regions, and ensuring that the recursive process maintains balanced and stable convergence in multi-directional feature fusion.

[0057] Furthermore, in the dynamic queue expansion phase, the framework first starts from the head of the interleaved index queue and sequentially reads the currently stored structure blocks, texture blocks, and harmonic blocks one by one. When a structure block is read, the system directly shifts the entire structure block one grid cell to the right while keeping the pixel matrix unchanged. Then, the shifted copy is appended to the tail of the interleaved index queue and marked as an expanded block. Since the shift operation only changes the relative position of the block in the grid without changing its pixel values, this expansion step can provide additional geometric support with the same shape features as the original structure block but in a new position, supplementing more candidate structure pairs for subsequent bi-state alignment mapping. If the traversal pointer currently points to a texture block, the system first takes the texture block and its subsequent block in the queue, calculates the intermediate grayscale value of the corresponding pixels of the two blocks using pixel-level linear interpolation, generates a transition texture matrix, and then shifts the entire transition texture matrix down one grid cell and copies it as an expanded block and adds it to the tail of the queue. The purpose of this approach is to simultaneously introduce subtle texture transitions and new vertical position transformations, making texture information more spatially continuous and avoiding texture autocorrelation caused by direct repetition. When traversing to a harmonic block, the framework maintains the grid coordinates of the harmonic block unchanged, only reducing the amplitude of all pixels within the harmonic block by 10%, and then copying it as an augmentation block and writing it to the tail of the queue. Amplitude reduction provides a less significant redundant copy at the same spatial location to offset possible local over-enhancement and form a natural amplitude gradient in subsequent confidence segmentation. As traversal progresses, the length of the interleaved index queue gradually increases, and the new augmentation block maintains the same alternating order features as the original block, thus not disrupting the spacing pattern of the original structure block and texture block. After augmentation, the density of structural information, texture information, and fusion information within the queue is synchronously increased, ensuring richer pairing options for subsequent bi-state alignment mapping and preventing the information generated by recursive misaligned convolution from being rapidly diluted in the loop. This provides sufficiently diverse and hierarchical inputs for forward and backward convolutional fusion, ultimately improving the convergence speed and output quality of block-level recursive misaligned harmonic processing.

[0058] Furthermore, after completing the dynamic queue expansion, the framework immediately renumbers the interleaved index queue according to its current position, using incrementing integers starting from zero to represent the new sequence number of each block in the queue. The system uniformly marks queue positions with even numbers as state one and queue positions with odd numbers as state two. This parity partitioning logically differentiates the originally linearly arranged blocks into two interleaved virtual sub-chains. Starting from the head of the queue, the algorithm first traverses all blocks in state one. When the pointer points to a block in state one, the system scans backward after that block until it encounters the first block in state two; the interval traversed during this process is called the current scan interval. Within the scan interval, the algorithm records all blocks in state two, their Euclidean distance to the current block, and their type information. If a block of a different type exists within the interval than the current block—for example, if the current block is a structure block while the interval contains texture blocks or harmonic blocks—the system selects the block with the closest Euclidean distance from the candidate set of different types as the candidate pair.

[0059] This approach maximizes the complementarity between structure and texture while maintaining a compact spatial distribution. If all blocks within the scan interval are of the same type as the current state block, the system prioritizes the state block with the smallest number difference as a candidate pairing, ensuring the pairing distance is as short as possible and reducing spatial misalignment caused by subsequent convolutional fusion. After completing a pairing decision, the traversal pointer remains at the current state block position. The system only records the pairing relationship without changing the queue structure, then continues to move the pointer forward to find the next state block and repeats the above process. Once all state blocks have been paired, the algorithm retraces all blocks at the state two position from the head of the queue, executing a symmetrical process: for each state two block, it scans backward to the next state one position, collecting all state blocks within the scan interval; if there are blocks of different types within the interval, the state block with the different types and the closest Euclidean distance is selected as a candidate pairing; if the block types within the interval are completely identical, the state block with the smallest number difference is selected as a candidate pairing.

[0060] Through bidirectional scanning, the system ensures that each state block and each state 2 block has at least one candidate pairing, forming a dense bidirectional link in the pairing graph across the entire interleaved index queue. Since parity marking naturally guarantees the alternation of the two states, the scanning interval does not expand indefinitely, preventing geometric looseness caused by long-distance pairing. Euclidean distance, as a core indicator of spatial proximity, combined with priority ranking based on block type differences, ensures that candidate pairings consider both structural and textural differences while remaining within an acceptable range of the local receptive field. The final candidate pairing set undergoes further screening in the subsequent horizontal and vertical deviation value calculation stages. Only pairings that meet the deviation threshold or are adjusted to within the threshold through local rearrangement are retained for the forward and reverse convolution fusion processes. This bi-state alignment mapping strategy utilizes parity numbering to construct an implicit hierarchical index, achieving adaptive pairing through local scanning and type discrimination. It not only maintains the sequential consistency of the interleaved index queue but also fully exploits the complementary potential between structural blocks, texture blocks, and harmonic blocks, providing high-quality entry relationships for recursive fusion and significantly improving the overall performance of subsequent fusion blocks in terms of geometric connection and texture filling.

[0061] Furthermore, after generating candidate pairs through the bi-state alignment mapping, the system immediately initiates the deviation calculation module to calculate the horizontal and vertical coordinate differences for each candidate pair. Specifically, the algorithm directly compares the row and column indices of the two blocks in a unified grid: the column index difference is the horizontal deviation value, and the row index difference is the vertical deviation value. The two non-negative integers obtained are used to measure the geometric distance between the two blocks in the horizontal and vertical directions. If either the horizontal or vertical deviation value is greater than 2 grid cells, the candidate pair is marked as a high-deviation pair; if neither is greater than 2, it is marked as a low-deviation pair. After completing the initial classification, the system performs local rearrangement on all high-deviation pairs sequentially. Local rearrangement is performed within the scan interval recorded when generating the pair, with the two ends of the interval representing the positions of the two currently paired blocks in the interleaved index queue. The algorithm expands the search forward and backward simultaneously in steps of 1 grid cell, attempting to find a replaceable candidate block within this interval such that the horizontal and vertical deviation values ​​obtained after recombination with the current block are both no greater than 2. The search prioritizes spatial distance, first checking the block with the smallest Euclidean distance to the current block and then expanding outwards. Secondly, based on block type differences, blocks of different types are placed in a higher priority order to increase the probability of structural and texture complementarity. If no new pairing that meets the double deviation threshold can be found within the entire scan interval, the algorithm accepts the original high-deviation pairing without modification to ensure the connectivity and integrity of the mapping graph.

[0062] After all high-biased pairs undergo a rearrangement process, the system has a set of candidate pairs after bias calculation and possible replacements. Next, the final mapping relationship is determined according to a priority strategy: the first priority is for pairs of different types with low bias; these pairs satisfy both geometric compactness and semantic complementarity, which is most beneficial for subsequent convolutional fusion. The second priority is for pairs of different types but with high bias; although these pairs have a large geometric spacing, they still have high fusion value because their structure and texture are complementary. The last category is pairs of the same type; regardless of bias, they are at the end of the priority queue and are only included in the mapping if the first two categories are insufficient to cover all blocks. During the priority sorting process, the uniqueness constraint of each pair edge is maintained. If the same block is covered by multiple candidate edges, the one with the highest priority and smallest bias value is retained, and the remaining edges are discarded. After completing the above filtering, the system generates the final mapping relationship graph and writes it into the recursive fusion module as the connection topology for forward convolutional fusion and reverse convolutional fusion. By employing this comprehensive strategy based on deviation thresholds, local rearrangement, and priority ranking, the method simultaneously ensures the balance between the reasonableness of the spatial distance between blocks and the diversity of types, significantly reducing the risk of structural tearing and texture drift. This provides a high-quality and robust pairing foundation for subsequent fusion block generation, enabling the entire digital data processing chain for facial imperfections to maintain accurate alignment and stable convergence in complex grid space.

[0063] Below is an example demonstrating the complete workflow of a digital data processing method for facial imperfections based on convolutional neural networks. The example starts with an image of resolution [resolution value missing]. Pixels, per channel Bit-depth raw facial blemish digital data Start by completing the steps in sequence. To the steps .

[0064] step Preprocessing and multi-scale pyramid face detection: White balance correction: Setting Indicates three color channels; This is the gain coefficient; These are the original pixel values; These are the pixel values ​​after white balance. Logarithmic photometric smoothing transformation: linear photometric Convert to logarithmic field Then with parameters Exponential smoother smoothing: Gaussian noise suppression: using kernel size Standard deviation Two-dimensional Gaussian convolution kernel ; Filtering results : Pyramid construction and convolutional detection: scaling Minimum detection size Pixels, co-generated Layer-scale sequence In each layer of the image Above, using a shared kernel size stride The detection network extracts candidate feature planes After batch normalization and After activation, the maximum pooling window Obtain the confidence plane Set a threshold. ,satisfy The location is mapped back to the original scale, and non-maximum suppression is performed across the entire scale set, with cross-union thresholding applied. Final face bounding box coordinates .

[0065] step Cropping and Scaling & Feature Dual-Branch Generation: Cropping and Scaling: Cropping Region Bilinear interpolation scaling to Size, to obtain standardized digital facial data Multi-scale convolutional coding layer: Three sets of dilation coefficients are used. Each group contains indivual Dilatable convolution kernel; output feature tensor Residual Focusing Layer: Used on the main path indivual Convolution and indivual Shortcut path identity mapping; output Attention fusion layer: Calculates self-attention weights. ;in Structural channel weights Texture channel weights Obtained through channel segmentation: ; and These are structural feature digital data and texture feature digital data, respectively.

[0066] step Block-level recursive misalignment reconciliation: Mesh generation and interleaved writing: Feature maps are divided into Grid, size of each piece Structural blocks With texture blocks Write to the interleaved index queue in alternating order. Misaligned windows and convolutional scans: Window length Step length For blocks within the window Apply A staggered layout is obtained. A horizontal convolutional kernel group is constructed. Convolutional kernel group in the vertical direction All sizes .calculate ; Mixed block Added to Tail. Dynamic queue expansion: traversal. The entire structural block was shifted to the right. Unit copying; texture blocks are linearly interpolated and then shifted downwards. Unit copying; harmonic block pixel magnitude multiplication The queue length is determined by... Increase to Two-state alignment mapping: The queue is renumbered, with even numbers representing state one and odd numbers representing state two. For each state block, scan backwards to the nearest state two block. If the types are different, choose the one with the smallest Euclidean distance; otherwise, choose the one with the smallest number difference. A symmetric strategy is applied to state two blocks. Generate a candidate pairing set. Deviation Calculation and Local Rearrangement: For calculate ;like If the deviation is high, it is considered high; otherwise, it is low. For high deviation, pair the step size within its scanning interval. Bidirectional search and replace block ,satisfy If no match is found, the original pairing is retained. Final mapping priority: different types and low bias. Different types and high deviation Same type. Bidirectional convolutional fusion and confidence segmentation: Perform one forward convolutional fusion and then one backward convolutional fusion along the mapping direction, for a total of... Round-robin recursion. Calculate the average pixel confidence for the merged block. Threshold . The high-confidence blocks are designated as high-confidence segments, while the rest are low-confidence segments. High-confidence blocks are directly written into the candidate repair plane. Low-confidence blocks are filtered by a shift filter ; then write Boundary execution weighted average transition ; Obtain repair feature digital data .

[0067] step Pseudo-random texture diffusion and color consistency optimization: Diffusion seed and weight initialization: Taking medium confidence level greater than pixel set The seed is used; the rest are candidate sets. Define weights for candidate pixels. ;in It's Manhattan distance. This represents the gradient magnitude. Pseudo-random displacement diffusion: Linear congruent generator. ;seed For every pixel promoted, from Selected offset vector make Specify direction. Diffusion radius. Step length until Empty. Texture detail compensation: Detecting local variance. ; This is the window mean. If Then perform secondary diffusion, neighborhood radius threshold Color consistency optimization: Calculate the cumulative histogram of the repaired area and the original non-defective area. and For each pixel implement Local iteration After the wheel, color error ;like or reach maximum The wheel stops. The final target repair data is obtained. .

[0068] Figure 2This paper demonstrates the core technical implementation process of block-level recursive misalignment harmonic processing in a digital data processing method for facial imperfections based on convolutional neural networks. This technical solution employs a stepped misalignment layout to spatially rearrange four consecutive blocks within a misalignment window to achieve efficient feature fusion. In this stepped misalignment layout, the length of the misalignment window is set to four consecutive blocks. When the four blocks within the misalignment window are originally numbered as the first to the fourth block, the specific spatial transformation rules are as follows: the first block remains in its original position as a spatial reference; the second and fourth blocks are each shifted one grid cell to the right to achieve horizontal position adjustment; the third block is shifted one grid cell downwards to achieve vertical position offset. Through the above spatial transformations, a hierarchical stepped misalignment layout is formed. This layout can maintain the spatial correlation between blocks while generating appropriate positional misalignment, creating richer feature interaction conditions for subsequent convolution operations. In the misaligned convolution operation process, the system establishes two independent convolutional scanning paths within the misaligned window: the horizontal scanning path expands along the overlapping region of adjacent blocks in the same row to capture horizontal feature associations; the vertical scanning path expands along the overlapping region of adjacent blocks in the same column to extract vertical feature dependencies. Independent convolutional kernel groups are configured for both the horizontal and vertical scanning paths, with each kernel group uniformly set to 3x3 pixels to ensure sufficient receptive field coverage. During the specific convolution calculation, the system first performs a complete convolution calculation along the horizontal scanning path to obtain intermediate feature results in the first direction; then, it performs a complete convolution calculation along the vertical scanning path to obtain intermediate feature results in the second direction. Finally, the intermediate feature results in the first and second directions are averaged at the pixel level to obtain a harmonic block that integrates bidirectional feature information. This harmonic block contains spatial association features between the original blocks and enhanced features introduced by the misalignment transformation, providing a richer and more stable data foundation for subsequent feature processing.

[0069] Figure 3This paper details the complete implementation process of the bi-state alignment mapping technique, a crucial step in block-level recursive misalignment reconciliation. After dynamic queue expansion, the system renumbers the interleaved index queues according to their current positions, establishing a bi-state classification mechanism: even-numbered queue positions are marked as state one, and odd-numbered queue positions are marked as state two, forming an alternating bi-state structure. In the candidate pairing phase, the system employs a bidirectional scanning strategy for precise matching. For each block in state one, the system scans from the current position to the next nearest state two position, recording all blocks in state two within the scan interval. Within the scan interval, if a block of a different type than the current state one exists, the state two block with the closest Euclidean distance to the current block is prioritized as a candidate pairing; if all blocks in the scan interval are of the same type, the state two block is selected based on the principle of minimizing the number difference, ensuring relative spatial proximity. Similarly, for each block in state two, the system scans to the next nearest state one position, using the same matching rules for candidate pairing selection. In the deviation calculation stage, the system calculates the grid coordinate difference in the horizontal and vertical directions for each candidate pair of blocks, obtaining the horizontal deviation value and the vertical deviation value respectively. When the horizontal or vertical deviation value is greater than 2 grid cells, the system determines the candidate pair as a high-deviation pair; otherwise, it determines it as a low-deviation pair. For high-deviation pairs, the system performs a local rearrangement operation: within the scanning interval of the candidate pair, it searches bidirectionally for replaceable candidate blocks with a step size of 1 grid cell, until a replacement block with both horizontal and vertical deviation values ​​not greater than 2 is found; if no replacement block meeting the conditions is found, the original high-deviation pair remains unchanged. Finally, the system determines the mapping relationship according to a strict priority hierarchy: first, it prioritizes pairings of different types with low deviation, as these pairings have the best feature complementarity and spatial proximity; second, it uses pairings of different types with high deviation to ensure feature diversity; finally, it uses pairings of the same type to ensure the integrity and robustness of the system. Through the aforementioned dual-state alignment mapping mechanism, the system can achieve optimal pairing between structural blocks, texture blocks, and harmonic blocks, providing high-quality input pairs for subsequent forward and reverse convolutional fusion, thereby generating fusion blocks with good feature representation capabilities.

[0070] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention. The scope of protection claimed by the appended claims and their equivalents is defined.

Claims

1. A method for processing digital data on facial imperfections based on convolutional neural networks, characterized in that, The method includes: Step 1: After preprocessing the original digital data of facial imperfections, the face bounding box is determined using a multi-scale pyramid face detection framework; Step 2: After cropping the face bounding box, scale it at a fixed resolution to obtain standardized face digital data; feed the standardized face digital data into a convolutional neural network, and pass it through a multi-scale convolutional coding layer, a residual focusing layer and an attention fusion layer in sequence to generate structural feature digital data and texture feature digital data; Step 3: Perform block-level recursive misalignment harmonization processing on the structural feature digital data and texture feature digital data, and output the repair feature digital data; Step 4: Input the repair feature digital data into the pseudo-random texture diffusion process, perform texture detail compensation and color consistency optimization, and generate target repair digital data; Step 3 specifically includes: Step 3.1: Divide the structural feature digital data and the texture feature digital data into equal-sized blocks according to a consistent grid, including structural blocks and texture blocks, and write the structural blocks and texture blocks into an interleaved index queue in an alternating order; Step 3.2: Slide the staggered window on the staggered index queue according to the preset movement rules to generate a staggered window, perform the staggered convolution operation on each staggered window to output a harmonic block, and append the harmonic block to the tail of the staggered index queue in sequence; Step 3.3: When the length of the interleaved index queue is less than twice the initial length, perform dynamic queue expansion until the length of the interleaved index queue exceeds the set threshold; then perform bi-state alignment mapping, selecting mutually mapped structure blocks, texture blocks, or harmonic blocks in pairs; first perform forward convolution fusion, then perform reverse convolution fusion to obtain fused blocks, until the current recursive loop counter square root round ends; Step 3.4: Calculate the average pixel confidence of each fusion block, and divide the interleaved index queue into high-confidence and low-confidence segments according to the average pixel confidence; keep the original resolution and grid coordinates of the fusion blocks in the high-confidence segment, write them directly into the candidate repair plane, and lock their boundaries; pass the fusion blocks in the low-confidence segment through a shift filter, write them into the candidate repair plane, and lock their boundaries. Step 3.5: Perform bidirectional edge smoothing fusion at the boundary between the high-confidence segment and the low-confidence segment, and transition the edge pixels of adjacent blocks in a weighted average manner to eliminate block edges and obtain repair feature digital data.

2. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 1, characterized in that, Step 1 involves preprocessing the original digital data of facial imperfections, which includes performing white balance correction, logarithmic photometric smoothing transformation, and Gaussian noise suppression on the original digital data of facial imperfections to obtain preprocessed digital data of faces.

3. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 2, characterized in that, In step 1, the process of determining the face bounding box using the multi-scale pyramid face detection framework includes: continuously scaling down the preprocessed face digital data at a fixed scaling ratio to generate a multi-scale digital data sequence arranged from top to bottom; performing convolution, normalization, and activation operations sequentially on the digital data sequence at each scale to output a candidate feature plane; performing max pooling downsampling on the candidate feature plane to obtain a confidence plane; retaining the coordinates of digital data blocks with confidence scores higher than a preset confidence threshold on the confidence plane, mapping them back to the original resolution, merging all candidate rectangles, performing de-overlap filtering, and obtaining the face bounding box.

4. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 3, characterized in that, In step 3.2, the length of the misaligned window is set to 4 consecutive blocks; the sliding step is set to 1 block, that is, after each sliding, the queue head pointer moves 1 position towards the queue tail; when the 4 blocks in the misaligned window are recorded as the first to the fourth block according to their original sequence numbers, the second and fourth blocks are shifted to the right by 1 grid unit, the third block is shifted down by 1 grid unit, and the first block remains in its original position, thus forming a stepped misaligned layout.

5. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 4, characterized in that, In step 3.2, the process of performing misaligned convolution operations on each misaligned window to output a harmonic block includes: establishing two convolutional scanning paths within the misaligned window: the horizontal scanning path expands along the overlapping area of ​​adjacent blocks in the same row, and the vertical scanning path expands along the overlapping area of ​​adjacent blocks in the same column; configuring independent convolutional kernel groups for the horizontal and vertical scanning paths respectively, with the size of each group of convolutional kernels uniformly set to 3 by 3 pixels; firstly performing a complete convolutional calculation along the horizontal scanning path to obtain the intermediate feature result in the first direction; then performing a complete convolutional calculation along the vertical scanning path to obtain the intermediate feature result in the second direction; and performing a pixel-level arithmetic average operation on the intermediate feature result in the first direction and the intermediate feature result in the second direction to obtain the harmonic block.

6. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 5, characterized in that, The process of dynamic queue expansion in step 3.3 includes: traversing the current interleaved index queue; for structure blocks, shifting the entire block one grid cell to the right and then copying it as an expanded block; for texture blocks, performing pixel-level linear interpolation with its successor blocks and then shifting the entire block one grid cell down to generate an expanded block; for harmonic blocks, reducing all pixel amplitudes by 10% while keeping the grid coordinates unchanged and then copying it as an expanded block.

7. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 6, characterized in that, In step 3.3, after completing the dynamic queue expansion, during the two-state alignment mapping, the interleaved index queues are renumbered according to their current position order; even-numbered queue positions are marked as state one, and odd-numbered queue positions are marked as state two; starting from the head of the queue, for each block in state one position, the scan proceeds to the next nearest state two position, recording all blocks in state two positions within the scan interval; if there is a block of a different type than the current state one block within the scan interval, the state two block with the different type and the closest Euclidean distance to the current block is selected as a candidate pair; if all blocks in the scan interval are of the same type, the state two block with the smallest number difference is selected as a candidate pair; for each block in state two position, the scan proceeds to the next nearest state one position, recording all blocks in state one positions within the scan interval; if there is a block of a different type than the current state two block within the scan interval, the state one block with the different type and the closest Euclidean distance to the current block is selected as a candidate pair; if all blocks in the scan interval are of the same type, the state one block with the smallest number difference is selected as a candidate pair.

8. The method for processing digital data on facial imperfections based on convolutional neural networks as described in claim 7, characterized in that, For each candidate pair of blocks, calculate the difference in grid coordinates between the two blocks in the horizontal and vertical directions to obtain the horizontal and vertical deviation values, respectively. If the horizontal or vertical deviation value is greater than 2 grid cells, the candidate pair is determined to be a high-deviation pair; otherwise, it is determined to be a low-deviation pair. Perform a local rearrangement on the high-deviation pair: within the scan interval of the candidate pair, search for a replaceable candidate block in both directions with a step size of 1 grid cell until a replaceable block with a horizontal and vertical deviation value of no more than 2 is found. If no replacement block is found, the original high-deviation pair is maintained. Determine the final mapping relationship for all candidate pairs after deviation calculation according to the following priority: prioritize the use of pairs with different types and low deviation; secondly, use pairs with different types and high deviation; and finally, use pairs with the same type.

Citation Information

Patent Citations

  • Facial defect detection method based on convolutional neural network and bilateral filtering

    CN112070158A

  • Multi-scale pyramid type jump connection method for image completion

    CN113344815A