Image processing method and image processing model training method
By adding an attention feature extraction layer to the image processing model, the problem of poor local blur denoising effect is solved, and higher image denoising accuracy is achieved, especially for the processing of locally blurred images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2022-09-06
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, images are often subject to noise interference during acquisition and transmission, leading to a decrease in image quality. In particular, the denoising effect on locally blurred images is poor, reducing the accuracy of image denoising.
By improving the structure of the image processing model, adding an attention feature extraction layer, identifying regions in the image where noise has been added, and increasing the weights of these regions, the model pays more attention to noisy regions during training, thereby improving the denoising effect of locally blurred images.
It improves the accuracy of image denoising, especially the denoising effect on locally blurred images, enhances the image processing model's attention to noisy areas, and improves image quality.
Smart Images

Figure CN116152079B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image processing method and an image processing model training method. Background Technology
[0002] With the development of network technology, images have become the most commonly used information carrier among users and the main way for users to obtain information from the outside world.
[0003] In existing technologies, images are often subject to various noise interferences during acquisition and transmission, which degrades image quality. Therefore, in order to obtain high-quality images, it is generally necessary to perform noise reduction processing on the images, so as to maintain the integrity of the original information while removing useless information from the images.
[0004] However, commonly used noise reduction methods generally target the entire image for noise reduction, which is less effective for locally blurred images and reduces the accuracy of image denoising. Summary of the Invention
[0005] This application provides an image processing method and an image processing model training method to improve the accuracy of image denoising.
[0006] In a first aspect, embodiments of this application provide an image processing method, including:
[0007] Obtain the image to be processed;
[0008] The image to be processed is input into an image processing model to obtain a denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to a region where noise has been added.
[0009] Optionally, each attention feature extraction layer includes: a first input layer, a mapping layer, and a sub-feature extraction layer. Then, the at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map, including:
[0010] For each attention feature extraction layer, the initial feature map is preprocessed through the first input layer to obtain an initial feature map of a preset size;
[0011] The initial feature map of the preset size is normalized by the mapping layer to obtain a weight map. In the weight map, the pixel value of each pixel represents the clarity of the pixel. The smaller the pixel value, the higher the clarity of the pixel. The pixel values of the pixels in the weight map are within a first preset range.
[0012] The weighted feature map is obtained by weighting the weight map and the initial feature map through the sub-feature extraction layer.
[0013] Optionally, the mapping layer includes a channel pooling layer and a normalization layer. The step of normalizing the initial feature map of the preset size through the mapping layer to obtain a weight map includes:
[0014] The channel pooling layer performs channel dimensionality reduction on the initial feature map of the preset size to obtain a single-channel feature map.
[0015] The feature map of the single channel is normalized by the normalization layer to obtain the weight map.
[0016] Optionally, if the sub-feature extraction layer includes a residual network layer and an extended convolutional layer, then the step of weighting the weight map and the initial feature map through the sub-feature extraction layer to obtain a weighted feature map includes:
[0017] The initial weighted feature map is obtained by performing residual processing on the weight map and the initial feature map through the residual network layer.
[0018] The initial weighted feature map is extracted by the extended convolutional layer to obtain a weighted feature map.
[0019] Optionally, the extended convolutional layer includes a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer.
[0020] The step of extracting features from the initial weighted feature map through the extended convolutional layer to obtain a weighted feature map includes:
[0021] The initial weighted feature map is transformed by the second input layer and the first sub-convolutional layer to obtain the translated initial weighted feature map.
[0022] The initial weighted feature map after translation transformation is activated by the activation function layer to obtain a nonlinear initial weighted feature map;
[0023] The second sub-convolutional layer performs feature extraction on the nonlinear initial weighted feature map to obtain a concentrated weighted feature map;
[0024] The initial weighted feature map and the centralized weighted feature map are subjected to residual processing through the sub-residual network layer to obtain a weighted feature map, and the weighted feature map is output through the output layer.
[0025] Optionally, the attention feature extraction layer may consist of at least two layers, and each attention feature extraction layer may include a first sub-attention feature extraction layer and a second sub-attention feature extraction layer, wherein the first sub-attention layer corresponds to at least one second sub-attention layer.
[0026] The step of normalizing the initial feature map of the preset size through the mapping layer to obtain the weight map includes:
[0027] For each of the first sub-attention feature extraction layers, the initial feature map of the preset size is normalized through the mapping layer to obtain a weight map;
[0028] For each second sub-attention feature extraction layer corresponding to the first sub-attention feature extraction layer, the weight map determined by the corresponding first sub-attention feature extraction layer is directly obtained.
[0029] Optionally, after inputting the image to be processed into the image processing model to obtain the denoised image, the method further includes:
[0030] Identify target objects contained in the denoised image, wherein the target object is at least one of a person, animal, plant, traffic sign, and license plate number;
[0031] If the target object matches the preset object, then the target object is determined to have passed verification.
[0032] Secondly, embodiments of this application provide an image processing model training method, the image processing model including a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer, the method including:
[0033] Obtain an image training sample set, wherein the image training sample set contains at least one image training sample;
[0034] The image training sample set is input into the image processing model for model training to obtain the trained image processing model.
[0035] Specifically, the first feature extraction layer extracts features from each of the image training samples to obtain an initial feature map; the at least one attention feature extraction layer performs feature weighting on the initial feature map to obtain a weighted feature map, wherein the weighted feature map is used to indicate whether each region in the initial feature map belongs to a region with added noise; and the second feature extraction layer performs residual processing on the initial feature map and the weighted feature map.
[0036] Optionally, the image training samples include training images with added noise and corresponding annotations for the training images, wherein the annotations are clear, noise-free images corresponding to the training images.
[0037] The step of performing residual processing on the initial feature map and the weighted feature map through the second feature extraction layer to obtain the trained image processing model includes:
[0038] The initial feature map and the weighted feature map are subjected to residual processing by the second feature extraction layer to obtain the denoised training image;
[0039] A first loss value is determined based on the denoised training image and the corresponding clear image without added noise, and a trained image processing model is obtained based on the first loss value.
[0040] Optionally, the annotation label also includes a score, which represents the overall sharpness of the noisy training image.
[0041] After determining the first loss value based on the denoised training image and the corresponding clear image without added noise, the method further includes:
[0042] The second loss value is determined based on the denoised training image and the score value;
[0043] Correspondingly, obtaining the trained image processing model based on the first loss value includes:
[0044] The trained image processing model is obtained based on the first loss value and the second loss value.
[0045] Optionally, before obtaining the trained image processing model based on the first loss value and the second loss value, the method further includes:
[0046] An initial difference feature map is determined based on the denoised training image, the clear image without added noise corresponding to the training image, and a preset threshold function. The pixel value of each pixel in the initial difference feature map represents the difference between the pixel value in the denoised training image and the pixel value of the corresponding pixel in the clear image, and the pixel value of each pixel in the initial difference feature map is within a second preset interval.
[0047] Subtract a preset pixel threshold from the pixel value of each pixel in the difference feature map to obtain the difference feature map, wherein the preset pixel threshold is close to the smaller endpoint of the second preset interval;
[0048] The third loss value is determined based on the difference feature map;
[0049] Correspondingly, obtaining the trained image processing model based on the first loss value and the second loss value includes:
[0050] The trained image processing model is obtained based on the first loss value, the second loss value, and the third loss value.
[0051] Thirdly, embodiments of this application provide an image processing apparatus, including:
[0052] The first acquisition layer is used to acquire the image to be processed;
[0053] A first processing layer is used to input the image to be processed into an image processing model to obtain a denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to a region where noise has been added.
[0054] Fourthly, embodiments of this application provide an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0055] The memory stores computer-executed instructions;
[0056] The processor executes computer execution instructions stored in the memory to implement the method as described in either the first or second aspect.
[0057] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in either the first or second aspect.
[0058] This application provides an image processing method and an image processing model training method. Using the above scheme, an image to be processed can be acquired first, and then input into a trained image processing model to obtain a denoised image. The image processing model may include a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer extracts features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer performs feature weighting on the initial feature map to obtain a weighted feature map. The second feature extraction layer performs residual processing on the initial feature map and the weighted feature map (which indicates whether each region in the initial feature map belongs to a region with added noise) to obtain a denoised image. By improving the structure of the image processing model, an attention feature extraction layer is added. This attention feature extraction layer can determine the regions with added noise in the image and increase the weight of these regions. This allows the image processing model to pay more attention to the regions with added noise during training, improving the denoising effect of locally blurred images and thus improving the accuracy of image denoising. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 A schematic diagram of the architecture of an application system for the image processing model training method provided in this application embodiment;
[0061] Figure 2 A schematic flowchart illustrating the image processing model training method provided in this application embodiment;
[0062] Figure 3 This is a schematic diagram illustrating the application of the attention feature extraction layer provided in the embodiments of this application;
[0063] Figure 4 This is a schematic diagram illustrating the application of the attention feature extraction layer provided in another embodiment of this application;
[0064] Figure 5This is a schematic diagram of the structure of the image processing model provided in the embodiments of this application;
[0065] Figure 6 A flowchart illustrating the image processing model application method provided in the embodiments of this application;
[0066] Figure 7 This is a schematic diagram of the structure of the image processing model application device provided in the embodiments of this application;
[0067] Figure 8 This is a schematic diagram of the structure of the image processing model training device provided in the embodiments of this application;
[0068] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0069] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0070] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can also include other sequential examples besides those illustrated or described. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0071] In related technologies, images are often subject to various noise interferences during acquisition and transmission, leading to a decline in image quality. For example, due to imperfections in transmission media and recording equipment, digital images are often contaminated by various noises during transmission and recording. Furthermore, image preprocessing algorithms (such as image segmentation, target recognition, and edge extraction algorithms) can be used to process images, resulting in processed images that are then applied to achieve related functions. However, image preprocessing algorithms also affect image quality. Therefore, to obtain high-quality images, noise reduction processing is generally required, preserving the integrity of the original information while removing useless information. However, commonly used noise reduction methods typically target the entire image, performing well for images that are generally blurred, but poorly for images that are partially blurred. For example, adding noise only to a face results in poor noise reduction, thus reducing the accuracy of image denoising.
[0072] Based on the aforementioned technical problems, this application improves the structure of the image processing model by adding an attention feature extraction layer. This attention feature extraction layer can identify the regions with added noise in the image and increase the weight of these regions. This allows the image processing model to pay more attention to the regions with added noise during training, thereby improving the denoising effect of locally blurred images and thus enhancing the accuracy of image denoising.
[0073] Figure 1 This is a schematic diagram of the architecture of an application system for the image processing model training method provided in the embodiments of this application, such as... Figure 1 As shown, the application system may include a server and a database. The database stores an image training sample set, and the server deploys an image processing model. The server can obtain the image training sample set from the database and train the image processing model based on the obtained image training sample set to obtain a trained image processing model. The image processing model may include a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. After obtaining the image training sample set, the server can input the image training sample set into the image processing model for training to obtain the trained image processing model. Specifically, the first feature extraction layer can extract features from each image training sample to obtain an initial feature map. The initial feature map is then weighted by at least one attention feature extraction layer to obtain a weighted feature map indicating whether each region in the initial feature map belongs to a region with added noise. The second feature extraction layer performs residual processing on the initial feature map and the weighted feature map.
[0074] Optionally, the image training sample set can also be generated in real time. The image training sample set may contain one or more image training samples, each of which may contain a noisy image and a corresponding label, where the label is the clear, un-noisy image corresponding to the noisy image.
[0075] The technical solutions of this application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0076] Figure 2 This is a schematic flowchart of the image processing method provided in the embodiments of this application, as shown below. Figure 2 As shown, in this embodiment, it may include:
[0077] S201: Obtain the image to be processed.
[0078] In this embodiment, the image to be processed may be an image with added noise. In order to better identify objects in the image, the image can be denoised first. Then, the denoised image can be identified, and subsequent operations can be performed based on the identification results. For example, if the objects contained in the denoised image are plants or animals, the denoised image can be identified after denoising, thereby determining the species of plants or animals.
[0079] S202: Input the image to be processed into the image processing model to obtain the denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain the denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to the region where noise has been added.
[0080] In this embodiment, when denoising the image to be processed, it can be done through a model. The image processing model is a pre-trained model, that is, an image processing model is trained first, and then the image to be processed can be denoised through the image processing model. For example, the specific image processing model training method is described in the following description.
[0081] Furthermore, to improve the denoising accuracy of the model for images with locally added noise, the structure of the image processing model can be improved. The improved image processing model can include a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to a region with added noise.
[0082] By adopting the above scheme, the structure of the image processing model is improved by adding an attention feature extraction layer. This attention feature extraction layer can identify the regions with added noise in the image and increase the weight of these regions. This allows the image processing model to pay more attention to the regions with added noise during training, improving the denoising effect of locally blurred images and thus improving the accuracy of image denoising.
[0083] based on Figure 2 In addition to the method described herein, this specification also provides some specific implementation schemes of the method, which will be described below.
[0084] In another embodiment, each attention feature extraction layer includes: a first input layer, a mapping layer, and a sub-feature extraction layer. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map, specifically including:
[0085] For each attention feature extraction layer, the initial feature map is preprocessed through the first input layer to obtain an initial feature map of a preset size.
[0086] The initial feature map of the preset size is normalized by the mapping layer to obtain a weight map. In the weight map, the pixel value of each pixel represents the sharpness of the pixel. The smaller the pixel value, the higher the sharpness of the pixel. The pixel values of the pixels in the weight map are within a first preset range.
[0087] The weighted feature map is obtained by weighting the weight map and the initial feature map through the sub-feature extraction layer.
[0088] In this embodiment, there may be one or more attention feature extraction layers, and the specific number can be customized according to actual needs and different application scenarios.
[0089] Optionally, the attention feature extraction layer may include: a first input layer, a mapping layer, and a sub-feature extraction layer. After obtaining the initial feature map, the format of the initial feature map can be preprocessed by the first input layer to obtain an initial feature map of a preset size (wherein, the preset size can be customized according to the actual application scenario, and will not be specified in detail here). Then, the initial feature map of the preset size can be normalized by the mapping layer to obtain a weight map. The pixel value of each pixel in the weight map can represent the sharpness of the pixel; the smaller the pixel value, the higher the sharpness of the pixel, and the larger the pixel value, the lower the sharpness of the pixel. In addition, the pixel values of the pixels in the weight map are within a first preset range. For example, the first preset range can be [0, 1].
[0090] In summary, by using a weighted graph, the weight of noisy regions in an image can be increased, thereby improving the subsequent denoising effect.
[0091] Furthermore, the mapping layer includes a channel pooling layer and a normalization layer. The normalization process performed on the initial feature map of the preset size through the mapping layer to obtain the weight map may specifically include:
[0092] The channel pooling layer performs channel dimensionality reduction on the initial feature map of the preset size to obtain a feature map of a single channel.
[0093] The normalization layer normalizes the feature map of a single channel to obtain a weight map.
[0094] Specifically, the mapping layer can include a channel pooling layer and a normalization layer. After obtaining the initial feature map, which may have multiple channels, a channel pooling layer can be used to reduce the channel dimensionality of the initial feature map to a single channel to facilitate subsequent normalization. Then, a normalization layer can be used to normalize the single-channel feature map to obtain a weight map. The channel pooling layer and the normalization layer can be implemented using existing methods. For example, the channel pooling layer can be a Channel-Wise Pooling layer, and the normalization layer can be a sigmoid function layer.
[0095] For example, Figure 3 This is a schematic diagram illustrating the application of the attention feature extraction layer provided in the embodiments of this application, such as... Figure 3As shown, in this embodiment, the attention feature extraction layer may include a first input layer, a mapping layer, and a sub-feature extraction layer. The mapping layer may include a channel pooling layer and a normalization layer. Correspondingly, the initial feature map can be preprocessed by the first input layer to obtain an initial feature map of a preset size. Then, the initial feature map of the preset size can be subjected to channel dimensionality reduction processing by the channel pooling layer to obtain a single-channel feature map. Then, the single-channel feature map can be normalized by the normalization layer to obtain a weight map. Finally, the weight map and the initial feature map are weighted by the sub-feature extraction layer to obtain a weighted feature map.
[0096] Furthermore, the sub-feature extraction layer may include a residual network layer and an extended convolutional layer. The step of weighting the weight map and the initial feature map through the sub-feature extraction layer to obtain a weighted feature map may specifically include:
[0097] The initial weighted feature map is obtained by performing residual processing on the weight map and the initial feature map through the residual network layer.
[0098] The initial weighted feature map is extracted by the extended convolutional layer to obtain a weighted feature map.
[0099] Specifically, the sub-feature extraction layer can include a residual network layer and an extended convolutional layer. After obtaining the weight map and the initial feature map, the residual network layer can be used to perform residual processing on the weight map and the initial feature map to obtain an initial weighted feature map. Then, the extended convolutional layer can be used to further extract features from the initial weighted feature map, making the extracted features more specific and obtaining a weighted feature map.
[0100] Optionally, the residual network layer can multiply the pixel value of each pixel in the weight map with the corresponding pixel value in the initial feature map to obtain an initial weighted feature map. This initial weighted feature map allows parameter weights to be concentrated on the noisy regions of the image, thereby improving the accuracy of subsequent image denoising.
[0101] Furthermore, the extended convolutional layer includes a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer. The step of extracting features from the initial weighted feature map using the extended convolutional layer to obtain a weighted feature map may include:
[0102] The initial weighted feature map is transformed by the second input layer and the first sub-convolutional layer to obtain the translated initial weighted feature map.
[0103] The initial weighted feature map after translation transformation is activated by the activation function layer to obtain a nonlinear initial weighted feature map.
[0104] The second sub-convolutional layer performs feature extraction on the nonlinear initial weighted feature map to obtain a concentrated weighted feature map.
[0105] The initial weighted feature map and the centralized weighted feature map are subjected to residual processing through the sub-residual network layer to obtain a weighted feature map, and the weighted feature map is output through the output layer.
[0106] Specifically, extending the convolutional layer can make the extracted features more specific. The extended convolutional layer can include a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer. After obtaining the initial weighted feature map, the second input layer and the first sub-convolutional layer in the extended convolutional layer can be used to perform a translation transformation on the initial weighted feature map, resulting in a translated initial weighted feature map. The first sub-convolutional layer can contain a shift operator and a convolutional layer (exemplarily a 1x1 convolutional layer). By setting shift operators in different directions, different channels of the input tensor can be translated. Subsequently, combined with the 1x1 convolutional layer, cross-channel information fusion can be achieved, thus obtaining the translated initial weighted feature map. This translated initial weighted feature map can represent fuzzy spatial features. Since the position of fuzzy features in each fuzzy image is not fixed within the entire image, the first sub-convolutional layer can make the features more concentrated and increase the robustness of the network.
[0107] Furthermore, after obtaining the initial weighted feature map after translation transformation, an activation function layer can be used to activate the initial weighted feature map to obtain a nonlinear initial weighted feature map. For example, the activation function layer can be the Prelude activation function, which increases the nonlinearity of neurons and enhances the robustness of the network model.
[0108] Furthermore, after obtaining the nonlinear initial weighted feature map, a second sub-convolutional layer can be used to extract features from the nonlinear initial weighted feature map, resulting in a concentrated weighted feature map. This second sub-convolutional layer can also contain a shift operator and a convolutional layer (for example, a 1x1 convolutional layer). This second sub-convolutional layer can yield more concentrated spatial features representing the fuzzy representation, i.e., the concentrated weighted feature map.
[0109] For example, Figure 4 This is a schematic diagram illustrating the application of an attention feature extraction layer provided in another embodiment of this application, such as... Figure 4As shown, in this embodiment, the attention feature extraction layer may include a first input layer, a mapping layer, and a sub-feature extraction layer. The mapping layer may include a channel pooling layer and a normalization layer. The sub-feature extraction layer may include a residual network layer and an extended convolutional layer. The extended convolutional layer may include a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer. Correspondingly, the initial feature map can be preprocessed by the first input layer to obtain an initial feature map of a preset size. Then, the initial feature map of the preset size can be subjected to channel dimensionality reduction processing by the channel pooling layer to obtain a single-channel feature map. Then, the single-channel feature map can be normalized by the normalization layer to obtain a weight map. Finally, the weight map and the initial feature map can be subjected to residual processing by the residual network layer to obtain an initial weighted feature map. Then, the initial weighted feature map is transformed by a second input layer and a first sub-convolutional layer to obtain a translated initial weighted feature map. Next, an activation function layer is used to activate the translated initial weighted feature map, resulting in a non-linear initial weighted feature map. A second sub-convolutional layer then extracts features from this non-linear initial weighted feature map, yielding a concentrated weighted feature map. Finally, a sub-residual network layer performs residual processing on the initial weighted feature map and the concentrated weighted feature map to obtain a weighted feature map, which is then output by the output layer.
[0110] In summary, by employing two sub-convolutional layers with an activation function in between (each sub-convolutional layer contains a shift operator and a convolutional layer), the receptive field can be increased without increasing the computational cost, thereby improving the effectiveness of local feature extraction.
[0111] In another embodiment, the attention feature extraction layer comprises at least two layers, and each attention feature extraction layer includes a first sub-attention feature extraction layer and a second sub-attention feature extraction layer, wherein the first sub-attention layer corresponds to at least one second sub-attention layer. The normalization process performed on the initial feature map of the preset size through the mapping layer to obtain the weight map may specifically include:
[0112] For each of the first sub-attention feature extraction layers, the initial feature map of the preset size is normalized through the mapping layer to obtain a weight map.
[0113] For each second sub-attention feature extraction layer corresponding to the first sub-attention feature extraction layer, the weight map determined by the corresponding first sub-attention feature extraction layer is directly obtained.
[0114] In this embodiment, there can be two types of sub-attention feature extraction layers: a first sub-attention feature extraction layer and a second sub-attention feature extraction layer. There can be one or more first sub-attention feature extraction layers, and each first sub-attention feature extraction layer corresponds to one or more second sub-attention feature extraction layers. Furthermore, the first sub-attention feature extraction layer can determine the weight map corresponding to the initial feature map through a mapping layer. The one or more second sub-attention feature extraction layers corresponding to the first sub-attention feature extraction layer can directly obtain the weight map determined by the first sub-attention feature extraction layer, and then determine the weighted feature map based on the determined weight map. By dividing the sub-attention feature extraction layers into two types, and having the second sub-attention feature extraction layer directly use the weight map determined by its corresponding first sub-attention feature extraction layer, the weight values of the processing objects of the two sub-attention feature extraction layers are consistent. This weight-sharing approach reduces the computational load of the model, thereby improving the training efficiency of the model.
[0115] Furthermore, the first sub-attention feature extraction layer can extract features using upsampling, while the second sub-attention feature extraction layer can extract features using downsampling. Correspondingly, each first sub-attention feature extraction layer can correspond to one second sub-attention feature extraction layer.
[0116] For example, Figure 5 This is a schematic diagram of the structure of the image processing model provided in the embodiments of this application, such as... Figure 5 As shown, in this embodiment, it may include a first feature extraction layer, a first self-attention feature extraction layer, a second self-attention feature extraction layer, and a second feature extraction layer. The first and second self-attention feature extraction layers share weights, meaning each first self-attention feature extraction layer corresponds to one second self-attention feature extraction layer. For example, if there are four first self-attention feature extraction layers, then there are also four second self-attention feature extraction layers.
[0117] In another embodiment, after inputting the image to be processed into the image processing model to obtain the denoised image, the method may further include:
[0118] Identify target objects contained in the denoised image, wherein the target object is at least one of a person, animal, plant, traffic sign, and license plate number.
[0119] If the target object matches the preset object, then the target object is determined to have passed verification.
[0120] In this embodiment, after obtaining the denoised image, the target object contained in the denoised image can be identified first, and then the relevant functions can be implemented based on the identified target object.
[0121] Optionally, after identifying the target object, it can be compared with pre-stored objects. If they match, the target object verification is considered successful. The target object can be a person, animal, plant, traffic sign, or license plate number, etc. For example, if the target object is a person, user verification can be achieved by comparing it with pre-stored objects. Furthermore, if the target object does not match a pre-stored object, a discrepancy message can be generated, indicating that the relevant person's verification failed, thus improving the user experience.
[0122] Optionally, after identifying the target object, relevant information about the target object can be displayed directly. For example, the target object can be an animal or a plant. After identifying the target object, the name of the animal or plant and related information can be displayed to help users understand the plant or animal.
[0123] Figure 6 This is a flowchart illustrating the image processing model training method provided in this embodiment. The method in this embodiment can be executed by a server. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. Figure 6 As shown, the method in this embodiment may include:
[0124] S601: Obtain an image training sample set, wherein the image training sample set contains at least one image training sample.
[0125] In this embodiment, before training the image processing model, an image training sample set can be obtained first, and then the image processing model can be trained based on the image training sample set to obtain the trained image processing model.
[0126] Optionally, the image training sample set may contain at least one image training sample. Each image training sample may contain an image with added noise and a corresponding label. The label may be a clear image without added noise (i.e., a denoised image) corresponding to the image with added noise. The image training samples may be data with custom annotations or data obtained from public datasets (e.g., LIVE2, CSIQ, etc.). The size of the images in the image training samples can be customized; for example, it may be a 480*640 image.
[0127] Furthermore, different noise addition methods can be used for different image training samples. For example, noise addition methods can be Gaussian noise, Poisson noise, multiplicative noise, or salt and pepper noise.
[0128] S602: Input the image training sample set into the image processing model to train the model and obtain the trained image processing model.
[0129] Specifically, the first feature extraction layer extracts features from each image training sample to obtain an initial feature map; the initial feature map is then weighted by at least one attention feature extraction layer to obtain a weighted feature map, wherein the weighted feature map is used to indicate whether each region in the initial feature map belongs to a region with added noise; and the second feature extraction layer performs residual processing on the initial feature map and the weighted feature map.
[0130] In this embodiment, the first feature extraction layer can be a convolutional layer. For example, the first feature extraction layer can contain two 3*3 convolutional layers. Through this convolutional layer, features in the image training samples can be extracted in a shallow manner to obtain an initial feature map. For example, if the object in the image training samples is a face, the initial feature map can mainly contain the contour information of the face.
[0131] Furthermore, the image processing model may include one or more attention feature extraction layers. After obtaining the initial feature map, one or more attention feature extraction layers can be used to perform feature weighting on the initial feature map to obtain a weighted feature map. This weighted feature map can be used to indicate whether noise has been added to each region in the initial feature map. Optionally, the pixel value of each pixel in the weighted feature map can be used to represent whether noise has been added to each region in the initial feature map.
[0132] In one implementation, if the pixel value of a pixel is higher than a preset pixel threshold, it indicates that the region in the initial feature map corresponding to that pixel is a region with added noise; if the pixel value of a pixel is lower than or equal to the preset pixel threshold, it indicates that the region in the initial feature map corresponding to that pixel is a region without added noise.
[0133] In another implementation, a target region within a preset range can be determined using the pixel coordinates of a pixel as the center. Then, the average pixel value of each pixel within this target region is determined, and the relationship between this average pixel value and a pixel threshold is compared. If the average pixel value is higher than the preset pixel threshold, it indicates that the region in the initial feature map corresponding to that pixel has added noise; if the average pixel value is lower than or equal to the preset pixel threshold, it indicates that the region in the initial feature map corresponding to that pixel has not added noise. By first determining the average pixel value and then using this value to determine whether a region has added noise, the accuracy of noise region identification is improved.
[0134] Furthermore, this application only lists a few scenarios for determining areas where noise has been added. The process of determining whether noise has been added to each area in the initial feature map through other means is also within the scope of protection of this application, and will not be described in detail here.
[0135] Furthermore, after obtaining the initial feature map and the weighted feature map, a second feature extraction layer can be used to perform residual processing on the initial feature map and the weighted feature map to supplement the high-frequency information lost in the image during model training, thereby improving the accuracy of model training. The second feature extraction layer can be an existing residual network, and will not be specified further here.
[0136] By adopting the above scheme, the structure of the image processing model is improved by adding an attention feature extraction layer. This attention feature extraction layer can identify the regions with added noise in the image and increase the weight of these regions. This allows the image processing model to pay more attention to the regions with added noise during training, improving the denoising effect of locally blurred images and thus improving the accuracy of image denoising.
[0137] In another embodiment, the image training samples include training images with added noise and corresponding labels for the training images, wherein the labels are clear, noise-free images corresponding to the training images. The step of performing residual processing on the initial feature map and the weighted feature map through the second feature extraction layer to obtain the trained image processing model may specifically include:
[0138] The second feature extraction layer performs residual processing on the initial feature map and the weighted feature map to obtain a denoised training image.
[0139] A first loss value is determined based on the denoised training image and the corresponding clear image without added noise, and a trained image processing model is obtained based on the first loss value.
[0140] In this embodiment, during the image processing model training process, a first loss value can be determined based on the denoised training image and the corresponding clear image without added noise, and the trained image processing model can be obtained based on the first loss value. For example, the first loss value can be determined using the loss function MSE, or it can be determined using the expression Loss1 = ||HR - unint(LR)||1, where HR is the clear image without added noise corresponding to the training image, and LR is the denoised image obtained by the image processing model.
[0141] Furthermore, the annotation label also includes a score value, which represents the overall clarity of the training image with added noise. Therefore, after determining the first loss value based on the denoised training image and the corresponding clear image without added noise, the method may further include:
[0142] The second loss value is determined based on the denoised training image and the score.
[0143] Correspondingly, obtaining the trained image processing model based on the first loss value includes:
[0144] The trained image processing model is obtained based on the first loss value and the second loss value.
[0145] Specifically, the labeling can also include a score, which represents the overall sharpness of the training image after noise has been added. For example, the score can be between 0 and 100; a smaller score indicates a lower overall sharpness, and a larger score indicates a higher overall sharpness. The score determines a second loss value, which represents the overall denoising effect of the image.
[0146] Optionally, the second loss value can be determined using a quality assessment model. This involves inputting the denoised training image and its score into a trained quality assessment model to determine the second loss value. Correspondingly, the quality assessment model can consist of five residual networks. Each residual network can be composed of two 3x3 convolutions, each with 64 channels. The first 3x3 convolution increases the number of channels, while the second 3x3 convolution further extracts and smooths the features. Furthermore, each residual network is followed by a Maxpooling layer for dimensionality reduction, reducing any dimension of the feature map to 1x1. The last residual network is followed by a global pooling layer, ensuring that the dimension of all feature maps is reduced to 1x1. Finally, the global residual network is followed by two fully connected layers. The second loss value is obtained through these fully connected layers, where the first fully connected layer has 64 neurons and the second fully connected layer has 2 neurons.
[0147] In summary, by combining a first loss value representing the local denoising effect with a second loss value representing the overall denoising effect, the accuracy of image denoising is improved.
[0148] Furthermore, before obtaining the trained image processing model based on the first loss value and the second loss value, the method may further include:
[0149] An initial difference feature map is determined based on the denoised training image, the clear image without added noise corresponding to the training image, and a preset threshold function. The pixel value of each pixel in the initial difference feature map represents the difference between the pixel value in the denoised training image and the pixel value of the corresponding pixel in the clear image, and the pixel value of each pixel in the initial difference feature map is within a second preset interval.
[0150] Subtract a preset pixel threshold from the pixel value of each pixel in the difference feature map to obtain the difference feature map, wherein the preset pixel threshold is close to the smaller interval endpoint within the second preset interval range.
[0151] The third loss value is determined based on the difference feature map.
[0152] Correspondingly, obtaining the trained image processing model based on the first loss value and the second loss value includes:
[0153] The trained image processing model is obtained based on the first loss value, the second loss value, and the third loss value.
[0154] Specifically, when training an image processing model, in addition to combining the first and second loss values, a third loss value can also be used to train the image processing model.
[0155] Correspondingly, the third loss value can be determined based on the denoised training image, the corresponding clear image without added noise, and a preset threshold function. Optionally, it can be determined using the expression:
[0156] The initial difference feature map is determined by M = sigmoid ||DR – HR||, where the pixel values of the pixels in M are between 0 and 1. Considering that the loss can be brought closer to the blur, pixels with values less than 0.2 in M can be discarded. Then, the third loss value can be determined according to the expression: Lm = MSE(M - 0.2), where MSE is the mean squared error function.
[0157] In summary, by employing a third loss value, the determined loss can be biased towards the features that add noise, thereby improving the denoising effect of the model.
[0158] In addition, different weights can be set for the first loss value, the second loss value, and the third loss value according to the actual application scenario, thereby improving the training effect of the model.
[0159] Based on the same idea, this specification also provides an apparatus corresponding to the above method. Figure 7 This is a schematic diagram of the structure of the image processing apparatus provided in the embodiments of this application, such as... Figure 7 As shown, the apparatus provided in this embodiment may include:
[0160] The first acquisition layer 701 is used to acquire the image to be processed.
[0161] The first processing layer 702 is used to input the image to be processed into an image processing model to obtain a denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to a region where noise has been added.
[0162] In another embodiment, each attention feature extraction layer includes: a first input layer, a mapping layer, and a sub-feature extraction layer, then the first processing layer 702 is further configured to:
[0163] For each attention feature extraction layer, the initial feature map is preprocessed through the first input layer to obtain an initial feature map of a preset size.
[0164] The initial feature map of the preset size is normalized by the mapping layer to obtain a weight map. In the weight map, the pixel value of each pixel represents the clarity of the pixel. The smaller the pixel value, the higher the clarity of the pixel. The pixel values of the pixels in the weight map are within a first preset range.
[0165] The weighted feature map is obtained by weighting the weight map and the initial feature map through the sub-feature extraction layer.
[0166] Furthermore, since the mapping layer includes a channel pooling layer and a normalization layer, the first processing layer 702 is also used for:
[0167] The channel pooling layer performs channel dimensionality reduction on the initial feature map of the preset size to obtain a feature map of a single channel.
[0168] The feature map of the single channel is normalized by the normalization layer to obtain the weight map.
[0169] Furthermore, since the sub-feature extraction layer includes a residual network layer and an extended convolutional layer, the first processing layer 702 is also used for:
[0170] The initial weighted feature map is obtained by performing residual processing on the weight map and the initial feature map through the residual network layer.
[0171] The initial weighted feature map is extracted by the extended convolutional layer to obtain a weighted feature map.
[0172] Furthermore, if the extended convolutional layer includes a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer, then the first processing layer 702 is further used for:
[0173] The initial weighted feature map is transformed by the second input layer and the first sub-convolutional layer to obtain the translated initial weighted feature map.
[0174] The initial weighted feature map after translation transformation is activated by the activation function layer to obtain a nonlinear initial weighted feature map.
[0175] The second sub-convolutional layer performs feature extraction on the nonlinear initial weighted feature map to obtain a concentrated weighted feature map.
[0176] The initial weighted feature map and the centralized weighted feature map are subjected to residual processing through the sub-residual network layer to obtain a weighted feature map, and the weighted feature map is output through the output layer.
[0177] In another embodiment, the attention feature extraction layer comprises at least two layers, and each attention feature extraction layer includes a first sub-attention feature extraction layer and a second sub-attention feature extraction layer, wherein the first sub-attention layer corresponds to at least one second sub-attention layer. Then, the first processing layer 702 is further configured to:
[0178] For each of the first sub-attention feature extraction layers, the initial feature map of the preset size is normalized through the mapping layer to obtain a weight map.
[0179] For each second sub-attention feature extraction layer corresponding to the first sub-attention feature extraction layer, the weight map determined by the corresponding first sub-attention feature extraction layer is directly obtained.
[0180] In another embodiment, the first processing layer 702 is further configured to:
[0181] Identify target objects contained in the denoised image, wherein the target object is at least one of a person, animal, plant, traffic sign, and license plate number.
[0182] If the target object matches the preset object, then the target object is determined to have passed verification.
[0183] Figure 8 This is a schematic diagram of the structure of the image processing model training device provided in the embodiments of this application. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer, such as... Figure 8 As shown, the apparatus provided in this embodiment may include:
[0184] The second acquisition layer 801 is used to acquire an image training sample set, wherein the image training sample set contains at least one image training sample.
[0185] The second processing layer 802 is used to input the image training sample set into the image processing model for model training, so as to obtain the trained image processing model.
[0186] Specifically, the first feature extraction layer extracts features from each of the image training samples to obtain an initial feature map; the at least one attention feature extraction layer performs feature weighting on the initial feature map to obtain a weighted feature map, wherein the weighted feature map is used to indicate whether each region in the initial feature map belongs to a region with added noise; and the second feature extraction layer performs residual processing on the initial feature map and the weighted feature map.
[0187] In another embodiment, the image training samples include training images with added noise and corresponding annotations for the training images, wherein the annotations are clear, noise-free images corresponding to the training images. Then, the second processing layer 802 is further configured to:
[0188] The second feature extraction layer performs residual processing on the initial feature map and the weighted feature map to obtain a denoised training image.
[0189] A first loss value is determined based on the denoised training image and the corresponding clear image without added noise, and a trained image processing model is obtained based on the first loss value.
[0190] Furthermore, the annotation labels also include score values, which represent the overall sharpness of the training image with added noise. Therefore, the second processing layer 802 is further used for:
[0191] The second loss value is determined based on the denoised training image and the score.
[0192] The trained image processing model is obtained based on the first loss value and the second loss value.
[0193] In addition, the second processing layer 802 is also used for:
[0194] An initial difference feature map is determined based on the denoised training image, the clear image without added noise corresponding to the training image, and a preset threshold function. The pixel value of each pixel in the initial difference feature map represents the difference between the pixel value in the denoised training image and the pixel value of the corresponding pixel in the clear image, and the pixel value of each pixel in the initial difference feature map is within a second preset interval.
[0195] Subtract a preset pixel threshold from the pixel value of each pixel in the difference feature map to obtain the difference feature map, wherein the preset pixel threshold is close to the smaller interval endpoint within the second preset interval range.
[0196] The third loss value is determined based on the difference feature map.
[0197] The trained image processing model is obtained based on the first loss value, the second loss value, and the third loss value.
[0198] The apparatus provided in this application embodiment can achieve the above-mentioned... Figure 2 The methods in the embodiments shown are similar in principle and technical effect, and will not be described again here.
[0199] Figure 9 A schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application, such as... Figure 9 As shown, the device 900 provided in this embodiment includes a processor 901 and a memory communicatively connected to the processor. The processor 901 and the memory 902 are connected via a bus 903.
[0200] In the specific implementation process, the processor 901 executes the computer execution instructions stored in the memory 902, causing the processor 901 to execute the method in the above method embodiment.
[0201] The specific implementation process of processor 901 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0202] In the above Figure 9 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented using a combination of hardware and software layers within the processor.
[0203] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0204] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0205] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in the above method embodiments.
[0206] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.
[0207] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0208] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0209] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0210] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. An image processing method, characterized in that, include: Obtain the image to be processed; The image to be processed is input into an image processing model to obtain a denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer is used to extract features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer is used to obtain an initial feature map of a preset size, and to normalize the initial feature map of the preset size to obtain a weight map. The weight map and the initial feature map are weighted to obtain a weighted feature map. The second feature extraction layer is used to perform residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map is used to indicate whether each region in the initial feature map belongs to a region where noise has been added. The pixel value of each pixel in the weight map represents the sharpness of the pixel. The smaller the pixel value, the higher the sharpness of the pixel. The pixel values of the pixels in the weight map are within a first preset range.
2. The method according to claim 1, characterized in that, Each attention feature extraction layer includes: a first input layer, a mapping layer, and a sub-feature extraction layer. The at least one attention feature extraction layer is used to perform feature weighting processing on the initial feature map to obtain a weighted feature map, including: For each attention feature extraction layer, the initial feature map is preprocessed through the first input layer to obtain the initial feature map of the preset size; The initial feature map of the preset size is normalized through the mapping layer to obtain the weight map; The weighted feature map is obtained by weighting the weight map and the initial feature map through the sub-feature extraction layer.
3. The method according to claim 2, characterized in that, The mapping layer includes a channel pooling layer and a normalization layer. The step of normalizing the initial feature map of the preset size through the mapping layer to obtain a weight map includes: The channel pooling layer performs channel dimensionality reduction on the initial feature map of the preset size to obtain a single-channel feature map. The feature map of the single channel is normalized by the normalization layer to obtain the weight map.
4. The method according to claim 2, characterized in that, The sub-feature extraction layer includes a residual network layer and an extended convolutional layer. The step of weighting the weight map and the initial feature map through the sub-feature extraction layer to obtain a weighted feature map includes: The initial weighted feature map is obtained by performing residual processing on the weight map and the initial feature map through the residual network layer. The initial weighted feature map is extracted by the extended convolutional layer to obtain a weighted feature map.
5. The method according to claim 4, characterized in that, The extended convolutional layer includes a second input layer, a first sub-convolutional layer, an activation function layer, a second sub-convolutional layer, a sub-residual network layer, and an output layer. The step of extracting features from the initial weighted feature map through the extended convolutional layer to obtain a weighted feature map includes: The initial weighted feature map is transformed by the second input layer and the first sub-convolutional layer to obtain the translated initial weighted feature map. The initial weighted feature map after translation transformation is activated by the activation function layer to obtain a nonlinear initial weighted feature map; The second sub-convolutional layer performs feature extraction on the nonlinear initial weighted feature map to obtain a concentrated weighted feature map; The initial weighted feature map and the centralized weighted feature map are subjected to residual processing through the sub-residual network layer to obtain a weighted feature map. The weighted feature map is output through the output layer.
6. The method according to claim 2, characterized in that, The attention feature extraction layer comprises at least two layers, and each layer includes a first sub-attention feature extraction layer and a second sub-attention feature extraction layer, wherein the first sub-attention feature extraction layer corresponds to at least one second sub-attention layer. The step of normalizing the initial feature map of the preset size through the mapping layer to obtain the weight map includes: For each of the first sub-attention feature extraction layers, the initial feature map of the preset size is normalized through the mapping layer to obtain a weight map; For each second sub-attention feature extraction layer corresponding to the first sub-attention feature extraction layer, obtain the weight map determined by the corresponding first sub-attention feature extraction layer.
7. The method according to any one of claims 1-6, characterized in that, After inputting the image to be processed into the image processing model to obtain the denoised image, the process further includes: Identify target objects contained in the denoised image, wherein the target object is at least one of a person, animal, plant, traffic sign, and license plate number; If the target object matches the preset object, then the target object is determined to have passed verification.
8. A method for training an image processing model, characterized in that, The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The method includes: Obtain an image training sample set, wherein the image training sample set contains at least one image training sample; The image training sample set is input into the image processing model for model training to obtain the trained image processing model. The process involves: extracting features from each image training sample using the first feature extraction layer to obtain an initial feature map; obtaining an initial feature map of a preset size using the at least one attention feature extraction layer; normalizing the initial feature map to obtain a weight map; and performing a weighted feature map by weighting the weight map and the initial feature map to obtain a weighted feature map, wherein the weighted feature map indicates whether each region in the initial feature map belongs to a region with added noise; performing residual processing on the initial feature map and the weighted feature map using the second feature extraction layer; and representing the sharpness of each pixel in the weight map by its pixel value, with smaller pixel values indicating higher pixel sharpness, and the pixel values in the weight map falling within a first preset range.
9. The method according to claim 8, characterized in that, The image training samples include training images with added noise and corresponding labels for the training images. The labels are the clear, noise-free images corresponding to the training images. The step of performing residual processing on the initial feature map and the weighted feature map through the second feature extraction layer to obtain the trained image processing model includes: The initial feature map and the weighted feature map are subjected to residual processing by the second feature extraction layer to obtain the denoised training image; A first loss value is determined based on the denoised training image and the corresponding clear image without added noise, and a trained image processing model is obtained based on the first loss value.
10. The method according to claim 9, characterized in that, The annotation labels also include score values, which represent the overall sharpness of the noisy training images. After determining the first loss value based on the denoised training image and the corresponding clear image without added noise, the method further includes: The second loss value is determined based on the denoised training image and the score value; The step of obtaining the trained image processing model based on the first loss value includes: The trained image processing model is obtained based on the first loss value and the second loss value.
11. The method according to claim 10, characterized in that, Before obtaining the trained image processing model based on the first loss value and the second loss value, the method further includes: An initial difference feature map is determined based on the denoised training image, the clear image without added noise corresponding to the training image, and a preset threshold function. The pixel value of each pixel in the initial difference feature map represents the difference between the pixel value in the denoised training image and the pixel value of the corresponding pixel in the clear image, and the pixel value of each pixel in the initial difference feature map is within a second preset interval. Subtract a preset pixel threshold from the pixel value of each pixel in the difference feature map to obtain the difference feature map, wherein the preset pixel threshold is close to the smaller endpoint of the second preset interval; The third loss value is determined based on the difference feature map; The process of obtaining the trained image processing model based on the first loss value and the second loss value includes: The trained image processing model is obtained based on the first loss value, the second loss value, and the third loss value.
12. An image processing apparatus, characterized in that, include: The first acquisition layer is used to acquire the image to be processed; A first processing layer is used to input the image to be processed into an image processing model to obtain a denoised image. The image processing model includes a first feature extraction layer, at least one attention feature extraction layer, and a second feature extraction layer. The first feature extraction layer extracts features from the image to be processed to obtain an initial feature map. The at least one attention feature extraction layer obtains an initial feature map of a preset size and a weight map from the preset size initial feature map. The weight map and the initial feature map are weighted to obtain a weighted feature map. The second feature extraction layer performs residual processing on the initial feature map and the weighted feature map to obtain a denoised image. The weighted feature map indicates whether each region in the initial feature map belongs to a region where noise has been added. The pixel value of each pixel in the weight map represents the sharpness of the pixel; the smaller the pixel value, the higher the sharpness of the pixel. The pixel values in the weight map are within a first preset range.
13. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1 to 11.