WO2023001110A1 - Neural network training method and apparatus, and electronic device - Google Patents

Neural network training method and apparatus, and electronic device Download PDF

Info

Publication number
WO2023001110A1
WO2023001110A1 PCT/CN2022/106274 CN2022106274W WO2023001110A1 WO 2023001110 A1 WO2023001110 A1 WO 2023001110A1 CN 2022106274 W CN2022106274 W CN 2022106274W WO 2023001110 A1 WO2023001110 A1 WO 2023001110A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
neural network
degradation
target
parameter
Prior art date
Application number
PCT/CN2022/106274
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 WO2023001110A1 publication Critical patent/WO2023001110A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the application belongs to the field of image processing and deep learning, and specifically relates to a neural network training method, device and electronic equipment.
  • the solution to improve the shooting quality of electronic equipment is mainly realized by learning the deep network of face quality enhancement through convolutional neural network.
  • a deep network with a single input resolution (such as 256, 512) and a single image degradation is trained through a training set to perform image enhancement processing on captured images.
  • image processing method in some special scenes, such as low-illumination scenes, the amount of light entering is small when shooting, which is greatly affected by noise. Compared with scenes with normal brightness, the quality of images captured in low-light scenes is degraded. More severe (ie, lower image quality). For another example, when shooting group portraits, the degrees of degradation of faces with inconsistent sizes in the lens are also different.
  • the purpose of the embodiment of the present application is to provide a neural network training method, device and electronic equipment, which can solve the technical problem of poor image processing effect of the deep learning network in the related art.
  • the embodiment of the present application provides a neural network training method, the method includes: determining N degradation degrees according to the acquired M environmental parameters of the M first images, and one degradation degree corresponds to at least one environmental parameter, A degree of degradation corresponds to at least one first image, and M and N are both positive integers; based on each degree of degradation, the first image corresponding to each degree of degradation is degraded to obtain a second image corresponding to each degree of degradation , each second image corresponds to a first image; based on the first image and the second image corresponding to each degree of degradation, a sample set is generated respectively, and N sample sets are obtained; based on N sample sets, Q The neural network is trained, and a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the embodiment of the present application provides a neural network training device, which includes: the device includes: a determination module, a processing module, a generation module and a training module, wherein: the determination module is used to The M environmental parameters of the first image determine N degradation degrees, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image, M and N are both positive integers; the above processing module is used to For each degradation degree determined by the determination module, perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each second image corresponds to a first image respectively; the above-mentioned generation module , used to generate a sample set based on the first image and the second image corresponding to each degree of degradation obtained by the processing module to obtain N sample sets; the above training module is used to obtain N sample sets based on the generation module, Q neural networks are trained respectively, a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the determination module is used to The
  • an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
  • an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
  • the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
  • an embodiment of the present application provides a computer program product, the program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement the method described in the first aspect.
  • the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image , M and N are both positive integers; and based on each degree of degradation, degrade the first image corresponding to each degree of degradation to obtain the second image corresponding to each degree of degradation, and each second image corresponds to a The first image, then, based on the first image and the second image corresponding to each degree of degradation above, generate a sample set respectively to obtain N sample sets, and finally, based on the above N sample sets, respectively perform Q neural networks For training, a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters.
  • Image enhancement processing effect can be used to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation).
  • Fig. 1 is the flowchart of a kind of neural network training method provided by the embodiment of the present application
  • Fig. 2 is a schematic flow chart of processing by a multi-intensity degradation module provided in an embodiment of the present application
  • Fig. 3 is a schematic diagram of constructing a low-definition-high-definition training set provided by the embodiment of the present application;
  • Fig. 4 is a schematic diagram of ISO and face size information processing provided by the embodiment of the present application.
  • FIG. 5 is a schematic diagram of a multi-complexity GAN network flow provided by an embodiment of the present application.
  • FIG. 6 is a flow chart of an image processing method provided by an embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of a neural network training device provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an image processing device provided in an embodiment of the present application.
  • FIG. 9 is one of the schematic diagrams of the hardware structure of an electronic device provided in the embodiment of the present application.
  • FIG. 10 is a second schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
  • FIG. 1 shows a flowchart of the neural network training method provided in the embodiment of the present application.
  • the neural network training method provided by the embodiment of the present application may include the following steps 101 to 104:
  • Step 101 Determine N degradation degrees according to the acquired M environmental parameters of the M first images.
  • one degree of degradation corresponds to at least one environmental parameter
  • one degree of degradation corresponds to at least one first image
  • both M and N are positive integers.
  • the above-mentioned neural network training method can be a faceEnhanceGAN network (faceEnhanceGAN) training method
  • faceEnhanceGAN faceEnhanceGAN
  • faceEnhanceGAN faceEnhanceGAN
  • Paired image pairs ie, low-resolution images-high-resolution images
  • low-definition pictures can be obtained by performing various degradation processes (such as blurring, adding noise, etc.) on the acquired high-definition pictures (such as high-definition pictures taken by SLR) to obtain low-definition-high-definition image pairs, namely LQ -HQ dataset.
  • various degradation processes such as blurring, adding noise, etc.
  • the above-mentioned first image may be a high-definition picture.
  • the above-mentioned first image may be a high-definition picture captured by a camera of a high-quality imaging device (such as a single-lens reflex camera), or the above-mentioned first image may be a high-definition picture obtained by performing image enhancement on a low-quality image.
  • the clarity and quality of a picture can be measured by the degree of blur and noise, and the above-mentioned high-definition picture refers to a picture with less blur and less noise.
  • each first image and the environmental parameters corresponding to the first images can be stored in the database, and the neural network training device can be used when necessary
  • the M first images can be called from the database.
  • the foregoing environmental parameters may include at least one of the following: ISO value of sensitivity and brightness.
  • the sensitivity refers to the sensitivity to light expressed by numbers. The higher the ISO value, the stronger the sensitivity to light, and vice versa.
  • the M environmental parameters of the M first images may be obtained by inputting the M first images to the ISO and face size information processing module for processing.
  • the neural network training apparatus may determine the degree of degradation of the first image according to the magnitude relationship between the environmental parameters of the first image and the first threshold.
  • the above-mentioned first threshold is an ISO threshold, which may specifically be the size of the ISO.
  • the ISO value of image 1 is greater than the first threshold, the image 1 corresponds to a first degree of degradation (ie, a higher degree of degradation).
  • the multi-stage ISO threshold (ISO_threshold) can be reasonably set by collecting the user's photo data and analyzing the darkness of the scene.
  • the aforementioned environmental parameters may be referred to as prior information
  • the aforementioned ISO and face size information processing module is a preprocessing module for obtaining the prior information.
  • the foregoing N degradation degrees may be one or more of the preset L degradation degrees.
  • the above L degradation degrees may include: a first degradation degree and a second degradation degree.
  • the first degree of degradation may be a high degree of degradation
  • the second degree of degradation may be a low degree of degradation.
  • the above degradation degree may be flexibly determined according to actual conditions, for example, three or more degradation degrees may be set, which is not limited in this embodiment of the present application.
  • the above N degradation degrees correspond to N degradation modules respectively, each degradation module is used to perform corresponding degradation processing on the first image, and the degradation algorithm of each degradation module is different, namely , each degradation module corresponds to a different degradation effect.
  • the above N degradation modules may include: a high ISO segment degradation module and a low ISO segment degradation module. Further, the high ISO segment degradation module may correspond to the above-mentioned first degradation degree, and the low ISO segment degradation module may correspond to the above-mentioned second degradation degree.
  • N degradation modules may also be refined into degradation modules of more ISO segments according to actual requirements, which is not limited in this embodiment of the present application.
  • the high ISO segment degradation module is used to process the first image with a large ISO value, and its degradation degree is relatively high
  • the low ISO segment degradation module is used to process the first image with a large ISO value, and its degradation degree is low .
  • the neural network training device may determine the degree of degradation corresponding to the environment parameter according to the environment parameter of each first image in the M first images, so as to determine the degree of degradation of each first image. For example, taking an ISO value lower than 50 as a low sensitivity and corresponding to the first degree of degradation (for example, a low degree of degradation) as an example, if the ISO value of image 1 is 45, then the degree of degradation corresponding to image 1 is the first degree of degradation , that is, the image 1 corresponds to a low degree of degradation.
  • Step 102 Based on each degree of degradation, perform degradation processing on the first image corresponding to each degree of degradation to obtain a second image corresponding to each degree of degradation.
  • each second image corresponds to a first image.
  • the neural network training device may use a degradation module corresponding to each degradation degree to perform quality degradation processing on the first image corresponding to each degradation degree to obtain a low-quality image or a low-resolution image corresponding to the first image (i.e., the second image above).
  • the neural network training device can use the multi-intensity data degradation module to determine corresponding data degradation modules of different intensities according to the degree of degradation corresponding to the first image, and perform corresponding quality degradation on the first image deal with.
  • the neural network training device can determine the ISO flag bit information through the above-mentioned ISO and face size information processing module, and then determine the corresponding degradation module based on the ISO flag bit information through the above-mentioned multi-intensity data degradation module.
  • the above ISO flag is used to indicate the level of ISO, for example, the ISO flag is a high flag (ie highISO_flag), or the ISO flag is a low flag (ie lowISO_flag).
  • the size relationship between the ISO value of the first image and the above-mentioned ISO threshold ie, ISO_threshold
  • ISO_threshold the size relationship between the ISO value of the first image and the above-mentioned ISO threshold
  • the corresponding degradation module is determined based on the ISO flag bit information through the above multi-intensity data degradation module
  • the ISO flag bit information in the ISO and face size information processing module can be identified, and then based on the identified flag bit information, Determine the corresponding degenerate modules.
  • Example 1 after inputting multiple high-definition images to the ISO and face size information processing module and the multi-intensity data degradation module, if the high ISO flag highISO_flag is recognized to be equal to 1 from the ISO and face size information processing module, then It indicates that the high ISO segment is entered, and at this time, the high ISO segment degradation module is entered, through which the image (that is, the image to be degraded) can be added with multiple types of noise with greater intensity during the degradation process, and multiple types of noise with higher intensity can be added.
  • Large model operations such as triangular models, Gaussian models, linear models, motion blur and other fuzzy functions, all increase the fuzziness.
  • the input high-definition image is randomly darkened to simulate the brightness of the image under dark light.
  • Example 2 after inputting multiple high-definition images to the ISO and face size information processing module and the multi-intensity data degradation module, if the low ISO flag bit lowISO_flag is recognized as 1 from the ISO and face size information processing module, then It means that the image is entered into the low ISO segment. At this time, it enters the low ISO segment degradation module. Through this degradation module, the image can be added with less intense noise, and less types of blur functions can be added for lesser degree of blurring.
  • FIG. 2 is a schematic flow chart of processing using a multi-intensity degradation module.
  • the low ISO flag bit lowISO_flag corresponding to the high-definition image is equal to 1
  • enter the low ISO degradation module to process the high-definition image to obtain the corresponding low-definition image 1
  • the high-ISO flag bit highISO_flag corresponding to the high-definition image If it is equal to 1, enter the high-ISO degradation module to process the high-definition image to obtain the corresponding low-definition image 2.
  • the above-mentioned degradation processing includes but is not limited to at least one of the following: noise addition processing, blur processing (defocus blur, motion blur, Gaussian blur, linear blur), reduce/improve brightness (3D lighting), increase/decrease Shadows (random shadows), area-aware degradation.
  • various blurring models can be added to blur the first image through various blurring functions, for example, defocus model, Gaussian model, linear model, Fuzzy functions such as motion models.
  • the above degradation degree may include at least one of the following: degradation intensity and degradation mode.
  • the above degradation intensity refers to the degree of processing, for example, the size of added noise, the size of the degree of blur
  • the above degradation mode refers to the processing method, for example, adding noise to image 1 and blurring image 2, that is There are two different processing modes.
  • the multi-intensity degradation module is designed to perform differential image quality degradation on the first images of different ISOs (ie, high ISO and low ISO) according to the degradation intensity and degradation mode, so as to construct a better data set Simulate the image quality of electronic equipment from different ISO ranges.
  • FIG. 3 shows a schematic diagram of low-definition-high-definition training set construction.
  • the image training device performs one or more of the above-mentioned degradation processes on several high-definition images to obtain several quality degraded images (i.e., low clear image), so as to obtain the high-definition-low-definition training set.
  • M first images as 100 high-definition images as an example.
  • the ISO values of 40 images in the 100 high-definition images are greater than the ISO threshold value, corresponding to the first degree of degradation
  • the ISO values of the 60 images other than the 40 images are less than the ISO threshold value, corresponding to the second degree of degradation
  • the The 40 images are input to the high ISO segment degradation module corresponding to the first degradation degree for processing
  • the 60 images are input to the low ISO segment degradation module corresponding to the second degradation degree for processing, so as to obtain low clear image.
  • Step 103 Based on the first image and the second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets.
  • one degree of degradation corresponds to one sample set
  • N degrees of degradation correspond to N sample sets, that is, the above N sample sets respectively correspond to N degrees of degradation
  • the N sample sets constitute the training data set.
  • a sample set includes at least one first image and at least one second image, that is, each sample set includes at least one low-definition-high-definition image pair, that is, LQ-HQ data set.
  • one degree of degradation corresponds to one training data set.
  • the neural network training device may store the first image and the second image corresponding to the first image as training sample images in a corresponding training data set.
  • the ISO value is the darker the scene is, and the quality of the picture taken in the darker scene is more severely degraded, such as more blurred, more noise, etc.; the ISO value The smaller the value, the brighter the shooting scene, and the quality degradation of the picture taken in a bright scene is obviously weaker than that in a high ISO scene.
  • the image signal processing i.e., ISP
  • the image quality during the shooting process can be simulated more closely
  • a high-quality training set can be constructed, and a neural network with better face enhancement effect can be trained.
  • Step 104 Based on the above N sample sets, train Q neural networks respectively.
  • one sample set corresponds to at least one neural network
  • Q is a positive integer
  • the aforementioned Q neural networks may include a generative adversarial network (GAN network).
  • GAN network generative adversarial network
  • the aforementioned Q neural networks may be neural networks among a plurality of preset neural networks of different complexity.
  • the neural network training device may train Q neural networks respectively based on the aforementioned N sample sets in the multi-complexity GAN network module.
  • the above multi-complexity GAN network module includes P neural networks, and the neural network training device can determine Q neural networks from the P neural networks for training. Further, the neural network training device determines Q neural networks from the P neural networks for training according to the degree of degradation corresponding to the N sample sets, where P is greater than Q, and P is a positive integer.
  • the neural network training device may respectively input the above N sample sets into the Q neural network to train the neural network, and obtain Q neural networks after training.
  • the above Q neural networks may be the same, different or partly the same.
  • the same neural network refers to a neural network with the same complexity and input resolution.
  • the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to At least one first image, M and N are both positive integers; and each degradation degree is used to perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each The second images respectively correspond to a first image, and then, based on the above-mentioned first image and second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets, and finally, based on the above-mentioned N sample sets, respectively Q neural networks are trained, a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters.
  • Image enhancement processing effect can be used to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation).
  • the process of the above step 101 may include the following steps 101a and 101b:
  • Step 101a From the X parameter ranges, determine N target parameter ranges corresponding to the above M environmental parameters.
  • each parameter range corresponds to a degree of degradation
  • a target parameter range corresponds to at least one environmental parameter
  • Step 101b Determine the degradation degree corresponding to the i-th target parameter range among the N target parameter ranges as the i-th degradation degree.
  • the above i-th target parameter range is: according to the order of the corresponding degradation degree from small to large, the i-th target parameter range after sorting the above-mentioned N target parameter ranges, i is a positive integer; the above-mentioned i-th target The environment parameter corresponding to the parameter range is smaller than the environment parameter corresponding to the i+1th target parameter range.
  • the above-mentioned X parameter ranges may be preset parameter ranges, and the parameter ranges refer to the range of ISO values.
  • the X parameter ranges may include three parameter ranges with an ISO value less than 50, an ISO value greater than or equal to 50, less than 200, and an ISO value greater than or equal to 200.
  • the greater the environmental parameter corresponding to the image the darker the shooting scene corresponding to the image is, and the greater the degradation degree of the captured image is. Therefore, the image needs to be degraded to a greater extent to obtain a training data set that can better simulate the real shooting scene. That is, the greater the environmental parameter (ISO value) in the parameter range of the environmental parameter of the first image is, the greater the ISO value of the first image is, and the corresponding degradation degree of the first image is higher.
  • ISO value environmental parameter
  • each of the M first images includes at least one human face element.
  • the neural network training method provided in the embodiment of the present application further includes the following steps A1 and B1:
  • Step A1 Obtain R area size parameters corresponding to the human face elements in the above M first images.
  • each area size parameter is respectively: a size parameter of the area where the face element in the first image is located, R is a positive integer, and R is greater than or equal to M.
  • Step B1 Determine the aforementioned Q neural networks according to the aforementioned M environmental parameters and the aforementioned R area size parameters.
  • a neural network corresponds to: at least one environment parameter and at least one area size parameter.
  • one first image may include one or more human face elements.
  • the image 2 is a group photo of three people, the image 2 includes three face elements, and the image 2 corresponds to three area size parameters.
  • the aforementioned region size parameters may include at least one of the following: length, width, and area.
  • the neural network training device may obtain the region size parameters corresponding to at least one face element in each of the above M first images to obtain R region size parameters, wherein each first The image may correspond to one or more of the above R area size parameters.
  • the neural network training device may respectively determine corresponding environmental parameter levels and area size levels according to the aforementioned M environmental parameters and the aforementioned R area size parameters.
  • the aforementioned environmental parameter level may include a low ISO scene and a high ISO scene
  • the aforementioned area size level may include a large area and a small area.
  • the position information of the face in the first image can be acquired through a face detection algorithm.
  • the above-mentioned ISO and face size information processing module can be used to determine the face area flag information.
  • the face area flag is used to characterize the size of the area of the face element, for example, the face area flag is a large area flag (that is, bigFace_flag), or the face area flag is a small area flag ( That is, smallFace_flag).
  • the size relationship between the area of the face element of the first image and the area threshold (that is, area_threshold) can be judged, if face_area is greater than area_threshold, set the large area flag (or large area sign) to 1, and if face_area is smaller than area_threshold, set the small area flag to 1.
  • the above-mentioned area threshold is a multi-stage area threshold set in advance, and the specific area threshold can be determined by collecting user photo data.
  • the neural network training device can identify the flag information of the face area in the ISO and face size information processing module, and then determine the level of the size of the face area based on the identified flag information. For example, if it is recognized that bigFace_flag is 1, it is determined that the face element is a face element with a large area.
  • the neural network training apparatus may determine the ISO flag bit by comparing the environmental parameter (ie, the ISO value) of the first image with the ISO threshold. For example, if the ISO value is greater than ISO_threshold, set the high ISO flag bit (or high ISO sign bit) to 1, and if the ISO value is smaller than ISO_threshold, set the low ISO flag bit to 1.
  • the environmental parameter ie, the ISO value
  • the neural network training device can identify the ISO flag information in the ISO and face size information processing module, and then determine the ISO level based on the identified flag information. For example, if it is recognized that highISO_flag is equal to 1, it is determined that the first image corresponds to a low ISO value, that is, a low ISO scene.
  • Figure 4 is a schematic diagram of ISO and face size information processing.
  • the neural network training device may determine the neural network corresponding to each sample set according to the identified flag information of the face area corresponding to each sample set and the ISO flag information.
  • the neural network device can identify the N sample sets one by one.
  • the flag bit information of the face area of the first image in a certain sample set is recognized to indicate a large-area face element (that is, bigFace_flag is equal to 1)
  • the neural network training device inputs the sample set into the neural network of the first complexity (ie high complexity), and trains the neural network of the first complexity to obtain the trained neural network;
  • the flag bit information of the face area of the first image in this set indicates a small-area face element (that is, smallFace_flag is equal to 1)
  • the sample set is input into a low-complexity neural network for training.
  • the target parameter corresponding to the neural network with high complexity is greater than the target parameter corresponding to the neural network with small complexity
  • the above target parameters include: environment parameters and area size parameters.
  • the aforementioned neural network with high complexity refers to a neural network with relatively high time complexity and/or space complexity. Further, the complexity of the neural network can be reflected in the depth and breadth of the neural network.
  • FIG. 5 is a schematic diagram of a multi-complexity GAN network process.
  • the ISO value of image 1 corresponds to a low ISO scene
  • it is input into a simple GAN network for training to obtain the low ISO value of the scene.
  • the image to be processed has a trained neural network with better processing effect; assuming that the ISO value of image 1 corresponds to a high ISO scene, it is input into a complex GAN network for training to obtain an image to be processed that corresponds to a high ISO scene.
  • each sample set corresponds to at least two neural networks.
  • step B1 may include the following step C1:
  • Step C1 Determine the first neural network according to the first environment parameter and the first area size parameter
  • the above-mentioned first environmental parameter is: among the above-mentioned N sample sets, among the environmental parameters of the first image in any one of the sample sets;
  • the above-mentioned first area size parameter is: the area size corresponding to the first image in any of the above-mentioned sample sets in the parameter.
  • the above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
  • the first image in the aforementioned one sample set corresponds to a degree of degradation
  • the degree of degradation may correspond to a neural network
  • each sample set is a high-definition-low-definition image pair
  • the low-definition image in each sample set is a degraded image of the high-definition image.
  • the area size parameters (that is, the face area) of the face elements in the first image in a sample set are not the same, for example, there are large-area face elements and small-area face elements in the sample set.
  • a neural network with a larger input resolution and higher complexity can be selected for the first image including a large-area face element, and the first image selection for a face element including a small area Feed a neural network with a smaller resolution and lower complexity for training. In this way, the training efficiency can be improved while achieving a better training effect.
  • FIG. 6 shows a flow chart of the image processing method provided by the embodiment of the present application.
  • the neural network training method provided by the embodiment of the present application may include the following steps 201 and 202:
  • Step 201 In the case of displaying the preview image collected by the camera of the above-mentioned electronic device, according to the target environment parameters of the above-mentioned preview image, and the target area size parameters corresponding to the face elements in the above-mentioned preview image, from the Q neural networks after training , determine the target neural network.
  • the above-mentioned target environment parameters include at least one of the following: ISO value and brightness value; the above-mentioned target area size parameters include at least one of the following: width, height, and area.
  • the current ISO value of the camera may be obtained, and the current ISO value of the camera may be determined as the ISO value of the preview image, and the face of the face element in the preview image may be obtained area information.
  • the image processing device may determine whether the current shooting scene is a high ISO scene or a low ISO scene based on the obtained ISO value, and determine whether the face element to be processed is a large area or a small area based on the obtained face area information. area.
  • the above-mentioned target neural network is a trained adversarial neural network that matches the above-mentioned target environment parameters and target area size parameters.
  • the above-mentioned target neural network is used to perform image enhancement processing on the images captured by the camera.
  • Step 202 Input the third image captured by the above-mentioned camera into the above-mentioned target neural network for image processing to obtain a processed image.
  • the above-mentioned third image is: an image captured by the camera within a predetermined time period
  • the above-mentioned predetermined time period is a time period between the time when the camera collects the preview image and the time when the camera stops collecting the preview image.
  • the above-mentioned third image may be an image including human face elements.
  • the above image processing may be image enhancement processing, for example, performing enhancement processing on the human face area in the image by means of denoising, removing blur, increasing brightness, increasing contrast, and the like.
  • the image processing device can display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image, and the size of the target area corresponding to the face elements in the preview image parameters, and determine the target neural network from the Q neural networks after training.
  • the image processing device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters when the image is captured and the size of the human face in the captured image, thereby greatly Improves the effect and performance of face enhancement on captured images.
  • the image processing method provided in the embodiment of the present application also includes the following step D1:
  • Step D1 In the case that the above-mentioned preview image contains human face elements, obtain target environment parameters and target area size parameters corresponding to the human face elements.
  • the process of obtaining the target neural network may include the following steps 201a:
  • Step 201a Based on the pre-stored Q correspondences, determine the above-mentioned target neural network corresponding to the above-mentioned target environment parameters and the above-mentioned target area size parameters.
  • each corresponding relationship is respectively: a corresponding relationship between at least one environment parameter, at least one region size parameter and a trained neural network.
  • each of the above correspondences is respectively: a correspondence between an environment parameter level, an area size level and a trained neural network.
  • the above corresponding relationship may be established when a trained neural network is obtained after the training of a neural network is completed.
  • the trained neural network A corresponds to a low-ISO scene
  • the trained neural network B corresponds to a high-ISO scene.
  • the above-mentioned target neural network can be neural network A.
  • the trained neural network C corresponds to a large-area face element
  • the trained neural network D corresponds to a small-area face element.
  • the above-mentioned target neural network can be neural network network C.
  • the neural network training method provided in the embodiment of the present application may be executed by a neural network training device, or a control module in the neural network training device for executing the neural network training method.
  • the neural network training device provided by the embodiment of the present application is described by taking the neural network training method executed by the neural network training device as an example.
  • the embodiment of the present application provides a neural network training device 600, as shown in Figure 7, the device includes: a determination module 601, a processing module 602, a generation module 603 and a training module 604, wherein:
  • the above determination module 601 is configured to determine N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image, M, N are positive integers; the processing module 602 is configured to perform degradation processing on the first image corresponding to each degradation degree based on each degradation degree determined by the determination module 601 to obtain the second image corresponding to each degradation degree.
  • each second image corresponds to a first image
  • the generation module 603 is used to generate a sample set based on the first image and the second image corresponding to each degree of degradation obtained by the processing module 602, and obtain N sample sets
  • the training module 604 is used to train Q neural networks based on the above N sample sets obtained by the generating module 603, one sample set corresponds to at least one neural network, and Q is a positive integer.
  • the determination module 601 is specifically configured to determine N target parameter ranges corresponding to the above M environmental parameters from the X parameter ranges, and each parameter range corresponds to a degradation degree , one target parameter range corresponds to at least one environmental parameter; the determination module 601 is specifically configured to determine the degradation degree corresponding to the i-th target parameter range in the above-mentioned N target parameter ranges as the i-th degradation degree; wherein, the above-mentioned The i-th target parameter range is: the i-th target parameter range after sorting the above N target parameter ranges according to the order of the corresponding degradation degree from small to large, where i is a positive integer; the above-mentioned i-th target parameter range corresponds to The environmental parameter of is smaller than the environmental parameter corresponding to the i+1th target parameter range.
  • each of the M first images includes at least one human face element
  • the above device also includes: an acquisition module 605;
  • the acquisition module 605 is configured to acquire R area size parameters corresponding to the face elements in the M first images, and each area size parameter is: the area where the face elements in the first image are located. Size parameter, R is a positive integer, and R is greater than or equal to M; the above determination module 601 is also used to determine the above Q neural networks according to the M environmental parameters obtained by the above acquisition module 605 and the above R area size parameters; wherein, one The neural network corresponds to: at least one environment parameter and at least one region size parameter.
  • the target parameters corresponding to the neural networks with high complexity are greater than the target parameters corresponding to the neural networks with small complexity; wherein, the above-mentioned target parameters include: environmental parameters and area size parameters.
  • each sample set corresponds to at least one neural network
  • the above determination module 601 is specifically configured to determine the first neural network according to the first environment parameter and the first area size parameter; wherein, the above first environment parameter is: the first image in any one of the N sample sets mentioned above Among the environmental parameters; the above-mentioned first area size parameter is: among the area size parameters corresponding to the first image in any of the above-mentioned sample sets;
  • the above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
  • the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to At least one first image, M and N are both positive integers; and each degradation degree is used to perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each The second images respectively correspond to a first image, and then, based on the above-mentioned first image and second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets, and finally, based on the above-mentioned N sample sets, respectively Q neural networks are trained, a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters.
  • Image enhancement processing effect can be used to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation).
  • the image processing method provided in the embodiment of the present application may be executed by an image processing device, or a control module in the image processing device for executing the image processing method.
  • the image processing device executed by the image processing device is taken as an example to describe the image processing device provided in the embodiment of the present application.
  • the embodiment of the present application provides an image processing device 700.
  • the device includes Q neural networks trained by the above neural network training method, and Q is a positive integer;
  • the device includes: a determination module 701 and a processing module 702, of which:
  • the above-mentioned determination module 701 is used for displaying the preview image collected by the camera of the electronic device, according to the target environment parameters of the preview image, and the target area size parameters corresponding to the face elements in the preview image, from the Q neurons after training In the network, determine the target neural network;
  • the processing module 702 is configured to input the third image captured by the camera into the target neural network determined by the determination module 701 for image processing to obtain a processed image.
  • the third image is: an image captured by the camera within a predetermined period of time.
  • the predetermined time period is: the time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
  • the device 700 further includes an acquisition module 703, the above-mentioned acquisition module 703 is used to acquire the target environment parameters corresponding to the face element when the above-mentioned preview image contains a face element Target area size parameter.
  • the above-mentioned determination module 701 is specifically configured to determine the target neural network corresponding to the above-mentioned target environment parameters and the above-mentioned target area size parameters based on the pre-stored Q correspondences; wherein, each corresponding The relationships are respectively: a corresponding relationship between at least one environment parameter, at least one area size parameter and a trained neural network.
  • the image processing device can display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image, and the size of the target area corresponding to the human face element in the preview image parameters, and determine the target neural network from the Q neural networks after training.
  • the image processing device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters when the image is captured and the size of the human face in the captured image, thereby greatly Improves the effect and performance of face enhancement on captured images.
  • the neural network training device and the image processing device in the embodiments of the present application may be devices, or components, integrated circuits, or chips in a terminal.
  • the device may be a mobile electronic device or a non-mobile electronic device.
  • the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant).
  • non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
  • Network Attached Storage NAS
  • personal computer personal computer, PC
  • television television
  • teller machine or self-service machine etc.
  • the neural network training device and the image processing device in the embodiment of the present application may be devices with an operating system.
  • the operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
  • the neural network training device provided by the embodiment of the present application can realize various processes realized by the method embodiments in FIG. 1 to FIG. 5 , and details are not repeated here to avoid repetition.
  • the image processing apparatus provided in the embodiment of the present application can implement various processes implemented by the method embodiments in FIG. 6 and FIG. 7 , and details are not repeated here to avoid repetition.
  • the embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and programs or instructions stored in the memory 802 and operable on the processor 801.
  • the programs or instructions are executed by the processor 801
  • the various processes of the above-mentioned neural network training method or the above-mentioned image processing method embodiments can be achieved, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.
  • the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
  • FIG. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
  • the electronic device 100 includes but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110, etc. part.
  • the electronic device 100 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 110 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions.
  • a power supply such as a battery
  • the structure of the electronic device shown in FIG. 10 does not constitute a limitation to the electronic device.
  • the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange different components, and details will not be repeated here. .
  • the above-mentioned processor 110 is configured to determine N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, one degradation degree corresponds to at least one first image, and M , N are both positive integers; the processor 110 is configured to perform degradation processing on the first image corresponding to each degradation degree based on each degradation degree, to obtain the second image corresponding to each degradation degree above, each The second images respectively correspond to a first image; the processor 110 is configured to generate a sample set based on the first image and the second image corresponding to each degree of degradation, and obtain N sample sets; the processor 110, It is used to train Q neural networks respectively based on the above N sample sets, one sample set corresponds to at least one neural network, and Q is a positive integer.
  • the above-mentioned processor 110 is specifically configured to determine N target parameter ranges corresponding to the above-mentioned M environmental parameters from the X parameter ranges, and each parameter range corresponds to a degradation degree , one target parameter range corresponds to at least one environmental parameter; the above-mentioned processor 110 is specifically configured to determine the degradation degree corresponding to the i-th target parameter range in the N target parameter ranges as the i-th degradation degree; wherein, the above-mentioned The range of the i target parameter is: according to the order of the corresponding degradation degree from small to large, the ith target parameter range after sorting the above N target parameter ranges, i is a positive integer; the above i-th target parameter range corresponds to The environment parameter is smaller than the environment parameter corresponding to the i+1th target parameter range.
  • each of the M first images includes at least one human face element; the processor 110 is configured to obtain the human face element in the M first images Corresponding R area size parameters, each area size parameter is: a size parameter of the area where the face element in the first image is located, R is a positive integer, and R is greater than or equal to M; the processor 110 also It is used to determine the aforementioned Q neural networks according to the aforementioned M environmental parameters and the aforementioned R area size parameters; wherein, one neural network corresponds to: at least one environmental parameter and at least one area size parameter.
  • the target parameters corresponding to the neural networks with high complexity are greater than the target parameters corresponding to the neural networks with small complexity; wherein, the above-mentioned target parameters include: environmental parameters and area size parameters.
  • each sample set corresponds to at least one neural network
  • the above-mentioned processor 110 is specifically configured to determine the first neural network according to the first environment parameter and the first area size parameter; wherein, the above-mentioned first environment parameter is: the first image in any one of the above-mentioned N sample sets Among the environmental parameters; the above-mentioned first area size parameter is: among the area size parameters corresponding to the first image in any of the above-mentioned sample sets;
  • the above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
  • the electronic device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one of the first images.
  • An image where M and N are both positive integers; and using each degree of degradation, degrade the first image corresponding to each degree of degradation to obtain a second image corresponding to each degree of degradation, and each second image is respectively Corresponding to a first image, then, based on the above-mentioned first image and second image corresponding to each degree of degradation, generate a sample set respectively, and obtain N sample sets, and finally, based on the above-mentioned N sample sets, Q nerves
  • the network is trained, a sample set corresponds to at least one neural network, and Q is a positive integer.
  • the electronic device can degrade the first image under different environmental parameters corresponding to the degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image (that is, the second image) after the first image is degraded differently. , so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters, and improve the accuracy of the image. Enhanced processing.
  • the above-mentioned processor 110 is configured to, in the case of displaying a preview image collected by a camera of an electronic device, according to the target environment parameters of the preview image and the target area size parameters corresponding to the face elements in the preview image, from the trained Q In the first neural network, the target neural network is determined; the third image taken by the camera is input to the target neural network determined by the determination module 701 for image processing, and the processed image is obtained.
  • the above-mentioned third image is: the camera shoots within a predetermined time period
  • the predetermined time period is the time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
  • the processor 110 is configured to acquire target environment parameters and target area size parameters corresponding to the face elements when the preview image contains face elements.
  • the above-mentioned processor 110 is specifically configured to determine the target neural network corresponding to the target environment parameter and the target area size parameter based on the pre-stored Q correspondences; wherein, each correspondence is respectively is: a corresponding relationship between at least one environment parameter, at least one region size parameter and a trained neural network.
  • the electronic device may display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image and the target area size parameters corresponding to the face elements in the preview image, A target neural network is determined from the Q neural networks after training.
  • the electronic device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters and the size of the human face in the captured image, thereby greatly improving Effects and performance of face enhancements on captured images.
  • the input unit 104 may include a graphics processing unit (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processing unit 1041 is used by the image capturing device (such as the image data of the still picture or video obtained by the camera) for processing.
  • the display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the user input unit 107 includes a touch panel 1071 and other input devices 1072 .
  • the touch panel 1071 is also called a touch screen.
  • the touch panel 1071 may include two parts, a touch detection device and a touch controller.
  • Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which will not be repeated here.
  • Memory 109 may be used to store software programs as well as various data, including but not limited to application programs and operating systems.
  • the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces, and application programs, and the modem processor mainly processes wireless communications. It can be understood that the foregoing modem processor may not be integrated into the processor 110 .
  • the embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, each process of the above-mentioned neural network training method embodiment is realized, or the above-mentioned image
  • a readable storage medium on which a program or instruction is stored, and when the program or instruction is executed by a processor, each process of the above-mentioned neural network training method embodiment is realized, or the above-mentioned image
  • the processor is the processor in the electronic device described in the above embodiments.
  • the readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
  • the embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above-mentioned embodiment of the neural network training method
  • the chip includes a processor and a communication interface
  • the communication interface is coupled to the processor
  • the processor is used to run programs or instructions to implement the above-mentioned embodiment of the neural network training method
  • chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
  • the embodiment of the present application provides a computer program product, the program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to realize the various processes of the above-mentioned neural network training method embodiment, or the above-mentioned image
  • Each process of the embodiment of the method is processed, and the same technical effect can be achieved.
  • the term “comprising”, “comprising” or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase “comprising a " does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
  • the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
  • the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation.
  • the technical solution of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in various embodiments of the present application.
  • a terminal which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Abstract

A neural network training method and apparatus, and an electronic device. The method comprises: determining N degradation degrees according to M environment parameters of M obtained first images (101), one degradation degree corresponding to at least one environment parameter, one degradation degree corresponding to at least one first image, and both M and N being positive integers; performing degradation processing on the first image corresponding to each degradation degree on the basis of each degradation degree so as to obtain a second image corresponding to each degradation degree (102), each second image corresponding to one first image; generating a sample set on the basis of the first image and the second image corresponding to each degradation degree to obtain N sample sets (103); respectively training Q neural networks on the basis of the N sample sets (104), one sample set corresponding to at least one neural network, and Q being a positive integer.

Description

神经网络训练方法、装置及电子设备Neural network training method, device and electronic equipment
相关申请的交叉引用Cross References to Related Applications
本申请主张在2021年07月23日在中国提交的中国专利申请号No.202110838140.6的优先权,其全部内容通过引用包含于此。This application claims priority to Chinese Patent Application No. 202110838140.6 filed in China on July 23, 2021, the entire contents of which are hereby incorporated by reference.
技术领域technical field
本申请属于图像处理与深度学习领域,具体涉及一种神经网络训练方法、装置及电子设备。The application belongs to the field of image processing and deep learning, and specifically relates to a neural network training method, device and electronic equipment.
背景技术Background technique
随着人工智能技术的不断发展,电子设备越来越普及,用户对电子设备(如智能终端)的拍摄质量的要求越来越高。目前提升电子设备的拍摄质量的方案主要是通过卷积神经网络学习人脸质量增强的深度网络来实现。With the continuous development of artificial intelligence technology, electronic devices are becoming more and more popular, and users have higher and higher requirements on the shooting quality of electronic devices (such as smart terminals). At present, the solution to improve the shooting quality of electronic equipment is mainly realized by learning the deep network of face quality enhancement through convolutional neural network.
在相关技术中,是通过训练集训练单一输入分辨率(如256,512)和单一图像退化的深度网络,来对拍摄的图像进行图像增强处理。采用上述图像处理方式,在一些特殊场景下,例如在低照度场景中,拍摄时进光量较小,受噪声影响较大,相较正常亮度的场景,低照度场景中拍摄的图像的质量退化的更严重(即,图像质量更低)。又例如,在拍摄群体人像时,镜头中大小不一致的各个人脸的退化程度也不同。In related technologies, a deep network with a single input resolution (such as 256, 512) and a single image degradation is trained through a training set to perform image enhancement processing on captured images. Using the above image processing method, in some special scenes, such as low-illumination scenes, the amount of light entering is small when shooting, which is greatly affected by noise. Compared with scenes with normal brightness, the quality of images captured in low-light scenes is degraded. More severe (ie, lower image quality). For another example, when shooting group portraits, the degrees of degradation of faces with inconsistent sizes in the lens are also different.
因此,如果依然采用相关技术中训练单一输入分辨率、单一数据退化的深度学习网络对拍摄的图像进行处理,会导致训练后的深度学习网络对于不同退化程度的图像无法针对性地进行增强处理,从而导致难以取得显性的人脸质量增强效果,进而导致对图像的处理效果较差。Therefore, if a deep learning network trained with a single input resolution and single data degradation in related technologies is still used to process the captured images, it will cause the trained deep learning network to be unable to perform targeted enhancement processing on images with different degrees of degradation. As a result, it is difficult to obtain a dominant face quality enhancement effect, which in turn leads to a poor image processing effect.
发明内容Contents of the invention
本申请实施例的目的是提供一种神经网络训练方法、装置及电子设备,能够解决相关技术中的深度学习网络对图像的处理效果差的技术问题。The purpose of the embodiment of the present application is to provide a neural network training method, device and electronic equipment, which can solve the technical problem of poor image processing effect of the deep learning network in the related art.
为了解决上述技术问题,本申请是这样实现的:In order to solve the above-mentioned technical problems, the application is implemented as follows:
第一方面,本申请实施例提供了一种神经网络训练方法,该方法包括:根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;基于每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;基于每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;基于N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。In the first aspect, the embodiment of the present application provides a neural network training method, the method includes: determining N degradation degrees according to the acquired M environmental parameters of the M first images, and one degradation degree corresponds to at least one environmental parameter, A degree of degradation corresponds to at least one first image, and M and N are both positive integers; based on each degree of degradation, the first image corresponding to each degree of degradation is degraded to obtain a second image corresponding to each degree of degradation , each second image corresponds to a first image; based on the first image and the second image corresponding to each degree of degradation, a sample set is generated respectively, and N sample sets are obtained; based on N sample sets, Q The neural network is trained, and a sample set corresponds to at least one neural network, and Q is a positive integer.
第二方面,本申请实施例提供了一种神经网络训练装置,该装置包括:所述装置包括:确定模块、处理模块、生成模块和训练模块,其中:确定模块,用于根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;上述处理模块,用于基于确定模块确定的每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;上述生成模块,用于基于处理模块得到的每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;上述训练模块,用于基于生成模块得到的N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。In the second aspect, the embodiment of the present application provides a neural network training device, which includes: the device includes: a determination module, a processing module, a generation module and a training module, wherein: the determination module is used to The M environmental parameters of the first image determine N degradation degrees, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image, M and N are both positive integers; the above processing module is used to For each degradation degree determined by the determination module, perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each second image corresponds to a first image respectively; the above-mentioned generation module , used to generate a sample set based on the first image and the second image corresponding to each degree of degradation obtained by the processing module to obtain N sample sets; the above training module is used to obtain N sample sets based on the generation module, Q neural networks are trained respectively, a sample set corresponds to at least one neural network, and Q is a positive integer.
第三方面,本申请实施例提供了一种电子设备,该电子设备包括处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如第一方面所述的方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, the electronic device includes a processor, a memory, and a program or instruction stored in the memory and operable on the processor, and the program or instruction is The processor implements the steps of the method described in the first aspect when executed.
第四方面,本申请实施例提供了一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如第一方面所述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or an instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented .
第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所述的方法。In the fifth aspect, the embodiment of the present application provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions, so as to implement the first aspect the method described.
第六方面,本申请实施例提供一种计算机程序产品,该程序产品被存储在非易失的存储介质中,该程序产品被至少一个处理器执行以实现如第一方面所述的方法。In a sixth aspect, an embodiment of the present application provides a computer program product, the program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to implement the method described in the first aspect.
在本申请实施例中,神经网络训练装置根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;并基于每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像,然后,基于上述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集,最后,基于上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。通过该方法,神经网络训练装置可以对不同环境参数下的第一图像进行相应的退化程度(即有差异)的退化,以得到第一图像在有差异地退化后对应的退化图像(即第二图像),从而构建出符合多种环境参数下的拍摄质量的(即不同退化程度)的训练样本集,进而可以得到适用于对不同环境参数下的拍摄图像进行针对性处理的神经网络,提高对图像的增强处理效果。In the embodiment of the present application, the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image , M and N are both positive integers; and based on each degree of degradation, degrade the first image corresponding to each degree of degradation to obtain the second image corresponding to each degree of degradation, and each second image corresponds to a The first image, then, based on the first image and the second image corresponding to each degree of degradation above, generate a sample set respectively to obtain N sample sets, and finally, based on the above N sample sets, respectively perform Q neural networks For training, a sample set corresponds to at least one neural network, and Q is a positive integer. Through this method, the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters. Image enhancement processing effect.
附图说明Description of drawings
图1是本申请实施例提供的一种神经网络训练方法的流程图;Fig. 1 is the flowchart of a kind of neural network training method provided by the embodiment of the present application;
图2是本申请实施例提供的一种多强度退化模块进行处理的流程示意图;Fig. 2 is a schematic flow chart of processing by a multi-intensity degradation module provided in an embodiment of the present application;
图3是本申请实施例提供的一种低清-高清训练集构建示意图;Fig. 3 is a schematic diagram of constructing a low-definition-high-definition training set provided by the embodiment of the present application;
图4是本申请实施例提供的一种ISO与人脸大小信息处理示意图;Fig. 4 is a schematic diagram of ISO and face size information processing provided by the embodiment of the present application;
图5是本申请实施例提供的一种多复杂度GAN网络流程示意图;FIG. 5 is a schematic diagram of a multi-complexity GAN network flow provided by an embodiment of the present application;
图6是本申请实施例提供的一种图像处理方法的流程图;FIG. 6 is a flow chart of an image processing method provided by an embodiment of the present application;
图7是本申请实施例提供的一种神经网络训练装置的结构示意图;Fig. 7 is a schematic structural diagram of a neural network training device provided by an embodiment of the present application;
图8是本申请实施例提供的一种图像处理装置的结构示意图;FIG. 8 is a schematic structural diagram of an image processing device provided in an embodiment of the present application;
图9是本申请实施例提供的一种电子设备的硬件结构示意图之一;FIG. 9 is one of the schematic diagrams of the hardware structure of an electronic device provided in the embodiment of the present application;
图10是本申请实施例提供的一种电子设备的硬件结构示意图之二。FIG. 10 is a second schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施,且“第一”、“第二”等所区分的对象通常为一类,并不限定对象的个数,例如第一对象可以是一个,也可以是多个。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific sequence or sequence. It should be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application can be practiced in sequences other than those illustrated or described herein, and that references to "first," "second," etc. distinguish Objects are generally of one type, and the number of objects is not limited. For example, there may be one or more first objects. In addition, "and/or" in the specification and claims means at least one of the connected objects, and the character "/" generally means that the related objects are an "or" relationship.
下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的神经网络训练方法进行详细地说明。The neural network training method provided by the embodiment of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.
本申请实施例提供了一种神经网络训练方法,该神经网络训练方法可以应用于电子设备,图1示出了本申请实施例提供的神经网络训练方法的流程图。如图1所示,本申请实施例提供的神经网络训练方法可以包括如下步骤101至步骤104:An embodiment of the present application provides a neural network training method, which can be applied to electronic devices. FIG. 1 shows a flowchart of the neural network training method provided in the embodiment of the present application. As shown in Figure 1, the neural network training method provided by the embodiment of the present application may include the following steps 101 to 104:
步骤101:根据获取的M张第一图像的M个环境参数,确定N个退化程度。Step 101: Determine N degradation degrees according to the acquired M environmental parameters of the M first images.
其中,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数。Wherein, one degree of degradation corresponds to at least one environmental parameter, one degree of degradation corresponds to at least one first image, and both M and N are positive integers.
可选地,在本申请实施例中,上述神经网络训练方法可以为人脸增强GAN网络(faceEnhanceGAN)训练方法,由于人脸增强GAN网络(faceEnhanceGAN)训练方法是一种有监督的AI训练方法,需要成对的图像对(即,低清图-高清图)构成训练数据集。但是由于像素无法对齐等因素,无法直接拍摄得到一一对应的低清-高清图像对。因此,可以通过对获取到的高清图片(如单反拍摄的高清图)进行多种退化处理(如,模糊,加噪声等处理)来获取低清图片,以得到低清-高清图像对,即LQ-HQ数据集。Optionally, in the embodiment of the present application, the above-mentioned neural network training method can be a faceEnhanceGAN network (faceEnhanceGAN) training method, since the faceEnhanceGAN network (faceEnhanceGAN) training method is a supervised AI training method, it needs Paired image pairs (ie, low-resolution images-high-resolution images) constitute the training dataset. However, due to factors such as inability to align pixels, it is impossible to directly capture a one-to-one corresponding low-definition-high-definition image pair. Therefore, low-definition pictures can be obtained by performing various degradation processes (such as blurring, adding noise, etc.) on the acquired high-definition pictures (such as high-definition pictures taken by SLR) to obtain low-definition-high-definition image pairs, namely LQ -HQ dataset.
在本申请实施例中,上述第一图像可以为高清图片。示例性的,上述第一图像可以为通过高质量成像设备(如单反相机)的摄像头拍摄得到的高清图片,或者,上述第一图像 可以为对低质量图像进行图像增强后得到的高清图片。In this embodiment of the present application, the above-mentioned first image may be a high-definition picture. Exemplarily, the above-mentioned first image may be a high-definition picture captured by a camera of a high-quality imaging device (such as a single-lens reflex camera), or the above-mentioned first image may be a high-definition picture obtained by performing image enhancement on a low-quality image.
需要说明的是,图片的清晰度以及质量可以通过模糊程度和噪声来衡量,上述高清图片指的是模糊程度以及噪声较小的图片。It should be noted that the clarity and quality of a picture can be measured by the degree of blur and noise, and the above-mentioned high-definition picture refers to a picture with less blur and less noise.
示例性的,神经网络训练装置在获取到上述M张第一图像的情况下,可以将每张第一图像和该第一图像对应的环境参数保存在数据库中,当需要使用时神经网络训练装置可以从数据库中调用该M张第一图像。Exemplarily, when the neural network training device acquires the above-mentioned M first images, each first image and the environmental parameters corresponding to the first images can be stored in the database, and the neural network training device can be used when necessary The M first images can be called from the database.
可选地,在本申请实施例中,上述环境参数可以包括以下至少一项:感光度ISO值,亮度。Optionally, in the embodiment of the present application, the foregoing environmental parameters may include at least one of the following: ISO value of sensitivity and brightness.
需要说明的是,感光度是指用数字表示对光线的敏感度,当ISO值越高,表示对光线的敏感度越强,反之则越弱。It should be noted that the sensitivity refers to the sensitivity to light expressed by numbers. The higher the ISO value, the stronger the sensitivity to light, and vice versa.
可选地,在本申请实施例中,可以通过将M张第一图像输入到ISO与人脸大小信息处理模块进行处理后,获取到M张第一图像的M个环境参数。Optionally, in the embodiment of the present application, the M environmental parameters of the M first images may be obtained by inputting the M first images to the ISO and face size information processing module for processing.
示例性的,神经网络训练装置可以根据第一图像的环境参数和第一阈值的大小关系,确定第一图像的退化程度。进一步地,上述第一阈值为ISO阈值,具体可以为ISO的大小。例如,当图像1的ISO值大于第一阈值时,该图像1对应第一退化程度(即,较高的退化程度)。Exemplarily, the neural network training apparatus may determine the degree of degradation of the first image according to the magnitude relationship between the environmental parameters of the first image and the first threshold. Further, the above-mentioned first threshold is an ISO threshold, which may specifically be the size of the ISO. For example, when the ISO value of image 1 is greater than the first threshold, the image 1 corresponds to a first degree of degradation (ie, a higher degree of degradation).
进一步地,可以通过采集用户的拍照数据和分析场景黑暗程度,来合理设定多阶段的ISO阈值(ISO_threshold)。Furthermore, the multi-stage ISO threshold (ISO_threshold) can be reasonably set by collecting the user's photo data and analyzing the darkness of the scene.
需要说明的是,上述环境参数(即ISO)可以称为先验信息,上述ISO与人脸大小信息处理模块为获取该先验信息的预处理模块。It should be noted that the aforementioned environmental parameters (namely ISO) may be referred to as prior information, and the aforementioned ISO and face size information processing module is a preprocessing module for obtaining the prior information.
可选地,在本申请实施例中,上述N个退化程度可以为预设的L个退化程度中的一个或者多个退化程度。示例性的,上述L个退化程度可以包括:第一退化程度和第二退化程度。进一步地,上述第一退化程度可以为高退化程度,上述第二退化程度可以为低退化程度。需要说明的是,上述退化程度具体可以根据实际情况灵活确定,例如,可以设置三个或者更多的退化程度,本申请实施例对此不做任何限定。Optionally, in this embodiment of the present application, the foregoing N degradation degrees may be one or more of the preset L degradation degrees. Exemplarily, the above L degradation degrees may include: a first degradation degree and a second degradation degree. Further, the first degree of degradation may be a high degree of degradation, and the second degree of degradation may be a low degree of degradation. It should be noted that, the above degradation degree may be flexibly determined according to actual conditions, for example, three or more degradation degrees may be set, which is not limited in this embodiment of the present application.
可选地,在本申请实施例中,上述N个退化程度分别对应N个退化模块,每个退化模块用于对第一图像进行相应的退化处理,并且每个退化模块的退化算法不同,即,每个退化模块对应的退化效果不同。Optionally, in the embodiment of the present application, the above N degradation degrees correspond to N degradation modules respectively, each degradation module is used to perform corresponding degradation processing on the first image, and the degradation algorithm of each degradation module is different, namely , each degradation module corresponds to a different degradation effect.
示例性的,上述N个退化模块可以包括:高ISO段退化模块和低ISO段退化模块。进一步地,高ISO段退化模块可以对应上述第一退化程度,低ISO段退化模块可以对应上述第二退化程度。Exemplarily, the above N degradation modules may include: a high ISO segment degradation module and a low ISO segment degradation module. Further, the high ISO segment degradation module may correspond to the above-mentioned first degradation degree, and the low ISO segment degradation module may correspond to the above-mentioned second degradation degree.
需要说明的是,上述N个退化模块还可以根据实际需求细化为更多ISO段的退化模块,本申请实施例对此不做任何限定。It should be noted that the above N degradation modules may also be refined into degradation modules of more ISO segments according to actual requirements, which is not limited in this embodiment of the present application.
需要说明的是,高ISO段退化模块用于处理ISO值较大的第一图像,其退化程度较高,低ISO段退化模块用于处理ISO值较大的第一图像,其退化程度较低。It should be noted that the high ISO segment degradation module is used to process the first image with a large ISO value, and its degradation degree is relatively high, and the low ISO segment degradation module is used to process the first image with a large ISO value, and its degradation degree is low .
示例性的,神经网络训练装置可以根据M张第一图像中的每张第一图像的环境参数,确定与该环境参数对应的退化程度,以确定每张第一图像的退化程度。例如,以ISO值低于50为低感光度,对应第一退化程度(如,低退化程度)为例,若图像1的ISO值为45,则该图像1对应的退化程度为第一退化程度,即,该图像1对应低退化程度。Exemplarily, the neural network training device may determine the degree of degradation corresponding to the environment parameter according to the environment parameter of each first image in the M first images, so as to determine the degree of degradation of each first image. For example, taking an ISO value lower than 50 as a low sensitivity and corresponding to the first degree of degradation (for example, a low degree of degradation) as an example, if the ISO value of image 1 is 45, then the degree of degradation corresponding to image 1 is the first degree of degradation , that is, the image 1 corresponds to a low degree of degradation.
步骤102:基于每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像。Step 102: Based on each degree of degradation, perform degradation processing on the first image corresponding to each degree of degradation to obtain a second image corresponding to each degree of degradation.
其中,每个第二图像分别对应一个第一图像。Wherein, each second image corresponds to a first image.
在本申请实施例中,神经网络训练装置可以采用每个退化程度对应的退化模块,对每个退化程度对应的第一图像进行质量退化处理,得到第一图像对应的低质量图像或者低清图像(即,上述第二图像)。In the embodiment of the present application, the neural network training device may use a degradation module corresponding to each degradation degree to perform quality degradation processing on the first image corresponding to each degradation degree to obtain a low-quality image or a low-resolution image corresponding to the first image (i.e., the second image above).
可选地,在本申请实施例中,神经网络训练装置可以通过多强度数据退化模块,根据第一图像对应的退化程度确定相应的不同强度的数据退化模块,对第一图像进行相应的质量退化处理。Optionally, in the embodiment of the present application, the neural network training device can use the multi-intensity data degradation module to determine corresponding data degradation modules of different intensities according to the degree of degradation corresponding to the first image, and perform corresponding quality degradation on the first image deal with.
示例性的,神经网络训练装置可以通过上述ISO与人脸大小信息处理模块,确定ISO标志位信息,然后通过上述多强度数据退化模块,基于ISO标志位信息确定相应的退化模块。进一步地,上述ISO标志位用于表征ISO的高低,例如,ISO标志位为高标志位(即highISO_flag),或者,ISO标志位为低标志位(即lowISO_flag)。Exemplarily, the neural network training device can determine the ISO flag bit information through the above-mentioned ISO and face size information processing module, and then determine the corresponding degradation module based on the ISO flag bit information through the above-mentioned multi-intensity data degradation module. Further, the above ISO flag is used to indicate the level of ISO, for example, the ISO flag is a high flag (ie highISO_flag), or the ISO flag is a low flag (ie lowISO_flag).
进一步地,在通过上述ISO与人脸大小信息处理模块,确定ISO标志位信息时,可以判断第一图像的ISO值与上述ISO阈值(即,ISO_threshold)的大小关系,若ISO值大于ISO_threshold,则将高ISO标志位(或者高ISO符号位)置为1,若ISO值小于ISO_threshold,则将低ISO标志位置为1。Further, when the ISO flag bit information is determined by the above-mentioned ISO and face size information processing module, the size relationship between the ISO value of the first image and the above-mentioned ISO threshold (ie, ISO_threshold) can be judged, if the ISO value is greater than ISO_threshold, then Set the high ISO flag bit (or high ISO sign bit) to 1, and if the ISO value is less than ISO_threshold, set the low ISO flag bit to 1.
进一步地,在通过上述多强度数据退化模块,基于ISO标志位信息确定相应的退化模块时,可以识别ISO与人脸大小信息处理模块中的ISO标志位信息,然后基于识别到的标志位信息,确定相应的退化模块。Further, when the corresponding degradation module is determined based on the ISO flag bit information through the above multi-intensity data degradation module, the ISO flag bit information in the ISO and face size information processing module can be identified, and then based on the identified flag bit information, Determine the corresponding degenerate modules.
示例1,在将多张高清图像输入至ISO与人脸大小信息处理模块以及多强度数据退化模块后,如果从该ISO与人脸大小信息处理模块中识别到高ISO标志位highISO_flag等于1,则说明进入的是高ISO段,这时进入高ISO段退化模块,通过该退化模块可以在退化过程中对该图像(即待退化图像)加入强度更大的多类型噪声,并且加入多种强度更大的模型操作,比如,三角模型、高斯模型、线性模型、运动模糊等模糊函数的模糊程度全部加大。另外,对输入的高清图进行随机压暗处理以模拟暗光下的图片亮度。Example 1, after inputting multiple high-definition images to the ISO and face size information processing module and the multi-intensity data degradation module, if the high ISO flag highISO_flag is recognized to be equal to 1 from the ISO and face size information processing module, then It indicates that the high ISO segment is entered, and at this time, the high ISO segment degradation module is entered, through which the image (that is, the image to be degraded) can be added with multiple types of noise with greater intensity during the degradation process, and multiple types of noise with higher intensity can be added. Large model operations, such as triangular models, Gaussian models, linear models, motion blur and other fuzzy functions, all increase the fuzziness. In addition, the input high-definition image is randomly darkened to simulate the brightness of the image under dark light.
示例2,在将多张高清图像输入至ISO与人脸大小信息处理模块以及多强度数据退化模块后,如果从该ISO与人脸大小信息处理模块中识别到低ISO标志位lowISO_flag等于1,则说明进入的是低ISO段,这时进入低ISO段退化模块,通过该退化模块可以对该图像加入强度较小的噪声,以及加入较少类型的模糊函数进行较轻程度的模糊处理。Example 2, after inputting multiple high-definition images to the ISO and face size information processing module and the multi-intensity data degradation module, if the low ISO flag bit lowISO_flag is recognized as 1 from the ISO and face size information processing module, then It means that the image is entered into the low ISO segment. At this time, it enters the low ISO segment degradation module. Through this degradation module, the image can be added with less intense noise, and less types of blur functions can be added for lesser degree of blurring.
结合上述示例1和示例2的过程,图2为采用多强度退化模块进行处理的流程示意图。 如图2所示,若高清图像对应的低ISO标志位lowISO_flag等于1,则进入低ISO退化模块对该高清图像进行处理,得到对应的低清图像1;若高清图像对应的高ISO标志位highISO_flag等于1,则进入高ISO退化模块对该高清图像进行处理,得到对应的低清图像2。Combining the processes of Example 1 and Example 2 above, FIG. 2 is a schematic flow chart of processing using a multi-intensity degradation module. As shown in Figure 2, if the low ISO flag bit lowISO_flag corresponding to the high-definition image is equal to 1, enter the low ISO degradation module to process the high-definition image to obtain the corresponding low-definition image 1; if the high-ISO flag bit highISO_flag corresponding to the high-definition image If it is equal to 1, enter the high-ISO degradation module to process the high-definition image to obtain the corresponding low-definition image 2.
示例性的,上述退化处理包括但不限于以下至少一项:加噪处理、模糊处理(散焦模糊、运动模糊、高斯模糊、线性模糊)、降低/提高亮度(3D打光)、增加/减少阴影(随机阴影)、区域感知退化。Exemplarily, the above-mentioned degradation processing includes but is not limited to at least one of the following: noise addition processing, blur processing (defocus blur, motion blur, Gaussian blur, linear blur), reduce/improve brightness (3D lighting), increase/decrease Shadows (random shadows), area-aware degradation.
进一步地,在使用退化模块对第一图像进行处理时,可以加入多种模糊处理的模型,以通过多种模糊函数对第一图像进行模糊处理,例如,散焦模型、高斯模型、线性模型、运动模型等模糊函数。Further, when using the degradation module to process the first image, various blurring models can be added to blur the first image through various blurring functions, for example, defocus model, Gaussian model, linear model, Fuzzy functions such as motion models.
示例性的,上述退化程度可以包括以下至少一项:退化强度和退化模式。进一步地,上述退化强度指的处理程度的大小,例如,加入噪声的大小,模糊程度的大小;上述退化模式指的是处理方式,例如,对图像1加噪处理,对图像2模糊处理,即为两种不同的处理模式。Exemplarily, the above degradation degree may include at least one of the following: degradation intensity and degradation mode. Further, the above degradation intensity refers to the degree of processing, for example, the size of added noise, the size of the degree of blur; the above degradation mode refers to the processing method, for example, adding noise to image 1 and blurring image 2, that is There are two different processing modes.
需要说明的是,在实际的拍摄场景中,不同ISO场景拍摄得到的图片质量退化程度通常不同,高ISO场景交低ISO场景图像质量退化程度更高,得到的图像的质量更差。具体的,通过多次试验测试发现,高ISO场景下图像质量更差主要表现为:1)图像更加模糊,对焦更加不准,2)图像中的噪声更大且噪声不均匀。因此,本申请实施例通过设计多强度退化模块来对不同ISO(即高ISO和低ISO)的第一图像根据退化强度和退化模式来进行有差异的图像质量退化,从而构建数据集更好地模拟电子设备自不同ISO段下的拍摄图像质量。图3示出了低清-高清训练集构建示意图,如图3所示,图像训练装置对若干张高清图像进行上述退化处理中的一种或者多种,得到若干张质量退化图像(即,低清图像),从而得到高清-低清训练集。It should be noted that, in the actual shooting scene, the degree of image quality degradation obtained by shooting in different ISO scenes is usually different. The image quality degradation degree of high ISO scene and low ISO scene is higher, and the quality of the obtained image is worse. Specifically, through multiple experiments and tests, it is found that the worse image quality in high ISO scenes is mainly manifested in: 1) the image is more blurred and the focus is more inaccurate, 2) the noise in the image is larger and the noise is uneven. Therefore, in the embodiment of the present application, the multi-intensity degradation module is designed to perform differential image quality degradation on the first images of different ISOs (ie, high ISO and low ISO) according to the degradation intensity and degradation mode, so as to construct a better data set Simulate the image quality of electronic equipment from different ISO ranges. Fig. 3 shows a schematic diagram of low-definition-high-definition training set construction. As shown in Fig. 3, the image training device performs one or more of the above-mentioned degradation processes on several high-definition images to obtain several quality degraded images (i.e., low clear image), so as to obtain the high-definition-low-definition training set.
举例说明,以M张第一图像为100张高清图像为例。假设该100张高清图像中的40张图像的ISO值大于ISO阈值,对应第一退化程度,除该40张图像之外的60张图像的ISO值小于ISO阈值,对应第二退化程度,则将该40张图像输入至第一退化程度对应的高ISO段退化模块进行处理,将该60张图像输入至第二退化程度对应的低ISO段退化模块进行处理,以得到对应的不同退化程度的低清图像。For example, take M first images as 100 high-definition images as an example. Assuming that the ISO values of 40 images in the 100 high-definition images are greater than the ISO threshold value, corresponding to the first degree of degradation, and the ISO values of the 60 images other than the 40 images are less than the ISO threshold value, corresponding to the second degree of degradation, then the The 40 images are input to the high ISO segment degradation module corresponding to the first degradation degree for processing, and the 60 images are input to the low ISO segment degradation module corresponding to the second degradation degree for processing, so as to obtain low clear image.
步骤103:基于每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集。Step 103: Based on the first image and the second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets.
在本申请实施例中,一个退化程度对应一个样本集,N个退化程度对应N个样本集,即,上述N个样本集分别对应N个退化程度,N个样本集构成训练数据集。In the embodiment of the present application, one degree of degradation corresponds to one sample set, and N degrees of degradation correspond to N sample sets, that is, the above N sample sets respectively correspond to N degrees of degradation, and the N sample sets constitute the training data set.
可选地,在本申请实施例中,一个样本集中包括至少一张第一图像和至少一张第二图像,即每个样本集中包括至少一个低清-高清图像对,即,LQ-HQ数据集。Optionally, in this embodiment of the present application, a sample set includes at least one first image and at least one second image, that is, each sample set includes at least one low-definition-high-definition image pair, that is, LQ-HQ data set.
可选地,在本申请实施例中,一个退化程度对应一个训练数据集。示例性的,神经网 络训练装置可以将第一图像和第一图像对应的第二图像,作为训练样本图像关联保存至对应的训练数据集。Optionally, in this embodiment of the present application, one degree of degradation corresponds to one training data set. Exemplarily, the neural network training device may store the first image and the second image corresponding to the first image as training sample images in a corresponding training data set.
需要说明的是,在实际拍摄场景中,ISO值越大表明拍摄的场景越暗,而在越暗的场景中拍摄得到的图片的质量退化越严重,比如更加模糊、噪声更大等;ISO值越小表明拍摄场景越明亮,而在明亮的场景中拍摄得到的图片的质量退化程度要明显弱于高ISO的场景。基于此,在训练神经网络来对电子设备拍摄的图像进行增强处理时,从算法角度分析,如果可以更加接近地模拟出电子设备的图像信号处理(即,ISP)过程和拍摄过程中的图像质量退化模式,则可以构建出高质量的训练集,就可以训练出具备更佳的人脸增强效果的神经网络。It should be noted that in the actual shooting scene, the larger the ISO value is, the darker the scene is, and the quality of the picture taken in the darker scene is more severely degraded, such as more blurred, more noise, etc.; the ISO value The smaller the value, the brighter the shooting scene, and the quality degradation of the picture taken in a bright scene is obviously weaker than that in a high ISO scene. Based on this, when training the neural network to enhance the image captured by the electronic device, from the perspective of the algorithm, if the image signal processing (i.e., ISP) process of the electronic device and the image quality during the shooting process can be simulated more closely In the degradation mode, a high-quality training set can be constructed, and a neural network with better face enhancement effect can be trained.
步骤104:基于上述N个样本集,分别对Q个神经网络进行训练。Step 104: Based on the above N sample sets, train Q neural networks respectively.
其中,一个样本集对应至少一个神经网络,Q为正整数。Wherein, one sample set corresponds to at least one neural network, and Q is a positive integer.
在本申请实施例中,上述Q个神经网络可以包括生成对抗网络(GAN网络)。In the embodiment of the present application, the aforementioned Q neural networks may include a generative adversarial network (GAN network).
示例性的,上述Q个神经网络可以为预设的多个不同复杂度的神经网络中的神经网络。Exemplarily, the aforementioned Q neural networks may be neural networks among a plurality of preset neural networks of different complexity.
可选地,在本申请实施例中,神经网络训练装置可以在多复杂度GAN网络模块中,基于上述N个样本集,分别对Q个神经网络进行训练。示例性的,上述多复杂度GAN网络模块包括P个神经网络,神经网络训练装置可以从P个神经网络中确定Q个神经网络进行训练。进一步地,神经网络训练装置根据N个样本集对应的退化程度,从P个神经网络中确定Q个神经网络进行训练,P大于Q,P为正整数。Optionally, in the embodiment of the present application, the neural network training device may train Q neural networks respectively based on the aforementioned N sample sets in the multi-complexity GAN network module. Exemplarily, the above multi-complexity GAN network module includes P neural networks, and the neural network training device can determine Q neural networks from the P neural networks for training. Further, the neural network training device determines Q neural networks from the P neural networks for training according to the degree of degradation corresponding to the N sample sets, where P is greater than Q, and P is a positive integer.
示例性的,神经网络训练装置可以分别将上述N个样本集输入至Q神经网络对神经网络进行训练,得到训练后的Q个神经网络。进一步地,上述Q个神经网络可以相同,不同或者部分相同。Exemplarily, the neural network training device may respectively input the above N sample sets into the Q neural network to train the neural network, and obtain Q neural networks after training. Further, the above Q neural networks may be the same, different or partly the same.
需要说明的是,相同的神经网络指的是复杂度以及输入分辨率相同的神经网络。It should be noted that the same neural network refers to a neural network with the same complexity and input resolution.
需要说明的是,由于上述N个样本集的退化程度不同,因此,分别基于N个样本集中的每个样本集对神经网络训练后,得到的训练后的神经网络的参数(即权值)不同,即,不同样本集训练得到的神经网络对图像的增强处理效果不同。It should be noted that, since the degradation degrees of the above N sample sets are different, after the neural network is trained based on each sample set in the N sample sets, the parameters (ie weights) of the trained neural network are different. , that is, neural networks trained with different sample sets have different effects on image enhancement.
在本申请实施例提供的神经网络训练方法中,神经网络训练装置根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;并采用每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像,然后,基于上述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集,最后,基于上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。通过该方法,神经网络训练装置可以对不同环境参数下的第一图像进行相应的退化程度(即有差异)的退化,以得到第一图像在有差异地退化后对应的退化图像(即第二图像),从而构建出符合多种环境参数下的拍摄质量的(即不同退化程度)的训练样本集,进而可以得到适用于对不同环境 参数下的拍摄图像进行针对性处理的神经网络,提高对图像的增强处理效果。In the neural network training method provided in the embodiment of the present application, the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to At least one first image, M and N are both positive integers; and each degradation degree is used to perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each The second images respectively correspond to a first image, and then, based on the above-mentioned first image and second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets, and finally, based on the above-mentioned N sample sets, respectively Q neural networks are trained, a sample set corresponds to at least one neural network, and Q is a positive integer. Through this method, the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters. Image enhancement processing effect.
可选地,在本申请实施例中,上述步骤101的过程可以包括如下步骤101a和步骤101b:Optionally, in the embodiment of the present application, the process of the above step 101 may include the following steps 101a and 101b:
步骤101a:从X个参数范围中,确定出上述M个环境参数对应的N个目标参数范围。Step 101a: From the X parameter ranges, determine N target parameter ranges corresponding to the above M environmental parameters.
其中,每个参数范围分别对应一个退化程度,一个目标参数范围对应至少一个环境参数。Wherein, each parameter range corresponds to a degree of degradation, and a target parameter range corresponds to at least one environmental parameter.
步骤101b:将N个目标参数范围中的第i个目标参数范围对应的退化程度,确定为第i个退化程度。Step 101b: Determine the degradation degree corresponding to the i-th target parameter range among the N target parameter ranges as the i-th degradation degree.
其中,上述第i个目标参数范围为:按照对应的退化程度由小到大的顺序,对上述N个目标参数范围排序后的第i个目标参数范围,i为正整数;上述第i个目标参数范围对应的环境参数,小于第i+1个目标参数范围对应的环境参数。Among them, the above i-th target parameter range is: according to the order of the corresponding degradation degree from small to large, the i-th target parameter range after sorting the above-mentioned N target parameter ranges, i is a positive integer; the above-mentioned i-th target The environment parameter corresponding to the parameter range is smaller than the environment parameter corresponding to the i+1th target parameter range.
可选地,上述X个参数范围可以为预设的参数范围,该参数范围指的是ISO值的范围。例如,该X个参数范围可以包括ISO值小于50,ISO值大于等于50,小于200,以及ISO值大于等于200三个参数范围。Optionally, the above-mentioned X parameter ranges may be preset parameter ranges, and the parameter ranges refer to the range of ISO values. For example, the X parameter ranges may include three parameter ranges with an ISO value less than 50, an ISO value greater than or equal to 50, less than 200, and an ISO value greater than or equal to 200.
需要说明的是,图像对应的环境参数越大,表示该图像对应的拍摄场景越黑暗,则拍摄到的该图像的退化程度越大。因此,需要对该图像进行较大程度的退化,以得到能够更好的模拟真实拍摄场景的训练数据集。即,第一图像的环境参数所处的参数范围中的环境参数(ISO值)越大,第一图像的ISO值越大,则第一图像对应的退化程度越高。It should be noted that the greater the environmental parameter corresponding to the image, the darker the shooting scene corresponding to the image is, and the greater the degradation degree of the captured image is. Therefore, the image needs to be degraded to a greater extent to obtain a training data set that can better simulate the real shooting scene. That is, the greater the environmental parameter (ISO value) in the parameter range of the environmental parameter of the first image is, the greater the ISO value of the first image is, and the corresponding degradation degree of the first image is higher.
可选地,在本申请实施例中,上述M张第一图像中的每张第一图像中包括至少一个人脸元素。Optionally, in this embodiment of the present application, each of the M first images includes at least one human face element.
可选地,上述步骤104的过程之前,本申请实施例提供的神经网络训练方法还包括如下步骤A1和步骤B1:Optionally, before the above step 104, the neural network training method provided in the embodiment of the present application further includes the following steps A1 and B1:
步骤A1:获取上述M张第一图像中的人脸元素对应的R个区域尺寸参数。Step A1: Obtain R area size parameters corresponding to the human face elements in the above M first images.
其中,每个区域尺寸参数分别为:一张第一图像中的人脸元素所处的区域的尺寸参数,R为正整数,R大于等于M。Wherein, each area size parameter is respectively: a size parameter of the area where the face element in the first image is located, R is a positive integer, and R is greater than or equal to M.
步骤B1:根据上述M个环境参数和上述R个区域尺寸参数,确定上述Q个神经网络。Step B1: Determine the aforementioned Q neural networks according to the aforementioned M environmental parameters and the aforementioned R area size parameters.
其中,一个神经网络对应:至少一个环境参数和至少一个区域尺寸参数。Wherein, a neural network corresponds to: at least one environment parameter and at least one area size parameter.
可选地,一张第一图像中可以包括一个或者多个人脸元素。例如,图像2为一张三人合照,则该图像2中包括三个人脸元素,则该图像2对应3个区域尺寸参数。Optionally, one first image may include one or more human face elements. For example, if the image 2 is a group photo of three people, the image 2 includes three face elements, and the image 2 corresponds to three area size parameters.
可选地,上述区域尺寸参数可以包括以下至少一项:长度、宽度、面积。Optionally, the aforementioned region size parameters may include at least one of the following: length, width, and area.
示例性的,神经网络训练装置可以获取上述M张第一图像中,每个第一图像中的至少一个人脸元素对应的区域尺寸参数,以得到R个区域尺寸参数,其中,每张第一图像可以对应上述R个区域尺寸参数中的一个或者多个。Exemplarily, the neural network training device may obtain the region size parameters corresponding to at least one face element in each of the above M first images to obtain R region size parameters, wherein each first The image may correspond to one or more of the above R area size parameters.
可选地,神经网络训练装置可以根据上述M个环境参数和上述R个区域尺寸参数,分别确定对应的环境参数等级和区域尺寸等级。进一步地,上述环境参数等级可以包括低ISO场景和高ISO场景,上述区域尺寸等级可以包括大面积和小面积。示例性的,可以通 过人脸检测算法来获取第一图像中的人脸的位置信息。进一步地,可以采用矩形框对第一图像中的人脸元素进行框选,并对矩形框信息进行一定比例的扩充得到人脸元素对应的人脸区域的宽(即,face_width)和高(即,face_height),从而可以计算人脸大小的面积(face_area)为face_area=face_width*face_height。Optionally, the neural network training device may respectively determine corresponding environmental parameter levels and area size levels according to the aforementioned M environmental parameters and the aforementioned R area size parameters. Further, the aforementioned environmental parameter level may include a low ISO scene and a high ISO scene, and the aforementioned area size level may include a large area and a small area. Exemplarily, the position information of the face in the first image can be acquired through a face detection algorithm. Further, the face element in the first image can be frame-selected by using a rectangular frame, and the information of the rectangular frame is expanded by a certain ratio to obtain the width (ie, face_width) and height (ie, face_width) of the face area corresponding to the face element. , face_height), so that the area (face_area) of the size of the face can be calculated as face_area=face_width*face_height.
示例性的,可以通过上述ISO与人脸大小信息处理模块,确定人脸面积标志位信息。进一步地,人脸面积标志位用于表征人脸元素的面积的大小,例如,人脸面积标志位为大面积标志位(即,bigFace_flag),或者,人脸面积标志位为小面积标志位(即,smallFace_flag)。Exemplarily, the above-mentioned ISO and face size information processing module can be used to determine the face area flag information. Further, the face area flag is used to characterize the size of the area of the face element, for example, the face area flag is a large area flag (that is, bigFace_flag), or the face area flag is a small area flag ( That is, smallFace_flag).
进一步地,在通过上述ISO与人脸大小信息处理模块,确定人脸面积标志位信息时,可以判断第一图像的人脸元素的面积与面积阈值(即,area_threshold)的大小关系,若face_area大于area_threshold,则将大面积标志位(或者大面积符号位)置为1,若face_area小于area_threshold,则将小面积标志位置为1。进一步地,上述面积阈值为提前设定的多阶段面积阈值,可以通过采集用户拍照数据来确定具体的面积阈值。Further, when determining the face area flag bit information by the above-mentioned ISO and face size information processing module, the size relationship between the area of the face element of the first image and the area threshold (that is, area_threshold) can be judged, if face_area is greater than area_threshold, set the large area flag (or large area sign) to 1, and if face_area is smaller than area_threshold, set the small area flag to 1. Further, the above-mentioned area threshold is a multi-stage area threshold set in advance, and the specific area threshold can be determined by collecting user photo data.
进一步地,神经网络训练装置可以通过识别ISO与人脸大小信息处理模块中的人脸面积的标志位信息,然后基于识别到的标志位信息,确定人脸面积的大小的等级。例如,识别到bigFace_flag为1,则确定该人脸元素为大面积人脸元素。Further, the neural network training device can identify the flag information of the face area in the ISO and face size information processing module, and then determine the level of the size of the face area based on the identified flag information. For example, if it is recognized that bigFace_flag is 1, it is determined that the face element is a face element with a large area.
示例性的,神经网络训练装置可以通过比较第一图像的环境参数(即,ISO值)与ISO阈值,来确定ISO标志位。例如,若ISO值大于ISO_threshold,则将高ISO标志位(或者高ISO符号位)置为1,若ISO值小于ISO_threshold,则将低ISO标志位置为1。Exemplarily, the neural network training apparatus may determine the ISO flag bit by comparing the environmental parameter (ie, the ISO value) of the first image with the ISO threshold. For example, if the ISO value is greater than ISO_threshold, set the high ISO flag bit (or high ISO sign bit) to 1, and if the ISO value is smaller than ISO_threshold, set the low ISO flag bit to 1.
进一步地,神经网络训练装置可以通过识别ISO与人脸大小信息处理模块中的ISO的标志位信息,然后基于识别到的标志位信息,确定ISO的等级。例如,识别到highISO_flag等于1,则确定第一图像对应低ISO值,即低ISO场景。如图4所示为ISO与人脸大小信息处理示意图。Further, the neural network training device can identify the ISO flag information in the ISO and face size information processing module, and then determine the ISO level based on the identified flag information. For example, if it is recognized that highISO_flag is equal to 1, it is determined that the first image corresponds to a low ISO value, that is, a low ISO scene. Figure 4 is a schematic diagram of ISO and face size information processing.
示例性的,神经网络训练装置可以根据识别到的每个样本集对应的人脸面积的标志位信息和ISO的标志位信息,确定每个样本集对应的神经网络。Exemplarily, the neural network training device may determine the neural network corresponding to each sample set according to the identified flag information of the face area corresponding to each sample set and the ISO flag information.
进一步地,神经网络装置可以对N个样本集逐个识别,在识别到某一样本集中的第一图像的人脸面积的标志位信息指示大面积人脸元素(即bigFace_flag等于1)的情况下,神经网络训练装置将该样本集输入至第一复杂度(即高复杂度)的神经网络中,并对该第一复杂度的神经网络进行训练,得到训练后的神经网络;在识别到某一样本集中的第一图像的人脸面积的标志位信息指示小面积人脸元素(即smallFace_flag等于1)的情况下,将该样本集输入至低复杂度的神经网络中进行训练。Further, the neural network device can identify the N sample sets one by one. In the case where the flag bit information of the face area of the first image in a certain sample set is recognized to indicate a large-area face element (that is, bigFace_flag is equal to 1), The neural network training device inputs the sample set into the neural network of the first complexity (ie high complexity), and trains the neural network of the first complexity to obtain the trained neural network; In the case where the flag bit information of the face area of the first image in this set indicates a small-area face element (that is, smallFace_flag is equal to 1), the sample set is input into a low-complexity neural network for training.
进一步可选地,在本申请实施例中,上述Q个神经网络中,复杂度大的神经网络对应的目标参数,大于复杂度小的神经网络对应的目标参数;Further optionally, in the embodiment of the present application, among the above Q neural networks, the target parameter corresponding to the neural network with high complexity is greater than the target parameter corresponding to the neural network with small complexity;
其中,上述目标参数包括:环境参数和区域尺寸参数。Wherein, the above target parameters include: environment parameters and area size parameters.
可选地,上述复杂度大的神经网络指的是时间复杂度和/或空间复杂度较大的神经网络。进一步地,神经网络的复杂度可以体现在神经网络的深度和广度。Optionally, the aforementioned neural network with high complexity refers to a neural network with relatively high time complexity and/or space complexity. Further, the complexity of the neural network can be reflected in the depth and breadth of the neural network.
示例性的,对于环境参数(即ISO值)较大的第一图像,即,处于高ISO场景的第一图像,由于对其实施了更为复杂(即退化程度更高)的退化处理,此时会得到与其对应的退化更严重的图像组成一组高清-低清数据集,因此,可以使用更深、更大的复杂度更高的神经网络,而对于低ISO场景,由于对其实施了较简单(即退化程度较低)的退化处理,此时会得到其对应的退化相对较轻的图像组成一组高清-低清数据集,因此,可以使用较浅、较小的神经网络。即,可以为退化程度高训练集的选择复杂度高的神经网络进行训练,为退化程度低的数据集选择复杂度较低的神经网络进行训练,如此,在保证较好的处理效果的同时,可以降低运算复杂度,加快算法的处理时间,从而提高训练效率。Exemplarily, for the first image with a large environmental parameter (ie, the ISO value), that is, the first image in a high ISO scene, due to the implementation of more complex (ie, higher degree of degradation) degradation processing, this A set of high-definition-low-definition data sets will be obtained with corresponding more severely degraded images. Therefore, a deeper, larger and more complex neural network can be used. For low-ISO scenes, due to the implementation of a higher Simple (that is, less degraded) degradation processing, at this time, corresponding images with relatively light degradation will be obtained to form a set of high-definition-low-definition data sets. Therefore, a shallower and smaller neural network can be used. That is, it is possible to select a high-complexity neural network for the training set with a high degree of degradation for training, and select a neural network with a low complexity for training for a data set with a low degree of degradation. In this way, while ensuring a better processing effect, It can reduce the computational complexity and speed up the processing time of the algorithm, thereby improving the training efficiency.
示例性的,图5为多复杂度GAN网络流程示意图,如图5所示,假设图像1的ISO值对应低ISO场景,则将其输入简单的GAN网络进行训练,以得到对低ISO场景的待处理图像具有更佳的处理效果的训练后的神经网络;假设图像1的ISO值对应高ISO场景,则将其输入复杂的GAN网络进行训练,以得到对理高ISO场景的待处理图像具有更佳的处理效果的训练后的神经网络。Exemplarily, FIG. 5 is a schematic diagram of a multi-complexity GAN network process. As shown in FIG. 5, assuming that the ISO value of image 1 corresponds to a low ISO scene, it is input into a simple GAN network for training to obtain the low ISO value of the scene. The image to be processed has a trained neural network with better processing effect; assuming that the ISO value of image 1 corresponds to a high ISO scene, it is input into a complex GAN network for training to obtain an image to be processed that corresponds to a high ISO scene. A trained neural network with better processing results.
进一步可选地,在本申请实施例中,每个样本集分别对应至少两个神经网络。Further optionally, in the embodiment of the present application, each sample set corresponds to at least two neural networks.
可选地,上述步骤B1的过程,可以包括如下步骤C1:Optionally, the process of the above step B1 may include the following step C1:
步骤C1:根据第一环境参数和第一区域尺寸参数,确定第一神经网络;Step C1: Determine the first neural network according to the first environment parameter and the first area size parameter;
其中,上述第一环境参数为:上述N个样本集中,任一个样本集中的第一图像的环境参数中的;上述第一区域尺寸参数为:上述任一个样本集中的第一图像对应的区域尺寸参数中的。Wherein, the above-mentioned first environmental parameter is: among the above-mentioned N sample sets, among the environmental parameters of the first image in any one of the sample sets; the above-mentioned first area size parameter is: the area size corresponding to the first image in any of the above-mentioned sample sets in the parameter.
上述第一神经网络为:上述任一个样本集对应的神经网络中的。The above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
可选地,上述一个样本集中的第一图像对应一个退化程度,该一个退化程度可以对应一个神经网络。Optionally, the first image in the aforementioned one sample set corresponds to a degree of degradation, and the degree of degradation may correspond to a neural network.
需要说明的是,每个样本集为一个高清-低清图像对,每个样本集中的低清图像为对高清图像退化后的图像。It should be noted that each sample set is a high-definition-low-definition image pair, and the low-definition image in each sample set is a degraded image of the high-definition image.
示例性的,当一个样本集中的第一图像的人脸元素的区域尺寸参数(即,人脸面积)不尽相同时,例如,该一个样本集中存在包括大面积人脸元素和小面积人脸元素的第一图像时,可以对包括大面积的人脸元素的第一图像选择输入分辨率较大且复杂度较高的神经网络进行训练,对包括小面积的人脸元素的第一图像选择输入分辨率较小且复杂度较低的神经网络进行训练。如此,可以在取得更好地训练效果的同时提高训练效率。Exemplarily, when the area size parameters (that is, the face area) of the face elements in the first image in a sample set are not the same, for example, there are large-area face elements and small-area face elements in the sample set. When the first image of an element is selected, a neural network with a larger input resolution and higher complexity can be selected for the first image including a large-area face element, and the first image selection for a face element including a small area Feed a neural network with a smaller resolution and lower complexity for training. In this way, the training efficiency can be improved while achieving a better training effect.
本申请实施例提供了一种图像处理方法,该图像处理方法可以应用于电子设备,该电子设备可以包括上述神经网络训练方法训练后的Q个神经网络,Q为正整数。图6示出了本申请实施例提供的图像处理方法的流程图。如图6所示,本申请实施例提供的神经网络训练方法可以包括如下步骤201和步骤202:An embodiment of the present application provides an image processing method, which can be applied to an electronic device, and the electronic device can include Q neural networks trained by the above neural network training method, where Q is a positive integer. FIG. 6 shows a flow chart of the image processing method provided by the embodiment of the present application. As shown in Figure 6, the neural network training method provided by the embodiment of the present application may include the following steps 201 and 202:
步骤201:在显示上述电子设备的摄像头采集的预览图像的情况下,根据上述预览图像的目标环境参数,和上述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q 个神经网络中,确定出目标神经网络。Step 201: In the case of displaying the preview image collected by the camera of the above-mentioned electronic device, according to the target environment parameters of the above-mentioned preview image, and the target area size parameters corresponding to the face elements in the above-mentioned preview image, from the Q neural networks after training , determine the target neural network.
在本申请实施例中,上述目标环境参数包括以下至少一项:ISO值、亮度值;上述目标区域尺寸参数包括以下至少一项:宽度、高度、面积。In the embodiment of the present application, the above-mentioned target environment parameters include at least one of the following: ISO value and brightness value; the above-mentioned target area size parameters include at least one of the following: width, height, and area.
示例性的,在显示有预览图像的情况下,可以获取摄像头的当前ISO值,并将摄像头的当前ISO值确定为预览图像的ISO值,以及,可以获取预览图像中的人脸元素的人脸面积信息。Exemplarily, when a preview image is displayed, the current ISO value of the camera may be obtained, and the current ISO value of the camera may be determined as the ISO value of the preview image, and the face of the face element in the preview image may be obtained area information.
进一步地,图像处理装置可以基于上述获取的ISO值确定当前拍摄场景为高ISO场景,或是低ISO场景,以及,基于获取的人脸面积信息确定待处理的人脸元素为大面积或是小面积。Further, the image processing device may determine whether the current shooting scene is a high ISO scene or a low ISO scene based on the obtained ISO value, and determine whether the face element to be processed is a large area or a small area based on the obtained face area information. area.
可选地,在本申请实施例中,上述目标神经网络为与上述目标环境参数以及目标区域尺寸参数匹配的训练后的对抗神经网络。上述目标神经网络用于对摄像头拍摄的图像进行图像增强处理。Optionally, in the embodiment of the present application, the above-mentioned target neural network is a trained adversarial neural network that matches the above-mentioned target environment parameters and target area size parameters. The above-mentioned target neural network is used to perform image enhancement processing on the images captured by the camera.
步骤202:将上述摄像头拍摄的第三图像输入上述目标神经网络进行图像处理,得到处理后的图像。Step 202: Input the third image captured by the above-mentioned camera into the above-mentioned target neural network for image processing to obtain a processed image.
其中,上述第三图像为:摄像头在预定时间段内拍摄的图像,上述预定时间段为:摄像头采集上述预览图像的时刻至摄像头停止采集预览图像的时刻之间的时间段。Wherein, the above-mentioned third image is: an image captured by the camera within a predetermined time period, and the above-mentioned predetermined time period is a time period between the time when the camera collects the preview image and the time when the camera stops collecting the preview image.
可选地,在本申请实施例中,上述第三图像可以为包括人脸元素的图像。Optionally, in this embodiment of the present application, the above-mentioned third image may be an image including human face elements.
可选地,在本申请实施例中,上述图像处理可以为图像增强处理,例如,通过去噪、去除模糊、提升亮度、提升对比度等方式来对图像中的人脸区域进行增强处理。Optionally, in the embodiment of the present application, the above image processing may be image enhancement processing, for example, performing enhancement processing on the human face area in the image by means of denoising, removing blur, increasing brightness, increasing contrast, and the like.
在本申请实施例提供的图像处理方法中,图像处理装置可以在显示电子设备的摄像头采集的预览图像的情况下,根据预览图像的目标环境参数,和预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络。通过该方法,图像处理装置可以基于拍摄图像时的环境参数和拍摄图像中的人脸的尺寸大小,智能地选择符合当前拍摄的环境参数与人脸尺寸的神经网络进行图像增强处理,从而极大提升对拍摄图像的人脸增强的效果和性能。In the image processing method provided in the embodiment of the present application, the image processing device can display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image, and the size of the target area corresponding to the face elements in the preview image parameters, and determine the target neural network from the Q neural networks after training. Through this method, the image processing device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters when the image is captured and the size of the human face in the captured image, thereby greatly Improves the effect and performance of face enhancement on captured images.
可选地,在本申请实施例中,上述步骤201中根据上述预览图像的目标环境参数,和上述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络之前,本申请实施例提供的图像处理方法还包括如下步骤D1:Optionally, in the embodiment of the present application, in the above-mentioned step 201, according to the target environment parameters of the above-mentioned preview image, and the target area size parameters corresponding to the face elements in the above-mentioned preview image, from the Q neural networks after training, determine Before the target neural network is generated, the image processing method provided in the embodiment of the present application also includes the following step D1:
步骤D1:在上述预览图像包含人脸元素的情况下,获取目标环境参数和人脸元素对应的目标区域尺寸参数。Step D1: In the case that the above-mentioned preview image contains human face elements, obtain target environment parameters and target area size parameters corresponding to the human face elements.
示例性的,可以通过进行轮廓获取的方式来检测预览图像中是否包含人脸元素。Exemplarily, it is possible to detect whether the preview image contains human face elements by acquiring contours.
可选地,在本申请实施例中,上述步骤201中根据上述预览图像的目标环境参数,和上述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络的过程,可以包括如下步骤201a:Optionally, in the embodiment of the present application, in the above-mentioned step 201, according to the target environment parameters of the above-mentioned preview image, and the target area size parameters corresponding to the face elements in the above-mentioned preview image, from the Q neural networks after training, determine The process of obtaining the target neural network may include the following steps 201a:
步骤201a:基于预存的Q个对应关系,确定上述目标环境参数和上述目标区域尺寸参 数所对应的上述目标神经网络。Step 201a: Based on the pre-stored Q correspondences, determine the above-mentioned target neural network corresponding to the above-mentioned target environment parameters and the above-mentioned target area size parameters.
其中,每个对应关系分别为:至少一个环境参数、至少一个区域尺寸参数和一个训练后的神经网络间的对应关系。Wherein, each corresponding relationship is respectively: a corresponding relationship between at least one environment parameter, at least one region size parameter and a trained neural network.
或者,上述每个对应关系分别为:一个环境参数等级、一个区域尺寸等级和一个训练后的神经网络间的对应关系。Alternatively, each of the above correspondences is respectively: a correspondence between an environment parameter level, an area size level and a trained neural network.
示例性的,上述对应关系可以是在对一个神经网络训练结束后,得到一个训练后的神经网络的情况下建立的。Exemplarily, the above corresponding relationship may be established when a trained neural network is obtained after the training of a neural network is completed.
例如,训练后的神经网络A对应的低ISO场景,训练后的神经网络B对应的高ISO场景,假设上述目标环境参数对应低ISO场景,则上述目标神经网络可以为神经网络A。For example, the trained neural network A corresponds to a low-ISO scene, and the trained neural network B corresponds to a high-ISO scene. Assuming that the above-mentioned target environment parameters correspond to a low-ISO scene, the above-mentioned target neural network can be neural network A.
再例如,训练后的神经网络C对应的大面积人脸元素,训练后的神经网络D对应小面积人脸元素,假设上述目标环境参数对应大面积人脸元素,则上述目标神经网络可以为神经网络C。For another example, the trained neural network C corresponds to a large-area face element, and the trained neural network D corresponds to a small-area face element. Assuming that the above-mentioned target environment parameters correspond to a large-area face element, the above-mentioned target neural network can be neural network network C.
需要说明的是,本申请实施例提供的神经网络训练方法,执行主体可以为神经网络训练装置,或者该神经网络训练装置中的用于执行神经网络训练方法的控制模块。本申请实施例中以神经网络训练装置执行神经网络训练方法为例,说明本申请实施例提供的神经网络训练装置。It should be noted that, the neural network training method provided in the embodiment of the present application may be executed by a neural network training device, or a control module in the neural network training device for executing the neural network training method. In the embodiment of the present application, the neural network training device provided by the embodiment of the present application is described by taking the neural network training method executed by the neural network training device as an example.
本申请实施例提供一种神经网络训练装置600,如图7所示,该装置包括:确定模块601、处理模块602、生成模块603和训练模块604,其中:The embodiment of the present application provides a neural network training device 600, as shown in Figure 7, the device includes: a determination module 601, a processing module 602, a generation module 603 and a training module 604, wherein:
上述确定模块601,用于根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;上述处理模块602,用于基于上述确定模块601确定的每个退化程度,对上述每个退化程度对应的第一图像分别进行退化处理,得到上述每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;上述生成模块603,用于基于上述处理模块602得到的每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;上述训练模块604,用于基于上述生成模块603得到的上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。The above determination module 601 is configured to determine N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one first image, M, N are positive integers; the processing module 602 is configured to perform degradation processing on the first image corresponding to each degradation degree based on each degradation degree determined by the determination module 601 to obtain the second image corresponding to each degradation degree. image, each second image corresponds to a first image; the generation module 603 is used to generate a sample set based on the first image and the second image corresponding to each degree of degradation obtained by the processing module 602, and obtain N sample sets; the training module 604 is used to train Q neural networks based on the above N sample sets obtained by the generating module 603, one sample set corresponds to at least one neural network, and Q is a positive integer.
可选地,在本申请实施例中,上述确定模块601,具体用于从X个参数范围中,确定出上述M个环境参数对应的N个目标参数范围,每个参数范围分别对应一个退化程度,一个目标参数范围对应至少一个环境参数;上述确定模块601,具体用于将上述N个目标参数范围中的第i个目标参数范围对应的退化程度,确定为第i个退化程度;其中,上述第i个目标参数范围为:按照对应的退化程度由小到大的顺序,对上述N个目标参数范围排序后的第i个目标参数范围,i为正整数;上述第i个目标参数范围对应的环境参数,小于第i+1个目标参数范围对应的环境参数。Optionally, in the embodiment of the present application, the determination module 601 is specifically configured to determine N target parameter ranges corresponding to the above M environmental parameters from the X parameter ranges, and each parameter range corresponds to a degradation degree , one target parameter range corresponds to at least one environmental parameter; the determination module 601 is specifically configured to determine the degradation degree corresponding to the i-th target parameter range in the above-mentioned N target parameter ranges as the i-th degradation degree; wherein, the above-mentioned The i-th target parameter range is: the i-th target parameter range after sorting the above N target parameter ranges according to the order of the corresponding degradation degree from small to large, where i is a positive integer; the above-mentioned i-th target parameter range corresponds to The environmental parameter of is smaller than the environmental parameter corresponding to the i+1th target parameter range.
可选地,在本申请实施例中,上述M张第一图像中的每张第一图像中包括至少一个人脸元素;Optionally, in this embodiment of the present application, each of the M first images includes at least one human face element;
上述装置还包括:获取模块605;The above device also includes: an acquisition module 605;
上述获取模块605,用于获取上述M张第一图像中的人脸元素对应的R个区域尺寸参数,每个区域尺寸参数分别为:一张第一图像中的人脸元素所处的区域的尺寸参数,R为正整数,R大于等于M;上述确定模块601,还用于根据上述获取模块605获取的M个环境参数和上述R个区域尺寸参数,确定上述Q个神经网络;其中,一个神经网络对应:至少一个环境参数和至少一个区域尺寸参数。The acquisition module 605 is configured to acquire R area size parameters corresponding to the face elements in the M first images, and each area size parameter is: the area where the face elements in the first image are located. Size parameter, R is a positive integer, and R is greater than or equal to M; the above determination module 601 is also used to determine the above Q neural networks according to the M environmental parameters obtained by the above acquisition module 605 and the above R area size parameters; wherein, one The neural network corresponds to: at least one environment parameter and at least one region size parameter.
可选地,在本申请实施例中,上述Q个神经网络中,复杂度大的神经网络对应的目标参数,大于复杂度小的神经网络对应的目标参数;其中,上述目标参数包括:环境参数和区域尺寸参数。Optionally, in the embodiment of the present application, among the above-mentioned Q neural networks, the target parameters corresponding to the neural networks with high complexity are greater than the target parameters corresponding to the neural networks with small complexity; wherein, the above-mentioned target parameters include: environmental parameters and area size parameters.
可选地,在本申请实施例中,每个样本集分别对应至少一个神经网络;Optionally, in the embodiment of the present application, each sample set corresponds to at least one neural network;
上述确定模块601,具体用于根据第一环境参数和第一区域尺寸参数,确定第一神经网络;其中,上述第一环境参数为:上述N个样本集中,任一个样本集中的第一图像的环境参数中的;上述第一区域尺寸参数为:上述任一个样本集中的第一图像对应的区域尺寸参数中的;The above determination module 601 is specifically configured to determine the first neural network according to the first environment parameter and the first area size parameter; wherein, the above first environment parameter is: the first image in any one of the N sample sets mentioned above Among the environmental parameters; the above-mentioned first area size parameter is: among the area size parameters corresponding to the first image in any of the above-mentioned sample sets;
上述第一神经网络为:上述任一个样本集对应的神经网络中的。The above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
在本申请实施例提供的神经网络训练装置中,神经网络训练装置根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;并采用每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像,然后,基于上述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集,最后,基于上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。通过该方法,神经网络训练装置可以对不同环境参数下的第一图像进行相应的退化程度(即有差异)的退化,以得到第一图像在有差异地退化后对应的退化图像(即第二图像),从而构建出符合多种环境参数下的拍摄质量的(即不同退化程度)的训练样本集,进而可以得到适用于对不同环境参数下的拍摄图像进行针对性处理的神经网络,提高对图像的增强处理效果。In the neural network training device provided in the embodiment of the present application, the neural network training device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to At least one first image, M and N are both positive integers; and each degradation degree is used to perform degradation processing on the first image corresponding to each degradation degree to obtain a second image corresponding to each degradation degree, and each The second images respectively correspond to a first image, and then, based on the above-mentioned first image and second image corresponding to each degree of degradation, respectively generate a sample set to obtain N sample sets, and finally, based on the above-mentioned N sample sets, respectively Q neural networks are trained, a sample set corresponds to at least one neural network, and Q is a positive integer. Through this method, the neural network training device can degrade the first image under different environmental parameters to a corresponding degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image after the first image is degraded differently (that is, the second image). image), so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters. Image enhancement processing effect.
需要说明的是,本申请实施例提供的图像处理方法,执行主体可以为图像处理装置,或者该图像处理装置中的用于执行图像处理方法的控制模块。本申请实施例中以图像处理装置执行图像处理方法为例,说明本申请实施例提供的图像处理装置。It should be noted that, the image processing method provided in the embodiment of the present application may be executed by an image processing device, or a control module in the image processing device for executing the image processing method. In the embodiment of the present application, the image processing device executed by the image processing device is taken as an example to describe the image processing device provided in the embodiment of the present application.
本申请实施例提供一种图像处理装置700,如图8所示,该装置包括如上述神经网络训练方法训练后的Q个神经网络,Q为正整数;该装置包括:确定模块701和处理模块702,其中:The embodiment of the present application provides an image processing device 700. As shown in FIG. 8, the device includes Q neural networks trained by the above neural network training method, and Q is a positive integer; the device includes: a determination module 701 and a processing module 702, of which:
上述确定模块701,用于在显示电子设备的摄像头采集的预览图像的情况下,根据预览图像的目标环境参数,和预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络;The above-mentioned determination module 701 is used for displaying the preview image collected by the camera of the electronic device, according to the target environment parameters of the preview image, and the target area size parameters corresponding to the face elements in the preview image, from the Q neurons after training In the network, determine the target neural network;
上述处理模块702,用于将摄像头拍摄的第三图像输入确定模块701确定的目标神经网络进行图像处理,得到处理后的图像,上述第三图像为:摄像头在预定时间段内拍摄的图像,上述预定时间段为:摄像头采集预览图像的时刻至摄像头停止采集预览图像的时刻之间的时间段。The processing module 702 is configured to input the third image captured by the camera into the target neural network determined by the determination module 701 for image processing to obtain a processed image. The third image is: an image captured by the camera within a predetermined period of time. The predetermined time period is: the time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
可选地,在本申请实施例中,该装置700还包括获取模块703,上述获取模块703,用于在上述预览图像包含人脸元素的情况下,则获取目标环境参数和人脸元素对应的目标区域尺寸参数。Optionally, in the embodiment of the present application, the device 700 further includes an acquisition module 703, the above-mentioned acquisition module 703 is used to acquire the target environment parameters corresponding to the face element when the above-mentioned preview image contains a face element Target area size parameter.
可选地,在本申请实施例中,上述确定模块701,具体用于基于预存的Q个对应关系,确定上述目标环境参数和上述目标区域尺寸参数所对应的目标神经网络;其中,每个对应关系分别为:至少一个环境参数、至少一个区域尺寸参数和一个训练后的神经网络间的对应关系。Optionally, in the embodiment of the present application, the above-mentioned determination module 701 is specifically configured to determine the target neural network corresponding to the above-mentioned target environment parameters and the above-mentioned target area size parameters based on the pre-stored Q correspondences; wherein, each corresponding The relationships are respectively: a corresponding relationship between at least one environment parameter, at least one area size parameter and a trained neural network.
在本申请实施例提供的图像处理装置中,图像处理装置可以在显示电子设备的摄像头采集的预览图像的情况下,根据预览图像的目标环境参数,和预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络。通过该方法,图像处理装置可以基于拍摄图像时的环境参数和拍摄图像中的人脸的尺寸大小,智能地选择符合当前拍摄的环境参数与人脸尺寸的神经网络进行图像增强处理,从而极大提升对拍摄图像的人脸增强的效果和性能。In the image processing device provided in the embodiment of the present application, the image processing device can display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image, and the size of the target area corresponding to the human face element in the preview image parameters, and determine the target neural network from the Q neural networks after training. Through this method, the image processing device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters when the image is captured and the size of the human face in the captured image, thereby greatly Improves the effect and performance of face enhancement on captured images.
本申请实施例中的神经网络训练装置和图像处理装置可以是装置,也可以是终端中的部件、集成电路、或芯片。该装置可以是移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,非移动电子设备可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。The neural network training device and the image processing device in the embodiments of the present application may be devices, or components, integrated circuits, or chips in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant). assistant, PDA), etc., non-mobile electronic devices can be servers, network attached storage (Network Attached Storage, NAS), personal computer (personal computer, PC), television (television, TV), teller machine or self-service machine, etc., this application Examples are not specifically limited.
本申请实施例中的神经网络训练装置和图像处理装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The neural network training device and the image processing device in the embodiment of the present application may be devices with an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in this embodiment of the present application.
本申请实施例提供的神经网络训练装置能够实现图1至图5的方法实施例实现的各个过程,为避免重复,这里不再赘述。本申请实施例提供的图像处理装置能够实现图6和图7的方法实施例实现的各个过程,为避免重复,这里不再赘述。The neural network training device provided by the embodiment of the present application can realize various processes realized by the method embodiments in FIG. 1 to FIG. 5 , and details are not repeated here to avoid repetition. The image processing apparatus provided in the embodiment of the present application can implement various processes implemented by the method embodiments in FIG. 6 and FIG. 7 , and details are not repeated here to avoid repetition.
可选的,如图9所示,本申请实施例还提供一种电子设备800,包括处理器801,存储器802,存储在存储器802上并可在上述处理器801上运行的程序或指令,该程序或指令被处理器801执行时实现上述神经网络训练方法或者上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, as shown in FIG. 9 , the embodiment of the present application also provides an electronic device 800, including a processor 801, a memory 802, and programs or instructions stored in the memory 802 and operable on the processor 801. When the programs or instructions are executed by the processor 801, the various processes of the above-mentioned neural network training method or the above-mentioned image processing method embodiments can be achieved, and the same technical effect can be achieved. To avoid repetition, details are not repeated here.
需要说明的是,本申请实施例中的电子设备包括上述的移动电子设备和非移动电子设 备。It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
图10为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 10 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
该电子设备100包括但不限于:射频单元101、网络模块102、音频输出单元103、输入单元104、传感器105、显示单元106、用户输入单元107、接口单元108、存储器109、以及处理器110等部件。The electronic device 100 includes but is not limited to: a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110, etc. part.
本领域技术人员可以理解,电子设备100还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器110逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图10中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the electronic device 100 can also include a power supply (such as a battery) for supplying power to various components, and the power supply can be logically connected to the processor 110 through the power management system, so that the management of charging, discharging, and function can be realized through the power management system. Consumption management and other functions. The structure of the electronic device shown in FIG. 10 does not constitute a limitation to the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange different components, and details will not be repeated here. .
其中,上述处理器110,用于根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;上述处理器110,用于基于每个退化程度,对上述每个退化程度对应的第一图像分别进行退化处理,得到上述每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;上述处理器110,用于基于上述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;上述处理器110,用于基于上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。Wherein, the above-mentioned processor 110 is configured to determine N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, one degradation degree corresponds to at least one first image, and M , N are both positive integers; the processor 110 is configured to perform degradation processing on the first image corresponding to each degradation degree based on each degradation degree, to obtain the second image corresponding to each degradation degree above, each The second images respectively correspond to a first image; the processor 110 is configured to generate a sample set based on the first image and the second image corresponding to each degree of degradation, and obtain N sample sets; the processor 110, It is used to train Q neural networks respectively based on the above N sample sets, one sample set corresponds to at least one neural network, and Q is a positive integer.
可选地,在本申请实施例中,上述处理器110,具体用于从X个参数范围中,确定出上述M个环境参数对应的N个目标参数范围,每个参数范围分别对应一个退化程度,一个目标参数范围对应至少一个环境参数;上述处理器110,具体用于将N个目标参数范围中的第i个目标参数范围对应的退化程度,确定为第i个退化程度;其中,上述第i个目标参数范围为:按照对应的退化程度由小到大的顺序,对上述N个目标参数范围排序后的第i个目标参数范围,i为正整数;上述第i个目标参数范围对应的环境参数,小于第i+1个目标参数范围对应的环境参数。Optionally, in the embodiment of the present application, the above-mentioned processor 110 is specifically configured to determine N target parameter ranges corresponding to the above-mentioned M environmental parameters from the X parameter ranges, and each parameter range corresponds to a degradation degree , one target parameter range corresponds to at least one environmental parameter; the above-mentioned processor 110 is specifically configured to determine the degradation degree corresponding to the i-th target parameter range in the N target parameter ranges as the i-th degradation degree; wherein, the above-mentioned The range of the i target parameter is: according to the order of the corresponding degradation degree from small to large, the ith target parameter range after sorting the above N target parameter ranges, i is a positive integer; the above i-th target parameter range corresponds to The environment parameter is smaller than the environment parameter corresponding to the i+1th target parameter range.
可选地,在本申请实施例中,上述M张第一图像中的每张第一图像中包括至少一个人脸元素;处理器110,用于获取上述M张第一图像中的人脸元素对应的R个区域尺寸参数,每个区域尺寸参数分别为:一张第一图像中的人脸元素所处的区域的尺寸参数,R为正整数,R大于等于M;上述处理器110,还用于根据上述M个环境参数和上述R个区域尺寸参数,确定上述Q个神经网络;其中,一个神经网络对应:至少一个环境参数和至少一个区域尺寸参数。Optionally, in this embodiment of the present application, each of the M first images includes at least one human face element; the processor 110 is configured to obtain the human face element in the M first images Corresponding R area size parameters, each area size parameter is: a size parameter of the area where the face element in the first image is located, R is a positive integer, and R is greater than or equal to M; the processor 110 also It is used to determine the aforementioned Q neural networks according to the aforementioned M environmental parameters and the aforementioned R area size parameters; wherein, one neural network corresponds to: at least one environmental parameter and at least one area size parameter.
可选地,在本申请实施例中,上述Q个神经网络中,复杂度大的神经网络对应的目标参数,大于复杂度小的神经网络对应的目标参数;其中,上述目标参数包括:环境参数和区域尺寸参数。Optionally, in the embodiment of the present application, among the above-mentioned Q neural networks, the target parameters corresponding to the neural networks with high complexity are greater than the target parameters corresponding to the neural networks with small complexity; wherein, the above-mentioned target parameters include: environmental parameters and area size parameters.
可选地,在本申请实施例中,每个样本集分别对应至少一个神经网络;Optionally, in the embodiment of the present application, each sample set corresponds to at least one neural network;
上述处理器110,具体用于根据第一环境参数和第一区域尺寸参数,确定第一神经网 络;其中,上述第一环境参数为:上述N个样本集中,任一个样本集中的第一图像的环境参数中的;上述第一区域尺寸参数为:上述任一个样本集中的第一图像对应的区域尺寸参数中的;The above-mentioned processor 110 is specifically configured to determine the first neural network according to the first environment parameter and the first area size parameter; wherein, the above-mentioned first environment parameter is: the first image in any one of the above-mentioned N sample sets Among the environmental parameters; the above-mentioned first area size parameter is: among the area size parameters corresponding to the first image in any of the above-mentioned sample sets;
上述第一神经网络为:上述任一个样本集对应的神经网络中的。The above-mentioned first neural network is: one of the neural networks corresponding to any of the above-mentioned sample sets.
在本申请实施例提供的电子设备中,电子设备根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;并采用每个退化程度,对每个退化程度对应的第一图像分别进行退化处理,得到每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像,然后,基于上述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集,最后,基于上述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。通过该方法,电子设备可以对不同环境参数下的第一图像进行相应的退化程度(即有差异)的退化,以得到第一图像在有差异地退化后对应的退化图像(即第二图像),从而构建出符合多种环境参数下的拍摄质量的(即不同退化程度)的训练样本集,进而可以得到适用于对不同环境参数下的拍摄图像进行针对性处理的神经网络,提高对图像的增强处理效果。In the electronic device provided in the embodiment of the present application, the electronic device determines N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, and one degradation degree corresponds to at least one of the first images. An image, where M and N are both positive integers; and using each degree of degradation, degrade the first image corresponding to each degree of degradation to obtain a second image corresponding to each degree of degradation, and each second image is respectively Corresponding to a first image, then, based on the above-mentioned first image and second image corresponding to each degree of degradation, generate a sample set respectively, and obtain N sample sets, and finally, based on the above-mentioned N sample sets, Q nerves The network is trained, a sample set corresponds to at least one neural network, and Q is a positive integer. Through this method, the electronic device can degrade the first image under different environmental parameters corresponding to the degree of degradation (that is, there is a difference), so as to obtain the corresponding degraded image (that is, the second image) after the first image is degraded differently. , so as to construct a training sample set that conforms to the shooting quality under various environmental parameters (that is, different degrees of degradation), and then obtain a neural network suitable for targeted processing of captured images under different environmental parameters, and improve the accuracy of the image. Enhanced processing.
或者,上述处理器110,用于在显示电子设备的摄像头采集的预览图像的情况下,根据预览图像的目标环境参数,和预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络;将摄像头拍摄的第三图像输入确定模块701确定的目标神经网络进行图像处理,得到处理后的图像,上述第三图像为:摄像头在预定时间段内拍摄的图像,上述预定时间段为:摄像头采集预览图像的时刻至摄像头停止采集预览图像的时刻之间的时间段。Alternatively, the above-mentioned processor 110 is configured to, in the case of displaying a preview image collected by a camera of an electronic device, according to the target environment parameters of the preview image and the target area size parameters corresponding to the face elements in the preview image, from the trained Q In the first neural network, the target neural network is determined; the third image taken by the camera is input to the target neural network determined by the determination module 701 for image processing, and the processed image is obtained. The above-mentioned third image is: the camera shoots within a predetermined time period The predetermined time period is the time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
可选地,在本申请实施例中,上述处理器110,用于在所述预览图像包含人脸元素的情况下,获取目标环境参数和人脸元素对应的目标区域尺寸参数。Optionally, in the embodiment of the present application, the processor 110 is configured to acquire target environment parameters and target area size parameters corresponding to the face elements when the preview image contains face elements.
可选地,在本申请实施例中,上述处理器110,具体用于基于预存的Q个对应关系,确定目标环境参数和目标区域尺寸参数所对应的目标神经网络;其中,每个对应关系分别为:至少一个环境参数、至少一个区域尺寸参数和一个训练后的神经网络间的对应关系。Optionally, in the embodiment of the present application, the above-mentioned processor 110 is specifically configured to determine the target neural network corresponding to the target environment parameter and the target area size parameter based on the pre-stored Q correspondences; wherein, each correspondence is respectively is: a corresponding relationship between at least one environment parameter, at least one region size parameter and a trained neural network.
在本申请实施例提供的电子设备中,电子设备可以在显示电子设备的摄像头采集的预览图像的情况下,根据预览图像的目标环境参数,和预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络。通过该方法,电子设备可以基于拍摄图像时的环境参数和拍摄图像中的人脸的尺寸大小,智能地选择符合当前拍摄的环境参数与人脸尺寸的神经网络进行图像增强处理,从而极大提升对拍摄图像的人脸增强的效果和性能。In the electronic device provided in the embodiment of the present application, the electronic device may display the preview image captured by the camera of the electronic device, according to the target environment parameters of the preview image and the target area size parameters corresponding to the face elements in the preview image, A target neural network is determined from the Q neural networks after training. Through this method, the electronic device can intelligently select a neural network that conforms to the current environmental parameters and face size for image enhancement processing based on the environmental parameters and the size of the human face in the captured image, thereby greatly improving Effects and performance of face enhancements on captured images.
应理解的是,本申请实施例中,输入单元104可以包括图形处理器(Graphics Processing Unit,GPU)1041和麦克风1042,图形处理器1041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元106 可包括显示面板1061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板1061。用户输入单元107包括触控面板1071以及其他输入设备1072。触控面板1071,也称为触摸屏。触控面板1071可包括触摸检测装置和触摸控制器两个部分。其他输入设备1072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。存储器109可用于存储软件程序以及各种数据,包括但不限于应用程序和操作系统。处理器110可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器110中。It should be understood that, in the embodiment of the present application, the input unit 104 may include a graphics processing unit (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processing unit 1041 is used by the image capturing device ( Such as the image data of the still picture or video obtained by the camera) for processing. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 107 includes a touch panel 1071 and other input devices 1072 . The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts, a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which will not be repeated here. Memory 109 may be used to store software programs as well as various data, including but not limited to application programs and operating systems. The processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces, and application programs, and the modem processor mainly processes wireless communications. It can be understood that the foregoing modem processor may not be integrated into the processor 110 .
本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述神经网络训练方法实施例的各个过程,或者上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, each process of the above-mentioned neural network training method embodiment is realized, or the above-mentioned image Each process in the embodiment of the processing method can achieve the same technical effect, so in order to avoid repetition, details are not repeated here.
其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述神经网络训练方法实施例的各个过程,或者上述图像处理方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiment of the present application further provides a chip, the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the above-mentioned embodiment of the neural network training method Each process, or each process of the above image processing method embodiment, and can achieve the same technical effect, in order to avoid repetition, it is not repeated here.
应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chips mentioned in the embodiments of the present application may also be called system-on-chip, system-on-chip, system-on-a-chip, or system-on-a-chip.
本申请实施例提供一种计算机程序产品,该程序产品被存储在非易失的存储介质中,该程序产品被至少一个处理器执行以实现上述神经网络训练方法实施例的各个过程,或者上述图像处理方法实施例的各个过程,且能达到相同的技术效果。The embodiment of the present application provides a computer program product, the program product is stored in a non-volatile storage medium, and the program product is executed by at least one processor to realize the various processes of the above-mentioned neural network training method embodiment, or the above-mentioned image Each process of the embodiment of the method is processed, and the same technical effect can be achieved.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. Functions are performed, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡 献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementations. The above-mentioned specific implementations are only illustrative and not restrictive. Those of ordinary skill in the art will Under the inspiration of this application, without departing from the purpose of this application and the scope of protection of the claims, many forms can also be made, all of which belong to the protection of this application.

Claims (16)

  1. 一种神经网络训练方法,所述方法包括:A neural network training method, said method comprising:
    根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;According to the M environmental parameters of the acquired M first images, N degradation degrees are determined, one degradation degree corresponds to at least one environmental parameter, one degradation degree corresponds to at least one first image, and M and N are both positive integers;
    基于每个退化程度,对所述每个退化程度对应的第一图像分别进行退化处理,得到所述每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;Based on each degree of degradation, performing degradation processing on the first image corresponding to each degree of degradation to obtain a second image corresponding to each degree of degradation, and each second image corresponds to a first image;
    基于所述每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;Generate a sample set based on the first image and the second image corresponding to each degree of degradation to obtain N sample sets;
    基于所述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。Based on the N sample sets, Q neural networks are respectively trained, one sample set corresponds to at least one neural network, and Q is a positive integer.
  2. 根据权利要求1所述的方法,其中,所述根据获取的M张第一图像的M个环境参数,确定N个退化程度,包括:The method according to claim 1, wherein said determining N degradation degrees according to the M environmental parameters of the acquired M first images comprises:
    从X个参数范围中,确定出所述M个环境参数对应的N个目标参数范围,每个参数范围分别对应一个退化程度,一个目标参数范围对应至少一个环境参数;From the X parameter ranges, determine N target parameter ranges corresponding to the M environmental parameters, each parameter range corresponds to a degree of degradation, and one target parameter range corresponds to at least one environmental parameter;
    将所述N个目标参数范围中的第i个目标参数范围对应的退化程度,确定为第i个退化程度。The degradation degree corresponding to the i-th target parameter range in the N target parameter ranges is determined as the i-th degradation degree.
  3. 根据权利要求1所述的方法,其中,所述M张第一图像中的每张第一图像中包括至少一个人脸元素;The method according to claim 1, wherein each of the M first images includes at least one face element;
    所述基于所述N个样本集,分别对Q个神经网络进行训练之前,所述方法还包括:Before said training of Q neural networks based on said N sample sets, said method also includes:
    获取所述M张第一图像中的人脸元素对应的R个区域尺寸参数,每个区域尺寸参数分别为:一张第一图像中的人脸元素所处区域的尺寸参数,R为正整数,R大于等于M;Obtain R area size parameters corresponding to the face elements in the M first images, each area size parameter is: a size parameter of the area where the face elements in the first image are located, and R is a positive integer , R is greater than or equal to M;
    根据所述M个环境参数和所述R个区域尺寸参数,确定所述Q个神经网络;determining the Q neural networks according to the M environmental parameters and the R area size parameters;
    其中,一个神经网络对应:至少一个环境参数和至少一个区域尺寸参数。Wherein, a neural network corresponds to: at least one environment parameter and at least one area size parameter.
  4. 根据权利要求3所述的方法,其中,所述Q个神经网络中,复杂度大的神经网络对应的目标参数,大于复杂度小的神经网络对应的目标参数;The method according to claim 3, wherein, among the Q neural networks, the target parameter corresponding to the neural network with high complexity is greater than the target parameter corresponding to the neural network with small complexity;
    其中,所述目标参数包括:环境参数和区域尺寸参数。Wherein, the target parameters include: environment parameters and area size parameters.
  5. 根据权利要求3所述的方法,其中,每个样本集分别对应至少两个神经网络;The method according to claim 3, wherein each sample set corresponds to at least two neural networks;
    所述根据所述M个环境参数和所述R个区域尺寸参数,确定所述Q个神经网络,包括:The determining the Q neural networks according to the M environmental parameters and the R area size parameters includes:
    根据第一环境参数和第一区域尺寸参数,确定第一神经网络;determining a first neural network according to the first environment parameter and the first area size parameter;
    其中,所述第一环境参数为:所述N个样本集中,任一个样本集中的第一图像的环境参数中的;所述第一区域尺寸参数为:所述任一个样本集中的第一图像对应的区域尺寸参数中的;Wherein, the first environmental parameter is: among the environmental parameters of the first image in any one of the N sample sets; the first area size parameter is: the first image in any one of the sample sets In the corresponding area size parameter;
    所述第一神经网络为:所述任一个样本集对应的神经网络中的。The first neural network is: one of the neural networks corresponding to any one sample set.
  6. 一种图像处理方法,应用于电子设备,所述电子设备包括如权利要求1至5中任一项所述的神经网络训练方法训练后的Q个神经网络,Q为正整数;所述方法包括:An image processing method applied to an electronic device, the electronic device comprising Q neural networks trained by the neural network training method according to any one of claims 1 to 5, where Q is a positive integer; the method includes :
    在显示所述电子设备的摄像头采集的预览图像的情况下,根据所述预览图像的目标环境参数,和所述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络;In the case of displaying the preview image collected by the camera of the electronic device, according to the target environment parameters of the preview image and the target area size parameters corresponding to the face elements in the preview image, Q neural networks after training , determine the target neural network;
    将所述摄像头拍摄的第三图像输入所述目标神经网络进行图像处理,得到处理后的图像,所述第三图像为:所述摄像头在预定时间段内拍摄的图像,所述预定时间段为:所述摄像头采集所述预览图像的时刻至所述摄像头停止采集预览图像的时刻之间的时间段。Inputting the third image captured by the camera into the target neural network for image processing to obtain a processed image, the third image is: an image captured by the camera within a predetermined time period, and the predetermined time period is : the time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
  7. 根据权利要求6所述的方法,其中,所述根据所述预览图像的目标环境参数,和所述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络之前,所述方法还包括:The method according to claim 6, wherein, according to the target environment parameters of the preview image, and the target area size parameters corresponding to the human face elements in the preview image, it is determined from Q neural networks after training Before producing the target neural network, the method also includes:
    在所述预览图像包含人脸元素的情况下,获取目标环境参数和所述人脸元素对应的目标区域尺寸参数。In the case that the preview image contains a human face element, the target environment parameter and the target area size parameter corresponding to the human face element are acquired.
  8. 根据权利要求6所述的方法,其中,所述根据所述预览图像的目标环境参数,和所述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络,包括:The method according to claim 6, wherein, according to the target environment parameters of the preview image, and the target area size parameters corresponding to the human face elements in the preview image, it is determined from Q neural networks after training The target neural network, including:
    基于预存的Q个对应关系,确定所述目标环境参数和所述目标区域尺寸参数所对应的所述目标神经网络;Based on the pre-stored Q correspondences, determine the target neural network corresponding to the target environment parameter and the target area size parameter;
    其中,每个对应关系分别为:至少一个环境参数、至少一个区域尺寸参数和一个训练后的神经网络间的对应关系。Wherein, each corresponding relationship is respectively: a corresponding relationship between at least one environment parameter, at least one region size parameter and a trained neural network.
  9. 一种神经网络训练装置,所述装置包括:确定模块、处理模块、生成模块和训练模块,其中:A neural network training device, said device comprising: a determination module, a processing module, a generation module and a training module, wherein:
    所述确定模块,用于根据获取的M张第一图像的M个环境参数,确定N个退化程度,一个退化程度对应至少一个环境参数,一个退化程度对应至少一张第一图像,M、N均为正整数;The determination module is configured to determine N degradation degrees according to the acquired M environmental parameters of the M first images, one degradation degree corresponds to at least one environmental parameter, one degradation degree corresponds to at least one first image, M, N are positive integers;
    所述处理模块,用于基于所述确定模块确定的每个退化程度,对所述每个退化程度对应的第一图像分别进行退化处理,得到所述每个退化程度对应的第二图像,每个第二图像分别对应一个第一图像;The processing module is configured to perform degradation processing on the first image corresponding to each degradation degree based on each degradation degree determined by the determination module, to obtain a second image corresponding to each degradation degree, and each The second images respectively correspond to a first image;
    所述生成模块,用于基于所述处理模块得到的每个退化程度对应的第一图像和第二图像,分别生成一个样本集,得到N个样本集;The generation module is configured to generate a sample set based on the first image and the second image corresponding to each degree of degradation obtained by the processing module to obtain N sample sets;
    所述训练模块,用于基于所述生成模块得到的所述N个样本集,分别对Q个神经网络进行训练,一个样本集对应至少一个神经网络,Q为正整数。The training module is configured to respectively train Q neural networks based on the N sample sets obtained by the generating module, one sample set corresponds to at least one neural network, and Q is a positive integer.
  10. 一种图像处理装置,其中,所述装置包括如权利要求1至5中任一项所述的神经网络训练方法训练后的Q个神经网络,Q为正整数;所述装置包括:确定模块和处 理模块,其中:An image processing device, wherein the device comprises Q neural networks trained by the neural network training method according to any one of claims 1 to 5, and Q is a positive integer; the device comprises: a determination module and processing module, where:
    所述确定模块,用于在显示所述电子设备的摄像头采集的预览图像的情况下,根据所述预览图像的目标环境参数,和所述预览图像中人脸元素对应的目标区域尺寸参数,从训练后的Q个神经网络中,确定出目标神经网络;The determination module is configured to, in the case of displaying a preview image collected by the camera of the electronic device, according to the target environment parameter of the preview image and the target area size parameter corresponding to the human face element in the preview image, from Determine the target neural network among the Q neural networks after training;
    所述处理模块,用于将所述摄像头拍摄的第三图像输入所述确定模块确定的所述目标神经网络进行图像处理,得到处理后的图像,所述第三图像为:所述摄像头在预定时间段内拍摄的图像,所述预定时间段为:所述摄像头采集所述预览图像的时刻至所述摄像头停止采集预览图像的时刻之间的时间段。The processing module is configured to input the third image captured by the camera into the target neural network determined by the determination module for image processing to obtain a processed image, and the third image is: The predetermined time period is a time period between the moment when the camera captures the preview image and the moment when the camera stops capturing the preview image.
  11. 一种电子设备,包括处理器,存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令,所述程序或指令被所述处理器执行时实现如权利要求1-5任一项所述的神经网络训练方法的步骤,或如权利要求6-8任一项所述的图像处理方法的步骤。An electronic device, comprising a processor, a memory, and a program or instruction stored on the memory and operable on the processor, when the program or instruction is executed by the processor, claims 1-5 are realized The step of the neural network training method described in any one, or the step of the image processing method as described in any one of claims 6-8.
  12. 一种可读存储介质,所述可读存储介质上存储程序或指令,所述程序或指令被处理器执行时实现如权利要求1-5任一项所述的神经网络训练方法的步骤,或如权利要求6-8任一项所述的图像处理方法的步骤。A readable storage medium, storing programs or instructions on the readable storage medium, and implementing the steps of the neural network training method according to any one of claims 1-5 when the programs or instructions are executed by the processor, or The steps of the image processing method according to any one of claims 6-8.
  13. 一种神经网络训练装置,其特征在于,包括所述装置被配置成用于执行如权利要求1至5中任一项所述的神经网络训练方法。A neural network training device, characterized in that the device is configured to execute the neural network training method according to any one of claims 1 to 5.
  14. 一种图像处理装置,其特征在于,包括所述装置被配置成用于执行如权利要求6至8中任一项所述的图像处理方法。An image processing device, characterized in that the device is configured to execute the image processing method according to any one of claims 6 to 8.
  15. 一种计算机程序产品,其特征在于,所述程序产品被至少一个处理器执行以实现如权利要求1至5任一项所述的神经网络训练方法,或如权利要求6-8任一项所述的图像处理方法。A computer program product, characterized in that the program product is executed by at least one processor to implement the neural network training method according to any one of claims 1 to 5, or according to any one of claims 6-8 The image processing method described above.
  16. 一种芯片,其特征在于,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如权利要求1至5任一项所述的神经网络训练方法,或如权利要求6-8任一项所述的图像处理方法。A chip, characterized in that the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the process described in any one of claims 1 to 5. The neural network training method described above, or the image processing method as described in any one of claims 6-8.
PCT/CN2022/106274 2021-07-23 2022-07-18 Neural network training method and apparatus, and electronic device WO2023001110A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110838140.6 2021-07-23
CN202110838140.6A CN113706402A (en) 2021-07-23 2021-07-23 Neural network training method and device and electronic equipment

Publications (1)

Publication Number Publication Date
WO2023001110A1 true WO2023001110A1 (en) 2023-01-26

Family

ID=78650358

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/106274 WO2023001110A1 (en) 2021-07-23 2022-07-18 Neural network training method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN113706402A (en)
WO (1) WO2023001110A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113706402A (en) * 2021-07-23 2021-11-26 维沃移动通信(杭州)有限公司 Neural network training method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109285119A (en) * 2018-10-23 2019-01-29 百度在线网络技术(北京)有限公司 Super resolution image generation method and device
CN111105375A (en) * 2019-12-17 2020-05-05 北京金山云网络技术有限公司 Image generation method, model training method and device thereof, and electronic equipment
CN111950693A (en) * 2019-05-14 2020-11-17 辉达公司 Neural network inference using attenuation parameters
US20210073945A1 (en) * 2019-09-11 2021-03-11 Lg Electronics Inc. Method and apparatus for enhancing image resolution
CN113706402A (en) * 2021-07-23 2021-11-26 维沃移动通信(杭州)有限公司 Neural network training method and device and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109285119A (en) * 2018-10-23 2019-01-29 百度在线网络技术(北京)有限公司 Super resolution image generation method and device
CN111950693A (en) * 2019-05-14 2020-11-17 辉达公司 Neural network inference using attenuation parameters
US20210073945A1 (en) * 2019-09-11 2021-03-11 Lg Electronics Inc. Method and apparatus for enhancing image resolution
CN111105375A (en) * 2019-12-17 2020-05-05 北京金山云网络技术有限公司 Image generation method, model training method and device thereof, and electronic equipment
CN113706402A (en) * 2021-07-23 2021-11-26 维沃移动通信(杭州)有限公司 Neural network training method and device and electronic equipment

Also Published As

Publication number Publication date
CN113706402A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
CN110059642B (en) Face image screening method and device
CN111327824B (en) Shooting parameter selection method and device, storage medium and electronic equipment
CN111667420B (en) Image processing method and device
CN104349080B (en) A kind of image processing method and electronic equipment
CN109035147B (en) Image processing method and device, electronic device, storage medium and computer equipment
CN111047543A (en) Image enhancement method, device and storage medium
Peng et al. LVE-S2D: Low-light video enhancement from static to dynamic
CN112308797B (en) Corner detection method and device, electronic equipment and readable storage medium
CN111985281A (en) Image generation model generation method and device and image generation method and device
CN109816694A (en) Method for tracking target, device and electronic equipment
CN104869309A (en) Shooting method and shooting apparatus
CN113160231A (en) Sample generation method, sample generation device and electronic equipment
CN109961403B (en) Photo adjusting method and device, storage medium and electronic equipment
WO2023001110A1 (en) Neural network training method and apparatus, and electronic device
CN112422798A (en) Photographing method and device, electronic equipment and storage medium
CN105338221B (en) A kind of image processing method and electronic equipment
WO2023011280A1 (en) Image noise degree estimation method and apparatus, and electronic device and storage medium
CN115439386A (en) Image fusion method and device, electronic equipment and storage medium
CN113989387A (en) Camera shooting parameter adjusting method and device and electronic equipment
CN112734658A (en) Image enhancement method and device and electronic equipment
CN115115526A (en) Image processing method and apparatus, storage medium, and graphic calculation processor
CN114143448B (en) Shooting method, shooting device, electronic equipment and readable storage medium
CN112714246A (en) Continuous shooting photo obtaining method, intelligent terminal and storage medium
US9135687B2 (en) Threshold setting apparatus, threshold setting method and recording medium in which program for threshold setting method is stored
CN115037867B (en) Shooting method, shooting device, computer readable storage medium and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22845275

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE