WO2024131707A1 - Hair enhancement method, neural network, electronic device, and storage medium - Google Patents

Hair enhancement method, neural network, electronic device, and storage medium Download PDF

Info

Publication number
WO2024131707A1
WO2024131707A1 PCT/CN2023/139420 CN2023139420W WO2024131707A1 WO 2024131707 A1 WO2024131707 A1 WO 2024131707A1 CN 2023139420 W CN2023139420 W CN 2023139420W WO 2024131707 A1 WO2024131707 A1 WO 2024131707A1
Authority
WO
WIPO (PCT)
Prior art keywords
residual
features
feature
module
image
Prior art date
Application number
PCT/CN2023/139420
Other languages
French (fr)
Chinese (zh)
Inventor
张航
许合欢
王进
Original Assignee
虹软科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 虹软科技股份有限公司 filed Critical 虹软科技股份有限公司
Publication of WO2024131707A1 publication Critical patent/WO2024131707A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/806Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Definitions

  • the present application relates to but is not limited to the field of image processing technology, and in particular to a hair enhancement method, a neural network, an electronic device and a storage medium.
  • the present application provides a hair enhancement method, the method comprising:
  • the residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input feature of the latter residual module is The feature is the output feature of the previous residual module;
  • Feature reconstruction is performed based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
  • the plurality of sequentially connected residual modules include a first residual module and a second residual module that are sequentially connected; performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules to obtain the residual module fusion features includes:
  • the first feature and the second feature are fused to obtain the residual module fusion feature.
  • the plurality of sequentially connected residual modules include a first residual module, a second residual module, a third residual module, and a fourth residual module that are sequentially connected; performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules to obtain the residual module fusion features includes:
  • the first feature, the second feature, the third feature and the fourth feature are fused to obtain the residual module fusion feature.
  • each of the residual modules includes an initial layer and a plurality of sequentially connected residual layers
  • the method for obtaining the output features of the residual module includes:
  • convolution calculation is performed on the final output feature of the previous residual layer in the subsequent residual layer to obtain a convolution output feature, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer;
  • the final output feature of each residual layer and the final output feature of the initial layer of the residual module are concatenated to obtain a residual layer concatenated feature
  • acquiring the image features of the original image includes:
  • the initial features are downsampled to obtain image features of the original image.
  • downsampling the initial features to obtain the image features of the original image includes:
  • the initial features are downsampled step by step based on a plurality of sequentially connected downsampling modules to obtain image features of the original image, wherein, in two adjacent downsampling modules, the input features of the latter downsampling module are the output features of the former downsampling module.
  • downsampling the initial features is achieved by wavelet transform.
  • the step of reconstructing features based on the residual module fusion features to obtain an enhanced image corresponding to the original image includes:
  • the enhanced image is obtained by performing multiple upsampling and feature fusion calculations on the fusion features of the residual module based on multiple upsampling modules connected in sequence; wherein the number of the upsampling modules corresponds one to one to the number of the downsampling modules, and in two adjacent upsampling modules, the input features of the subsequent upsampling module are jointly determined according to the output features of the previous upsampling module and the output features of the target downsampling module, and the target downsampling module refers to the downsampling module corresponding to the subsequent upsampling module.
  • the wavelet transform comprises:
  • the initial features of the original image are sampled at intervals in rows and columns according to a preset step size to obtain sampling results;
  • a plurality of different frequency band information of the initial feature is calculated according to the sampling result as the image feature of the original image.
  • the hair enhancement method is implemented based on a neural network, and a method for obtaining sample image pairs for training the neural network includes:
  • the first sample image and the second sample image are regarded as a sample image pair.
  • an embodiment of the present application provides a neural network, including an acquisition module, a plurality of sequentially connected residual modules and a reconstruction module;
  • the acquisition module is configured to acquire image features of the original image
  • the plurality of residual modules are configured to sequentially perform residual calculation and feature fusion on the image features of the original image to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
  • the reconstruction module is configured to perform feature reconstruction based on the fusion features of the residual module to obtain an enhanced image corresponding to the original image.
  • an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory is configured to store executable instructions of the processor; and the processor is configured to execute the hair enhancement method as described in any one of the first aspects above by executing the executable instructions.
  • an embodiment of the present application provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the hair enhancement method as described in any of the first aspects above.
  • FIG1 is a flow chart of a hair enhancement method according to an embodiment of the present application.
  • FIG2 is a flow chart of a method for generating a residual module fusion feature according to an embodiment of the present application
  • FIG3 is a schematic diagram of the structure of multiple residual modules according to an embodiment of the present application.
  • FIG4 is a flow chart of a method for calculating output features of a residual module according to an embodiment of the present application
  • FIG5 is a schematic diagram of the internal structure of a residual module according to an embodiment of the present application.
  • FIG6 is a flow chart of wavelet transform according to an embodiment of the present application.
  • FIG7 is a schematic diagram of the effect of wavelet transformation according to an embodiment of the present application.
  • FIG8 is a flow chart of a method for acquiring a sample image pair according to an embodiment of the present application.
  • FIG9 is a schematic diagram of the structure of a neural network according to an embodiment of the present application.
  • FIG10 is a schematic diagram showing a comparison between an original image and an enhanced image according to an embodiment of the present application.
  • FIG11 is a structural block diagram of a neural network according to an embodiment of the present application.
  • connection is not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly.
  • the “multiple” involved in this application refers to two or more.
  • “And/or” describes the association relationship of associated objects, indicating that there can be three relationships. For example, “A and/or B” can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character “/” indicates that the objects associated with each other are in an “or” relationship.
  • first”, “second”, “third”, etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of objects.
  • the specification may have presented the method and/or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and/or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.
  • the present application provides a hair enhancement method, as shown in FIG1 , which comprises the following steps:
  • Step S101 obtaining image features of an original image.
  • the image features of the original image in this embodiment are image features related to hair.
  • the hair in this embodiment includes pet hair and/or human hair.
  • the original image can be any type of image. If the original image contains hair, the method in this embodiment can enhance the detailed texture of the hair to obtain a clearer image.
  • the process of acquiring image features can be achieved by a trained neural network through convolution calculation.
  • Step S102 performing residual calculation and feature fusion on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module.
  • the “connected in sequence” in this step indicates the data transmission relationship between the residual modules, for example, multiple residual modules can be cascaded.
  • the neural network used for hair enhancement includes multiple residual modules, which perform residual calculations on input features in turn to obtain multiple residual features, and then perform feature fusion on the multiple residual features through convolution calculation to obtain residual module fusion features.
  • the output features of the first residual module are the input features of the second residual module
  • the output features of the second residual module are the input features of the third residual module
  • the input of the first residual module is the image feature of the original image.
  • the number of residual modules is not limited, so the number of residual modules can be 2, 3, 4, 5, or even more.
  • the receptive field of the neural network can be deepened, and features at different scales can be better extracted, which is conducive to restoring complex hair textures.
  • the scale of the convolutional layer used for feature fusion can be 1 ⁇ 1 to increase the correlation between features of different depths.
  • Step S103 reconstructing features based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
  • feature reconstruction can be achieved through convolution calculation.
  • the image features of the original image are calculated based on multiple residual modules, so as to obtain the residual module fusion features including details such as direction and texture at different scales in the original image.
  • the enhanced image obtained by feature reconstruction based on the residual module fusion features has higher resolution and richer details than the original image, which can improve the processing effect of the hair texture details in the pet hair or portrait, and enhance the texture details in the image.
  • FIG2 is a flow chart of a method for generating residual module fusion features according to an embodiment of the present application. As shown in FIG2, the method may include the following steps:
  • Step S201 performing convolution fusion on the image features based on the first residual module to obtain a first feature
  • Step S202 performing convolution fusion on the first feature based on the second residual module to obtain a second feature
  • Step S203 fusing the first feature and the second feature to obtain a residual module fusion feature.
  • a method for processing image features using multiple residual modules is provided.
  • the first feature output by the first residual module is used as the input of the second residual module, and the receptive field of the extracted features can be increased step by step. Finally, all outputs are fused to obtain features under different receptive fields, thereby enhancing the restoration effect of the original image.
  • the fusion of the first feature and the second feature can be achieved through a 1 ⁇ 1 convolution layer to enhance the correlation between features of different receptive fields.
  • the neural network may also include a third residual module and a fourth residual module. As shown in FIG3 , the neural network includes four residual modules (Multi-Scale Res-Block, referred to as MSRB).
  • MSRB Multi-Scale Res-Block
  • the image features are convolutionally fused based on the first residual module to obtain the first feature; the first feature is convolutionally fused based on the second residual module to obtain the second feature, the second feature is convolutionally fused based on the third residual module to obtain the third feature, and the third feature is convolutionally fused based on the fourth residual module to obtain the fourth feature.
  • the first feature, the second feature, the third feature and the fourth feature are convolutionally fused through the convolution layer of the fusion module to obtain the residual module fusion feature.
  • the fusion module in this embodiment is a 1 ⁇ 1 convolution layer, which is used to change the number of output channels and increase the correlation between each feature at different receptive field depths.
  • the residual module may include an initial layer and a plurality of sequentially connected residual layers, and the output features of the residual module are calculated through the plurality of residual layers.
  • FIG4 is a flow chart of a method for calculating the output features of the residual module according to an embodiment of the present application. The first feature, the second feature, the third feature, and the fourth feature in the above embodiment as output features of the residual module can be obtained by the method, and the method comprises the following steps:
  • Step S401 for two adjacent residual layers, convolution calculation is performed on the final output feature of the previous residual layer by the subsequent residual layer to obtain a convolution output feature, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer;
  • Step S402 when there are multiple residual layers, concatenate the final output feature of each residual layer with the final output feature of the initial layer of the residual module to obtain a residual layer concatenation feature;
  • Step S403 determining the output features of the residual module according to the input features of the residual module and the residual layer concatenation features.
  • the residual layer splicing features can be first convolved through a convolution layer to reduce the channel, and then added to the input features of the residual module to obtain the output features of the residual module.
  • the first layer of the residual module serves as the initial layer, which can be an ordinary convolution layer, which is set to calculate the input features of the residual module and directly obtain the final output features of the initial layer.
  • the residual module is a residual layer from the second layer onwards, and the residual layer of the second layer (i.e., the first residual layer) adds its own convolution output features and the final output features of the initial layer as its own final output features.
  • FIG5 is a schematic diagram of the internal structure of a residual module according to an embodiment of the present application.
  • the residual module is composed of a convolution layer for residual calculation and a convolution layer for splicing and fusion.
  • the present embodiment includes 4 residual structures for residual calculation. After the residual calculation, the output features of each residual layer are concatenated (concat), and then a 1 ⁇ 1 convolution layer is connected to reduce the number of channels to reduce the amount of calculation of the neural network.
  • the input feature S of the residual module is convolved through the initial layer of the residual module to obtain S01
  • S01 is the final output feature of the initial layer
  • S01 passes through a convolution layer to obtain the convolution output feature S01'
  • S01' and S01 are added to form the first residual structure
  • the final output feature S02 of the first residual layer is obtained
  • S02 passes through a convolution layer to obtain the convolution output feature S02'
  • S02' and S02 are added to form a second residual structure
  • the final output feature S03 of the second residual layer is obtained
  • S03 After a convolution layer, the convolution output feature S03' is obtained.
  • S03' and S03 are added to form the third residual structure to obtain the final output feature S04 of the third residual layer.
  • S01, S02, S03, and S04 are concatenated (concat) in the channel dimension to obtain the residual layer concatenation feature.
  • the residual layer concatenation feature is convoluted and fused by a 1 ⁇ 1 convolution layer to increase the correlation between features of different receptive field depths and reduce the number of channels to obtain S'.
  • S' and S are added to form a residual structure again to obtain the output feature of the residual module.
  • the " ⁇ " in Figure 5 represents addition.
  • the addition process may be elementwise add to achieve element-by-element addition, thereby retaining more information in the original image and ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
  • the receptive field is gradually increased through multiple residual layers, and multi-scale features under different receptive fields are obtained, which is conducive to restoring the hair texture.
  • the image features of the original image are obtained by first obtaining the initial features of the original image, such as the underlying features at the pixel level, and then downsampling the initial features to obtain the image features of the original image for residual calculation.
  • the initial features of the original image such as the underlying features at the pixel level
  • downsampling the initial features to obtain the image features of the original image for residual calculation.
  • the image features of the original image when the image features of the original image are obtained based on the initial features, it can be implemented by downsampling step by step, which may include: downsampling the initial features step by step based on multiple sequentially connected downsampling modules to obtain image features at different scales.
  • the input features of the later downsampling module are the output features of the previous downsampling module.
  • multiple step-by-step decomposition and downsampling of the initial features can be achieved through wavelet transform (WT).
  • WT wavelet transform
  • wavelet transform can save calculation amount without losing various feature information of the original image. It can not only efficiently obtain the high and low frequency information after decomposition, but also restore it through inverse transformation without losing details, and the calculation amount is very small, which is very conducive to deployment on mobile terminals. Therefore, for texture features such as hair, the use of wavelet transform can better retain details and reduce losses.
  • discrete wavelet transform DWT
  • DWT discrete wavelet transform
  • the input features after the wavelet transform can be convolved to reduce the number of channels, thereby finally obtaining the output features of the downsampling module.
  • the step-by-step decomposition and feature extraction of the initial features include a total of 3 downsampling modules, and each downsampling module includes DWT decomposition and convolution calculation.
  • the first layer of decomposition and convolution structure performs DWT decomposition on the initial feature x0, and then convolves the decomposed features to reduce the number of channels, and then enhances the nonlinearity through the ReLU operation to obtain x1.
  • the second layer of decomposition and convolution structure performs DWT decomposition on x1, and also performs convolution and ReLU operations on the decomposed features to obtain the output feature x2.
  • the third layer of decomposition and convolution operation performs DWT decomposition on the feature x2, and then performs convolution operation on the decomposed features to obtain the output feature x3, which can be used as the input feature S of the residual module.
  • the size of the convolution layer can be 3 ⁇ 3 to reduce the amount of calculation, and the number of convolution layers is not limited.
  • FIG6 is a flow chart of wavelet transform according to an embodiment of the present application. As shown in FIG6 , the method includes:
  • Step S601 performing interval sampling on the initial features of the original image in rows and columns according to a preset step size to obtain sampling results.
  • the preset step size can be set according to the requirements.
  • p represents the pixel of the initial feature
  • p01 represents the pixel obtained by sampling every two pixels starting from 0 in the column direction of the image, and taking half of the sampling result
  • p02 represents the pixel obtained by sampling every two pixels starting from 1 in the column direction of the image, and taking half of the sampling result.
  • p1 to p4 represent four pixels in a 2 ⁇ 2 square
  • p1 is the pixel obtained by sampling every two pixels starting from 0 in the row direction of the image for p01
  • p2 is the pixel obtained by sampling every two pixels starting from 0 in the row direction of the image for p02
  • p3 is the pixel obtained by sampling every two pixels starting from 1 in the row direction of the image for p01
  • p4 is the pixel obtained by sampling every two pixels starting from 1 in the row direction of the image for p02. And so on, complete the entire sampling process and get the sampling result.
  • Step S602 Calculate a plurality of different frequency band information of the initial feature according to the sampling result as the image feature of the original image.
  • LL low-frequency information
  • HL high-frequency information in the vertical direction
  • LH high-frequency information in the horizontal direction
  • HH high-frequency information in the diagonal direction. Since low frequency reflects the image overview and high frequency reflects the image details, the image features can be better preserved through wavelet transform.
  • the image on the left is the original input image
  • the image on the right is a schematic diagram after a wavelet decomposition. After wavelet transform, 4 different frequency band information are obtained, and the horizontal and vertical coordinates in the image on the right represent the image size after wavelet transform.
  • the process of reconstructing the enhanced image by fusion features of the residual module is to perform multiple upsampling and feature fusion calculations on the fusion features of the residual module based on multiple sequentially connected upsampling modules to obtain an enhanced image, wherein the number of upsampling modules corresponds to the number of downsampling modules one by one, and in two adjacent upsampling modules, the input features of the subsequent upsampling module are determined based on the output features of the previous upsampling module and the output features of the target downsampling module, and the target downsampling module refers to the downsampling module corresponding to the subsequent upsampling module.
  • the input features of the subsequent upsampling module are obtained by elementwise add element by element.
  • the downsampling is a wavelet transform
  • the upsampling corresponds to an inverse wavelet transform (Inverse Wavelet Transform, referred to as IWT) to reduce the loss of details in the original image.
  • IWT Inverse Wavelet Transform
  • the obtained LL, HL, LH, and HH components are first concatenated in the channel dimension and then restored.
  • Rlt is the result of the final inverse wavelet transform.
  • feature reconstruction and step-by-step synthetic upsampling include a total of three upsampling modules, each of which includes a convolution layer and an IWT layer.
  • the residual module fusion feature is regarded as the input y3 of the first upsampling module.
  • the first upsampling module first convolves y3 output by the bottom multi-scale residual module to increase the number of channels, followed by a ReLU operation to enhance nonlinearity, and then uses IWT to obtain the feature y3', which is added to x2 obtained in the downsampling process to obtain the input feature y2 of the second upsampling module.
  • the second upsampling module reconstructs the feature of y2 through convolution, ReLU operation and IWT to obtain y2', which is added to x1 to obtain the input feature y1 of the third upsampling module.
  • the third upsampling module also uses convolution, ReLU operation and IWT to reconstruct the feature of y1 to obtain y1', which is added to x0 to obtain the feature y0.
  • y0 is calculated through a 3 ⁇ 3 convolution layer to obtain the final output feature y as an enhanced image.
  • the addition process in this embodiment may be an elementwise add to perform element-by-element addition, so that more information in the original image can be retained, thereby ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
  • the present application implements the above-mentioned hair enhancement method based on a neural network.
  • a neural network When training the neural network, corresponding sample image pairs are required.
  • FIG8 is a flow chart of a method for obtaining sample image pairs according to an embodiment of the present application. The method includes the following steps:
  • Step S801 acquiring a first sample image, wherein the image quality of the first sample image meets a preset image quality threshold.
  • a first sample image of high-definition pet hair or human hair can be collected by a high-definition image acquisition device such as a SLR camera.
  • a high-definition image acquisition device such as a SLR camera.
  • the collected hair is required to be smooth, the texture is clear, the detail resolution is high, and the hair direction consistency is good.
  • a corresponding image quality threshold can be set to screen the first sample image.
  • Step S802 performing image degradation on the first sample image to obtain a second sample image, wherein the image quality of the second sample image is lower than that of the first sample image.
  • degradation refers to the process of reducing image quality, which can be simulated through JPEG compression, raw noise, lens blur, zoom and other operations, and finally a low-quality pet hair image is obtained after the actual image is degraded.
  • Step S803 taking the first sample image and the second sample image as a sample image pair.
  • the training set is all acquired by real shooting with an image acquisition device that can acquire high-quality images, and high-definition hair images under different light, different environments, and different angles are collected, requiring the hair in the hair image to be smooth, with clear texture, high detail resolution, and good consistency of hair direction.
  • paired low-quality images are obtained through degradation to simulate low-quality hair images taken in real scenes, and finally sample image pairs are obtained, ensuring that the input and output are strictly aligned, and there is no pixel misalignment problem, so that the training results of the neural network are better.
  • the training of the neural network may include the following steps:
  • the loss function in this embodiment is obtained by weighted summation of multiple sub-loss functions.
  • L represents the final loss function
  • n represents the number of sample image pairs
  • L1 is the pixel-by-pixel calculation loss
  • L SSIM is the structural similarity loss
  • L VGG is the perceptual loss
  • L GAN is the loss of the generative adversarial network
  • the weights ⁇ 1 , ⁇ 2 , ⁇ 3 , and ⁇ 4 can be set according to requirements.
  • the loss is calculated based on the output results of the neural network and the real training set. When the value of the loss function reaches the minimum or the number of iterations exceeds the preset threshold, the training ends.
  • the structure of the neural network is shown in Figure 9, including an initial feature extraction module, multiple downsampling modules, multiple residual modules, a fusion module, multiple upsampling modules and a repair enhancement module, wherein the initial feature extraction module is configured to extract the basic features of the original image, multiple downsampling modules, multiple residual modules, a fusion module and multiple upsampling modules are configured to mine more feature information of the image, and the repair enhancement module is configured to achieve the final pet hair repair enhancement.
  • the initial feature extraction module is implemented by a 3 ⁇ 3 convolution layer, which is responsible for extracting the underlying pixel-level features x0 from the low-quality pet hair image x input to the neural network, and using more output channels to represent the feature information of x.
  • the size of the convolution kernel can be 3 ⁇ 3, which can avoid the increase in network parameters caused by too large a convolution kernel and reduce the computing performance consumed in the network inference stage.
  • the three downsampling modules decompose and downsample x0 step by step, and obtain the output features x1, x2, and x3 in turn through the DWT decomposition layer and the convolution layer.
  • the multiple residual modules are exemplified as 4 identical multi-scale residual modules
  • the fusion module is a 1 ⁇ 1 convolution layer, which is used to change the number of output channels and increase the correlation between each feature at different receptive field depths.
  • Each residual module consists of multiple 3 ⁇ 3 convolution layers and 1 1 ⁇ 1 convolution layer, and the residual layer performs residual calculation.
  • the final fusion module concatenates the output features of each of the four residual modules in the channel dimension and then convolves them to obtain the underlying feature extraction result, that is, the residual module fusion feature.
  • the multiple upsampling modules are exemplified as three upsampling modules, each of which includes a convolutional layer and an IWT reconstruction layer.
  • y1’ is obtained through calculation by the three upsampling modules, and the output feature y0 is obtained by adding y1’ and x0.
  • the final repair enhancement module is implemented by a deconvolution layer with a convolution kernel size of 3 ⁇ 3 and a step size of 2. Deconvolution is performed on y0 to obtain the final repair reconstruction result y.
  • the convolution layers of the initial feature extraction module, downsampling module, upsampling module and repair enhancement module in this embodiment are all 3 ⁇ 3, which can reduce parameter calculation and reduce the amount of calculation of the neural network, which is conducive to deployment on the mobile terminal.
  • the convolution layers of the fusion module are all 1 ⁇ 1, which can increase the correlation between each feature at different receptive field depths.
  • the “ ⁇ ” in Figure 9 represents addition.
  • the addition process can be elementwise add to achieve element-by-element addition, so that more information in the original image can be retained, ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
  • this embodiment uses DWT and IWT to implement step-by-step decomposition downsampling and step-by-step decomposition downsampling.
  • DWT and IWT are parameter-free operations with simple calculations, avoiding the performance consumption caused by parameterized up and down sampling; 2.
  • the high-frequency detail information of the image can be effectively mined, and DWT and IWT are a pair of lossless conversion operations, which can ensure that the content of the original image is restored without losing details.
  • Src represents the original image
  • Rlt represents the enhanced image after restoration.
  • the texture of the restored and reconstructed pet hair is clearer, and the direction is consistent with the original image, which can significantly enhance the hair resolution of the original image and improve the visual effect of the human eye.
  • the hair enhancement method based on the multi-scale residual network structure in this embodiment can solve the problems of blur, noise, out-of-focus, etc. in the hair area of the image.
  • the multi-scale residual structure can not only obtain the characteristics of different receptive fields and better mine the missing high-frequency detail information, but also the residual structure is convenient for training, ensuring the stability of the training process, and ultimately achieving the repair and enhancement of low-quality hair areas.
  • a neural network is also provided, which is used to implement the above embodiments and implementation methods, and the descriptions that have been made will not be repeated.
  • the terms “module”, “unit”, “sub-unit”, etc. used below can be a combination of software and/or hardware that implements the predetermined functions.
  • the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
  • FIG. 11 is a block diagram of a neural network according to an embodiment of the present application.
  • the neural network is used for hair enhancement, and includes an acquisition module 1101, a plurality of sequentially connected residual modules 1102, and a reconstruction module 1103;
  • An acquisition module 1101 is configured to acquire image features of an original image
  • a plurality of residual modules 1102 are configured to sequentially perform residual calculation and feature fusion on image features of the original image to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
  • the reconstruction module 1103 is configured to perform feature reconstruction based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
  • the image features of the original image are calculated based on multiple residual modules 1102, so as to obtain the residual module fusion features including details such as direction and texture in the original image, and the reconstruction module 1103
  • the enhanced image obtained by feature reconstruction based on the residual module fusion feature has higher resolution and richer details than the original image, which can improve the processing effect of the hair texture details in the pet hair or portrait, and enhance the texture details in the image.
  • a plurality of sequentially connected residual modules include a first residual module and a second residual module connected in sequence; residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, including: the first residual module performs convolution fusion on the image features to obtain a first feature; the second residual module performs convolution fusion on the first feature to obtain a second feature; the fusion module fuses the first feature and the second feature to obtain a residual module fusion feature.
  • a plurality of sequentially connected residual modules include a first residual module, a second residual module, a third residual module and a fourth residual module that are sequentially connected; the residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain the residual module fusion features, including: performing convolution fusion on the image features based on the first residual module to obtain the first feature; performing convolution fusion on the first feature based on the second residual module to obtain the second feature; performing convolution fusion on the second feature based on the third residual module to obtain the third feature; performing convolution fusion on the third feature based on the fourth residual module to obtain the fourth feature; and fusing the first feature, the second feature, the third feature and the fourth feature to obtain the residual module fusion feature.
  • a convolution output feature is obtained by performing a convolution calculation on the final output feature of the previous residual layer in the subsequent residual layer, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer; in the case of multiple residual layers, the fusion layer splices the final output feature of each residual layer and the final output feature of the initial layer of the residual module to obtain a residual layer splicing feature; the input feature of the residual module and the residual layer splicing feature jointly determine the output feature of the residual module.
  • the acquisition module 1101 is further configured to acquire initial features of the original image; and downsample the initial features to obtain image features of the original image.
  • the acquisition module 1101 downsamples the initial features step by step based on multiple sequentially connected downsampling modules to obtain image features of the original image, wherein, in two adjacent downsampling modules, the input features of the later downsampling module are the output features of the previous downsampling module.
  • downsampling of the initial features is achieved through wavelet transformation.
  • the reconstruction module 1103 is further configured to perform multiple upsampling and feature fusion calculations on the residual module fusion features based on a plurality of sequentially connected upsampling modules to obtain an enhanced image; wherein the number of upsampling modules corresponds to the number of downsampling modules one by one, and in two adjacent upsampling modules, the input of the subsequent upsampling module is The input features are determined based on the output features of the preceding upsampling module and the output features of the target downsampling module.
  • the target downsampling module refers to the downsampling module corresponding to the succeeding upsampling module.
  • the wavelet transform includes performing interval sampling on the initial features of the original image in rows and columns according to a preset step size to obtain sampling results; and calculating multiple different frequency band information of the initial features as image features of the original image based on the sampling results.
  • a method for acquiring a sample image pair for training a neural network may include: acquiring a first sample image, where the image quality of the first sample image meets a preset image quality threshold; performing image degradation on the first sample image to obtain a second sample image, where the image quality of the second sample image is lower than that of the first sample image; and treating the first sample image and the second sample image as a sample image pair.
  • This embodiment uses the acquisition method to acquire a large number of sample image pairs for training a neural network.
  • the hair enhancement method provided by the present application performs residual calculation and feature fusion on the image features of the original image through multiple sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module; feature reconstruction is performed based on the residual module fusion features to obtain an enhanced image corresponding to the original image, thereby improving the processing effect of hair texture details in pet hair or portraits and enhancing the texture details in the image.
  • Each of the above modules may be a functional module or a program module, and may be implemented by software or hardware.
  • each of the above modules may be located in the same processor; or each of the above modules may be located in different processors in any combination.
  • This embodiment also provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
  • the electronic device may include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
  • the processor may be configured to perform the following steps through a computer program:
  • a computer-readable storage medium may be provided in this embodiment for implementation.
  • the storage medium stores one or more programs, and the one or more programs may be executed by one or more processors; when the program is executed by the processor, any one of the methods in the above embodiments is implemented.
  • the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
  • Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium).
  • a computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data).
  • Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
  • communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Molecular Biology (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Processing (AREA)

Abstract

A hair enhancement method, a neural network, an electronic device, and a storage medium. The hair enhancement method comprises: acquiring an image feature of an original image; performing residual calculation and feature fusion on the image feature of the original image by means of a plurality of sequentially-connected residual modules to obtain a residual module fused feature, wherein in two adjacent residual modules, an input feature of the latter residual module is an output feature of the former residual module; and performing feature reconstruction on the basis of the residual module fused feature to obtain an enhanced image corresponding to the original image.

Description

毛发增强方法、神经网络、电子装置和存储介质Hair enhancement method, neural network, electronic device and storage medium
交叉引用cross reference
本申请要求在2022年12月22日提交中国专利局、申请号为202211659099.7、名称为“毛发增强方法、神经网络、电子装置和存储介质”的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application filed with the China Patent Office on December 22, 2022, with application number 202211659099.7 and titled “Hair enhancement method, neural network, electronic device and storage medium”, the entire contents of which are incorporated by reference into this application.
技术领域Technical Field
本申请涉及但不限于图像处理技术领域,特别是涉及一种毛发增强方法、神经网络、电子装置和存储介质。The present application relates to but is not limited to the field of image processing technology, and in particular to a hair enhancement method, a neural network, an electronic device and a storage medium.
背景技术Background technique
随着手机设备的普及,拍照逐渐成为人们记录生活的一种方式,为了可以更好地定格画面,人们对于手机拍照的质量要求也越来越高,例如,画面干净、色彩丰富、纹理清晰。With the popularity of mobile devices, taking photos has gradually become a way for people to record their lives. In order to better freeze the picture, people have higher and higher requirements for the quality of mobile phone photos, for example, the picture must be clean, colorful, and with clear textures.
受制于拍摄条件的限制,拍照时宠物毛发或者人像中的头发等区域不可避免的存在模糊、噪声、虚焦等问题,导致拍出来的照片质量不高。而目前常见的画质提升方案是基于深度学习的超分辨率重建方法,可以将一幅低分辨率的图像经过卷积神经网络处理得到高分辨率的图像,增加图像中缺失的高频细节信息。但由于目前主流的超分辨率重建方法都是针对自然图像的,拍照时虽然画面的分辨率得到提升,但宠物毛发或者人像中头发的纹理细节往往效果差强人意。Due to the limitations of shooting conditions, areas such as pet hair or hair in portraits will inevitably have problems such as blur, noise, and out-of-focus, resulting in low-quality photos. The most common solution for improving image quality is the super-resolution reconstruction method based on deep learning, which can process a low-resolution image through a convolutional neural network to obtain a high-resolution image and increase the high-frequency detail information missing in the image. However, since the current mainstream super-resolution reconstruction methods are all for natural images, although the resolution of the picture is improved when taking pictures, the texture details of pet hair or hair in portraits are often unsatisfactory.
目前针对宠物毛发或者人像中头发纹理细节的处理效果较差的问题,尚未提出有效的解决方案。Currently, no effective solution has been proposed for the problem of poor processing of pet hair or hair texture details in portraits.
发明概述SUMMARY OF THE INVENTION
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
第一方面,本申请提供了一种毛发增强方法,所述方法包括:In a first aspect, the present application provides a hair enhancement method, the method comprising:
获取原始图像的图像特征;Obtain image features of the original image;
通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个所述残差模块中,在后的所述残差模块的输入特 征为在前的所述残差模块的输出特征;The residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input feature of the latter residual module is The feature is the output feature of the previous residual module;
基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像。Feature reconstruction is performed based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
在其中一些实施例中,所述多个依次相连的残差模块包括依次相连的第一残差模块和第二残差模块;所述通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:In some embodiments, the plurality of sequentially connected residual modules include a first residual module and a second residual module that are sequentially connected; performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules to obtain the residual module fusion features includes:
基于第一残差模块对所述图像特征进行卷积融合,得到第一特征;Performing convolution fusion on the image features based on the first residual module to obtain a first feature;
基于第二残差模块对所述第一特征进行卷积融合,得到第二特征;Performing convolution fusion on the first features based on a second residual module to obtain a second feature;
对所述第一特征和所述第二特征进行融合,得到所述残差模块融合特征。The first feature and the second feature are fused to obtain the residual module fusion feature.
在其中一些实施例中,所述多个依次相连的残差模块包括依次相连的第一残差模块、第二残差模块、第三残差模块和第四残差模块;所述通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:In some embodiments, the plurality of sequentially connected residual modules include a first residual module, a second residual module, a third residual module, and a fourth residual module that are sequentially connected; performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules to obtain the residual module fusion features includes:
基于第一残差模块对所述图像特征进行卷积融合,得到第一特征;Performing convolution fusion on the image features based on the first residual module to obtain a first feature;
基于第二残差模块对所述第一特征进行卷积融合,得到第二特征;Performing convolution fusion on the first features based on a second residual module to obtain a second feature;
基于第三残差模块对所述第二特征进行卷积融合,得到第三特征;Performing convolution fusion on the second features based on a third residual module to obtain a third feature;
基于第四残差模块对所述第三特征进行卷积融合,得到第四特征;Performing convolution fusion on the third feature based on a fourth residual module to obtain a fourth feature;
对所述第一特征、所述第二特征、所述第三特征和所述第四特征进行融合,得到所述残差模块融合特征。The first feature, the second feature, the third feature and the fourth feature are fused to obtain the residual module fusion feature.
在其中一些实施例中,每个所述残差模块包括初始层和多个依次相连的残差层,所述残差模块的输出特征的获取方法包括:In some embodiments, each of the residual modules includes an initial layer and a plurality of sequentially connected residual layers, and the method for obtaining the output features of the residual module includes:
对于相邻的两个残差层,通过在后的残差层对在前的残差层的最终输出特征进行卷积计算,得到卷积输出特征,将所述卷积输出特征与所述在前的残差层的最终输出特征相加作为所述在后的残差层的最终输出特征;For two adjacent residual layers, convolution calculation is performed on the final output feature of the previous residual layer in the subsequent residual layer to obtain a convolution output feature, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer;
在有多个残差层的情况下,将每个残差层的所述最终输出特征和所述残差模块的初始层的最终输出特征进行拼接得到残差层拼接特征;In the case of multiple residual layers, the final output feature of each residual layer and the final output feature of the initial layer of the residual module are concatenated to obtain a residual layer concatenated feature;
根据所述残差模块的输入特征和所述残差层拼接特征,确定所述残差模块的输出特征。Determine the output features of the residual module according to the input features of the residual module and the residual layer concatenation features.
在其中一些实施例中,所述获取原始图像的图像特征包括:In some embodiments, acquiring the image features of the original image includes:
获取原始图像的初始特征; Obtain the initial features of the original image;
对所述初始特征进行下采样,得到所述原始图像的图像特征。The initial features are downsampled to obtain image features of the original image.
在其中一些实施例中,所述对所述初始特征进行下采样,得到所述原始图像的图像特征包括:In some embodiments, downsampling the initial features to obtain the image features of the original image includes:
基于多个依次相连的下采样模块对所述初始特征进行逐级下采样,得到所述原始图像的图像特征,其中,相邻两个所述下采样模块中,在后的所述下采样模块的输入特征为在前的所述下采样模块的输出特征。The initial features are downsampled step by step based on a plurality of sequentially connected downsampling modules to obtain image features of the original image, wherein, in two adjacent downsampling modules, the input features of the latter downsampling module are the output features of the former downsampling module.
在其中一些实施例中,所述对所述初始特征进行下采样通过小波变换实现。In some of the embodiments, downsampling the initial features is achieved by wavelet transform.
在其中一些实施例中,所述基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像包括:In some embodiments, the step of reconstructing features based on the residual module fusion features to obtain an enhanced image corresponding to the original image includes:
基于多个依次相连的上采样模块对所述残差模块融合特征进行多次上采样和特征融合计算,得到所述增强图像;其中,所述上采样模块的数量与所述下采样模块的数量一一对应,相邻两个所述上采样模块中,在后的所述上采样模块的输入特征根据在前的所述上采样模块的输出特征和目标下采样模块的输出特征共同确定,所述目标下采样模块是指与所述在后的上采样模块对应的下采样模块。The enhanced image is obtained by performing multiple upsampling and feature fusion calculations on the fusion features of the residual module based on multiple upsampling modules connected in sequence; wherein the number of the upsampling modules corresponds one to one to the number of the downsampling modules, and in two adjacent upsampling modules, the input features of the subsequent upsampling module are jointly determined according to the output features of the previous upsampling module and the output features of the target downsampling module, and the target downsampling module refers to the downsampling module corresponding to the subsequent upsampling module.
在其中一些实施例中,所述小波变换包括:In some embodiments, the wavelet transform comprises:
根据预设步长对所述原始图像的初始特征在行和列上分别进行间隔采样,得到采样结果;The initial features of the original image are sampled at intervals in rows and columns according to a preset step size to obtain sampling results;
根据所述采样结果计算所述初始特征的多个不同频带信息作为所述原始图像的图像特征。A plurality of different frequency band information of the initial feature is calculated according to the sampling result as the image feature of the original image.
在其中一些实施例中,基于神经网络实现所述毛发增强方法,用于训练所述神经网络的样本图像对的获取方法包括:In some embodiments, the hair enhancement method is implemented based on a neural network, and a method for obtaining sample image pairs for training the neural network includes:
采集第一样本图像,所述第一样本图像的图像质量满足预设的图像质量阈值;Acquire a first sample image, where the image quality of the first sample image meets a preset image quality threshold;
对所述第一样本图像进行图像退化得到第二样本图像,所述第二样本图像的图像质量低于所述第一样本图像的图像质量;Performing image degradation on the first sample image to obtain a second sample image, wherein the image quality of the second sample image is lower than the image quality of the first sample image;
将所述第一样本图像和所述第二样本图像作为一个样本图像对。The first sample image and the second sample image are regarded as a sample image pair.
第二方面,本申请实施例提供了一种神经网络,包括获取模块、多个依次相连的残差模块和重建模块; In a second aspect, an embodiment of the present application provides a neural network, including an acquisition module, a plurality of sequentially connected residual modules and a reconstruction module;
所述获取模块,设置为获取原始图像的图像特征;The acquisition module is configured to acquire image features of the original image;
多个所述残差模块,设置为依次对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个所述残差模块中,在后的所述残差模块的输入特征为在前的所述残差模块的输出特征;The plurality of residual modules are configured to sequentially perform residual calculation and feature fusion on the image features of the original image to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
所述重建模块,设置为基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像。The reconstruction module is configured to perform feature reconstruction based on the fusion features of the residual module to obtain an enhanced image corresponding to the original image.
第三方面,本申请实施例提供了一种电子装置,包括处理器以及存储器,所述存储器设置为存储所述处理器的可执行指令;所述处理器设置为经由执行所述可执行指令来执行实现如上述第一方面任一所述的毛发增强方法。In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory is configured to store executable instructions of the processor; and the processor is configured to execute the hair enhancement method as described in any one of the first aspects above by executing the executable instructions.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如上述第一方面任一所述的毛发增强方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the hair enhancement method as described in any of the first aspects above.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF DESCRIPTION OF THE DRAWINGS
附图用来提供对本申请技术方案的理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide an understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
图1是根据本申请实施例的毛发增强方法的流程图;FIG1 is a flow chart of a hair enhancement method according to an embodiment of the present application;
图2是根据本申请实施例的残差模块融合特征的生成方法的流程图;FIG2 is a flow chart of a method for generating a residual module fusion feature according to an embodiment of the present application;
图3是根据本申请实施例的多个残差模块的结构示意图;FIG3 is a schematic diagram of the structure of multiple residual modules according to an embodiment of the present application;
图4是根据本申请实施例的残差模块输出特征的计算方法的流程图;FIG4 is a flow chart of a method for calculating output features of a residual module according to an embodiment of the present application;
图5是根据本申请实施例的一个残差模块的内部结构示意图;FIG5 is a schematic diagram of the internal structure of a residual module according to an embodiment of the present application;
图6是根据本申请实施例的小波变换的流程图;FIG6 is a flow chart of wavelet transform according to an embodiment of the present application;
图7是根据本申请实施例的小波变换的效果示意图;FIG7 is a schematic diagram of the effect of wavelet transformation according to an embodiment of the present application;
图8是根据本申请实施例的样本图像对的获取方法的流程图;FIG8 is a flow chart of a method for acquiring a sample image pair according to an embodiment of the present application;
图9是根据本申请实施例的神经网络的结构示意图;FIG9 is a schematic diagram of the structure of a neural network according to an embodiment of the present application;
图10是根据本申请实施例的原始图像和增强图像的对比示意图; FIG10 is a schematic diagram showing a comparison between an original image and an enhanced image according to an embodiment of the present application;
图11是根据本申请实施例的神经网络的结构框图。FIG11 is a structural block diagram of a neural network according to an embodiment of the present application.
详述Details
下面结合附图和实施例,对本申请进行了描述和说明。The present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
除另作定义外,本申请所涉及的技术术语或者科学术语应具有本申请所属技术领域具备一般技能的人所理解的一般含义。在本申请中的“一”、“一个”、“一种”、“该”、“这些”等类似的词并不表示数量上的限制,它们可以是单数或者复数。在本申请中所涉及的术语“包括”、“包含”、“具有”及其任何变体,其目的是涵盖不排他的包含;例如,包含一系列步骤或模块(单元)的过程、方法和系统、产品或设备并未限定于列出的步骤或模块(单元),而可包括未列出的步骤或模块(单元),或者可包括这些过程、方法、产品或设备固有的其他步骤或模块(单元)。在本申请中所涉及的“连接”、“相连”、“耦接”等类似的词语并不限定于物理的或机械连接,而可以包括电气连接,无论是直接连接还是间接连接。在本申请中所涉及的“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。通常情况下,字符“/”表示前后关联的对象是一种“或”的关系。在本申请中所涉及的术语“第一”、“第二”、“第三”等,只是对相似对象进行区分,并不代表针对对象的特定排序。Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a kind of", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And/or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and/or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character "/" indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of objects.
本申请描述了多个实施例,但是该描述是示例性的,而不是限制性的,并且对于本领域的普通技术人员来说,在本申请所描述的实施例包含的范围内可以有更多的实施例和实现方案。尽管在附图中示出了许多可能的特征组合,并在具体实施方式中进行了讨论,但是所公开的特征的许多其它组合方式也是可能的。除非特意加以限制的情况以外,任何实施例的任何特征或元件可以与任何其它实施例中的任何其他特征或元件结合使用,或可以替代任何其它实施例中的任何其他特征或元件。The present application describes multiple embodiments, but the description is exemplary rather than restrictive, and for those of ordinary skill in the art, there may be more embodiments and implementations within the scope of the embodiments described in the present application. Although many possible feature combinations are shown in the drawings and discussed in the specific embodiments, many other combinations of the disclosed features are also possible. Unless specifically limited, any feature or element of any embodiment may be used in combination with any other feature or element in any other embodiment, or may replace any other feature or element in any other embodiment.
本申请包括并设想了与本领域普通技术人员已知的特征和元件的组合。本申请已经公开的实施例、特征和元件也可以与任何常规特征或元件组合,以形成由权利要求限定的独特的发明方案。任何实施例的任何特征或元件也可以与来自其它发明方案的特征或元件组合,以形成另一个由权利要求限定的独特的发明方案。因此,应当理解,在本申请中示出和/或讨论的任何特征可以单独地或以任何适当的组合来实现。因此,除了根据所附权利要求及其等同替换所做的限制以外,实施例不受其它限制。此外,可以在所附权利要求的 保护范围内进行各种修改和改变。This application includes and contemplates combinations of features and elements known to those of ordinary skill in the art. The embodiments, features, and elements that have been disclosed in this application may also be combined with any conventional features or elements to form a unique inventive solution as defined by the claims. Any features or elements of any embodiment may also be combined with features or elements from other inventive solutions to form another unique inventive solution as defined by the claims. Therefore, it should be understood that any feature shown and/or discussed in this application may be implemented alone or in any appropriate combination. Therefore, the embodiments are not subject to other limitations except as provided in the appended claims and their equivalents. In addition, the invention may be described in the appended claims. Various modifications and changes are made within the scope of protection.
此外,在描述具有代表性的实施例时,说明书可能已经将方法和/或过程呈现为特定的步骤序列。然而,在该方法或过程不依赖于本文所述步骤的特定顺序的程度上,该方法或过程不应限于所述的特定顺序的步骤。如本领域普通技术人员将理解的,其它的步骤顺序也是可能的。因此,说明书中阐述的步骤的特定顺序不应被解释为对权利要求的限制。此外,针对该方法和/或过程的权利要求不应限于按照所写顺序执行它们的步骤,本领域技术人员可以容易地理解,这些顺序可以变化,并且仍然保持在本申请实施例的精神和范围内。In addition, when describing representative embodiments, the specification may have presented the method and/or process as a specific sequence of steps. However, to the extent that the method or process does not rely on the specific order of the steps described herein, the method or process should not be limited to the steps of the specific order described. As will be understood by those of ordinary skill in the art, other sequences of steps are also possible. Therefore, the specific sequence of the steps set forth in the specification should not be interpreted as a limitation to the claims. In addition, the claims for the method and/or process should not be limited to the steps of performing them in the order written, and those skilled in the art can easily understand that these sequences can be changed and still remain within the spirit and scope of the embodiments of the present application.
本申请实施例提供了一种毛发增强方法,如图1所示,该方法包括如下步骤:The present application provides a hair enhancement method, as shown in FIG1 , which comprises the following steps:
步骤S101,获取原始图像的图像特征。Step S101, obtaining image features of an original image.
本实施例中的原始图像的图像特征为和毛发相关的图像特征,本实施例中的毛发包括宠物毛发和/或人的头发,原始图像可以为任何种类的图像,若原始图像中包含毛发,通过本实施例中的方法,可以对毛发的细节纹理进行增强,以得到更加清晰的图像。The image features of the original image in this embodiment are image features related to hair. The hair in this embodiment includes pet hair and/or human hair. The original image can be any type of image. If the original image contains hair, the method in this embodiment can enhance the detailed texture of the hair to obtain a clearer image.
获取图像特征的过程可以由训练好的神经网络通过卷积计算实现。The process of acquiring image features can be achieved by a trained neural network through convolution calculation.
步骤S102,通过多个依次相连的残差模块对原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个残差模块中,在后的残差模块的输入特征为在前的残差模块的输出特征。Step S102, performing residual calculation and feature fusion on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module.
其中,该步骤中的“依次相连”表示残差模块之间的数据传递关系,比如多个残差模块可以级联。The “connected in sequence” in this step indicates the data transmission relationship between the residual modules, for example, multiple residual modules can be cascaded.
本实施例中用于进行毛发增强的神经网络包括多个残差模块,残差模块依次对输入特征进行残差计算,得到多个残差特征,然后通过卷积计算对多个残差特征进行特征融合,得到残差模块融合特征。其中,由于多个残差模块级联,所以第一残差模块的输出特征是第二残差模块的输入特征,第二残差模块的输出特征是第三残差模块的输入特征,以此类推,第一残差模块的输入为原始图像的图像特征。本实施例中不对残差模块的数量进行限制,因此,残差模块的数量可以为2个、3个、4个、5个,甚至更多。In this embodiment, the neural network used for hair enhancement includes multiple residual modules, which perform residual calculations on input features in turn to obtain multiple residual features, and then perform feature fusion on the multiple residual features through convolution calculation to obtain residual module fusion features. Among them, since multiple residual modules are cascaded, the output features of the first residual module are the input features of the second residual module, the output features of the second residual module are the input features of the third residual module, and so on. The input of the first residual module is the image feature of the original image. In this embodiment, the number of residual modules is not limited, so the number of residual modules can be 2, 3, 4, 5, or even more.
通过多个级联的残差模块,可以加深神经网络的感受野,更好地提取不同尺度上的特征,有利于恢复复杂的毛发纹理,示例性的,用于进行特征融合的卷积层的尺度可以为1×1,以增加不同深度特征之间的相关性。 Through multiple cascaded residual modules, the receptive field of the neural network can be deepened, and features at different scales can be better extracted, which is conducive to restoring complex hair textures. For example, the scale of the convolutional layer used for feature fusion can be 1×1 to increase the correlation between features of different depths.
步骤S103,基于残差模块融合特征进行特征重建,得到对应于原始图像的增强图像。Step S103, reconstructing features based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
本实施例的一种实施方式中,特征重建可以通过卷积计算实现。In one implementation of this embodiment, feature reconstruction can be achieved through convolution calculation.
通过上述步骤S101至步骤S103,本实施例中基于多个残差模块对原始图像的图像特征进行计算,从而得到原始图像中不同尺度下的包括方向和纹理等细节的残差模块融合特征,基于该残差模块融合特征进行特征重建得到的增强图像,相较于原始图像而言,分辨率更高,细节更丰富,可以提升对于宠物毛发或人像中头发纹理细节的处理效果,增强了图像中的纹理细节。Through the above steps S101 to S103, in this embodiment, the image features of the original image are calculated based on multiple residual modules, so as to obtain the residual module fusion features including details such as direction and texture at different scales in the original image. The enhanced image obtained by feature reconstruction based on the residual module fusion features has higher resolution and richer details than the original image, which can improve the processing effect of the hair texture details in the pet hair or portrait, and enhance the texture details in the image.
本实施例的一种实施方式中,本实施例神经网络的多个残差模块级联,残差模块融合特征由多个残差模块的输出融合得到。所述多个依次相连的残差模块可以包括依次相连的第一残差模块和第二残差模块,图2是根据本申请实施例的残差模块融合特征的生成方法的流程图,如图2所示,该方法可以包括如下步骤:In one implementation of this embodiment, multiple residual modules of the neural network of this embodiment are cascaded, and the residual module fusion feature is obtained by fusion of the outputs of the multiple residual modules. The multiple sequentially connected residual modules may include a first residual module and a second residual module that are sequentially connected. FIG2 is a flow chart of a method for generating residual module fusion features according to an embodiment of the present application. As shown in FIG2, the method may include the following steps:
步骤S201,基于第一残差模块对图像特征进行卷积融合,得到第一特征;Step S201, performing convolution fusion on the image features based on the first residual module to obtain a first feature;
步骤S202,基于第二残差模块对第一特征进行卷积融合,得到第二特征;Step S202, performing convolution fusion on the first feature based on the second residual module to obtain a second feature;
步骤S203,对第一特征和第二特征进行融合,得到残差模块融合特征。Step S203, fusing the first feature and the second feature to obtain a residual module fusion feature.
本实施例中给出了多个残差模块对图像特征的处理方法,将第一残差模块输出的第一特征作为第二残差模块的输入,可以逐级增加提取特征的感受野,最后将所有的输出进行融合可以得到不同感受野下的特征,增强对原始图像的恢复效果。其中,本实施例中对第一特征和第二特征的融合可以通过1×1的卷积层实现,以增强不同感受野的特征之间的相关性。In this embodiment, a method for processing image features using multiple residual modules is provided. The first feature output by the first residual module is used as the input of the second residual module, and the receptive field of the extracted features can be increased step by step. Finally, all outputs are fused to obtain features under different receptive fields, thereby enhancing the restoration effect of the original image. In this embodiment, the fusion of the first feature and the second feature can be achieved through a 1×1 convolution layer to enhance the correlation between features of different receptive fields.
可见,残差模块的数量越多,感受野越深,可以提取到的不同尺度的特征也越多,并且计算量也越大,因此为了平衡细节特征和计算量,在一些实施例中,神经网络还可以包括第三残差模块和第四残差模块,如图3所示,该神经网络包括四个残差模块(Multi-Scale Res-Block,简称为MSRB)。此时,基于第一残差模块对图像特征进行卷积融合,得到第一特征;基于第二残差模块对第一特征进行卷积融合,得到第二特征,基于第三残差模块对第二特征进行卷积融合,得到第三特征,基于第四残差模块对第三特征进行卷积融合,得到第四特征,最后,通过融合模块的卷积层将第一特征、第二特征、第三特征和第四特征进行卷积融合,得到残差模块融合特征。本实施例中的融合模块为一个1×1的卷积层,该卷积层的用处是改变输出通道数并且增加不同感受野深度下每个特征之间的相关性。 It can be seen that the more residual modules there are, the deeper the receptive field is, the more features of different scales can be extracted, and the greater the amount of calculation. Therefore, in order to balance the detail features and the amount of calculation, in some embodiments, the neural network may also include a third residual module and a fourth residual module. As shown in FIG3 , the neural network includes four residual modules (Multi-Scale Res-Block, referred to as MSRB). At this time, the image features are convolutionally fused based on the first residual module to obtain the first feature; the first feature is convolutionally fused based on the second residual module to obtain the second feature, the second feature is convolutionally fused based on the third residual module to obtain the third feature, and the third feature is convolutionally fused based on the fourth residual module to obtain the fourth feature. Finally, the first feature, the second feature, the third feature and the fourth feature are convolutionally fused through the convolution layer of the fusion module to obtain the residual module fusion feature. The fusion module in this embodiment is a 1×1 convolution layer, which is used to change the number of output channels and increase the correlation between each feature at different receptive field depths.
在其中一些实施例中,残差模块可以包括初始层和多个依次相连的残差层,通过多个残差层来计算残差模块的输出特征,图4是根据本申请实施例的残差模块输出特征的计算方法的流程图,上述实施例中的第一特征、第二特征、第三特征和第四特征作为残差模块的输出特征均可以通过该方法得到,该方法包括如下步骤:In some embodiments, the residual module may include an initial layer and a plurality of sequentially connected residual layers, and the output features of the residual module are calculated through the plurality of residual layers. FIG4 is a flow chart of a method for calculating the output features of the residual module according to an embodiment of the present application. The first feature, the second feature, the third feature, and the fourth feature in the above embodiment as output features of the residual module can be obtained by the method, and the method comprises the following steps:
步骤S401,对于相邻的两个残差层,通过在后的残差层对在前的残差层的最终输出特征进行卷积计算,得到卷积输出特征,将卷积输出特征与在前的残差层的最终输出特征相加作为在后的残差层的最终输出特征;Step S401, for two adjacent residual layers, convolution calculation is performed on the final output feature of the previous residual layer by the subsequent residual layer to obtain a convolution output feature, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer;
步骤S402,在有多个残差层的情况下,将每个残差层的最终输出特征和残差模块的初始层的最终输出特征进行拼接得到残差层拼接特征;Step S402, when there are multiple residual layers, concatenate the final output feature of each residual layer with the final output feature of the initial layer of the residual module to obtain a residual layer concatenation feature;
步骤S403,根据残差模块的输入特征和残差层拼接特征,确定残差模块的输出特征。Step S403, determining the output features of the residual module according to the input features of the residual module and the residual layer concatenation features.
本实施例的一种实施方式中,可以先通过卷积层对残差层拼接特征进行卷积计算降低通道,再与残差模块的输入特征进行相加,从而得到残差模块的输出特征。In one implementation of this embodiment, the residual layer splicing features can be first convolved through a convolution layer to reduce the channel, and then added to the input features of the residual module to obtain the output features of the residual module.
其中,残差模块的第一层作为初始层,可以为普通的卷积层,设置为对残差模块的输入特征进行计算,并直接得到初始层的最终输出特征,残差模块从第二层起均为残差层,第二层的残差层(即,第一层残差层)将自身的卷积输出特征与初始层的最终输出特征相加作为自身的最终输出特征。Among them, the first layer of the residual module serves as the initial layer, which can be an ordinary convolution layer, which is set to calculate the input features of the residual module and directly obtain the final output features of the initial layer. The residual module is a residual layer from the second layer onwards, and the residual layer of the second layer (i.e., the first residual layer) adds its own convolution output features and the final output features of the initial layer as its own final output features.
图5是根据本申请实施例的一个残差模块的内部结构示意图,如图5所示,其中残差模块由用于残差计算的卷积层和用于拼接融合的卷积层构成,示例性的,本实施例中包括4个残差结构用来残差计算,残差计算之后将每个残差层的输出特征进行拼接(concat),再接1个1×1卷积层用来降低通道数,以降低神经网络的计算量。可以包括以下步骤:首先残差模块的输入特征S通过残差模块的初始层进行卷积计算得到S01,S01即为初始层的最终输出特征,S01经过一个卷积层得到卷积输出特征S01’,S01’和S01相加构成第一个残差结构,并得到第一个残差层的最终输出特征S02,S02经过一个卷积层得到卷积输出特征S02’,S02’和S02相加构成第二个残差结构,并得到第二个残差层的最终输出特征S03,S03经过一个卷积层得到卷积输出特征S03’,S03’和S03相加构成第三个残差结构,得到第三个残差层的最终输出特征S04,最后将S01、S02、S03、S04在通道维度拼接(concat),得到残差层拼接特征,由1×1的卷积层对残差层拼接特征进行卷积融合计算,增加不同感受野深度的特征之间的相关性,并且降低通道数得到S’,最后S’和S相加再次组成残差结构,得到该残差模块的输出特征。图5中的“⊕”表示相加,本实施例 中相加过程可以为elementwise add,以实现逐元素相加,从而可以保留更多的原始图像中的信息,保证增强图像的纹理细节和原始图像中毛发的方向信息一致。FIG5 is a schematic diagram of the internal structure of a residual module according to an embodiment of the present application. As shown in FIG5 , the residual module is composed of a convolution layer for residual calculation and a convolution layer for splicing and fusion. Exemplarily, the present embodiment includes 4 residual structures for residual calculation. After the residual calculation, the output features of each residual layer are concatenated (concat), and then a 1×1 convolution layer is connected to reduce the number of channels to reduce the amount of calculation of the neural network. The following steps may be included: first, the input feature S of the residual module is convolved through the initial layer of the residual module to obtain S01, S01 is the final output feature of the initial layer, S01 passes through a convolution layer to obtain the convolution output feature S01', S01' and S01 are added to form the first residual structure, and the final output feature S02 of the first residual layer is obtained, S02 passes through a convolution layer to obtain the convolution output feature S02', S02' and S02 are added to form a second residual structure, and the final output feature S03 of the second residual layer is obtained, S03 After a convolution layer, the convolution output feature S03' is obtained. S03' and S03 are added to form the third residual structure to obtain the final output feature S04 of the third residual layer. Finally, S01, S02, S03, and S04 are concatenated (concat) in the channel dimension to obtain the residual layer concatenation feature. The residual layer concatenation feature is convoluted and fused by a 1×1 convolution layer to increase the correlation between features of different receptive field depths and reduce the number of channels to obtain S'. Finally, S' and S are added to form a residual structure again to obtain the output feature of the residual module. The "⊕" in Figure 5 represents addition. This embodiment The addition process may be elementwise add to achieve element-by-element addition, thereby retaining more information in the original image and ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
通过上述步骤S401至步骤S403,在每个残差模块内部,通过多个残差层逐级增加感受野,并获取不同感受野下的多尺度特征,有利于恢复毛发纹理。Through the above steps S401 to S403, within each residual module, the receptive field is gradually increased through multiple residual layers, and multi-scale features under different receptive fields are obtained, which is conducive to restoring the hair texture.
在其中一些实施例中,原始图像的图像特征通过如下方法得到,先获取原始图像的初始特征,例如像素级别的底层特征,然后对初始特征进行下采样,从而得到原始图像的图像特征用于进行残差计算。本实施例中通过下采样获取图像特征,不仅能得到分解后的高低频信息,而且可以得到更多的图像细节。In some embodiments, the image features of the original image are obtained by first obtaining the initial features of the original image, such as the underlying features at the pixel level, and then downsampling the initial features to obtain the image features of the original image for residual calculation. In this embodiment, by downsampling to obtain the image features, not only the high and low frequency information after decomposition can be obtained, but also more image details can be obtained.
本实施例的一种实施方式中,在基于初始特征获取原始图像的图像特征时,可以通过逐级下采样实现,可以包括:基于多个依次相连的下采样模块对初始特征进行逐级下采样得到不同尺度上的图像特征。其中,相邻两个下采样模块中,在后的下采样模块的输入特征为在前的下采样模块的输出特征。In one implementation of this embodiment, when the image features of the original image are obtained based on the initial features, it can be implemented by downsampling step by step, which may include: downsampling the initial features step by step based on multiple sequentially connected downsampling modules to obtain image features at different scales. Among them, in two adjacent downsampling modules, the input features of the later downsampling module are the output features of the previous downsampling module.
本实施例的一种实施方式中,对初始特征进行多次逐级分解下采样可以通过小波变换(Wavelet Transform,简称为WT)实现。相比于通常的通过卷积计算实现下采样,小波变换可以节省计算量且不丢失原始图像的各类特征信息,不仅能高效获得分解后的高低频信息,而且可以不丢失细节地通过逆变换完成恢复,并且计算量很小,非常有利于在移动端进行部署。因此对于毛发等纹理特征,采用小波变换可以更好地保留细节,减少损失。可选地,本实施例中采用离散小波变换(Discrete Wavelet Transform,简称为DWT)。In one implementation of this embodiment, multiple step-by-step decomposition and downsampling of the initial features can be achieved through wavelet transform (WT). Compared with the usual downsampling through convolution calculation, wavelet transform can save calculation amount without losing various feature information of the original image. It can not only efficiently obtain the high and low frequency information after decomposition, but also restore it through inverse transformation without losing details, and the calculation amount is very small, which is very conducive to deployment on mobile terminals. Therefore, for texture features such as hair, the use of wavelet transform can better retain details and reduce losses. Optionally, discrete wavelet transform (DWT) is used in this embodiment.
在小波变换后,为了减少计算量,可以对小波变换后的输入特征进行卷积计算以降低通道数,从而最终得到下采样模块的输出特征。After the wavelet transform, in order to reduce the amount of calculation, the input features after the wavelet transform can be convolved to reduce the number of channels, thereby finally obtaining the output features of the downsampling module.
本实施例的一种实施方式中,对初始特征逐级分解和特征提取共包含3个下采样模块,每个下采样模块均包括DWT分解和卷积计算。示例性的,第一层分解和卷积结构对初始特征x0进行DWT分解,对分解后的特征再进行卷积以降低通道数,然后通过ReLU操作提升非线性,得到x1。第二层分解和卷积结构将x1进行DWT分解,同样对分解后的特征进行卷积加ReLU操作,得到输出特征x2。第三层分解和卷积操作将特征x2进行DWT分解,再对分解后的特征进行卷积运算得到输出特征x3,该x3可以作为残差模块的输入特征S。其中,卷积层的尺寸可以为3×3,以降低计算量,卷积层的数量不做限制。In one implementation of this embodiment, the step-by-step decomposition and feature extraction of the initial features include a total of 3 downsampling modules, and each downsampling module includes DWT decomposition and convolution calculation. Exemplarily, the first layer of decomposition and convolution structure performs DWT decomposition on the initial feature x0, and then convolves the decomposed features to reduce the number of channels, and then enhances the nonlinearity through the ReLU operation to obtain x1. The second layer of decomposition and convolution structure performs DWT decomposition on x1, and also performs convolution and ReLU operations on the decomposed features to obtain the output feature x2. The third layer of decomposition and convolution operation performs DWT decomposition on the feature x2, and then performs convolution operation on the decomposed features to obtain the output feature x3, which can be used as the input feature S of the residual module. Among them, the size of the convolution layer can be 3×3 to reduce the amount of calculation, and the number of convolution layers is not limited.
在一些实施例中,图6是根据本申请实施例的小波变换的流程图,如图6所示,该方法包括: In some embodiments, FIG6 is a flow chart of wavelet transform according to an embodiment of the present application. As shown in FIG6 , the method includes:
步骤S601,根据预设步长对原始图像的初始特征在行和列上分别进行间隔采样,得到采样结果。Step S601 , performing interval sampling on the initial features of the original image in rows and columns according to a preset step size to obtain sampling results.
预设步长可以根据需求设置,在预设步长为2时,可以通过如下公式1到公式6进行采样计算:
p01=p[:,∶,0::2,∶]/2                                    公式1
p02=p[:,∶,1::2,∶]/2                                    公式2
p1=p01[:,∶,∶,0::2]                                     公式3
p2=p02[:,∶,∶,0::2]                                     公式4
p3=p01[:,∶,∶,1::2]                                     公式5
p4=p02[:,∶,∶,1::2]                                     公式6
The preset step size can be set according to the requirements. When the preset step size is 2, the sampling calculation can be performed by the following formulas 1 to 6:
p01=p[:,∶,0::2,∶]/2 Formula 1
p02=p[:,∶,1::2,∶]/2 Formula 2
p1=p01[:,∶,∶,0::2] Formula 3
p2=p02[:,∶,∶,0::2] Formula 4
p3=p01[:,∶,∶,1::2] Formula 5
p4=p02[:,∶,∶,1::2] Formula 6
其中,p表示初始特征的像素点,p01表示在图像的列方向上,从0开始,每隔两个像素点进行采样,采样的结果取半得到的像素点,p02表示在图像的列方向上,从1开始,每隔两个像素点进行采样,采样的结果取半得到的像素点。p1到p4表示一个2×2方格中的四个像素点,p1为在图像的行方向上,对于p01从0开始,每隔两个像素点进行采样得到的像素点,p2为在图像的行方向上,对于p02从0开始,每隔两个像素点进行采样得到的像素点,p3为在图像的行方向上,对于p01从1开始,每隔两个像素点进行采样得到的像素点,p4为在图像的行方向上,对于p02从1开始,每隔两个像素点进行采样得到的像素点。以此类推,完成整个采样过程,得到采样结果。Among them, p represents the pixel of the initial feature, p01 represents the pixel obtained by sampling every two pixels starting from 0 in the column direction of the image, and taking half of the sampling result, and p02 represents the pixel obtained by sampling every two pixels starting from 1 in the column direction of the image, and taking half of the sampling result. p1 to p4 represent four pixels in a 2×2 square, p1 is the pixel obtained by sampling every two pixels starting from 0 in the row direction of the image for p01, p2 is the pixel obtained by sampling every two pixels starting from 0 in the row direction of the image for p02, p3 is the pixel obtained by sampling every two pixels starting from 1 in the row direction of the image for p01, and p4 is the pixel obtained by sampling every two pixels starting from 1 in the row direction of the image for p02. And so on, complete the entire sampling process and get the sampling result.
步骤S602,根据采样结果计算初始特征的多个不同频带信息作为原始图像的图像特征。Step S602: Calculate a plurality of different frequency band information of the initial feature according to the sampling result as the image feature of the original image.
本实施例的一种实施方式中,可以通过如下公式7到公式10完成频带信息的计算过程:
LL=p1+p2+p3+p4                                   公式7
HL=-p1-p2+p3+p4                                 公式8
LH=-p1+p2-p3+p4                                 公式9
HH=p1-p2-p3+p4                                  公式10
In an implementation of this embodiment, the frequency band information calculation process may be completed by the following formulas 7 to 10:
LL=p1+p2+p3+p4 Formula 7
HL=-p1-p2+p3+p4 Formula 8
LH=-p1+p2-p3+p4 Formula 9
HH=p1-p2-p3+p4 Formula 10
其中,LL是低频信息,HL是垂直方向高频信息,LH是水平方向高频信息,HH是对角方向高频信息。由于低频反应图像概貌,高频反应图像细节,因此通过小波变换可以更好的保留图像特征。如图7所示,位于左侧的图像为输入的原始图像,位于右侧的图像为经过一次小波分解后的示意图。在经过小波变换后,得到4个不同的频带信息,右侧图像中的横纵坐标表示小波变换后的图像尺寸。Among them, LL is low-frequency information, HL is high-frequency information in the vertical direction, LH is high-frequency information in the horizontal direction, and HH is high-frequency information in the diagonal direction. Since low frequency reflects the image overview and high frequency reflects the image details, the image features can be better preserved through wavelet transform. As shown in Figure 7, the image on the left is the original input image, and the image on the right is a schematic diagram after a wavelet decomposition. After wavelet transform, 4 different frequency band information are obtained, and the horizontal and vertical coordinates in the image on the right represent the image size after wavelet transform.
通过上述步骤S601和步骤S602,可以无损得到包括多个不同频带信息的图像特征, 有利于获取毛发的纹理、方向等细节。Through the above steps S601 and S602, image features including multiple different frequency band information can be obtained losslessly. It is helpful to obtain details such as hair texture and direction.
相对应的,基于残差模块融合特征进行特征重建得到增强图像的过程为基于多个依次相连的上采样模块对残差模块融合特征进行多次上采样和特征融合计算,得到增强图像,其中,上采样模块的数量与下采样模块的数量一一对应,相邻两个上采样模块中,在后的上采样模块的输入特征根据在前的上采样模块的输出特征和目标下采样模块的输出特征共同确定,目标下采样模块是指与在后的上采样模块对应的下采样模块。其中,对于在前的上采样模块的输出特征和目标下采样模块的输出特征,通过elementwise add逐元素加和的方式得到在后的上采样模块的输入特征。在下采样为小波变换的情况下,上采样对应为逆小波变换(Inverse Wavelet Transform,简称为IWT),以减少原始图像中的细节损失。Correspondingly, the process of reconstructing the enhanced image by fusion features of the residual module is to perform multiple upsampling and feature fusion calculations on the fusion features of the residual module based on multiple sequentially connected upsampling modules to obtain an enhanced image, wherein the number of upsampling modules corresponds to the number of downsampling modules one by one, and in two adjacent upsampling modules, the input features of the subsequent upsampling module are determined based on the output features of the previous upsampling module and the output features of the target downsampling module, and the target downsampling module refers to the downsampling module corresponding to the subsequent upsampling module. Among them, for the output features of the previous upsampling module and the output features of the target downsampling module, the input features of the subsequent upsampling module are obtained by elementwise add element by element. In the case where the downsampling is a wavelet transform, the upsampling corresponds to an inverse wavelet transform (Inverse Wavelet Transform, referred to as IWT) to reduce the loss of details in the original image.
本实施例的一种实施方式中,对于已经得到的LL、HL、LH、HH分量,首先将其在通道维度上拼接,再进行还原,IWT具体计算公式如公式11至公式18所示:
p1=LL/2                                             公式11
p2=HL/2                                             公式12
p3=LH/2                                             公式13
p4=HH/2                                            公式14
Rlt[:,:,0::2,0::2]=p1-p2-p3+p4                     公式15
Rlt[:,:,1::2,0::2]=p1-p2+p3-p4                     公式16
Rlt[:,:,0::2,1::2]=p1+p2-p3-p4                     公式17
Rlt[:,:,1::2,1::2]=p1+p2+p3+p4                     公式18
In one implementation of this embodiment, the obtained LL, HL, LH, and HH components are first concatenated in the channel dimension and then restored. The specific calculation formula of IWT is shown in Formulas 11 to 18:
p1=LL/2 Formula 11
p2=HL/2 Formula 12
p3=LH/2 Formula 13
p4=HH/2 Formula 14
Rlt[:,:,0::2,0::2]=p1-p2-p3+p4 Formula 15
Rlt[:,:,1::2,0::2]=p1-p2+p3-p4 Formula 16
Rlt[:,:,0::2,1::2]=p1+p2-p3-p4 Formula 17
Rlt[:,:,1::2,1::2]=p1+p2+p3+p4 Formula 18
其中,Rlt为最终逆小波变换的结果。Among them, Rlt is the result of the final inverse wavelet transform.
本实施例的一种实施方式中,特征重建以及逐级合成上采样共包含3个上采样模块,每个上采样模块均包括卷积层和IWT层,残差模块融合特征视为第一个上采样模块的输入y3,第一个上采样模块先将底层多尺度残差模块输出的y3进行卷积以增大通道数,后接ReLU操作提升非线性,然后利用IWT得到特征y3’,y3’和下采样过程得到的x2相加后得到第二个上采样模块的输入特征y2,第二个上采样模块通过卷积、ReLU操作以及IWT对y2进行特征重建得到y2’,y2’和x1相加后得到第三个上采样模块的输入特征y1。第三个上采样模块同样采用卷积、ReLU操作以及IWT对y1进行特征重建得到y1’,y1’和x0相加后得到特征y0。在完成上采样过程之后,通过3×3的卷积层对y0进行计算,得到最终的输出特征y作为增强图像。本实施例中的相加过程可以为elementwise add以进行逐元素相加,因此可以保留更多的原始图像中的信息,从而保证增强图像的纹理细节和原始图像中毛发的方向信息一致。 In one implementation of this embodiment, feature reconstruction and step-by-step synthetic upsampling include a total of three upsampling modules, each of which includes a convolution layer and an IWT layer. The residual module fusion feature is regarded as the input y3 of the first upsampling module. The first upsampling module first convolves y3 output by the bottom multi-scale residual module to increase the number of channels, followed by a ReLU operation to enhance nonlinearity, and then uses IWT to obtain the feature y3', which is added to x2 obtained in the downsampling process to obtain the input feature y2 of the second upsampling module. The second upsampling module reconstructs the feature of y2 through convolution, ReLU operation and IWT to obtain y2', which is added to x1 to obtain the input feature y1 of the third upsampling module. The third upsampling module also uses convolution, ReLU operation and IWT to reconstruct the feature of y1 to obtain y1', which is added to x0 to obtain the feature y0. After completing the upsampling process, y0 is calculated through a 3×3 convolution layer to obtain the final output feature y as an enhanced image. The addition process in this embodiment may be an elementwise add to perform element-by-element addition, so that more information in the original image can be retained, thereby ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
在其中一些实施例中,本申请基于神经网络实现上述的毛发增强方法,在训练神经网络时,需要对应的样本图像对,图8是根据本申请实施例的样本图像对的获取方法的流程图,该方法包括如下步骤:In some embodiments, the present application implements the above-mentioned hair enhancement method based on a neural network. When training the neural network, corresponding sample image pairs are required. FIG8 is a flow chart of a method for obtaining sample image pairs according to an embodiment of the present application. The method includes the following steps:
步骤S801,采集第一样本图像,第一样本图像的图像质量满足预设的图像质量阈值。Step S801: acquiring a first sample image, wherein the image quality of the first sample image meets a preset image quality threshold.
本实施例的一种实施方式中,可以通过单反相机等高清的图像采集设备来采集高清宠物毛发或者人的头发的第一样本图像,对于采集到的第一样本图像,要求采集毛发柔顺、纹理清晰、细节分辨率高、毛发方向一致性较好,基于此,可以设置相应的图像质量阈值,对第一样本图像进行筛选。In one implementation of this embodiment, a first sample image of high-definition pet hair or human hair can be collected by a high-definition image acquisition device such as a SLR camera. For the collected first sample image, the collected hair is required to be smooth, the texture is clear, the detail resolution is high, and the hair direction consistency is good. Based on this, a corresponding image quality threshold can be set to screen the first sample image.
步骤S802,对第一样本图像进行图像退化得到第二样本图像,第二样本图像的图像质量低于第一样本图像的图像质量。Step S802: performing image degradation on the first sample image to obtain a second sample image, wherein the image quality of the second sample image is lower than that of the first sample image.
其中,退化是指将图像质量降低的过程,具体可以通过JPEG压缩、raw噪声、镜头模糊、缩放等操作来模拟实现,最后得到实拍图像经过退化后的低质量宠物毛发图像。Among them, degradation refers to the process of reducing image quality, which can be simulated through JPEG compression, raw noise, lens blur, zoom and other operations, and finally a low-quality pet hair image is obtained after the actual image is degraded.
步骤S803,将第一样本图像和第二样本图像作为一个样本图像对。Step S803: taking the first sample image and the second sample image as a sample image pair.
通过上述步骤S801至步骤S803,训练集全部采用可以获取高质量图像的图像采集设备实拍获取,采集不同光线、不同环境、不同角度下的高清毛发图像,要求毛发图像中毛发柔顺、纹理清晰、细节分辨率高、毛发方向一致性较好。再通过退化获取配对的低质量图像,模拟真实场景实拍的低质量毛发图像,最终获得样本图像对,保证了输入输出之间是严格对齐的,不存在像素错位问题,使得神经网络的训练结果更好。Through the above steps S801 to S803, the training set is all acquired by real shooting with an image acquisition device that can acquire high-quality images, and high-definition hair images under different light, different environments, and different angles are collected, requiring the hair in the hair image to be smooth, with clear texture, high detail resolution, and good consistency of hair direction. Then, paired low-quality images are obtained through degradation to simulate low-quality hair images taken in real scenes, and finally sample image pairs are obtained, ensuring that the input and output are strictly aligned, and there is no pixel misalignment problem, so that the training results of the neural network are better.
本实施例的一种实施方式中,神经网络的训练可以包括如下步骤:In one implementation of this embodiment, the training of the neural network may include the following steps:
S1,获取多个样本图像对;S1, obtain multiple sample image pairs;
S2,将多个样本图像对构成的训练集输入到待训练的基于多尺度残差网络结构的神经网络,进行训练。本实施例中神经网络的损失函数如公式19所示:
S2, input the training set consisting of multiple sample image pairs into the neural network to be trained based on the multi-scale residual network structure for training. The loss function of the neural network in this embodiment is shown in Formula 19:
为了提升生成的真实性,本实施例中的损失函数采用多个子损失函数加权求和得到。其中,L表示最终的损失函数,n表示样本图像对的数目,L1是逐像素计算损失,LSSIM是结构相似性损失,LVGG是感知损失,LGAN是生成对抗网络的损失,权重λ1、λ2、λ3、λ4可以根据需求设置。根据神经网络的输出结果和真实的训练集计算损失,当损失函数的值达到最小或迭代次数超过预设阈值时,训练结束。 In order to improve the authenticity of the generation, the loss function in this embodiment is obtained by weighted summation of multiple sub-loss functions. Wherein, L represents the final loss function, n represents the number of sample image pairs, L1 is the pixel-by-pixel calculation loss, L SSIM is the structural similarity loss, L VGG is the perceptual loss, L GAN is the loss of the generative adversarial network, and the weights λ 1 , λ 2 , λ 3 , and λ 4 can be set according to requirements. The loss is calculated based on the output results of the neural network and the real training set. When the value of the loss function reaches the minimum or the number of iterations exceeds the preset threshold, the training ends.
S3,保存满足收敛条件时的神经网络模型用于进行毛发增强。S3, saves the neural network model that meets the convergence condition for hair enhancement.
以下以宠物毛发增强的应用场景为例,给出一个实施例。An embodiment is given below by taking the application scenario of pet hair enhancement as an example.
本实施例中,神经网络的结构如图9所示,包括初始特征提取模块、多个下采样模块、多个残差模块、融合模块、多个上采样模块和修复增强模块,其中,初始特征提取模块设置为提取原始图像的基础特征,多个下采样模块、多个残差模块、融合模块和多个上采样模块设置为挖掘图像更多的特征信息,修复增强模块设置为实现最终的宠物毛发修复增强。In this embodiment, the structure of the neural network is shown in Figure 9, including an initial feature extraction module, multiple downsampling modules, multiple residual modules, a fusion module, multiple upsampling modules and a repair enhancement module, wherein the initial feature extraction module is configured to extract the basic features of the original image, multiple downsampling modules, multiple residual modules, a fusion module and multiple upsampling modules are configured to mine more feature information of the image, and the repair enhancement module is configured to achieve the final pet hair repair enhancement.
初始特征提取模块由一层3×3的卷积层实现,负责从输入神经网络的低质量宠物毛发图像x提取像素级的底层特征x0,并用更多的输出通道来表示x的特征信息。卷积核的大小可以为3×3,可以避免过大的卷积核带来网络参数量的增加,并且可以降低网络推理阶段消耗的计算性能。The initial feature extraction module is implemented by a 3×3 convolution layer, which is responsible for extracting the underlying pixel-level features x0 from the low-quality pet hair image x input to the neural network, and using more output channels to represent the feature information of x. The size of the convolution kernel can be 3×3, which can avoid the increase in network parameters caused by too large a convolution kernel and reduce the computing performance consumed in the network inference stage.
三个下采样模块对x0逐级分解下采样,通过DWT分解层和卷积层依次得到输出特征x1、x2、x3。The three downsampling modules decompose and downsample x0 step by step, and obtain the output features x1, x2, and x3 in turn through the DWT decomposition layer and the convolution layer.
本实施例中,多个残差模块示例性为4个相同的多尺度残差模块,融合模块为一个1×1的卷积层,用于改变输出通道数并且增加不同感受野深度下每个特征之间的相关性。其中每个残差模块由多个3×3的卷积层和1个1×1的卷积层组成,残差层进行残差计算。最后的融合模块将4个残差模块各自的输出特征在通道维度拼接后进行卷积得到底层特征提取结果,即残差模块融合特征。In this embodiment, the multiple residual modules are exemplified as 4 identical multi-scale residual modules, and the fusion module is a 1×1 convolution layer, which is used to change the number of output channels and increase the correlation between each feature at different receptive field depths. Each residual module consists of multiple 3×3 convolution layers and 1 1×1 convolution layer, and the residual layer performs residual calculation. The final fusion module concatenates the output features of each of the four residual modules in the channel dimension and then convolves them to obtain the underlying feature extraction result, that is, the residual module fusion feature.
多个上采样模块示例性为三个上采样模块,每个上采样模块包括卷积层和IWT重建层,经过三个上采样模块的计算得到y1’,y1’和x0相加后得到输出特征y0。The multiple upsampling modules are exemplified as three upsampling modules, each of which includes a convolutional layer and an IWT reconstruction layer. y1’ is obtained through calculation by the three upsampling modules, and the output feature y0 is obtained by adding y1’ and x0.
最终的修复增强模块由卷积核尺寸为3×3、步长为2的反卷积层实现,对y0进行反卷积,得到最终的修复重建结果y。The final repair enhancement module is implemented by a deconvolution layer with a convolution kernel size of 3×3 and a step size of 2. Deconvolution is performed on y0 to obtain the final repair reconstruction result y.
可以看出,本实施例中初始特征提取模块、下采样模块、上采样模块和修复增强模块的卷积层均为3×3,可以减少参数计算,降低神经网络的计算量,有利于部署于移动端。融合模块的卷积层均为1×1,可以增加不同感受野深度下每个特征之间的相关性。It can be seen that the convolution layers of the initial feature extraction module, downsampling module, upsampling module and repair enhancement module in this embodiment are all 3×3, which can reduce parameter calculation and reduce the amount of calculation of the neural network, which is conducive to deployment on the mobile terminal. The convolution layers of the fusion module are all 1×1, which can increase the correlation between each feature at different receptive field depths.
图9中的“⊕”表示相加,本实施例中相加过程可以为elementwise add,以实现逐元素相加,从而可以保留更多的原始图像中的信息,保证增强图像的纹理细节和原始图像中毛发的方向信息一致。The “⊕” in Figure 9 represents addition. In this embodiment, the addition process can be elementwise add to achieve element-by-element addition, so that more information in the original image can be retained, ensuring that the texture details of the enhanced image are consistent with the direction information of the hair in the original image.
本实施例的一种实施方式中,本实施例通过DWT和IWT实现逐级分解下采样与逐 级合成上采样。相比于传统的采用卷积和反卷积实现下采样和上采样,采用DWT和IWT有如下两个优势:1、可以减少参数和计算量,DWT和IWT属于无参数操作,计算简单,避免了有参数的上下采样带来的性能消耗;2、用HH、HL、LH、LL四种分量表示原始图像后,可以有效地挖掘图像的高频细节信息,且DWT和IWT是一对无损转换操作,可以保证不丢细节地复原原始图像的内容。In one implementation of this embodiment, this embodiment uses DWT and IWT to implement step-by-step decomposition downsampling and step-by-step decomposition downsampling. Compared with the traditional convolution and deconvolution to achieve downsampling and upsampling, the use of DWT and IWT has the following two advantages: 1. It can reduce parameters and calculations. DWT and IWT are parameter-free operations with simple calculations, avoiding the performance consumption caused by parameterized up and down sampling; 2. After the original image is represented by the four components of HH, HL, LH, and LL, the high-frequency detail information of the image can be effectively mined, and DWT and IWT are a pair of lossless conversion operations, which can ensure that the content of the original image is restored without losing details.
如图10所示,Src表示原始图像,Rlt表示修复后的增强图像,修复重建后的宠物毛发纹理更加清晰,方向和原图贴合,可以明显增强原图毛发解析力,提升人眼视觉效果。As shown in Figure 10, Src represents the original image, and Rlt represents the enhanced image after restoration. The texture of the restored and reconstructed pet hair is clearer, and the direction is consistent with the original image, which can significantly enhance the hair resolution of the original image and improve the visual effect of the human eye.
因此本实施例中的基于多尺度残差网络结构的毛发增强方法,可以解决图像中毛发区域产生的模糊、噪声、虚焦等问题,通过多尺度残差结构不仅可以获取不同感受野的特征,更好地挖掘缺失的高频细节信息,而且残差结构也方便训练,保证训练过程的稳定性,最终实现对低质量毛发区域的修复增强。Therefore, the hair enhancement method based on the multi-scale residual network structure in this embodiment can solve the problems of blur, noise, out-of-focus, etc. in the hair area of the image. The multi-scale residual structure can not only obtain the characteristics of different receptive fields and better mine the missing high-frequency detail information, but also the residual structure is convenient for training, ensuring the stability of the training process, and ultimately achieving the repair and enhancement of low-quality hair areas.
在上述流程中或者附图的流程图中示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and, although a logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that shown here.
在本实施例中还提供了一种神经网络,该神经网络用于实现上述实施例及实施方式,已经进行过说明的不再赘述。以下所使用的术语“模块”、“单元”、“子单元”等可以实现预定功能的软件和/或硬件的组合。尽管在以下实施例中所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a neural network is also provided, which is used to implement the above embodiments and implementation methods, and the descriptions that have been made will not be repeated. The terms "module", "unit", "sub-unit", etc. used below can be a combination of software and/or hardware that implements the predetermined functions. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
图11是根据本申请实施例的神经网络的结构框图,如图11所示,该神经网络用于进行毛发增强,包括获取模块1101、多个依次相连的残差模块1102和重建模块1103;FIG. 11 is a block diagram of a neural network according to an embodiment of the present application. As shown in FIG. 11 , the neural network is used for hair enhancement, and includes an acquisition module 1101, a plurality of sequentially connected residual modules 1102, and a reconstruction module 1103;
获取模块1101,设置为获取原始图像的图像特征;An acquisition module 1101 is configured to acquire image features of an original image;
多个残差模块1102,设置为依次对原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个残差模块中,在后的残差模块的输入特征为在前的残差模块的输出特征;A plurality of residual modules 1102 are configured to sequentially perform residual calculation and feature fusion on image features of the original image to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
重建模块1103,设置为基于残差模块融合特征进行特征重建,得到对应于原始图像的增强图像。The reconstruction module 1103 is configured to perform feature reconstruction based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
通过上述步骤神经网络,本实施例中基于多个残差模块1102对原始图像的图像特征进行计算,从而得到原始图像中包括方向和纹理等细节的残差模块融合特征,重建模块 1103基于残差模块融合特征进行特征重建得到的增强图像,相较于原始图像而言,分辨率更高,细节更丰富,可以提升对于宠物毛发或人像中头发纹理细节的处理效果,增强了图像中的纹理细节。Through the above steps of the neural network, in this embodiment, the image features of the original image are calculated based on multiple residual modules 1102, so as to obtain the residual module fusion features including details such as direction and texture in the original image, and the reconstruction module 1103 The enhanced image obtained by feature reconstruction based on the residual module fusion feature has higher resolution and richer details than the original image, which can improve the processing effect of the hair texture details in the pet hair or portrait, and enhance the texture details in the image.
本实施例的一种实施方式中,多个依次相连的残差模块包括依次相连的第一残差模块和第二残差模块;通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:第一残差模块对图像特征进行卷积融合,得到第一特征;第二残差模块对第一特征进行卷积融合,得到第二特征;融合模块对第一特征和第二特征进行融合,得到残差模块融合特征。In one implementation of the present embodiment, a plurality of sequentially connected residual modules include a first residual module and a second residual module connected in sequence; residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, including: the first residual module performs convolution fusion on the image features to obtain a first feature; the second residual module performs convolution fusion on the first feature to obtain a second feature; the fusion module fuses the first feature and the second feature to obtain a residual module fusion feature.
本实施例的一种实施方式中,多个依次相连的残差模块包括依次相连的第一残差模块、第二残差模块、第三残差模块和第四残差模块;所述通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:基于第一残差模块对所述图像特征进行卷积融合,得到第一特征;基于第二残差模块对所述第一特征进行卷积融合,得到第二特征;基于第三残差模块对所述第二特征进行卷积融合,得到第三特征;基于第四残差模块对所述第三特征进行卷积融合,得到第四特征;对所述第一特征、所述第二特征、所述第三特征和所述第四特征进行融合,得到所述残差模块融合特征。In one implementation of the present embodiment, a plurality of sequentially connected residual modules include a first residual module, a second residual module, a third residual module and a fourth residual module that are sequentially connected; the residual calculation and feature fusion are performed on the image features of the original image through a plurality of sequentially connected residual modules to obtain the residual module fusion features, including: performing convolution fusion on the image features based on the first residual module to obtain the first feature; performing convolution fusion on the first feature based on the second residual module to obtain the second feature; performing convolution fusion on the second feature based on the third residual module to obtain the third feature; performing convolution fusion on the third feature based on the fourth residual module to obtain the fourth feature; and fusing the first feature, the second feature, the third feature and the fourth feature to obtain the residual module fusion feature.
本实施例的一种实施方式中,对于相邻的两个残差层,通过在后的残差层对在前的残差层的最终输出特征进行卷积计算,得到卷积输出特征,将卷积输出特征与在前的残差层的最终输出特征相加作为在后的残差层的最终输出特征;在有多个残差层的情况下,融合层将每个残差层的最终输出特征和残差模块的初始层的最终输出特征进行拼接得到残差层拼接特征;残差模块的输入特征和残差层拼接特征共同确定残差模块的输出特征。In one implementation of this embodiment, for two adjacent residual layers, a convolution output feature is obtained by performing a convolution calculation on the final output feature of the previous residual layer in the subsequent residual layer, and the convolution output feature is added to the final output feature of the previous residual layer as the final output feature of the subsequent residual layer; in the case of multiple residual layers, the fusion layer splices the final output feature of each residual layer and the final output feature of the initial layer of the residual module to obtain a residual layer splicing feature; the input feature of the residual module and the residual layer splicing feature jointly determine the output feature of the residual module.
本实施例的一种实施方式中,获取模块1101还设置为获取原始图像的初始特征;对初始特征进行下采样,得到原始图像的图像特征。In an implementation manner of this embodiment, the acquisition module 1101 is further configured to acquire initial features of the original image; and downsample the initial features to obtain image features of the original image.
本实施例的一种实施方式中,获取模块1101基于多个依次相连的下采样模块对初始特征进行逐级下采样,得到原始图像的图像特征,其中,相邻两个下采样模块中,在后的下采样模块的输入特征为在前的下采样模块的输出特征。In one implementation of this embodiment, the acquisition module 1101 downsamples the initial features step by step based on multiple sequentially connected downsampling modules to obtain image features of the original image, wherein, in two adjacent downsampling modules, the input features of the later downsampling module are the output features of the previous downsampling module.
本实施例的一种实施方式中,对初始特征进行下采样通过小波变换实现。In one implementation of this embodiment, downsampling of the initial features is achieved through wavelet transformation.
本实施例的一种实施方式中,重建模块1103还设置为基于多个依次相连的上采样模块对残差模块融合特征进行多次上采样和特征融合计算,得到增强图像;其中,上采样模块的数量与下采样模块的数量一一对应,相邻两个上采样模块中,在后的上采样模块的输 入特征根据在前的上采样模块的输出特征和目标下采样模块的输出特征共同确定,目标下采样模块是指与在后的上采样模块对应的下采样模块。In one implementation of this embodiment, the reconstruction module 1103 is further configured to perform multiple upsampling and feature fusion calculations on the residual module fusion features based on a plurality of sequentially connected upsampling modules to obtain an enhanced image; wherein the number of upsampling modules corresponds to the number of downsampling modules one by one, and in two adjacent upsampling modules, the input of the subsequent upsampling module is The input features are determined based on the output features of the preceding upsampling module and the output features of the target downsampling module. The target downsampling module refers to the downsampling module corresponding to the succeeding upsampling module.
本实施例的一种实施方式中,小波变换包括根据预设步长对原始图像的初始特征在行和列上分别进行间隔采样,得到采样结果;根据采样结果计算初始特征的多个不同频带信息作为原始图像的图像特征。In one implementation of this embodiment, the wavelet transform includes performing interval sampling on the initial features of the original image in rows and columns according to a preset step size to obtain sampling results; and calculating multiple different frequency band information of the initial features as image features of the original image based on the sampling results.
本实施例的一种实施方式中,训练神经网络的样本图像对的获取方法可以包括:采集第一样本图像,第一样本图像的图像质量满足预设的图像质量阈值;对第一样本图像进行图像退化得到第二样本图像,第二样本图像的图像质量低于第一样本图像的图像质量;将第一样本图像和第二样本图像作为一个样本图像对。In one implementation of this embodiment, a method for acquiring a sample image pair for training a neural network may include: acquiring a first sample image, where the image quality of the first sample image meets a preset image quality threshold; performing image degradation on the first sample image to obtain a second sample image, where the image quality of the second sample image is lower than that of the first sample image; and treating the first sample image and the second sample image as a sample image pair.
本实施例通过该获取方法,获取大量的样本图像对,用以训练神经网络。This embodiment uses the acquisition method to acquire a large number of sample image pairs for training a neural network.
本申请提供的毛发增强方法,通过多个依次相连的残差模块对原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个残差模块中,在后的残差模块的输入特征为在前的残差模块的输出特征;基于残差模块融合特征进行特征重建,得到对应于原始图像的增强图像,提升了宠物毛发或者人像中头发纹理细节的处理效果,增强了图像中的纹理细节。The hair enhancement method provided by the present application performs residual calculation and feature fusion on the image features of the original image through multiple sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module; feature reconstruction is performed based on the residual module fusion features to obtain an enhanced image corresponding to the original image, thereby improving the processing effect of hair texture details in pet hair or portraits and enhancing the texture details in the image.
上述每个模块可以是功能模块或可以是程序模块,既可以通过软件来实现,或可以通过硬件来实现。对于通过硬件来实现的模块而言,上述每个模块可以位于同一处理器中;或者上述每个模块或可以按照任意组合的形式分别位于不同的处理器中。Each of the above modules may be a functional module or a program module, and may be implemented by software or hardware. For modules implemented by hardware, each of the above modules may be located in the same processor; or each of the above modules may be located in different processors in any combination.
在本实施例中还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。This embodiment also provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
本实施例的一种实施方式中,上述电子装置可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。In one implementation of this embodiment, the electronic device may include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
本实施例的一种实施方式中,上述处理器可以被设置为通过计算机程序执行以下步骤:In one implementation of this embodiment, the processor may be configured to perform the following steps through a computer program:
S1,获取原始图像的图像特征。S1, obtain the image features of the original image.
S2,通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个所述残差模块中,在后的所述残差模块的输入特征为在前的所述残差模块的输出特征。 S2, performing residual calculation and feature fusion on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module.
S3,基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像。S3, performing feature reconstruction based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
在本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,在本实施例中不再赘述。For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation modes, which will not be described in detail in this embodiment.
此外,结合上述实施例中提供的样本标签的获取方法,在本实施例中可以提供一种计算机可读存储介质来实现。该存储介质上存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行;该程序被处理器执行时实现上述实施例中的任意一种方法。In addition, in combination with the method for obtaining sample labels provided in the above embodiments, a computer-readable storage medium may be provided in this embodiment for implementation. The storage medium stores one or more programs, and the one or more programs may be executed by one or more processors; when the program is executed by the processor, any one of the methods in the above embodiments is implemented.
应该明白的是,这里描述的具体实施例只是用来解释这个应用,而不是用来对它进行限定。根据本申请提供的实施例,本领域普通技术人员在不进行创造性劳动的情况下得到的所有其它实施例,均属本申请保护范围。It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
附图只是本申请的一些例子或实施例,对本领域的普通技术人员来说,可以根据这些附图将本申请适用于其他类似情况,但无需付出创造性劳动。另外,可以理解的是,尽管在此开发过程中所做的工作可能是复杂和漫长的,但是,对于本领域的普通技术人员来说,根据本申请披露的技术内容进行的某些设计、制造或生产等更改仅是常规的技术手段,不应被视为本申请公开的内容不足。The accompanying drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
“实施例”一词在本申请中指的是结合实施例描述的具体特征、结构或特性可以包括在本申请的至少一个实施例中。该短语出现在说明书中的各个位置并不一定意味着相同的实施例,也不意味着与其它实施例相互排斥而具有独立性或可供选择。本领域的普通技术人员可以清楚或隐含地理解的是,本申请中描述的实施例在没有冲突的情况下,可以与其它实施例结合。The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It can be clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对专利保护范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。 The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些组件或所有组件可以被实施为由处理器,如数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。 It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules/units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

Claims (13)

  1. 一种毛发增强方法,包括:A method for hair enhancement, comprising:
    获取原始图像的图像特征;Obtain image features of the original image;
    通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个所述残差模块中,在后的所述残差模块的输入特征为在前的所述残差模块的输出特征;Performing residual calculation and feature fusion on the image features of the original image through a plurality of sequentially connected residual modules to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
    基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像。Feature reconstruction is performed based on the residual module fusion features to obtain an enhanced image corresponding to the original image.
  2. 根据权利要求1所述的毛发增强方法,其中,所述多个依次相连的残差模块包括依次相连的第一残差模块和第二残差模块;所述通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:The hair enhancement method according to claim 1, wherein the plurality of sequentially connected residual modules include a first residual module and a second residual module that are sequentially connected; and performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules to obtain the residual module fusion features includes:
    基于第一残差模块对所述图像特征进行卷积融合,得到第一特征;Performing convolution fusion on the image features based on the first residual module to obtain a first feature;
    基于第二残差模块对所述第一特征进行卷积融合,得到第二特征;Performing convolution fusion on the first features based on a second residual module to obtain a second feature;
    对所述第一特征和所述第二特征进行融合,得到所述残差模块融合特征。The first feature and the second feature are fused to obtain the residual module fusion feature.
  3. 根据权利要求1所述的毛发增强方法,其中,所述多个依次相连的残差模块包括依次相连的第一残差模块、第二残差模块、第三残差模块和第四残差模块;所述通过多个依次相连的残差模块对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征包括:The hair enhancement method according to claim 1, wherein the plurality of sequentially connected residual modules include a first residual module, a second residual module, a third residual module, and a fourth residual module that are sequentially connected; and the residual module fusion features obtained by performing residual calculation and feature fusion on the image features of the original image through the plurality of sequentially connected residual modules include:
    基于第一残差模块对所述图像特征进行卷积融合,得到第一特征;Performing convolution fusion on the image features based on the first residual module to obtain a first feature;
    基于第二残差模块对所述第一特征进行卷积融合,得到第二特征;Performing convolution fusion on the first features based on a second residual module to obtain a second feature;
    基于第三残差模块对所述第二特征进行卷积融合,得到第三特征;Performing convolution fusion on the second features based on a third residual module to obtain a third feature;
    基于第四残差模块对所述第三特征进行卷积融合,得到第四特征;Performing convolution fusion on the third feature based on a fourth residual module to obtain a fourth feature;
    对所述第一特征、所述第二特征、所述第三特征和所述第四特征进行融合,得到所述残差模块融合特征。The first feature, the second feature, the third feature and the fourth feature are fused to obtain the residual module fusion feature.
  4. 根据权利要求1或2所述的毛发增强方法,其中,每个所述残差模块包括初始层和多个依次相连的残差层,所述残差模块的输出特征的获取方法包括:The hair enhancement method according to claim 1 or 2, wherein each of the residual modules comprises an initial layer and a plurality of sequentially connected residual layers, and a method for acquiring output features of the residual module comprises:
    对于相邻的两个残差层,通过在后的残差层对在前的残差层的最终输出特征进行卷积计算,得到卷积输出特征,将所述卷积输出特征与所述在前的残差层的最终输出特征相加 作为所述在后的残差层的最终输出特征;For two adjacent residual layers, the final output features of the previous residual layer are convolved in the subsequent residual layer to obtain the convolution output features, and the convolution output features are added to the final output features of the previous residual layer. As the final output feature of the subsequent residual layer;
    在有多个残差层的情况下,将每个残差层的所述最终输出特征和所述残差模块的初始层的最终输出特征进行拼接得到残差层拼接特征;In the case of multiple residual layers, the final output feature of each residual layer and the final output feature of the initial layer of the residual module are concatenated to obtain a residual layer concatenated feature;
    根据所述残差模块的输入特征和所述残差层拼接特征,确定所述残差模块的输出特征。The output feature of the residual module is determined according to the input feature of the residual module and the residual layer concatenation feature.
  5. 根据权利要求1所述的毛发增强方法,其中,所述获取原始图像的图像特征包括:The hair enhancement method according to claim 1, wherein the acquiring the image features of the original image comprises:
    获取原始图像的初始特征;Obtain the initial features of the original image;
    对所述初始特征进行下采样,得到所述原始图像的图像特征。The initial features are downsampled to obtain image features of the original image.
  6. 根据权利要求5所述的毛发增强方法,其中,所述对所述初始特征进行下采样,得到所述原始图像的图像特征包括:The hair enhancement method according to claim 5, wherein downsampling the initial features to obtain the image features of the original image comprises:
    基于多个依次相连的下采样模块对所述初始特征进行逐级下采样,得到所述原始图像的图像特征,其中,相邻两个所述下采样模块中,在后的所述下采样模块的输入特征为在前的所述下采样模块的输出特征。The initial features are downsampled step by step based on a plurality of sequentially connected downsampling modules to obtain image features of the original image, wherein, in two adjacent downsampling modules, the input features of the latter downsampling module are the output features of the former downsampling module.
  7. 根据权利要求5或6所述的毛发增强方法,其中,所述对所述初始特征进行下采样通过小波变换实现。The hair enhancement method according to claim 5 or 6, wherein the downsampling of the initial features is achieved by wavelet transform.
  8. 根据权利要求7所述的毛发增强方法,其中,所述基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像包括:The hair enhancement method according to claim 7, wherein the step of performing feature reconstruction based on the residual module fusion feature to obtain an enhanced image corresponding to the original image comprises:
    基于多个依次相连的上采样模块对所述残差模块融合特征进行多次上采样和特征融合计算,得到所述增强图像;其中,所述上采样模块的数量与下采样模块的数量一一对应,相邻两个所述上采样模块中,在后的所述上采样模块的输入特征根据在前的所述上采样模块的输出特征和目标下采样模块的输出特征共同确定,所述目标下采样模块是指与所述在后的上采样模块对应的下采样模块。The enhanced image is obtained by performing multiple upsampling and feature fusion calculations on the fusion features of the residual module based on multiple upsampling modules connected in sequence; wherein the number of the upsampling modules corresponds one-to-one to the number of the downsampling modules, and in two adjacent upsampling modules, the input features of the subsequent upsampling module are jointly determined according to the output features of the previous upsampling module and the output features of the target downsampling module, and the target downsampling module refers to the downsampling module corresponding to the subsequent upsampling module.
  9. 根据权利要求7所述的毛发增强方法,其中,所述小波变换包括:The hair enhancement method according to claim 7, wherein the wavelet transform comprises:
    根据预设步长对所述原始图像的初始特征在行和列上分别进行间隔采样,得到采样结果;The initial features of the original image are sampled at intervals in rows and columns according to a preset step size to obtain sampling results;
    根据所述采样结果计算所述初始特征的多个不同频带信息作为所述原始图像的图像特征。A plurality of different frequency band information of the initial feature is calculated according to the sampling result as the image feature of the original image.
  10. 根据权利要求1所述的毛发增强方法,其中,基于神经网络实现所述毛发增强方 法,用于训练所述神经网络的样本图像对的获取方法包括:The hair enhancement method according to claim 1, wherein the hair enhancement method is implemented based on a neural network. The method for obtaining the sample image pairs for training the neural network includes:
    采集第一样本图像,所述第一样本图像的图像质量满足预设的图像质量阈值;Acquire a first sample image, where the image quality of the first sample image meets a preset image quality threshold;
    对所述第一样本图像进行图像退化得到第二样本图像,所述第二样本图像的图像质量低于所述第一样本图像的图像质量;Performing image degradation on the first sample image to obtain a second sample image, wherein the image quality of the second sample image is lower than the image quality of the first sample image;
    将所述第一样本图像和所述第二样本图像作为一个样本图像对。The first sample image and the second sample image are regarded as a sample image pair.
  11. 一种神经网络,包括获取模块、多个依次相连的残差模块和重建模块;A neural network comprises an acquisition module, a plurality of sequentially connected residual modules and a reconstruction module;
    所述获取模块,设置为获取原始图像的图像特征;The acquisition module is configured to acquire image features of the original image;
    多个所述残差模块,设置为依次对所述原始图像的图像特征进行残差计算和特征融合,得到残差模块融合特征,其中,相邻两个所述残差模块中,在后的所述残差模块的输入特征为在前的所述残差模块的输出特征;The plurality of residual modules are configured to sequentially perform residual calculation and feature fusion on the image features of the original image to obtain residual module fusion features, wherein, in two adjacent residual modules, the input features of the latter residual module are the output features of the former residual module;
    所述重建模块,设置为基于所述残差模块融合特征进行特征重建,得到对应于所述原始图像的增强图像。The reconstruction module is configured to perform feature reconstruction based on the fusion features of the residual module to obtain an enhanced image corresponding to the original image.
  12. 一种电子装置,包括处理器以及存储器,所述存储器设置为存储所述处理器的可执行指令;所述处理器设置为经由执行所述可执行指令来执行权利要求1至10中任意一项所述的毛发增强方法。An electronic device comprises a processor and a memory, wherein the memory is configured to store executable instructions of the processor; and the processor is configured to execute the hair enhancement method according to any one of claims 1 to 10 by executing the executable instructions.
  13. 一种计算机可读存储介质,所述计算机可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如权利要求1至10中任意一项所述的毛发增强方法。 A computer-readable storage medium storing one or more programs, wherein the one or more programs can be executed by one or more processors to implement the hair enhancement method according to any one of claims 1 to 10.
PCT/CN2023/139420 2022-12-22 2023-12-18 Hair enhancement method, neural network, electronic device, and storage medium WO2024131707A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211659099.7 2022-12-22
CN202211659099.7A CN116188295A (en) 2022-12-22 2022-12-22 Hair enhancement method, neural network, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2024131707A1 true WO2024131707A1 (en) 2024-06-27

Family

ID=86449858

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/139420 WO2024131707A1 (en) 2022-12-22 2023-12-18 Hair enhancement method, neural network, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN116188295A (en)
WO (1) WO2024131707A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180137603A1 (en) * 2016-11-07 2018-05-17 Umbo Cv Inc. Method and system for providing high resolution image through super-resolution reconstruction
CN112990171A (en) * 2021-05-20 2021-06-18 腾讯科技(深圳)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN114129171A (en) * 2021-12-01 2022-03-04 山东省人工智能研究院 Electrocardiosignal noise reduction method based on improved residual error dense network
CN114742733A (en) * 2022-04-19 2022-07-12 中国工商银行股份有限公司 Cloud removing method and device, computer equipment and storage medium
CN115100583A (en) * 2022-08-29 2022-09-23 君华高科集团有限公司 Method and system for real-time supervision of safety of kitchen food

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180137603A1 (en) * 2016-11-07 2018-05-17 Umbo Cv Inc. Method and system for providing high resolution image through super-resolution reconstruction
CN112990171A (en) * 2021-05-20 2021-06-18 腾讯科技(深圳)有限公司 Image processing method, image processing device, computer equipment and storage medium
CN114129171A (en) * 2021-12-01 2022-03-04 山东省人工智能研究院 Electrocardiosignal noise reduction method based on improved residual error dense network
CN114742733A (en) * 2022-04-19 2022-07-12 中国工商银行股份有限公司 Cloud removing method and device, computer equipment and storage medium
CN115100583A (en) * 2022-08-29 2022-09-23 君华高科集团有限公司 Method and system for real-time supervision of safety of kitchen food

Also Published As

Publication number Publication date
CN116188295A (en) 2023-05-30

Similar Documents

Publication Publication Date Title
TWI728465B (en) Method, device and electronic apparatus for image processing and storage medium thereof
CN111898701B (en) Model training, frame image generation and frame insertion methods, devices, equipment and media
US10325346B2 (en) Image processing system for downscaling images using perceptual downscaling method
Zheng et al. Learning frequency domain priors for image demoireing
RU2706891C1 (en) Method of generating a common loss function for training a convolutional neural network for converting an image into an image with drawn parts and a system for converting an image into an image with drawn parts
CN112801901A (en) Image deblurring algorithm based on block multi-scale convolution neural network
CN110060204B (en) Single image super-resolution method based on reversible network
TWI769725B (en) Image processing method, electronic device and computer readable storage medium
CN111681177B (en) Video processing method and device, computer readable storage medium and electronic equipment
KR20200132682A (en) Image optimization method, apparatus, device and storage medium
CN113129212B (en) Image super-resolution reconstruction method and device, terminal device and storage medium
CN110428382A (en) A kind of efficient video Enhancement Method, device and storage medium for mobile terminal
Xu et al. Exploiting raw images for real-scene super-resolution
Fang et al. High-resolution optical flow and frame-recurrent network for video super-resolution and deblurring
CN111800630A (en) Method and system for reconstructing video super-resolution and electronic equipment
CN112991231A (en) Single-image super-image and perception image enhancement joint task learning system
CN114881888A (en) Video Moire removing method based on linear sparse attention transducer
Rasheed et al. LSR: Lightening super-resolution deep network for low-light image enhancement
CN111429371A (en) Image processing method and device and terminal equipment
CN112150363B (en) Convolutional neural network-based image night scene processing method, computing module for operating method and readable storage medium
CN111951171A (en) HDR image generation method and device, readable storage medium and terminal equipment
WO2024131707A1 (en) Hair enhancement method, neural network, electronic device, and storage medium
Zhou et al. Deep fractal residual network for fast and accurate single image super resolution
Li et al. RGSR: A two-step lossy JPG image super-resolution based on noise reduction
CN111383171B (en) Picture processing method, system and terminal equipment