Image enhancement method and device
By adjusting image pixel values and feature extraction, combined with semantic segmentation and feature fusion, the problem of unsatisfactory image quality enhancement processing is solved, better image brightness, color and contrast improvements are achieved, ghosting is reduced, and image display is improved Effect.
Patent Information
- Application Number
- CN201910831006.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-09-04
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2039-09-04
AI Technical Summary
The existing technology has unsatisfactory effects in image quality enhancement processing, and it is difficult to effectively improve the brightness, color, contrast, saturation and other indicators of the image, resulting in poor image display effects.
By adjusting the pixel values of the image to be processed, multiple images with different pixel values are generated, and these images are used to extract local and global features, perform image enhancement processing, and combine semantic segmentation and feature fusion to improve image quality.
It improves the effect of image quality enhancement processing, enhances the brightness, color and contrast of the image, reduces ghosting, reflects more natural lighting and semantic differences, and improves the image display effect.
Smart Images

Figure CN112446834B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and more specifically, to an image enhancement method and apparatus. Background Art
[0002] Computer vision is an integral component of intelligent and autonomous systems in various fields, including manufacturing, inspection, document analysis, medical diagnosis, and the military. It involves using cameras and computers to acquire the data and information we need about the objects being photographed. Figuratively speaking, it's like equipping computers with eyes (cameras) and brains (algorithms) to replace the human eye in identifying, tracking, and measuring objects, thus enabling computers to perceive their environment. Because perception can be viewed as extracting information from sensory signals, computer vision can also be considered the study of how artificial systems can "perceive" from images or multidimensional data. In short, computer vision uses various imaging systems to replace the visual organs to acquire input information, and then computers replace the brain to process and interpret this input information. The ultimate goal of computer vision research is to enable computers to observe and understand the world through vision like humans do, and to have the ability to autonomously adapt to their environments.
[0003] In the field of computer vision, image quality enhancement is often required for digital images. For example, in various application scenarios such as mobile phone photography, autonomous driving, and safe cities, image or video quality enhancement can be performed before recognition or analysis is performed on the enhanced image or video. However, in many cases, the effect of image quality enhancement is not ideal.
[0004] Therefore, how to improve the effect of image quality enhancement processing has become a technical problem that needs to be solved urgently. Summary of the Invention
[0005] The present application provides an image enhancement method and device, which can improve the effect of image quality enhancement processing.
[0006] In a first aspect, an image enhancement method is provided, the method comprising:
[0007] Adjusting pixel values of an image to be processed to obtain K images, wherein the K images have different pixel values, and K is a positive integer greater than 1; extracting local features of the K images; extracting global features of the image to be processed; performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an enhanced output image.
[0008] The image enhancement method in the embodiment of the present application adjusts the pixel values of the image to be processed to obtain multiple images with different pixel values, and uses these multiple images with different pixel values to perform image quality enhancement processing on the image to be processed, so that more local detail information can be obtained from the multiple images with different pixel values to achieve image enhancement of the image to be processed. This method can improve the effect of image quality enhancement processing.
[0009] At the same time, by adjusting the pixel values of the image to be processed to obtain K images, it can be ensured that the image content in the K images participating in the image enhancement processing is consistent and there is no pixel offset, thereby avoiding ghosting caused by inconsistent image content or pixel offset.
[0010] Optionally, the above-mentioned local features are features extracted from local areas of the image, including: edges, corners, lines, curves or areas with special attributes, etc.; the above-mentioned global features refer to the overall attributes of the image, including: color features, texture features, shape features or histograms, etc.
[0011] Optionally, K images may be obtained by adjusting the pixel values of the image to be processed K times. In this case, the K images are all obtained by adjusting the pixel values of the image to be processed, that is, the K images do not include the image to be processed.
[0012] Alternatively, K-1 images may be obtained by adjusting the pixel values of the image to be processed K-1 times, and K images may be obtained based on the K-1 images and the image to be processed. In this case, the K images include the image to be processed, and the other K-1 images among the K images except the image to be processed are obtained by adjusting the pixel values of the image to be processed.
[0013] Optionally, the image to be processed may be an image (low-resolution image) obtained by downsampling the original image to be processed.
[0014] In an embodiment of the present application, the image to be enhanced (i.e., the original image of the image to be processed) can be downsampled first to obtain a low-resolution image (i.e., the image to be processed), and then the features of the low-resolution image can be extracted, thereby reducing the computational complexity of the image enhancement processing.
[0015] In combination with the first aspect, in certain implementations of the first aspect, adjusting the pixel values of the image to be processed to obtain K images includes: increasing and / or decreasing all pixel values of the image to be processed through nonlinear transformation to obtain the K images.
[0016] In the embodiment of the present application, all pixel values of the image to be processed are increased and / or decreased by nonlinear transformation, so that K images can be easily obtained, thereby obtaining more local detail information from the K images.
[0017] Optionally, the nonlinear transformation may be a gamma transformation (or γ transformation), or may be other nonlinear transformation methods capable of adjusting image pixel values, which is not limited in the embodiments of the present application.
[0018] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: performing semantic segmentation on the image to be processed to obtain a semantic segmentation map; performing feature extraction on the semantic segmentation map to obtain semantic conditions, wherein the semantic conditions include semantic information of the image to be processed; wherein at least one of the local features of the K images is extracted based on the semantic conditions.
[0019] In an embodiment of the present application, local features of at least one of the K images are extracted based on the semantic segmentation map, so that semantic differences between different local areas can be reflected in the image after image enhancement.
[0020] Furthermore, feature extraction is performed on the semantic segmentation map to obtain semantic conditions, and local features of at least one image in the K images are extracted based on the semantic conditions, which can better reflect the semantic differences between different local areas in the image after image enhancement.
[0021] In combination with the first aspect, in certain implementations of the first aspect, at least one of the local features of the K images is extracted based on a first semantic feature and a second semantic feature, and the first semantic feature and the second semantic feature are determined based on the semantic condition.
[0022] In combination with the first aspect, in certain implementations of the first aspect, at least one of the local features of the K images is determined based on a residual estimation value, and the residual estimation value is determined based on the first semantic feature, the second semantic feature and the image feature of the image to be processed.
[0023] In combination with the first aspect, in certain implementations of the first aspect, the method further includes: performing feature fusion on the local features of the K images to obtain local fusion features; wherein, performing image enhancement processing on the image to be processed based on the global features and the local features to obtain an output image after image enhancement includes: performing image enhancement processing on the image to be processed based on the global features and the local fusion features to obtain an output image after image enhancement.
[0024] In combination with the first aspect, in certain implementations of the first aspect, the performing image enhancement processing on the image to be processed based on the global features and the local features to obtain an output image after image enhancement includes: performing feature fusion on the global features and the local features to obtain fusion features; and performing image enhancement processing on the image to be processed based on the fusion features to obtain an output image after image enhancement.
[0025] In an embodiment of the present application, the fusion feature is obtained by fusing the global feature and the local feature, rather than simply adding the global feature and the local feature. Therefore, it is possible to avoid the local area of the image after image enhancement having the same global feature, thereby improving the effect of image enhancement processing.
[0026] Optionally, a neural network may be used to perform feature fusion on the global features and the local features to obtain fused features.
[0027] In combination with the first aspect, in certain implementations of the first aspect, the feature fusion of the global feature and the local feature to obtain the fused feature includes: performing feature extraction on the global feature to obtain a first global feature and a second global feature; performing an addition operation on the first global feature and the local feature to obtain a candidate fused feature; and performing a concatenation operation and a convolution operation on the candidate fused feature and the second global feature to obtain the fused feature.
[0028] In an embodiment of the present application, after dividing the global features into two independent channels (i.e., the first global feature and the second global feature), the first global feature and the second global feature are fused with the local features. This allows the model to learn more accurate global information and make the color transitions of different lighting and different semantics in the image to be processed more natural.
[0029] In combination with the first aspect, in certain implementations of the first aspect, the feature fusion of the global feature and the local feature to obtain the fused feature includes: performing feature extraction on the global feature to obtain a first global feature and a second global feature; performing a connection operation and a convolution operation on the first global feature and the local feature to obtain a candidate fused feature; and performing an addition operation on the candidate fused feature and the second global feature to obtain the fused feature.
[0030] In an embodiment of the present application, after dividing the global features into two independent channels (i.e., the first global feature and the second global feature), the first global feature and the second global feature are fused with the local features. This allows the model to learn more accurate global information and make the color transitions of different lighting and different semantics in the image to be processed more natural.
[0031] In combination with the first aspect, in certain implementations of the first aspect, the image to be processed is an image obtained by downsampling the original image of the image to be processed; wherein, performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement includes: performing image enhancement processing on the original image of the image to be processed according to the global features and the local features to obtain an output image after image enhancement.
[0032] In combination with the first aspect, in certain implementations of the first aspect, when the image to be processed is an image obtained by downsampling the original image of the image to be processed, the image enhancement processing is performed on the image to be processed according to the fusion feature to obtain an image-enhanced output image, including: upsampling the fusion feature according to the original image of the image to be processed to obtain a target fusion feature; and performing image enhancement processing on the original image of the image to be processed according to the target fusion feature to obtain an image-enhanced output image.
[0033] In a second aspect, an image enhancement device is provided, including: a pixel adjustment unit, used to adjust the pixel values of the image to be processed to obtain K images, the pixel values of the K images are different, and K is a positive integer greater than 1; a local feature extraction unit, used to extract local features of the K images; a global feature extraction unit, used to extract global features of the image to be processed; and an image enhancement unit, used to perform image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement.
[0034] The image enhancement device in the embodiment of the present application adjusts the pixel values of the image to be processed to obtain multiple images with different pixel values, and uses these multiple images with different pixel values to perform image quality enhancement processing on the image to be processed, so that more local detail information can be obtained from the multiple images with different pixel values to achieve image enhancement of the image to be processed. This method can improve the effect of image quality enhancement processing.
[0035] At the same time, by adjusting the pixel values of the image to be processed to obtain K images, it can be ensured that the image content in the K images participating in the image enhancement processing is consistent and there is no pixel offset, thereby avoiding ghosting caused by inconsistent image content or pixel offset.
[0036] Optionally, the above-mentioned local features are features extracted from local areas of the image, including: edges, corners, lines, curves or areas with special attributes, etc.; the above-mentioned global features refer to the overall attributes of the image, including: color features, texture features, shape features or histograms, etc.
[0037] Optionally, K images may be obtained by adjusting the pixel values of the image to be processed K times. In this case, the K images are all obtained by adjusting the pixel values of the image to be processed, that is, the K images do not include the image to be processed.
[0038] Alternatively, K-1 images may be obtained by adjusting the pixel values of the image to be processed K-1 times, and K images may be obtained based on the K-1 images and the image to be processed. In this case, the K images include the image to be processed, and the other K-1 images among the K images except the image to be processed are obtained by adjusting the pixel values of the image to be processed.
[0039] Optionally, the image to be processed may be an image (low-resolution image) obtained by downsampling the original image to be processed.
[0040] In an embodiment of the present application, the image to be enhanced (i.e., the original image of the image to be processed) can be downsampled first to obtain a low-resolution image (i.e., the image to be processed), and then the features of the low-resolution image can be extracted, thereby reducing the computational complexity of the image enhancement processing.
[0041] In combination with the second aspect, in some implementations of the second aspect, the pixel adjustment unit is specifically used to: increase and / or decrease all pixel values of the image to be processed through nonlinear transformation to obtain the K images.
[0042] In the embodiment of the present application, all pixel values of the image to be processed are increased and / or decreased by nonlinear transformation, so that K images can be easily obtained, thereby obtaining more local detail information from the K images.
[0043] Optionally, the nonlinear transformation may be a gamma transformation (or transformation), or may be other nonlinear transformation methods capable of adjusting image pixel values, which is not limited in the embodiments of the present application.
[0044] In combination with the second aspect, in certain implementations of the second aspect, the device further includes a semantic segmentation unit, configured to: perform semantic segmentation on the image to be processed to obtain a semantic segmentation map; the device further includes a semantic condition generation unit, configured to: perform feature extraction on the semantic segmentation map to obtain semantic conditions, wherein the semantic conditions include semantic information of the image to be processed; wherein at least one of the local features of the K images is extracted based on the semantic conditions.
[0045] In an embodiment of the present application, local features of at least one of the K images are extracted based on the semantic segmentation map, so that semantic differences between different local areas can be reflected in the image after image enhancement.
[0046] Furthermore, feature extraction is performed on the semantic segmentation map to obtain semantic conditions, and local features of at least one image in the K images are extracted based on the semantic conditions, which can better reflect the semantic differences between different local areas in the image after image enhancement.
[0047] In combination with the second aspect, in certain implementations of the second aspect, at least one of the local features of the K images is extracted based on a first semantic feature and a second semantic feature, and the first semantic feature and the second semantic feature are determined based on the semantic condition.
[0048] In combination with the second aspect, in certain implementations of the second aspect, at least one of the local features of the K images is determined based on a residual estimation value, and the residual estimation value is determined based on the first semantic feature, the second semantic feature and the image feature of the image to be processed.
[0049] In combination with the second aspect, in certain implementations of the second aspect, the local feature extraction unit is further used to: perform feature fusion on the local features of the K images to obtain local fusion features; wherein the image enhancement unit is specifically used to: perform image enhancement processing on the image to be processed according to the global features and the local fusion features to obtain an output image after image enhancement.
[0050] In combination with the second aspect, in certain implementations of the second aspect, the image enhancement unit is specifically used to: perform feature fusion on the global features and the local features to obtain fused features; perform image enhancement processing on the image to be processed based on the fused features to obtain an output image after image enhancement.
[0051] In an embodiment of the present application, the fusion feature is obtained by fusing the global feature and the local feature, rather than simply adding the global feature and the local feature. Therefore, it is possible to avoid the local area of the image after image enhancement having the same global feature, thereby improving the effect of image enhancement processing.
[0052] Optionally, a neural network may be used to perform feature fusion on the global features and the local features to obtain fused features.
[0053] In combination with the second aspect, in certain implementations of the second aspect, the image enhancement unit is specifically used to: perform feature extraction on the global feature to obtain a first global feature and a second global feature; perform an addition operation on the first global feature and the local feature to obtain a candidate fusion feature; perform a connection operation and a convolution operation on the candidate fusion feature and the second global feature to obtain the fusion feature.
[0054] In an embodiment of the present application, after dividing the global features into two independent channels (i.e., the first global feature and the second global feature), the first global feature and the second global feature are fused with the local features. This allows the model to learn more accurate global information and make the color transitions of different lighting and different semantics in the image to be processed more natural.
[0055] In combination with the second aspect, in certain implementations of the second aspect, the image enhancement unit is specifically used to: perform feature extraction on the global feature to obtain a first global feature and a second global feature; perform a connection operation and a convolution operation on the first global feature and the local feature to obtain a candidate fusion feature; perform an addition operation on the candidate fusion feature and the second global feature to obtain the fusion feature.
[0056] In an embodiment of the present application, after dividing the global features into two independent channels (i.e., the first global feature and the second global feature), the first global feature and the second global feature are fused with the local features. This allows the model to learn more accurate global information and make the color transitions of different lighting and different semantics in the image to be processed more natural.
[0057] In combination with the second aspect, in certain implementations of the second aspect, the image to be processed is an image obtained after downsampling of the original image of the image to be processed; wherein, the image enhancement unit is specifically used to: perform image enhancement processing on the original image of the image to be processed according to the global features and the local features to obtain an output image after image enhancement.
[0058] In combination with the second aspect, in certain implementations of the second aspect, when the image to be processed is an image obtained by downsampling the original image of the image to be processed, the image enhancement unit is specifically used to: upsample the fusion features according to the original image of the image to be processed to obtain target fusion features; and perform image enhancement on the original image of the image to be processed according to the target fusion features to obtain an output image after image enhancement.
[0059] In a third aspect, an image enhancement device is provided, comprising: a memory for storing a program; and a processor for executing the program stored in the memory. When the program stored in the memory is executed, the processor is used to execute the method in any one of the implementations of the first aspect.
[0060] The processor in the third aspect can be either a central processing unit (CPU) or a combination of a CPU and a neural network processor. The neural network processor here can include a graphics processing unit (GPU), a neural network processing unit (NPU), and a tensor processing unit (TPU). Among them, the TPU is a dedicated integrated circuit for artificial intelligence accelerators fully customized by Google for machine learning.
[0061] According to a fourth aspect, a computer-readable medium is provided, which stores a program code for execution by a device, wherein the program code includes a method for executing any one of the implementations of the first aspect.
[0062] In a fifth aspect, a computer program product comprising instructions is provided, which, when run on a computer, enables the computer to execute the method in any one of the implementations of the first aspect.
[0063] In a sixth aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface and executes a method in any one of the implementation modes of the first aspect.
[0064] Optionally, as an implementation method, the chip may further include a memory, in which instructions are stored, and the processor is used to execute the instructions stored on the memory. When the instructions are executed, the processor is used to execute the method in any one of the implementation methods of the first aspect.
[0065] The chip may specifically be a field-programmable gate array (FPGA) or an application-specific integrated circuit (ASIC).
[0066] In a seventh aspect, an electronic device is provided, which includes the image enhancement device according to any one of the second aspects.
[0067] When the electronic device includes the image enhancement device in any one of the second aspects, the electronic device may specifically be a terminal device or a server.
[0068] The image enhancement method in the embodiment of the present application adjusts the pixel values of the image to be processed to obtain multiple images with different pixel values, and uses these multiple images with different pixel values to perform image quality enhancement processing on the image to be processed, so that more local detail information can be obtained from the multiple images with different pixel values to achieve image enhancement of the image to be processed. This method can improve the effect of image quality enhancement processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a structural diagram of the system architecture provided in an embodiment of the present application.
[0070] Figure 2 This is a schematic diagram of image enhancement based on a convolutional neural network model provided in an embodiment of the present application.
[0071] Figure 3 This is a schematic diagram of a chip hardware structure provided in an embodiment of the present application.
[0072] Figure 4 This is a schematic diagram of an application scenario provided in an embodiment of the present application.
[0073] Figure 5 This is a schematic flowchart of an image enhancement method provided by an embodiment of the present application.
[0074] Figure 6 This is a schematic block diagram of an image enhancement device provided in one embodiment of the present application.
[0075] Figure 7 It is a schematic block diagram of a local feature extraction method provided by an embodiment of the present application.
[0076] Figure 8 It is a schematic block diagram of a local feature extraction method provided by another embodiment of the present application.
[0077] Figure 9 This is a schematic block diagram of a residual block provided by an embodiment of the present application.
[0078] Figure 10 This is a schematic block diagram of semantic space conversion provided by an embodiment of the present application.
[0079] Figure 11 This is a schematic block diagram of local feature fusion provided by an embodiment of the present application.
[0080] Figure 12 This is a schematic block diagram of feature fusion provided by an embodiment of the present application.
[0081] Figure 13 It is a schematic block diagram of feature fusion provided by another embodiment of the present application.
[0082] Figure 14 Schematic diagram of the hardware structure of the image enhancement device according to an embodiment of the present application.
[0083] Figure 15 It is a schematic diagram of the hardware structure of the model training device of an embodiment of the present application. DETAILED DESCRIPTION
[0084] The technical solution in this application will be described below with reference to the accompanying drawings.
[0085] The image enhancement method provided in the embodiments of the present application can be applied to photography, video recording, safe cities, human-computer interaction, and other scenarios requiring image restoration or image quality enhancement, such as image recognition and image classification.
[0086] It should be understood that the images in the embodiments of the present application can be static images (or static pictures) or dynamic images (or dynamic pictures). For example, the images in the present application can be videos or dynamic pictures, or the images in the present application can also be static pictures or photos. For ease of description, the present application will refer to static images and dynamic images as images in the following embodiments.
[0087] The image enhancement method of the embodiment of the present application can be specifically applied to photo-taking scenarios and image recognition scenarios. The following is a brief introduction to these two scenarios.
[0088] Photo (or video) scene:
[0089] When taking photos using a camera, terminal device or other smart electronic device, in order to display images of better quality, the image enhancement method of the embodiment of the present application can be used to automatically enhance the image obtained by taking the photo before or after taking the photo.
[0090] By adopting the image enhancement method of the embodiment of the present application, it is possible to improve image quality, enhance image display effects, and improve the accuracy of subsequent visual algorithms (for example, image recognition or image classification) performed on the image.
[0091] Image recognition (video surveillance) scenario:
[0092] As the application of artificial intelligence technology becomes increasingly widespread, in many cases, it is necessary to identify the content in an image. During image recognition, image enhancement processing is often performed on the image (for example, in a safe city video surveillance scenario, image enhancement processing is required for details in dark areas with insufficient lighting). By using the image enhancement method of the embodiment of the present application to perform image enhancement processing on the image during the image recognition process or before image recognition officially begins, the image quality can be improved, thereby improving the effect of subsequent image recognition.
[0093] Source enhancement scene:
[0094] When playing movies using smart terminals (such as smart TVs, smart screens, etc.), in order to display better image quality (picture quality), the original source of the movie can be subjected to image enhancement processing using the image enhancement method of the embodiment of the present application to improve the picture quality of the source and obtain a better visual experience.
[0095] For example, when using a smart TV or smart screen to play old movies (the source of old movies is relatively old and the picture quality of the source is poor), the image enhancement method of the embodiment of the present application can be used to perform image enhancement processing on the source of the old movies, which can display the visual perception of modern movies.
[0096] Image stylization (image beautification) scene:
[0097] After taking a photo with a camera, terminal device or other smart electronic device, when using image processing software (such as Photoshop, Meitu Xiu Xiu, etc.) to perform image stylization or image beautification processing on the photographed image, the image enhancement method of the embodiment of the present application can be used to perform image enhancement processing on the image to improve the image display effect.
[0098] The embodiments of the present application involve a large number of applications related to neural networks. In order to better understand the solutions of the embodiments of the present application, the relevant terms and concepts of neural networks that may be involved in the embodiments of the present application are first introduced below.
[0099] (1) Neural Network
[0100] A neural network can be composed of neural units, which can be represented by x s The output of the operation unit with the intercept 1 as input can be shown as formula (1-1):
[0101]
[0102] Where, s = 1, 2, ... n, n is a natural number greater than 1, W s is x sThe weight of the neural unit, b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0103] (2) Deep Neural Networks
[0104] A deep neural network (DNN), also known as a multi-layer neural network, can be understood as a neural network with multiple hidden layers. Based on the location of the different layers, the neural network within a DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. Each layer is fully connected, meaning that any neuron in layer i is connected to any neuron in layer i+1.
[0105] Although DNN looks complicated, the work of each layer is actually not complicated. In simple terms, it can be expressed as the following linear relationship: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The number of these parameters is also relatively large. The definitions of these parameters in DNN are as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input.
[0106] In summary, the coefficient from the kth neuron in the L-1th layer to the jth neuron in the Lth layer is defined as
[0107] It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a model with more parameters has higher complexity and greater "capacity," meaning it can handle more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrices for all layers of a trained deep neural network (a weight matrix formed by the vectors W across many layers).
[0108] (3) Convolutional Neural Network
[0109] A convolutional neural network (CNN) is a deep neural network with a convolutional architecture. It consists of a feature extractor consisting of convolutional layers and subsampling layers, which can be viewed as a filter. A convolutional layer is a layer of neurons that performs convolution processing on the input signal. In a convolutional layer of a CNN, a neuron can only connect to a subset of neurons in adjacent layers. A convolutional layer typically contains several feature planes, each of which can be composed of a rectangular arrangement of neurons. Neurons in the same feature plane share weights, which are referred to as convolution kernels. Shared weights can be understood as extracting image information in a position-independent manner. Convolution kernels can be initialized as matrices of random size, and during CNN training, they can learn to acquire reasonable weights. Furthermore, shared weights have the direct benefit of reducing the number of connections between layers of the CNN, thereby reducing the risk of overfitting.
[0110] (4) Recurrent neural networks (RNNs) are used to process sequence data. In traditional neural network models, the layers are fully connected from the input layer to the hidden layer and then to the output layer, while the nodes within each layer are disconnected. Although this ordinary neural network solves many difficult problems, it is still powerless to solve many problems. For example, if you want to predict the next word in a sentence, you generally need to use the previous word because the previous and next words in a sentence are not independent. RNN is called a recurrent neural network because the current output of a sequence is also related to the previous output. The specific manifestation is that the network will remember the previous information and apply it to the calculation of the current output, that is, the nodes between the hidden layers are no longer disconnected but connected, and the input of the hidden layer includes not only the output of the input layer but also the output of the hidden layer at the previous moment. In theory, RNN can process sequence data of any length. The training of RNN is the same as the training of traditional CNN or DNN.
[0111] Since we already have convolutional neural networks, why do we still need recurrent neural networks? The reason is simple. Convolutional neural networks assume that elements are independent of each other, and that inputs and outputs are also independent, such as cats and dogs. However, in the real world, many elements are interconnected, such as the changes in stock prices over time. Or, for example, someone says, "I love traveling, and my favorite place is Yunnan. I must visit it someday." Humans should know to fill in the blank with "Yunnan." This is because humans make inferences based on context, but how can machines do the same? That's where RNNs come in. RNNs aim to give machines the ability to remember, like humans do. Therefore, the output of an RNN depends on both the current input and historical memory.
[0112] (5) Loss function
[0113] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss as much as possible.
[0114] (6) Backpropagation algorithm
[0115] Neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model during training, reducing the reconstruction error loss of the neural network model. Specifically, the forward propagation of the input signal to the output generates error loss. This error loss information is then backpropagated to update the parameters in the initial neural network model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0116] (7) Pixel value
[0117] The pixel value of an image can be a red, green, and blue (RGB) color value, which can be a long integer representing the color. For example, a pixel value is 256*Red+100*Green+76Blue, where * represents multiplication, Blue represents the blue component, Green represents the green component, and Red represents the red component. For each color component, smaller values indicate lower brightness, while larger values indicate higher brightness. For grayscale images, pixel values can be grayscale values.
[0118] like Figure 1 As shown, the embodiment of the present application provides a system architecture 100. Figure 1 In the embodiment of the present invention, the data acquisition device 160 is used to acquire training data. For the image enhancement method of the embodiment of the present invention, the training data may include the original image and the ground truth (GT) corresponding to the original image, wherein the ground truth corresponding to the original image may be obtained by manual pre-processing.
[0119] After collecting the training data, the data collection device 160 stores the training data in the database 130 , and the training device 120 obtains the target model / rule 101 through training based on the training data maintained in the database 130 .
[0120] The following describes how the training device 120 obtains the target model / rule 101 based on the training data. The training device 120 processes the input original image and compares the output image with the true value corresponding to the original image until the difference between the image output by the training device 120 and the true value of the original image is less than a certain threshold, thereby completing the training of the target model / rule 101.
[0121] The above-mentioned target model / rule 101 can be used to implement the image enhancement method of the embodiment of the present application, that is, the image to be processed is input into the target model / rule 101 after relevant pre-processing, and the output image after image enhancement can be obtained. The target model / rule 101 in the embodiment of the present application can specifically be the image enhancement device in the embodiment of the present application. It should be noted that in actual applications, the training data maintained in the database 130 does not necessarily all come from the collection of the data acquisition device 160, and may also be received from other devices. It should also be noted that the training device 120 does not necessarily train the target model / rule 101 entirely based on the training data maintained by the database 130, and may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiment of the present application.
[0122] The target model / rule 101 obtained by training the training device 120 can be applied to different systems or devices, such as Figure 1The execution device 110 shown in the figure may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR), a vehicle terminal, etc. It may also be a server or a cloud device, etc. Figure 1 In the embodiment of the present application, the execution device 110 is configured with an input / output (I / O) interface 112 for data interaction with an external device. The user can input data to the I / O interface 112 through the client device 140. The input data may include: an image to be processed input by the client device.
[0123] The preprocessing module 113 and the preprocessing module 114 are used to perform preprocessing based on the input data (such as the image to be processed) received by the I / O interface 112. In an embodiment of the present application, the preprocessing module 113 and the preprocessing module 114 may not be present (or only one of the preprocessing modules may be present), and the computing module 111 may be used directly to process the input data.
[0124] When the execution device 110 preprocesses the input data, or when the computing module 111 of the execution device 110 performs calculations and other related processing, the execution device 110 can call the data, code, etc. in the data storage system 150 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 150.
[0125] Finally, the I / O interface 112 returns the processing result, such as the output image after image enhancement, to the client device 140 to provide it to the user.
[0126] It is worth noting that the training device 120 can generate corresponding target models / rules 101 based on different training data for different goals or different tasks. The corresponding target models / rules 101 can be used to achieve the above goals or complete the above tasks, thereby providing users with the desired results.
[0127] exist Figure 1In the illustrated case, the user can manually input data, which can be operated through the interface provided by I / O interface 112. In another case, client device 140 can automatically send input data to I / O interface 112. If the automatic transmission of input data by client device 140 requires user authorization, the user can set the corresponding permissions in client device 140. The user can view the results output by execution device 110 on client device 140, which can be presented in the form of display, sound, action, or other specific methods. Client device 140 can also serve as a data acquisition terminal, collecting input data input into I / O interface 112 and output results from I / O interface 112 as new sample data and storing them in database 130. Of course, collection can also be performed without going through client device 140, with I / O interface 112 directly storing the input data input into I / O interface 112 and output results from I / O interface 112 as new sample data in database 130.
[0128] It is worth noting that Figure 1 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 1 In the embodiment, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 can also be placed in the execution device 110.
[0129] like Figure 1 As shown, the target model / rule 101 is obtained through training according to the training device 120. The target model / rule 101 may be the image enhancement device in the embodiment of the present application. Specifically, the image enhancement device provided in the embodiment of the present application may include one or more neural networks, and the one or more neural networks may include CNN, deep convolutional neural networks (DCNN) and / or recurrent neural networks (RNNS), etc.
[0130] Since CNN is a very common neural network, the following Figure 2This section focuses on a detailed introduction to the structure of CNNs. As mentioned in the basic concepts above, a convolutional neural network is a deep neural network with a convolutional structure and a deep learning architecture. Deep learning architectures use machine learning algorithms to perform multiple levels of learning at different levels of abstraction. As a deep learning architecture, a CNN is a feed-forward artificial neural network in which individual neurons respond to input images.
[0131] like Figure 2 As shown, convolutional neural network (CNN) 200 may include input layer 210, convolution layer / pooling layer 220 (wherein the pooling layer is optional), and neural network layer 230. The relevant contents of these layers are described in detail below.
[0132] Convolutional layer / pooling layer 220:
[0133] Convolutional layer:
[0134] like Figure 2 The convolutional layer / pooling layer 220 shown may include layers 221-226. For example, in one implementation, layer 221 is a convolutional layer, layer 222 is a pooling layer, layer 223 is a convolutional layer, layer 224 is a pooling layer, layer 225 is a convolutional layer, and layer 226 is a pooling layer. In another implementation, layers 221 and 222 are convolutional layers, layer 223 is a pooling layer, layers 224 and 225 are convolutional layers, and layer 226 is a pooling layer. That is, the output of a convolutional layer can be used as the input of a subsequent pooling layer, or as the input of another convolutional layer to continue the convolution operation.
[0135] The following will take convolutional layer 221 as an example to introduce the internal working principle of a convolutional layer.
[0136] Convolution layer 221 can include multiple convolution operators, also known as kernels. In image processing, a convolution operator acts as a filter that extracts specific information from an input image matrix. A convolution operator is essentially a weight matrix, which is typically predefined. During the convolution operation, the weight matrix is typically applied horizontally to the input image, pixel by pixel (or two pixels by two pixels, depending on the stride), thereby extracting specific features from the image. The size of the weight matrix should be related to the image size. It is important to note that the depth dimension of the weight matrix is the same as the depth dimension of the input image. During the convolution operation, the weight matrix extends across the entire depth of the input image. Therefore, convolution with a single weight matrix produces a convolution output with a single depth dimension. However, in most cases, a single weight matrix is not used. Instead, multiple weight matrices of the same size (rows × columns) are applied, i.e., multiple homogeneous matrices. The outputs of each weight matrix are stacked to form the depth dimension of the convolved image, where the dimension is determined by the "multiple" mentioned above. Different weight matrices can be used to extract different features from an image. For example, one weight matrix can be used to extract edge information, another weight matrix can be used to extract specific colors, and yet another weight matrix can be used to blur unwanted noise in the image. The weight matrices have the same size (rows × columns), and the feature maps extracted by these weight matrices are also the same size. The extracted feature maps of the same size are then merged to form the output of the convolution operation.
[0137] The weight values in these weight matrices need to be obtained through a lot of training in practical applications. The weight matrices formed by the weight values obtained through training can be used to extract information from the input image, so that the convolutional neural network 200 can make correct predictions.
[0138] When the convolutional neural network 200 has multiple convolutional layers, the initial convolutional layer (for example, 221) often extracts more general features, which can also be called low-level features. As the depth of the convolutional neural network 200 increases, the features extracted by the later convolutional layers (for example, 226) become more and more complex, such as high-level semantic features. Features with higher semantics are more suitable for the problem to be solved.
[0139] Pooling layer / pooling layer 220:
[0140] Since it is often necessary to reduce the number of training parameters, it is often necessary to periodically introduce a pooling layer after the convolution layer, such as Figure 2Each layer 221-226 illustrated in Figure 220 can be a convolutional layer followed by a pooling layer, or multiple convolutional layers followed by one or more pooling layers. In the image processing process, the sole purpose of the pooling layer is to reduce the spatial size of the image. The pooling layer can include an average pooling operator and / or a maximum pooling operator to sample the input image to obtain a smaller image. The average pooling operator can calculate the pixel values in the image within a specific range to produce an average value as the result of average pooling. The maximum pooling operator can take the pixel with the largest value within a specific range as the result of maximum pooling. In addition, just as the size of the weight matrix used in the convolutional layer should be related to the image size, the operators in the pooling layer should also be related to the image size. The size of the image output after processing by the pooling layer can be smaller than the size of the image input to the pooling layer. Each pixel in the image output by the pooling layer represents the average value or maximum value of the corresponding sub-region of the image input to the pooling layer.
[0141] Neural Network Layer 230:
[0142] After being processed by the convolution layer / pooling layer 220, the convolution neural network 200 is not sufficient to output the required output information. As mentioned above, the convolution layer / pooling layer 220 only extracts features and reduces the parameters brought by the input image. However, in order to generate the final output information (the required class information or other related information), the convolution neural network 200 needs to use the neural network layer 230 to generate one or a group of outputs of the required number of classes. Therefore, the neural network layer 230 may include multiple hidden layers (such as Figure 2 231, 232 to 23n) and the output layer 240 shown, the parameters contained in the multi-layer hidden layer can be pre-trained according to relevant training data of a specific task type, for example, the task type may include image recognition, image classification, image super-resolution reconstruction, etc.
[0143] After the multiple hidden layers in the neural network layer 230, that is, the last layer of the entire convolutional neural network 200 is the output layer 240, which has a loss function similar to the classification cross entropy, specifically used to calculate the prediction error. Once the forward propagation of the entire convolutional neural network 200 (such as Figure 2 The propagation from 210 to 240 is forward propagation) and the reverse propagation (such as Figure 2 The propagation from 240 to 210 is called back propagation) and then the weight values and biases of the aforementioned layers will be updated to reduce the loss of the convolutional neural network 200 and the error between the result output by the convolutional neural network 200 through the output layer and the ideal result.
[0144] It should be noted that if Figure 2The convolutional neural network 200 shown is only an example of a convolutional neural network. In specific applications, the convolutional neural network may also exist in the form of other network models.
[0145] In this application, the image enhancement device may include Figure 2 The convolutional neural network 200 shown in FIG. 2 can perform image enhancement processing on the image to be processed to obtain an enhanced output image.
[0146] Figure 3 A chip hardware structure provided in an embodiment of the present application includes a neural network processor 50. The chip can be set as follows Figure 1 The execution device 110 shown in FIG. 1 is used to complete the calculation work of the calculation module 111. The chip can also be set in Figure 1 The training device 120 shown in FIG. 1 is used to complete the training work of the training device 120 and output the target model / rule 101. Figure 2 The algorithms of each layer in the convolutional neural network shown in the figure can be used in Figure 3 is implemented in the chip shown.
[0147] The neural network processor NPU 50 is mounted on the host CPU as a coprocessor and is assigned tasks by the host CPU. The core part of the NPU is the arithmetic circuit 503. The controller 504 controls the arithmetic circuit 503 to extract data from the memory (weight memory or input memory) and perform calculations.
[0148] In some implementations, the arithmetic circuit 503 includes multiple processing engines (PEs). In some implementations, the arithmetic circuit 503 is a two-dimensional systolic array. The arithmetic circuit 503 may also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 503 is a general-purpose matrix processor.
[0149] For example, assume there are input matrix A, weight matrix B, and output matrix C. Operation circuit 503 retrieves the corresponding data of matrix B from weight memory 502 and caches it on each PE in operation circuit 503. Operation circuit 503 retrieves the data of matrix A from input memory 501 and performs matrix operations on matrix B. The partial or final results of the matrix are stored in accumulator 508.
[0150] The vector calculation unit 507 can further process the output of the operation circuit 503, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. For example, the vector calculation unit 507 can be used for network calculations of non-convolutional / non-FC layers in a neural network, such as pooling, batch normalization, local response normalization, etc.
[0151] In some implementations, the vector calculation unit 507 can store the processed output vector in the unified buffer 506. For example, the vector calculation unit 507 can apply a nonlinear function to the output of the operation circuit 503, such as a vector of accumulated values, to generate an activation value. In some implementations, the vector calculation unit 507 generates a normalized value, a merged value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 503, for example, for use in a subsequent layer in a neural network.
[0152] The unified memory 506 is used to store input data and output data.
[0153] The weight data is directly transferred from the external memory to the input memory 501 and / or the unified memory 506 through the direct memory access controller 505 (DMAC), the weight data in the external memory is stored in the weight memory 502, and the data in the unified memory 506 is stored in the external memory.
[0154] The bus interface unit (BIU) 510 is used to implement interaction between the main CPU, DMAC and instruction fetch memory 509 through the bus.
[0155] An instruction fetch buffer 509 connected to the controller 504 and used to store instructions used by the controller 504;
[0156] The controller 504 is used to call the instructions cached in the memory 509 to control the working process of the computing accelerator.
[0157] Generally, the unified memory 506, the input memory 501, the weight memory 502 and the instruction fetch memory 509 are all on-chip memories, and the external memory is a memory outside the NPU, which can be a double data rate synchronous dynamic random access memory (DDR SDRAM), a high bandwidth memory (HBM) or other readable and writable memory.
[0158] in, Figure 2 The operations of each layer in the convolutional neural network shown can be performed by the operation circuit 503 or the vector calculation unit 307.
[0159] Introduced above Figure 1 The execution device 110 in the embodiment of the present application can execute each step of the image enhancement method. Figure 2 The CNN model shown and Figure 3 The chip shown can also be used to execute the various steps of the image enhancement method of the embodiment of the present application. The image enhancement method of the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0160] The image enhancement method provided in the embodiment of the present application can be executed on a server, on the cloud, or on a terminal device. Figure 4 As shown, the technical solution of the embodiment of the present invention can be applied to a terminal device. The image enhancement method in the embodiment of the present application can perform image enhancement processing on an input image to obtain an output image after the input image is enhanced. The terminal device can be mobile or fixed. For example, the terminal device can be a mobile phone with image enhancement function, a tablet personal computer (TPC), a media player, a smart TV, a laptop computer (LC), a personal digital assistant (PDA), a personal computer (PC), a camera, a camcorder, a smart watch, a wearable device (WD), or an autonomous vehicle, etc., which is not limited in the embodiment of the present invention.
[0161] In existing technologies, due to limitations in computing power and power consumption of terminal devices, images to be processed are often downsampled to obtain low-resolution images, which are then enhanced. However, low-resolution images make it difficult to obtain accurate local details, which affects the effectiveness of image quality enhancement.
[0162] An embodiment of the present application proposes an image enhancement method, which obtains multiple images with different pixel values by adjusting the pixel values of the image to be processed, and uses these multiple images with different pixel values to perform image quality enhancement processing, so that more local detail information can be obtained from the multiple images with different pixel values. Therefore, this method can improve the effect of image quality enhancement processing.
[0163] It should be noted that image quality enhancement can also be referred to as image enhancement, which specifically refers to processing the brightness, color, contrast, saturation, and / or dynamic range of an image so that the various indicators of the image meet preset conditions. In the embodiments of the present application, image enhancement and image quality enhancement have the same meaning.
[0164] Figure 5 FIG. 5 is a schematic flow chart of an image enhancement method 500 provided in an embodiment of the present application. The method may be performed by an apparatus or device capable of performing image enhancement. For example, the method may be performed by Figure 4 Executed by the terminal device in.
[0165] S510: Adjust the pixel values of the image to be processed to obtain K images.
[0166] The pixel values of the K images are different, and K is a positive integer greater than 1.
[0167] It should be understood that the different pixel values of the K images mentioned here may refer to that all pixel values of the K images are different, or may refer to that some pixel values of the K images are different.
[0168] At the same time, by adjusting the pixel values of the image to be processed to obtain K images, it can be ensured that the image content in the K images participating in the image enhancement processing is consistent and there is no pixel offset, thereby avoiding ghosting caused by inconsistent image content or pixel offset.
[0169] Optionally, K images may be obtained by adjusting the pixel values of the image to be processed K times. In this case, the K images are all obtained by adjusting the pixel values of the image to be processed, that is, the K images do not include the image to be processed.
[0170] Alternatively, K-1 images may be obtained by adjusting the pixel values of the image to be processed K-1 times, and K images may be obtained based on the K-1 images and the image to be processed. In this case, the K images include the image to be processed, and the other K-1 images among the K images except the image to be processed are obtained by adjusting the pixel values of the image to be processed.
[0171] Optionally, adjusting the pixel values of the image to be processed to obtain the K images may include: increasing and / or decreasing all pixel values of the image to be processed by nonlinear transformation to obtain the K images.
[0172] In the embodiment of the present application, all pixel values of the image to be processed are increased and / or decreased by nonlinear transformation, so that K images can be easily obtained, thereby obtaining more local detail information from the K images.
[0173] The nonlinear transformation in the above S510 may be a gamma transformation (or γ transformation), or may be other nonlinear transformation methods capable of adjusting image pixel values, which is not limited in the embodiment of the present application.
[0174] Generally, gamma transform can also be called gamma correction, or gamma nonlinearization, which is a method for performing nonlinear transformation on an image.
[0175] The gamma transformation can be achieved by the following formula:
[0176]
[0177] Among them, V in is the input image pixel, V out is the output image pixel, A is the gain, and γ is the nonlinear power.
[0178] V in can be the normalized input image pixels, that is, V in The value of V is between [0,1]. in After normalization, when γ<1, the pixel value of the input image can be increased. At this time, it can be considered that V out is relative to V in When γ>1, the pixel value of the input image can be reduced. At this time, it can be considered that V out is relative to V in Low exposure image.
[0179] In the present application, the pixel values of the image to be processed can be adjusted by the above-mentioned gamma transformation.
[0180] For example, the image to be processed can be V in the above formula in , one image among K images can be obtained by one gamma transformation, and K images can be obtained by K gamma transformations. In this case, the K images are all obtained by gamma transformation, and the K images do not include the image to be processed.
[0181] Alternatively, K-1 images may be obtained through K-1 gamma transformations, and the K images may be obtained based on the K-1 images and the image to be processed. In this case, the K images include the image to be processed, and the other K-1 images of the K images, excluding the image to be processed, are obtained through gamma transformations.
[0182] In the embodiment of the present application, during high exposure processing (i.e., using gamma transformation to increase the pixel value of the image to be processed), the γ in the above formula can be replaced by γ high-exop Indicates that in low exposure processing (i.e., using gamma transformation to reduce the pixel value of the image to be processed), the γ in the above formula can be replaced by γ low-exop Indicates that γ high-exop and γ low-exop It can be determined by the following formula:
[0183]
[0184]
[0185]
[0186] Among them, L avg is the average brightness value of all pixels in the image to be processed, L high is the high threshold of brightness, L low is the lower threshold of brightness, and 0 <L low <L high <1, p(L≥L high ) indicates that the brightness value of all pixels in the image to be processed is higher than L high The ratio of pixels, p(L≤L low ) indicates that the brightness value of all pixels in the image to be processed is lower than L low The ratio of pixels, a is the low threshold of γ in high exposure processing, b is the high threshold of γ in high exposure processing, a, b, L high and L low are all hyperparameters.
[0187] In this application, when Figure 5 The method shown is Figure 4When the terminal device in the process is executed, the image to be processed may be an image captured by the terminal device through a camera, or the image to be processed may also be an image obtained from inside the terminal device (for example, an image stored in the photo album of the terminal device, or an image obtained from the cloud by the terminal device). The embodiments of the present application are not limited to this.
[0188] Alternatively, in the present application, in order to reduce the amount of computation, the image to be enhanced (i.e., the original image of the image to be processed) can be downsampled first to obtain a low-resolution image, and then the features of the low-resolution image can be extracted, thereby reducing the amount of computation for the image enhancement processing.
[0189] Figure 6 This is a possible implementation of the embodiment of the present application, for example, Figure 6 As shown, the image to be processed may be the original image of the image to be processed. Figure 6 The image obtained after being processed by the downsampling unit 100 in .
[0190] At this time, the original image of the image to be processed can be an image captured by the terminal device through a camera, or the original image of the image to be processed can also be an image obtained from inside the terminal device, and the image to be processed can be an image (low-resolution image) obtained after the original image of the image to be processed is down-sampled.
[0191] S520: Extract local features of the K images.
[0192] Optionally, a neural network may be used to extract local features of the K images.
[0193] The above-mentioned local features may be features extracted from local areas of an image, including edges, corners, lines, curves, or areas with special attributes.
[0194] Since the pixel values of the K images are different, K neural networks may be used to extract local features of the K images.
[0195] Optionally, the K neural networks may correspond one-to-one to the K images, and the K neural networks may be used to extract local features of the corresponding images respectively.
[0196] For example, Figure 6 As shown, the image to be processed is the original image of the image to be processed. Figure 6 The image (low-resolution image) obtained after the downsampling unit 100 in the image is processed; the pixel values of the image to be processed are adjusted to obtain three images, the three images including a high-exposure image, a low-exposure image and the image to be processed, wherein, Figure 6The local feature extraction unit 302 in the image to be processed corresponds to the image to be processed and is used to extract local features of the image to be processed. Figure 6 The local feature extraction unit 304 corresponds to the high exposure image and is used to extract local features of the high exposure image. Figure 6 The local feature extraction unit 306 corresponds to the low-exposure image and is used to extract local features of the low-exposure image.
[0197] The above method of downsampling the original image of the image to be processed to obtain the image to be processed can be specifically referred to the existing technology and will not be described in detail in the embodiments of the present application.
[0198] Optionally, Figure 6 The local feature extraction unit 302, the local feature extraction unit 304 and the local feature extraction unit 306 can be implemented by three neural networks.
[0199] For example, Figure 6 One or more of the local feature extraction unit 302, the local feature extraction unit 304, and the local feature extraction unit 306 can be used Figure 7 The multi-scale self-learning network structure shown is used for implementation, or other neural networks can be used for implementation, which is not limited in the embodiments of the present application.
[0200] Figure 7 The multi-scale self-learning network structure in the image processing method comprises multiple modules including an upper sub-network, a middle sub-network, and a bottom sub-network. The upper sub-network is the original feature extraction layer, the middle sub-network is a different intermediate feature extraction layer, and the bottom sub-network is the final feature extraction layer. Downsampling is performed using a space2depth (or space to depth) operation. The specific description of the network structure can be referred to the related application (the invention name is image denoising method and device, application number is 201910156951.0), which will not be repeated in the embodiments of this application.
[0201] It should be noted that the multi-scale self-learning network structure in this application is optimized based on the above-mentioned related applications. Figure 7As shown, after the image to be processed undergoes the spaec2depth operation, separable convolution can be used instead of ordinary convolution. In this way, the convolution depth is increased without excessively increasing the amount of calculation, and the convolution receptive field is increased to achieve more accurate feature extraction. Of course, in this application, the network structure in the above-mentioned related application can also be used for feature extraction, and this is not limited in the embodiments of this application.
[0202] In an embodiment of the present application, semantic segmentation may be performed on the image to be processed to obtain a semantic segmentation map, and feature extraction may be performed on the semantic segmentation map to obtain semantic conditions, wherein the semantic conditions may include semantic information of the image to be processed.
[0203] Semantic segmentation in the present application can also be called image semantic segmentation, which refers to the process of dividing the pixels in an image into different regions according to certain rules (for example, lighting or category). The result of semantic segmentation of an image is a semantic segmentation map.
[0204] Optionally, the image can be divided into different regions at the pixel level according to categories. For example, different colors can be used to distinguish different regions in the image.
[0205] For example, you can mark the area where buildings are located in the image as blue, the area where the sky is located as green, and the area where plants are located as yellow. This image with different categories marked with different colors is called a semantic segmentation map.
[0206] The information carried in the semantic segmentation map that can be used to indicate different categories in the image (for example, buildings, plants, and sky, etc.) can be called semantic information (or semantic information of the image). Similarly, the semantic segmentation map can also include semantic information for indicating other information in the image (for example, dividing different lighting in the image into different categories), which is not limited in the embodiments of the present application.
[0207] In the embodiment of the present application, the semantic condition may include semantic information of the image to be processed, and the semantic information may be used to indicate different categories or lighting information in the image to be processed. Alternatively, the semantic information may also be used to indicate other information in the image to be processed, which is not limited in the embodiment of the present application.
[0208] The above method of performing semantic segmentation on the image to be processed to obtain a semantic segmentation map can be specifically referred to the existing technology and will not be described in detail in the embodiments of the present application.
[0209] Optionally, a neural network can be used to extract features from the semantic segmentation map to obtain semantic conditions. Figure 6 As shown, the semantic condition generating unit 301 can be used to extract features from the semantic segmentation map to obtain semantic conditions, wherein the semantic condition generating unit 301 can be implemented by a neural network.
[0210] In the present application, extracting local features of the K images may include: extracting local features of one or more images in the K images according to the semantic condition.
[0211] That is, at least one of the local features of the K images may be extracted according to the semantic condition.
[0212] In an embodiment of the present application, feature extraction is performed on the semantic segmentation map to obtain semantic conditions. Based on the semantic conditions, local features of one or more images in the K images are extracted, which can better reflect the semantic differences between different local areas in the image after image enhancement.
[0213] For example, Figure 6 As shown, the pixel values of the image to be processed are adjusted to obtain three images, including: a high-exposure image, a low-exposure image, and the image to be processed; at this time, local features of the image to be processed in the three images can be extracted according to the semantic conditions obtained by the semantic condition generation unit 301; or, local features of the high-exposure image or the low-exposure image in the three images can be extracted according to the semantic conditions; or, local features of multiple images in the three images can be extracted according to the semantic conditions, for example, local features of the high-exposure image and the low-exposure image can be extracted according to the semantic conditions, which is not limited in this embodiment of the present application.
[0214] For example, when using Figure 7 When the network structure shown in FIG. 1 performs feature extraction on one or more of the K images, as shown in FIG. 2 , FIG. 3 , FIG. 4 , FIG. 5 , and FIG. 6 , respectively. Figure 8 As shown, the semantic conditions can be input into each residual convolution block, and a residual estimation value can be determined based on the semantic conditions; and local features of one or more images in the K images can be determined based on the residual estimation value.
[0215] Figure 8 The structure of the residual block in can be as follows Figure 9 As shown, it can be seen that the residual block in the embodiment of the present application may include one or more convolutional layers, and each convolutional layer in the residual block may be preceded by a semantic spatial transform (SST) layer. The specific implementation of the SST layer can be as follows Figure 10 shown.
[0216] It should be understood that Figure 8 and Figure 9 The embodiments shown are merely examples and are not limiting. In the present application, when other networks are used for feature extraction, local features of one or more images in the K images may also be extracted according to the semantic conditions.
[0217] Optionally, extracting local features of one or more images among the K images based on the semantic condition may include: determining a first semantic feature and a second semantic feature based on the semantic condition; and extracting local features of one image among the K images based on the first semantic feature and the second semantic feature.
[0218] That is, at least one of the local features of the K images may be extracted based on a first semantic feature and a second semantic feature, where the first semantic feature and the second semantic feature are determined based on the semantic condition.
[0219] Furthermore, extracting the local features of one of the K images based on the first semantic feature and the second semantic feature may include: determining a residual estimation value based on the first semantic feature, the second semantic feature and the image features of the image to be processed; and determining the local features of one of the K images based on the residual estimation value.
[0220] That is, at least one of the local features of the K images may be determined based on a residual estimation value, where the residual estimation value is determined based on the first semantic feature, the second semantic feature, and the image feature of the image to be processed.
[0221] It should be noted that the above-mentioned extraction of local features of one image among the K images does not limit the extraction of local features of only one image among the K images, but also means that for each image among the K images, the first semantic feature and the second semantic feature corresponding to the image determined according to the semantic condition may be different.
[0222] For example, you can use Figure 10 The semantic spatial transform (SST) model shown in FIG. 1 is used to determine the first semantic feature (i.e., Figure 10 β in ) and the second semantic feature (i.e. Figure 10 ), and determining a residual estimation value according to the first semantic feature, the second semantic feature, and the image feature of the image to be processed.
[0223] Figure 10The SST model can be expressed as follows:
[0224] SST=ReLU((β·F)+γ)
[0225] Among them, SST is the result of semantic space transformation, ReLU is the rectified linear unit ReLU, β is the first semantic feature, γ is the second semantic feature, F is the image feature of the image to be processed, and “·” is a dot multiplication operation.
[0226] After obtaining the result of the semantic space transformation, as Figure 9 As shown, a convolution operation can be performed on the result of the semantic space transformation, and then the convolution result is added to the image features of the image to be processed to obtain a residual estimation value.
[0227] It should be noted that Figure 9 The residual block shown may include one or more SST models and one or more convolution layers. That is to say, in an embodiment of the present application, after one or more SSTs and one or more convolution operations, it can be added to the image features of the image to be processed to obtain a residual estimate. The embodiment of the present application does not limit the number of SST and convolution operations.
[0228] After extracting the local features of the K images, feature fusion may be performed on the local features of the K images to obtain fused local fusion features.
[0229] For example, Figure 6 As shown, the local feature fusion unit 308 can be used to perform feature fusion on the local features of the high exposure image, the local features of the low exposure image, and the local features of the image to be processed. The structure of the local feature fusion unit 308 can be as follows: Figure 11 shown.
[0230] Specifically, in Figure 11 In the process, the local features of the high-exposure image, the local features of the low-exposure image, and the local features of the image to be processed can be concatenated and convolved to obtain fused local fusion features.
[0231] It should be understood that Figure 11 The structure shown is only an example and not a limitation. The local feature fusion unit 308 may include more or fewer convolutional layers, and may also include a pooling layer, a full connection layer (FC) or other layers in the neural network, which is not limited in the embodiments of the present application.
[0232] S530: Extract global features of the image to be processed.
[0233] Optionally, a neural network may be used to extract global features of the image to be processed. For example, the neural network may be a pre-trained convolutional neural network.
[0234] The above-mentioned global features may refer to the overall attributes of an image, including color features, texture features, shape features, or histograms.
[0235] It should be noted that the execution order of S520 and S530 is not limited in the embodiments of the present application. For example, S520 can be executed before S530; or S530 can be executed before S520; or S520 and S530 can be executed simultaneously, and the present application does not limit this.
[0236] S540: Perform image enhancement processing on the image to be processed according to the global features and the local features to obtain an enhanced output image.
[0237] In the present application, when feature fusion is performed on the local features of the K images to obtain local fusion features, the image enhancement processing is performed on the image to be processed according to the global features and the local features to obtain the output image after image enhancement, which may include: performing image enhancement processing on the image to be processed according to the global features and the local fusion features to obtain the output image after image enhancement.
[0238] Optionally, performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement may include: performing feature fusion on the global features and the local features to obtain fused features; performing image enhancement processing on the image to be processed according to the fused features to obtain an output image after image enhancement.
[0239] In an embodiment of the present application, the fusion feature is obtained by fusing the global feature and the local feature, rather than simply adding the global feature and the local feature. Therefore, it is possible to avoid the local area of the image after image enhancement having the same global feature, thereby improving the effect of image enhancement processing.
[0240] Optionally, a neural network may be used to perform feature fusion on the global features and the local features to obtain fused features.
[0241] Optionally, in this application, the global features and local features can be fused to obtain fused features in the following two ways:
[0242] Method 1:
[0243] Optionally, feature extraction can be performed on the global feature to obtain a first global feature and a second global feature; an addition operation can be performed on the first global feature and the local feature to obtain a candidate fusion feature; a concatenation operation and a convolution operation can be performed on the candidate fusion feature and the second global feature to obtain the fusion feature.
[0244] For example, Figure 12 As shown, the global feature can be passed through two independent fully connected layers to generate two global features (i.e., the first global feature and the second global feature). One of the two global features can be first added to the local feature, and then the result of the addition can be connected and convolved with the other global feature of the two global features to obtain a fused feature.
[0245] Method 2:
[0246] Optionally, feature extraction can be performed on the global feature to obtain a first global feature and a second global feature; a connection operation and a convolution operation can be performed on the first global feature and the local feature to obtain a candidate fusion feature; an addition operation can be performed on the candidate fusion feature and the second global feature to obtain the fusion feature.
[0247] For example, Figure 13 As shown, the global feature can be passed through two independent fully connected layers to generate two global features (i.e., the first global feature and the second global feature). One of the two global features can first be connected and convolved with the local feature, and then the result of the connection and convolution is added to the one of the two global features to obtain a fused feature.
[0248] In the fusion method of the above-mentioned method 1 and method 2, after dividing the global features into two independent channels (i.e., the first global feature and the second global feature), the first global feature and the second global feature are fused with the local features. This allows the model to learn more accurate global information and make the color transitions of different lighting and different semantics in the image to be processed more natural.
[0249] Optionally, in the case where the image to be processed is an image obtained by downsampling the original image of the image to be processed, performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement may include: performing image enhancement processing on the original image of the image to be processed according to the global features and the local features to obtain an output image after image enhancement.
[0250] Optionally, in the case where the image to be processed is an image obtained by downsampling the original image of the image to be processed, performing image enhancement processing on the image to be processed according to the fusion feature to obtain an image-enhanced output image may include: performing upsampling processing on the fusion feature according to the original image of the image to be processed to obtain a target fusion feature; performing image enhancement processing on the original image of the image to be processed according to the target fusion feature to obtain an image-enhanced output image.
[0251] The image enhancement method in the embodiment of the present application adjusts the pixel values of the image to be processed to obtain multiple images with different pixel values, and uses these multiple images with different pixel values to perform image quality enhancement processing on the image to be processed, so that more local detail information can be obtained from the multiple images with different pixel values to achieve image enhancement of the image to be processed. This method can improve the effect of image quality enhancement processing.
[0252] Figure 6 This is a schematic block diagram of an image enhancement device in one embodiment of the present application. It should be understood that Figure 6 The models shown are examples only and are not limiting. Figure 6 The model in may include more or fewer units or modules, which is not limited in the implementation of this application.
[0253] In the embodiment of this application, you can use Figure 6 The image enhancement device in the image enhancement process performs image enhancement on the image to be processed. The specific image enhancement process can be as follows:
[0254] like Figure 6 As shown, after the original image of the image to be processed is processed by the downsampling unit 100, a low-resolution image, ie, the image to be processed, can be obtained.
[0255] Optionally, after the image to be processed is processed by the semantic segmentation unit 200, a semantic segmentation map can be obtained, and the semantic segmentation map is passed through the semantic condition generation unit 301 to obtain semantic conditions, wherein the semantic conditions include semantic information of the image to be processed.
[0256] Optionally, after the image to be processed is processed by the local feature extraction unit 302, local features of the image to be processed can be obtained. The local feature extraction unit 302 can be implemented by a neural network.
[0257] For example, the structure of the local feature extraction unit 302 can be as follows: Figure 7 shown.
[0258] Furthermore, when the local feature extraction unit 302 is used to extract the local features of the image to be processed, semantic information of the image to be processed may be introduced. Optionally, when the local feature extraction unit 302 is used to extract the local features of the image to be processed, the semantic condition may be introduced.
[0259] For example, Figure 8 As shown, the semantic condition can be introduced into the processing of the residual block. The specific implementation of the residual block can be as follows Figure 9 and Figure 10 shown.
[0260] Optionally, a high-exposure image corresponding to the image to be processed and a low-exposure image corresponding to the image to be processed may be obtained through the high-exposure processing unit 303 and the low-exposure processing unit 305 .
[0261] The high exposure processing unit 303 and the low exposure processing unit 305 may change the pixel values of the image to be processed through nonlinear transformation.
[0262] For example, the high exposure processing unit 303 and the low exposure processing unit 305 may use gamma transformation to change the pixel values of the image to be processed.
[0263] Optionally, the local features of the high-exposure image may be extracted by the local feature extraction unit 304 , and the local features of the low-exposure image may be extracted by the local feature extraction unit 306 .
[0264] The local feature extraction unit 304 and the local feature extraction unit 306 can be Figure 7 or Figure 8 The structure shown may also be other neural network structures in the prior art, and the embodiments of the present application are not limited to this.
[0265] Optionally, the global feature extraction unit 307 may also be used to extract the global features of the image to be processed.
[0266] Optionally, a local feature fusion unit 308 may be used to fuse the local features of the image to be processed, the local features of the high-exposure image, and the local features of the low-exposure image to obtain local fusion features.
[0267] The structure of the local feature fusion unit 308 can be as follows Figure 11 shown.
[0268] Optionally, the local fusion feature and the global feature of the image to be processed may be fused by the feature fusion unit 309 to obtain a fusion feature.
[0269] The structure of the feature fusion unit 309 can be as follows Figure 12 Alternatively, the structure of the feature fusion unit 309 may also be as shown. Figure 13 shown.
[0270] Optionally, the upsampling unit 400 may be used to perform upsampling processing on the fused features according to the original image of the image to be processed, so as to obtain fused features with full resolution.
[0271] It should be understood that the full-resolution fusion features mentioned here mean that the full-resolution fusion features can be combined with the original image of the image to be processed through the calculation method in the existing technology to obtain an output image after image enhancement, and the resolution of the output image can be the same as the resolution of the original image of the image to be processed.
[0272] Optionally, the original image to be processed and the full-resolution features of the image to be processed may be processed by the full-resolution calculation unit 500 to produce an enhanced output image. The full-resolution calculation unit 500 may be implemented with reference to the prior art and will not be described in detail in the embodiments of this application.
[0273] Figure 6 The image enhancement device in can be pre-trained. In the embodiment of the present application, the image enhancement device can be trained using the following loss function, as follows:
[0274] L mix =L content +α*L visual +β*L aesthetic +γ*L grad +ρ*L saturation +σ*L regularization
[0275] Among them, α, β, γ, ρ and σ are hyperparameters, L mix is the above loss function, L content is the content loss, L visual For visual loss, L aesthetic is aesthetic loss, L grad is the gradient constraint (grad loss), L saturation is the saturation constraint (saturation loss), L regularization is the L1 regularization constraint, as follows:
[0276] L content =|enhanced-GT|
[0277] Among them, enhanced is the output image after image enhancement, GT is the true value, L content Using the L1 paradigm, pixel-level constraints are applied to the enhanced and GT images.
[0278] L visual =MSSIM(enhanced,GT)
[0279] Among them, MSSIM(·) is the multi-scale-structural similarity index (MS-SSIM), and MSSIM(·) is used to evaluate enhanced and GT.
[0280] L aesthetic =N-Aesthetic (enhanced)
[0281] Where N is the highest score of the aesthetic evaluation, and Aesthetic(enhanced) is the aesthetic score of the output image after image enhancement.
[0282] L grad =|grad(input)-grad(enhanced)|
[0283] Where input is the input image (i.e., the original image to be processed), and grad(·) is the gradient calculation, which calculates the gradient of input and enhanced in the flat area to suppress video flicker in the flat area.
[0284] L saturation =w*|enhanced-input|+(1-w)*|enhanced-GT|
[0285] Among them, w is the weight coefficient. Saturation constraint is performed on areas that are subjectively sensitive to the human eye (such as faces and skies). The saturation weight curve is adopted, and enhanced is used to weight the input and GT to calculate the loss.
[0286] L regularization =γ||ω||1=∑ i |ω i |
[0287] Among them, || ||1 is the L1 norm, | | is the absolute value, γ represents the weight of the norm ||ω||1 in the loss function, ω represents the weight of the entire neural network, ω i Represents the weight of the i-th neural network, i is a positive integer, L regularizationThe L1 regularization constraint can make the network more sparse, and the differences between adjacent image frames in the video will not be overly magnified, thereby suppressing global and local flickering in the video.
[0288] Figure 14 Schematic diagram of the hardware structure of the image enhancement device according to an embodiment of the present application. Figure 14 The image enhancement device 4000 shown includes a memory 4001, a processor 4002, a communication interface 4003, and a bus 4004. The memory 4001, the processor 4002, and the communication interface 4003 are connected to each other via the bus 4004.
[0289] Memory 4001 can be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). Memory 4001 can store programs. When the program stored in memory 4001 is executed by processor 4002, processor 4002 and communication interface 4003 are used to perform the various steps of the image enhancement device of the embodiment of the present application.
[0290] The processor 4002 can be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU) or one or more integrated circuits, which are used to execute relevant programs to implement the functions required to be performed by the units in the image enhancement device of the embodiment of the present application, or to execute the image enhancement method of the method embodiment of the present application.
[0291] The processor 4002 may also be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the image enhancement method of the embodiment of the present application may be completed by hardware integrated logic circuits in the processor 4002 or software instructions.
[0292] The processor 4002 may also be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of the present application may be directly implemented as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 4001, and the processor 4002 reads the information in the memory 4001 and, in combination with its hardware, performs the functions required to be performed by the units included in the image enhancement device of the embodiments of the present application, or performs the image enhancement method of the method embodiments of the present application.
[0293] The communication interface 4003 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the apparatus 4000 and other devices or a communication network. For example, the image to be processed can be acquired through the communication interface 4003.
[0294] The bus 4004 may include a path for transmitting information between various components of the device 4000 (eg, the memory 4001 , the processor 4002 , and the communication interface 4003 ).
[0295] Figure 15 Schematic diagram of the hardware structure of the model training device 5000 of the embodiment of the present application. Similar to the above-mentioned device 4000, Figure 15 The model training device 5000 shown includes a memory 5001, a processor 5002, a communication interface 5003 and a bus 5004. The memory 5001, the processor 5002 and the communication interface 5003 are connected to each other via the bus 5004.
[0296] The memory 5001 can store programs. When the program stored in the memory 5001 is executed by the processor 5002, the processor 5002 is used to execute each step of the training method for training the image enhancement device of the embodiment of the present application.
[0297] The processor 5002 can adopt a general-purpose CPU, microprocessor, ASIC, GPU or one or more integrated circuits to execute relevant programs to implement the training method of the image enhancement device of the embodiment of the present application.
[0298] The processor 5002 may also be an integrated circuit chip with signal processing capabilities. During the training process, each step of the training method of the image enhancement device of the embodiment of the present application may be completed by hardware integrated logic circuits in the processor 5002 or software instructions.
[0299] It should be understood that through Figure 15 The model training device 5000 shown in the figure trains the image enhancement device, and the trained image enhancement device can be used to perform the image enhancement method of the embodiment of the present application. Specifically, the neural network can be trained by the device 5000 to obtain Figure 5 The image intensification device of the method shown, or Figure 6 The image intensifier device shown.
[0300] Specifically, Figure 15 The device shown can obtain training data and an image enhancement device to be trained from the outside world through the communication interface 5003, and then the processor trains the image enhancement device to be trained according to the training data.
[0301] It should be noted that although the above-mentioned apparatus 4000 and apparatus 5000 only show a memory, a processor, and a communication interface, in the specific implementation process, those skilled in the art should understand that the apparatus 4000 and apparatus 5000 may also include other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the apparatus 4000 and apparatus 5000 may also include hardware devices that implement other additional functions. In addition, those skilled in the art should understand that the apparatus 4000 and apparatus 5000 may also only include the devices necessary to implement the embodiments of the present application, and do not necessarily include Figure 14 and Figure 15 All devices shown in .
[0302] It should be understood that the processor in the embodiments of the present application may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0303] It should also be understood that the memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0304] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0305] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. A and B can be singular or plural. Furthermore, the character " / " as used herein generally indicates an "or" relationship between the associated objects, but it may also indicate an "and / or" relationship. For specific understanding, please refer to the context.
[0306] In this application, "at least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or plural.
[0307] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0308] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0309] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0310] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0311] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0312] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0313] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0314] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image enhancement method, characterized in that: include: Adjusting the pixel values of the image to be processed to obtain K images, wherein the pixel values of the K images are different, and K is a positive integer greater than 1; Extracting local features of the K images; Extracting global features of the image to be processed; Performing feature extraction on the global feature to obtain a first global feature and a second global feature; Performing an addition operation on the first global feature and the local feature to obtain a candidate fusion feature; performing a concatenation operation and a convolution operation on the candidate fusion feature and the second global feature to obtain a fusion feature; or, Performing a connection operation and a convolution operation on the first global feature and the local feature to obtain a candidate fusion feature; performing an addition operation on the candidate fusion feature and the second global feature to obtain the fusion feature; Performing image enhancement processing on the image to be processed according to the fusion feature to obtain an output image after image enhancement.
2. The method according to claim 1, characterized in that The step of adjusting the pixel values of the image to be processed to obtain K images includes: The K images are obtained by increasing and / or decreasing all pixel values of the image to be processed through nonlinear transformation.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Performing semantic segmentation on the image to be processed to obtain a semantic segmentation map; Performing feature extraction on the semantic segmentation map to obtain semantic conditions, wherein the semantic conditions include semantic information of the image to be processed; Wherein, at least one of the local features of the K images is extracted according to the semantic condition.
4. The method according to claim 3, characterized in that At least one of the local features of the K images is extracted based on a first semantic feature and a second semantic feature, and the first semantic feature and the second semantic feature are determined based on the semantic condition.
5. The method according to claim 4, characterized in that At least one of the local features of the K images is determined based on a residual estimation value, and the residual estimation value is determined based on the first semantic feature, the second semantic feature, and an image feature of the image to be processed.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Performing feature fusion on the local features of the K images to obtain local fusion features; The step of performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement includes: The image to be processed is subjected to image enhancement processing according to the global features and the local fusion features to obtain an output image after image enhancement.
7. The method according to any one of claims 1 to 6, characterized in that The image to be processed is an image obtained by downsampling the original image of the image to be processed; The step of performing image enhancement processing on the image to be processed according to the global features and the local features to obtain an output image after image enhancement includes: Image enhancement processing is performed on the original image of the image to be processed according to the global features and the local features to obtain an output image after image enhancement.
8. The method according to any one of claims 1 to 6, characterized in that In a case where the image to be processed is an image obtained by downsampling the original image of the image to be processed, performing image enhancement processing on the image to be processed according to the fusion feature to obtain an output image after image enhancement, comprises: According to the original image of the image to be processed, upsampling the fusion feature to obtain a target fusion feature; The original image of the image to be processed is subjected to image enhancement processing according to the target fusion feature to obtain an output image after image enhancement.
9. An image enhancement device, characterized in that: include: A pixel adjustment unit, used for adjusting the pixel values of the image to be processed to obtain K images, wherein the pixel values of the K images are different, and K is a positive integer greater than 1; A local feature extraction unit, used to extract local features of the K images; A global feature extraction unit, used for extracting global features of the image to be processed; Image enhancement unit for: Performing feature extraction on the global feature to obtain a first global feature and a second global feature; Performing an addition operation on the first global feature and the local feature to obtain a candidate fusion feature; performing a concatenation operation and a convolution operation on the candidate fusion feature and the second global feature to obtain a fusion feature; or, Performing a connection operation and a convolution operation on the first global feature and the local feature to obtain a candidate fusion feature; performing an addition operation on the candidate fusion feature and the second global feature to obtain the fusion feature; Performing image enhancement processing on the image to be processed according to the fusion feature to obtain an output image after image enhancement.
10. The device according to claim 9, characterized in that The pixel adjustment unit is specifically used to increase and / or decrease all pixel values of the image to be processed through nonlinear transformation to obtain the K images.
11. The device according to claim 9 or 10, characterized in that The device also includes a semantic segmentation unit, which is used to: perform semantic segmentation on the image to be processed to obtain a semantic segmentation map; The device also includes a semantic condition generating unit, which is used to: extract features from the semantic segmentation map to obtain semantic conditions, wherein the semantic conditions include semantic information of the image to be processed; Wherein, at least one of the local features of the K images is extracted according to the semantic condition.
12. The device according to claim 11, characterized in that At least one of the local features of the K images is extracted based on a first semantic feature and a second semantic feature, and the first semantic feature and the second semantic feature are determined based on the semantic condition.
13. The device according to claim 12, characterized in that At least one of the local features of the K images is determined based on a residual estimation value, and the residual estimation value is determined based on the first semantic feature, the second semantic feature, and an image feature of the image to be processed.
14. The device according to any one of claims 9 to 13, characterized in that The local feature extraction unit is further used to: perform feature fusion on the local features of the K images to obtain local fusion features; The image enhancement unit is specifically used to perform image enhancement processing on the image to be processed according to the global feature and the local fusion feature to obtain an output image after image enhancement.
15. The device according to any one of claims 9 to 14, characterized in that The image to be processed is an image obtained by downsampling the original image of the image to be processed; The image enhancement unit is specifically used to perform image enhancement processing on the original image of the image to be processed according to the global feature and the local feature to obtain an output image after image enhancement.
16. The device according to any one of claims 9 to 14, characterized in that In the case where the image to be processed is an image obtained by downsampling the original image of the image to be processed, the image enhancement unit is specifically used to: according to the original image of the image to be processed, upsample the fusion feature to obtain the target fusion feature; according to the target fusion feature, perform image enhancement on the original image of the image to be processed to obtain an output image after image enhancement.
17. An image enhancement device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store program instructions, and the processor is used to call the program instructions to execute the method according to any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that: The computer-readable medium stores a program code for execution by a device, the program code including a program for executing the method according to any one of claims 1 to 8.
19. A chip, characterized in that: The chip includes a processor and a data interface, and the processor reads instructions stored in a memory through the data interface to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image denoising method and device
CN109993707A
Real-time image enhancement method based on deep bilateral learning
CN107689036A
Image enhancement model training method, device, electronic device, and readable storage medium
CN109102483A
Method and system for fusing multiple images
US20150030242A1
