Image processing method, device and electronic equipment
By segmenting images and assigning scene weights, the problem of poor performance of deep learning network models in processing images beyond a fixed noise distribution or blur level is solved, and high-resolution images with better effects can be generated.
Patent Information
- Application Number
- CN202110587606.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-27
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-05-27
AI Technical Summary
Deep learning network models are less effective at generating high-resolution images when processing low-resolution images with noise distribution or blur levels beyond a fixed level.
By performing scene segmentation on the target image, each scene is obtained and a weight map is generated according to the scene weight, which is input to the network model to generate high-resolution images, and guides the model to generate images with different strengths and weaknesses of details.
The image generation effect is improved, enabling the model to process low-resolution images with different noise distributions and blur levels, and generate better high-resolution images.
Smart Images

Figure CN113313630B
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and specifically relates to an image processing method, device and electronic equipment. Background Art
[0002] Training deep learning network models requires constructing sample images. Common construction methods include acquisition and degradation.
[0003] Among them, constructing a sample image through a degradation method requires collecting a high-resolution image and then performing a degradation operation on the image to generate a low-resolution image.
[0004] Since the same degradation model is used for each training, the noise distribution and blur level of the generated images are at a fixed level, so that the deep learning network model can only process low-resolution images whose noise distribution and blur level are below this fixed level.
[0005] When the noise distribution or blur level of an image exceeds the above fixed level, the high-resolution image output by the deep learning network model will be poor. Summary of the invention
[0006] The purpose of the embodiments of the present application is to provide an image processing method, device and electronic device that can solve the problem of poor image effects generated by a network model trained with a degradation model.
[0007] In a first aspect, an embodiment of the present application provides an image processing method, the method comprising:
[0008] Performing scene segmentation on the target image to obtain each scene contained in the target image;
[0009] Generate a first weight map according to scene weights corresponding to each scene included in the target image;
[0010] Inputting the target image and the first weight map into a target network model to generate a target high-resolution image;
[0011] Wherein, the target image is a low-resolution image to be processed.
[0012] In a second aspect, an embodiment of the present application provides an image processing device, the device comprising:
[0013] An acquisition module, used to perform scene segmentation on a target image and acquire each scene contained in the target image;
[0014] A weight map generation module, used to generate a first weight map according to scene weights corresponding to each scene contained in the target image;
[0015] A generating module, used for inputting the target image and the first weight map into a target network model to generate a target high-resolution image;
[0016] Wherein, the target image is a low-resolution image to be processed.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0018] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or 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.
[0019] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the method described in the first aspect.
[0020] The image processing method, device and electronic device provided in the embodiments of the present application introduce scene segmentation into the degradation model and assign scene weights to different scenes to guide the target network model to generate images with different strong and weak details, thereby improving the effect of the generated image. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a flowchart of an image processing method according to an embodiment of the present application;
[0022] Figure 2 is a schematic diagram of a model training process of an image processing method according to an embodiment of the present application;
[0023] Figure 3 is a module block diagram of an image processing device provided according to an embodiment of the present application;
[0024] Figure 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
[0025] Figure 5 It is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0028] The image processing method, device and electronic device provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0029] Figure 1 This is a flow chart of the image processing method provided in the embodiment of the present application. Figure 1 , the present application embodiment provides an image processing method, which may include:
[0030] Step 110: performing scene segmentation on the target image to obtain each scene contained in the target image;
[0031] Step 120: Generate a first weight map according to the scene weights corresponding to the scenes included in the target image;
[0032] Step 130: input the target image and the first weight map into the target network model to generate a target high-resolution image;
[0033] Wherein, the target image is a low-resolution image to be processed.
[0034] It should be noted that the execution subject of the image processing method provided in the embodiment of the present application can be an intelligent electronic device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc.
[0035] The following uses a computer as an execution subject to implement the image processing method provided in the embodiment of the present application as an example to describe in detail the technical solution of the present application.
[0036] Optionally, in step 110, the computer may use a deep learning algorithm to design a segmentation network, and then use the segmentation network to perform scene segmentation on the target image to obtain various scenes contained in the target image. The scene may include, for example, the sky, green plants, buildings, portraits, electronic screens, water surfaces, flowers, etc. The type of scene can be determined according to actual needs, and the embodiments of the present application do not specifically limit this.
[0037] Optionally, the target image may be an image captured by a camera, or may be a downloaded image, or may be an image sent by another terminal, which is not specifically limited in the embodiment of the present application. .
[0038] Optionally, in step 120, the computer may assign corresponding scene weights to each scene included in the target image. Since the details of different scenes are different, different scenes have different corresponding weights. For example, the sky area has fewer details, that is, the corresponding scene weight assigned is smaller, and the details of the sky in the generated target image will be weakened; while green plants belong to scenes with stronger textures, that is, the corresponding scene weight assigned is larger, and the details of the green plants in the generated target image will be enhanced.
[0039] After assigning corresponding scene weights to each scene included in the target image, a first weight map can be generated according to the scene weights corresponding to each scene included in the target image. The first weight map can represent each scene included in the target image and the scene weights corresponding to each scene in the form of a vector, for example.
[0040] Optionally, in step 130, the target network model may link the first weight map with the target image, so that the first weight map serves as a guide map to guide the target network model to assign corresponding scene weights to each scene contained in the target image when performing network inference, thereby generating a target high-resolution image.
[0041] The target image may be a low-resolution image to be processed. The target network model may be, for example, a super-resolution network, a network based on a GAN (Generative Adversarial Network) framework, or the like.
[0042] The image processing method provided in the embodiment of the present application introduces scene segmentation into the degradation model and assigns scene weights to different scenes to guide the target network model to generate images with different strong and weak details, thereby improving the image effect.
[0043] In one embodiment, before step 110, the image processing method provided by the embodiment of the present application may further include:
[0044] Step 101: Segment the high-resolution image into scenes to obtain the scenes contained in the high-resolution image;
[0045] Step 102: Determine a second weight map according to the scene weights corresponding to the various scenes included in the high-resolution image;
[0046] Step 103: performing data degradation on the high-resolution image based on the second weight map to generate a low-resolution image;
[0047] Step 104: input the low-resolution image and the second weight map into the initial network model for training to obtain a target network model.
[0048] like Figure 2 As shown, optionally, in step 101, the high-resolution image can be segmented by a segmentation network, different segmentation scenes can be marked with different colors, and scenes can be classified according to the type of each pixel in the high-resolution image.
[0049] Optionally, in step 102, different scene weights may be assigned to different types of scenes in the high-resolution image. For example, for images that use blue areas, purple areas, green areas, and other areas to mark different scenes, the scene weights are assigned as follows: 0.1 for the blue area, 0.5 for the purple area, 0.8 for the green area, and 0.5 for the other areas. For images classified using specific scenes, the scene weights are assigned as follows: 0.1 for the sky, 0.9 for green plants, 0.5 for buildings, 0.6 for portraits, 0.5 for electronic screens, 0.2 for water surfaces, and 0.8 for flowers. The above-mentioned areas of different colors and specific scenes are used only as examples and are not specifically limited in the embodiments of the present application.
[0050] After determining the scene weights corresponding to the scenes included in the high-resolution image, a second weight map can be generated based on the scene weights corresponding to the scenes included in the high-resolution image. The second weight map can represent the scenes included in the high-resolution image and the scene weights corresponding to the scenes in the form of vectors, for example.
[0051] Optionally, in step 103, data degradation may be performed on the high-resolution image according to the weights corresponding to the various scenes included in the high-resolution image in the second weight map, thereby generating a low-resolution image.
[0052] Optionally, in step 104, the initial network model may link the second weight map with the low-resolution image, so that the second weight map serves as a guide map to guide the initial network model to assign corresponding scene weights to each scene contained in the low-resolution image during training.
[0053] By training the initial network model multiple times, the various model parameters required for the target network model can be determined, and then the final target network model can be obtained.
[0054] The image processing method provided in the embodiment of the present application generates a second weight map through scene segmentation, and then performs initial network model training based on the second weight map and the low-resolution image after data degradation. This allows the target network model obtained by the initial network model training to generate images with different strengths and weaknesses of details according to different degradation schemes, thereby further improving the image effect.
[0055] In one embodiment, the scene weight may include any of the following:
[0056] Preset scene weights;
[0057] The scene weights are determined according to a preset method;
[0058] The scene weights determined in a preset manner may include:
[0059] Obtaining a first average value of characteristic parameters of the plurality of sample images and a second average value of characteristic parameters of each scene included in the plurality of sample images;
[0060] Determining a scene weight corresponding to each scene according to a ratio of the second average value to the first average value;
[0061] The sample image is a historically collected image; the characteristic parameters include at least one of the following: noise level, brightness and clarity.
[0062] Optionally, the scene weight can be determined as follows:
[0063] Method 1: Preset scene weights, that is, according to the details of different scenes in the image, different scene weights are set based on experience. For example, the sky area has fewer details, and the details of the sky area in the target generated image can be weakened, so the scene weight of the sky area is set to 0.1; while the green plants contain details with strong textures, and the details of the sky area in the target generated image can be enhanced, so the scene weight of the sky area is set to 0.9.
[0064] Method 2: The scene weight is determined according to a preset method, that is, the historically collected images are used as sample images and determined according to the average value of the image feature parameters.
[0065] Optionally, first determine a first average value of characteristic parameters of multiple sample images, that is, the first average value is obtained based on the characteristic parameters of the sample images as a whole; perform scene segmentation on multiple sample images to obtain each scene contained in the sample images; then determine a second average value of characteristic parameters corresponding to each scene, that is, the second average value is obtained based on the characteristic parameters of scene images corresponding to each scene in the sample images. Finally, the ratio of the second average value to the first average value is used as the scene weight corresponding to each scene.
[0066] Optionally, N historically collected images are selected as sample images, and the scene weights of various scenes included in the sample images are determined according to parameter values of noise level, brightness, and clarity of the N sample images:
[0067] First, determine the average value of the noise level, brightness and clarity of N sample images as M, and then determine the average value of the noise level, brightness and clarity of each scene. For example: The average value of the noise level, brightness and clarity of scene 1 is M 1 , the average values of noise level, brightness and clarity of scene 2 are M 2 , then the scene weight of scene 1 is M 1 / M, the scene weight of scene 2 is M 2 / M. The embodiment of the present application does not specifically limit the number of sample images, the parameter values corresponding to the feature parameters, and the specific scenes included in the sample images.
[0068] For example, 100 sample images are selected, the average value of the noise level, brightness and clarity of the sample images is 10, and the sample images contain two scenes: sky and green plants. The average value of the noise level, brightness and clarity of the sky is 1, and the average value of the noise level, brightness and clarity of the green plants is 9. The scene weight of the sky is 0.1, and the scene weight of the green plants is 0.9.
[0069] Optionally, the average value of the noise level in the sample image may be obtained as A, the average value of the brightness as B, and the average value of the clarity as C; and then the average value of the characteristic parameters of each scene contained in the sample image may be determined. For example, the average value of the noise level of scene 1 is A. 1 The average brightness is B 1 The average clarity is C 1 , then the weight coefficient of scenario 1 = A 1 / A+B 1 / B+C 1 / C; the average noise level of scene 2 is A 2 The average brightness is B 2 The average clarity is C 2 , then the weight coefficient of scenario 2 = A 2 / A+B 2 / B+C 2 / C. The embodiment of the present application does not specifically limit the number of sample images, the parameter values corresponding to the feature parameters, and the specific scenes included in the sample images.
[0070] For example, 100 sample images are selected, the average noise level of the sample images is 5, the average brightness is 10, and the average clarity is 15. The sample images contain two scenes: sky and green plants. The average noise level of the sky is 1 / 6, the average brightness is 1 / 3, and the average clarity is 1 / 2. The scene weight of the sky is 0.1; the average noise level of the green plants is 2, the average brightness is 3, and the average clarity is 3. The scene weight of the green plants is 0.9.
[0071] Optionally, N historically collected images may be selected as sample images, and the scene weights of the various scenes contained in the sample images may be determined based on a certain characteristic parameter of the N sample images. The characteristic parameter may be one of noise level, clarity, or brightness. For example, the average noise level of the sample images is determined to be S, and then the average noise level of each scene is determined. Among them, the noise level of scene 1 is S1, and the scene weight of scene 1 is S 1 / S; the noise level of scene 2 is S 2 , then the scene weight of scene 2 is S 2 / S. The embodiment of the present application does not specifically limit the number of sample images, feature parameters and corresponding parameter values, and specific scenes included in the sample images.
[0072] For example, 100 sample images are selected, the average noise level of the sample images is 5, and the sample images contain two scenes: sky and green plants. The average noise level of the sky is 0.5, and the average noise level of the green plants is 4.5. The scene weight of the sky is 0.1, and the scene weight of the green plants is 0.9.
[0073] The image processing method provided in the embodiment of the present application determines the scene weights corresponding to different scenes through the various methods mentioned above, so as to ensure that the high-resolution images generated according to the scene weights in various scenes can reflect details of different strengths, thereby ensuring the stable improvement of image effects.
[0074] In one embodiment, the image processing method provided in the embodiment of the present application may further include:
[0075] When the difference between the scene weight corresponding to the first scene and the scene weight corresponding to the second scene exceeds a preset threshold, a transition zone is set along the connection between the first scene and the second scene;
[0076] The scene weight corresponding to the transition zone is the average of the scene weight corresponding to the first scene and the scene weight corresponding to the second scene;
[0077] The first scene is adjacent to the second scene.
[0078] For example, for adjacent first and second scenes, if the difference between the scene weights of the two scenes exceeds a preset threshold, a transition zone may be set at the connection between the first scene and the second scene.
[0079] Among them, the specific size of the preset threshold can be, for example, 0.5, 0.6, 0.7, etc., and its specific size can be adjusted according to actual needs, and the embodiment of the present application does not make specific limitations on this.
[0080] Assuming that the scene weight of the first scene is 0.1, the scene weight of the second scene is 0.8, and the difference between the two is 0.7, which exceeds the preset threshold value of 0.5, a transition zone can be set at the connection between the first scene and the second scene. The scene weight of the transition zone is 0.45, which is the average value of the scene weight of the first scene (0.1) and the scene weight of the second scene (0.8).
[0081] It is understandable that, for adjacent first scenes and second scenes, if the difference between the weights of the two scenes is too large, the resulting image may have a large difference (eg, a large color difference, etc.).
[0082] Therefore, by setting a transition zone at the connection of adjacent scenes when the difference in weights of adjacent scenes exceeds a certain value, it is possible to avoid the situation where the final image has a large difference. This ensures that while images with different strengths and details are generated, the images of each scene can be naturally integrated to achieve a smooth image effect.
[0083] In one embodiment, performing data degradation on the high-resolution image based on the second weight map may include:
[0084] The second weight map is fused with the high-resolution image, and at least one of the following operations is performed on the fused high-resolution image:
[0085] Noise processing;
[0086] Blurring;
[0087] Resize the image.
[0088] Optionally, the scene segmentation weight value of each pixel point can be determined according to the fused high-resolution image. For example, a coordinate system is established according to the high-resolution image, and W(x, y) is used as the scene segmentation weight of the point (x, y).
[0089] Optionally, the fused high-resolution image may be associated with the high-resolution image before fusion, and data degradation may be performed. The data degradation may include at least one of noise addition, blurring, and image size adjustment.
[0090] For the noise addition process, assuming that sigma is the random noise variance of the original image (the high-resolution image before fusion), the product of W(x, y) and sigma can be used as the random noise variance for data degradation;
[0091] For blur processing, assuming that kernel is a random blur kernel of the original image, the product of W(x, y) and kernel can be used as the random blur kernel for data degradation.
[0092] For the image resizing operation, the fused high-resolution image can be randomly scaled.
[0093] The image processing method provided in the embodiment of the present application can output low-resolution images with different noise distributions and blur levels by performing data degradation on the fused high-resolution image, so that the target network model can process low-resolution images with different noise distributions and blur levels, thereby generating high-resolution images with better effects.
[0094] It should be noted that the image processing method provided in the embodiment of the present application can 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 provided in the embodiment of the present application is described by taking the image processing device executing the image processing method as an example.
[0095] Figure 3 is a module block diagram of an image processing device provided according to an embodiment of the present application. Figure 3 , an embodiment of the present application provides an image processing device, which may include:
[0096] An acquisition module 310 is used to perform scene segmentation on a target image to acquire each scene contained in the target image;
[0097] A weight map generating module 320, configured to generate a first weight map according to scene weights corresponding to each scene included in the target image;
[0098] A generating module 330, configured to input the target image and the first weight map into a target network model to generate a target high-resolution image;
[0099] Wherein, the target image is a low-resolution image to be processed.
[0100] The image processing device provided in the embodiment of the present application introduces scene segmentation into the degradation model and assigns scene weights to different scenes to guide the target network model to generate images with different strong and weak details, thereby improving the image effect.
[0101] In one embodiment, the image processing apparatus provided in the embodiment of the present application may further include a training module (not shown) for:
[0102] Performing scene segmentation on the high-resolution image to obtain each scene contained in the high-resolution image;
[0103] Determining a second weight map according to scene weights corresponding to respective scenes included in the high-resolution image;
[0104] Performing data degradation on the high-resolution image based on the second weight map to generate a low-resolution image;
[0105] The low-resolution image and the second weight map are input into an initial network model for training to determine the target network model.
[0106] In one embodiment, the scene weight includes any one of the following:
[0107] Preset scene weights;
[0108] The scene weights are determined according to a preset method;
[0109] Among them, the scene weights determined according to the preset method include:
[0110] Obtaining a first average value of characteristic parameters of a plurality of sample images and a second average value of characteristic parameters of each scene included in the plurality of sample images;
[0111] Determining a scene weight corresponding to each scene according to a ratio of the second average value to the first average value;
[0112] The sample image is a historically collected image; the characteristic parameter includes at least one of the following: noise level, brightness and clarity.
[0113] In one embodiment, the image processing device provided in the embodiment of the present application may further include a transition module (not shown) for:
[0114] When the difference between the scene weight corresponding to the first scene and the scene weight corresponding to the second scene exceeds a preset threshold, setting a transition zone along the connection between the first scene and the second scene;
[0115] The scene weight corresponding to the transition zone is an average of the scene weight corresponding to the first scene and the scene weight corresponding to the second scene;
[0116] The first scene is adjacent to the second scene.
[0117] In one embodiment, the training module is specifically used to:
[0118] The second weight map is fused with the high-resolution image, and at least one of the following operations is performed on the fused high-resolution image:
[0119] Noise processing;
[0120] Blurring;
[0121] Resize the image.
[0122] The image processing device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0123] The image processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0124] The image processing device provided in the embodiment of the present application can achieve Figure 1 and Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0125] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a program or instruction stored in the memory 402 and executable on the processor 401. When the program or instruction is executed by the processor 401, each process of the above-mentioned image processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0126] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0127] Figure 5A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0128] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.
[0129] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0130] The processor 510 is configured to:
[0131] Performing scene segmentation on the target image to obtain each scene contained in the target image;
[0132] Generate a first weight map according to scene weights corresponding to each scene included in the target image;
[0133] Inputting the target image and the first weight map into a target network model to generate a target high-resolution image;
[0134] Wherein, the target image is a low-resolution image to be processed.
[0135] The electronic device provided in the embodiment of the present application introduces scene segmentation in the degradation model and assigns scene weights to different scenes to guide the target network model to generate images with different strong and weak details, thereby improving the image effect.
[0136] Optionally, the processor 510 is further configured to:
[0137] Performing scene segmentation on the high-resolution image to obtain each scene contained in the high-resolution image;
[0138] Determining a second weight map according to scene weights corresponding to respective scenes included in the high-resolution image;
[0139] Performing data degradation on the high-resolution image based on the second weight map to generate a low-resolution image;
[0140] The low-resolution image and the second weight map are input into an initial network model for training to obtain the target network model.
[0141] Optionally, the scene weight includes any one of the following:
[0142] Preset scene weights;
[0143] The scene weights are determined according to a preset method;
[0144] Among them, the scene weights determined according to the preset method include:
[0145] Obtaining a first average value of characteristic parameters of a plurality of sample images and a second average value of characteristic parameters of each scene included in the plurality of sample images;
[0146] Determining a scene weight corresponding to each scene according to a ratio of the second average value to the first average value;
[0147] The sample image is a historically collected image; the characteristic parameter includes at least one of the following: noise level, brightness and clarity.
[0148] Optionally, the processor 510 is further configured to:
[0149] When the difference between the scene weight corresponding to the first scene and the scene weight corresponding to the second scene exceeds a preset threshold, setting a transition zone along the connection between the first scene and the second scene;
[0150] The scene weight corresponding to the transition zone is an average of the scene weight corresponding to the first scene and the scene weight corresponding to the second scene;
[0151] The first scene is adjacent to the second scene.
[0152] Optionally, the processor 510 is specifically configured to:
[0153] The second weight map is fused with the high-resolution image, and at least one of the following operations is performed on the fused high-resolution image:
[0154] Noise processing;
[0155] Blurring;
[0156] Resize the image.
[0157] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (Graphics Processing Unit, GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include but are not limited to a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 509 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 510 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, the user interface, and the application program, etc., and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 510.
[0158] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned image method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0159] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0160] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned image processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0161] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0162] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the 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, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0163] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0164] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. An image processing method, characterized in that: include: Performing scene segmentation on the target image to obtain each scene contained in the target image; Generate a first weight map according to scene weights corresponding to each scene included in the target image; Inputting the target image and the first weight map into a target network model to generate a target high-resolution image; Wherein, the target image is a low-resolution image to be processed; Before performing scene segmentation on the target image, the method further includes: Performing scene segmentation on the high-resolution image to obtain each scene contained in the high-resolution image; Determining a second weight map according to scene weights corresponding to respective scenes included in the high-resolution image; Performing data degradation on the high-resolution image before scene segmentation based on the second weight map to generate a low-resolution image; Inputting the low-resolution image and the second weight map into an initial network model for training to obtain the target network model; The scene weights include: The scene weights are determined according to a preset method; Among them, the scene weights determined according to the preset method include: Obtaining a first average value of characteristic parameters of a plurality of sample images and a second average value of characteristic parameters of each scene included in the plurality of sample images; Determining a scene weight corresponding to each scene according to a ratio of the second average value to the first average value; The sample image is a historically collected image; the characteristic parameter includes at least one of the following: noise level, brightness and clarity.
2. The image processing method according to claim 1, characterized in that: Also includes: When the difference between the scene weight corresponding to the first scene and the scene weight corresponding to the second scene exceeds a preset threshold, setting a transition zone along the connection between the first scene and the second scene; The scene weight corresponding to the transition zone is an average of the scene weight corresponding to the first scene and the scene weight corresponding to the second scene; The first scene is adjacent to the second scene.
3. The image processing method according to claim 2, characterized in that: The performing data degradation on the high-resolution image before scene segmentation based on the second weight map includes: The second weight map is fused with the high-resolution image, and at least one of the following operations is performed on the fused high-resolution image: Noise processing; Blurring; Resize the image.
4. An image processing device, characterized in that: include: An acquisition module, used to perform scene segmentation on a target image and acquire each scene contained in the target image; A weight map generation module, used to generate a first weight map according to scene weights corresponding to each scene contained in the target image; A generating module, used for inputting the target image and the first weight map into a target network model to generate a target high-resolution image; Wherein, the target image is a low-resolution image to be processed; Also includes training modules for: Performing scene segmentation on the high-resolution image to obtain each scene contained in the high-resolution image; Determining a second weight map according to scene weights corresponding to respective scenes included in the high-resolution image; Performing data degradation on the high-resolution image before scene segmentation based on the second weight map to generate a low-resolution image; Inputting the low-resolution image and the second weight map into an initial network model for training to determine the target network model; The scene weights include: The scene weights are determined according to a preset method; Among them, the scene weights determined according to the preset method include: Obtaining a first average value of characteristic parameters of a plurality of sample images and a second average value of characteristic parameters of each scene included in the plurality of sample images; Determining a scene weight corresponding to each scene according to a ratio of the second average value to the first average value; The sample image is a historically collected image; the characteristic parameter includes at least one of the following: noise level, brightness and clarity.
5. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the image processing method according to any one of claims 1 to 3.
6. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the image processing method according to any one of claims 1 to 3 are implemented.
