Image correction method and device, computer equipment, storage medium and program product
By using convolutional layers and residual blocks to extract and fuse shallow and deep features of images in power distribution scenes, the problem of low image quality under complex lighting conditions is solved and the accuracy of image data analysis is improved.
Patent Information
- Application Number
- CN202410983709.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-10-15
AI Technical Summary
Under complex lighting conditions in power distribution scenes, the clarity and legibility of images are affected, resulting in reduced image quality and posing challenges to subsequent data analysis and processing.
Extract shallow features from the image to be corrected through the convolutional layer, and use at least 2 residual blocks to extract and fuse deep features. Based on the target deep feature extraction results, the image is corrected and key features are restored or enhanced to improve image quality.
It effectively improves the image quality under complex lighting conditions and enhances the accuracy of image data analysis and processing.
Smart Images

Figure CN118781318A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power distribution network monitoring, and in particular to an image correction method, device, computer equipment, storage medium and program product. Background Art
[0002] With the rapid development of smart grid and automation technology, the digitalization and intelligence of power distribution system have been significantly improved. In modern power distribution system, equipment status monitoring and fault diagnosis gradually rely on efficient and accurate image data analysis and processing methods.
[0003] However, in real power distribution scenarios, we often face complex lighting conditions, such as backlight, fog, shadows, and reflections. These lighting conditions will affect the clarity and recognizability of the image, thereby reducing the image quality and posing huge challenges to subsequent image data analysis and processing.
[0004] Therefore, how to correct images under complex lighting conditions in power distribution scenarios to improve image quality has become a technical problem that needs to be urgently solved in this field. Summary of the invention
[0005] Based on this, it is necessary to provide an image correction method, device, computer equipment, storage medium and program product that can correct images under complex lighting conditions in power distribution scenarios to improve the quality of the images in response to the above technical problems.
[0006] In a first aspect, the present application provides an image correction method. The method comprises:
[0007] The shallow feature extraction is performed on the image to be corrected in the power distribution scene through the convolution layer to obtain the shallow feature extraction result;
[0008] The shallow feature extraction result is subjected to deep feature extraction through at least two residual blocks, and the extraction results of each deep feature extraction are fused to obtain the target deep feature extraction result; wherein the input of the latter residual block is the output of the previous residual block;
[0009] The image to be corrected is corrected based on the target deep feature extraction result to determine the target image.
[0010] In one embodiment, the image to be corrected is corrected based on the target deep feature extraction result to determine the target image, including:
[0011] The target deep feature extraction result is used as the input of the residual block, and the deep feature extraction result is processed by the residual block to obtain a residual image output by the residual block;
[0012] The deep feature extraction result is fused with the residual image to obtain a feature image;
[0013] The image to be corrected is corrected based on the characteristic image to determine the target image.
[0014] In one embodiment, the correcting the image to be corrected based on the feature image to determine the target image includes:
[0015] Performing convolution processing on the feature image to obtain a corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected;
[0016] The target feature image is superimposed on the image to be corrected to obtain the target image.
[0017] In one embodiment, the at least two residual blocks include a first residual block, a second residual block, a third residual block and a fourth residual block, and the shallow feature extraction result is subjected to deep feature extraction through at least two residual blocks, and the extraction results of each deep feature extraction are fused to obtain a target deep feature extraction result, including:
[0018] Inputting the shallow feature extraction result into the first residual block to obtain first feature data;
[0019] Downsampling the first feature data, and inputting the downsampled first feature data into the second residual block to obtain second feature data;
[0020] Downsampling the second feature data, and inputting the downsampled second feature data into the third residual block to obtain third feature data;
[0021] Downsampling the third feature data, and inputting the downsampled third feature data into the fourth residual block to obtain fourth feature data;
[0022] The first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain the target deep feature extraction result.
[0023] In one embodiment, the first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain the target deep feature extraction result, including:
[0024] Upsampling the fourth feature data, and performing feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result;
[0025] Performing dimension reduction on the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data;
[0026] Upsampling the fifth feature data, and performing feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result;
[0027] Performing dimension reduction on the second feature fusion result, and inputting the dimension reduced second feature fusion result into the second residual block to obtain sixth feature data;
[0028] Upsampling the sixth feature data, and performing feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result;
[0029] The third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
[0030] In one of the embodiments, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by performing Taylor expansion based on a softmax function.
[0031] In a second aspect, the present application also provides an image correction device. The device comprises:
[0032] A first feature extraction module is used to perform shallow feature extraction on the image to be corrected in the power distribution scene through a convolution layer to obtain a shallow feature extraction result;
[0033] A second feature extraction module is used to perform deep feature extraction on the shallow feature extraction result through at least two residual blocks, and fuse the extraction results of each deep feature extraction to obtain a target deep feature extraction result; wherein the input of the latter residual block is the output of the previous residual block;
[0034] The correction module is used to correct the image to be corrected based on the target deep feature extraction result to determine the target image.
[0035] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the above methods when executed by a processor.
[0037] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0038] The above-mentioned image correction method, device, computer equipment, storage medium and program product perform shallow feature extraction on the image to be corrected in the power distribution scenario through a convolution layer to obtain a shallow feature extraction result, perform deep feature extraction on the shallow feature extraction result through at least 2 residual blocks, and fuse the extraction results of each deep feature extraction to obtain a target deep feature extraction result, and then correct the image to be corrected based on the target deep feature extraction result to determine the target image, so that the key features in the image to be corrected can be restored or enhanced through the deep features, thereby improving the quality of the image to be corrected, and then improving the accuracy of subsequent image data analysis and processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is an internal structure diagram of a computer device provided in an embodiment of the present application;
[0040] Figure 2 It is a flowchart of an image correction method provided in an embodiment of the present application;
[0041] Figure 3 It is a flowchart of a target image determination method provided in an embodiment of the present application;
[0042] Figure 4 is a flow chart of another target image determination method provided in an embodiment of the present application;
[0043] Figure 5 It is a flowchart of a method for determining a target deep feature extraction result provided in an embodiment of the present application;
[0044] Figure 6 It is a flowchart of another method for determining a target deep feature extraction result provided in an embodiment of the present application;
[0045] Figure 7 It is a flowchart of an image illumination correction method in a complex power distribution scenario provided by an embodiment of the present application;
[0046] Figure 8 It is a structural block diagram of an image correction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] With the rapid development of smart grid and automation technology, the digitalization and intelligence of power distribution system have been significantly improved. In modern power distribution system, equipment status monitoring and fault diagnosis gradually rely on efficient and accurate image data analysis and processing methods.
[0049] However, in real power distribution scenarios, we often face complex lighting conditions, such as backlight, fog, shadows, and reflections. These lighting conditions will affect the clarity and recognizability of the image, thereby reducing the image quality and posing huge challenges to subsequent image data analysis and processing.
[0050] Therefore, how to correct images under complex lighting conditions in power distribution scenarios to improve image quality has become a technical problem that needs to be urgently solved in this field.
[0051] The image correction method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Figure 1 is an internal structure diagram of a computer device provided in an embodiment of the present application. The computer device may be a server, and its internal structure diagram may be as follows Figure 1 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an image correction method is implemented.
[0052] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0053] In one embodiment, Figure 2 As shown, Figure 2 is a flow chart of an image correction method provided in an embodiment of the present application, which can be applied to Figure 1 The computer device comprises the following steps:
[0054] S201, performing shallow feature extraction on the image to be corrected in the power distribution scene through a convolutional layer to obtain a shallow feature extraction result.
[0055] In the embodiment of the present application, the image to be corrected can be acquired by an image acquisition device arranged in the power distribution scene, wherein the image acquisition device can be, for example, a camera, an infrared camera, and the like.
[0056] Optionally, the image to be corrected may be input as an input of a convolutional layer, shallow feature extraction may be performed through the convolutional layer, and then the output of the convolutional layer may be used as a shallow feature extraction result.
[0057] S202, performing deep feature extraction on the shallow feature extraction result through at least two residual blocks, and fusing the extraction results of each deep feature extraction to obtain the target deep feature extraction result.
[0058] Among them, the input of the next residual block is the output of the previous residual block.
[0059] The shallow feature extraction result includes the shallow features of the image to be corrected, and the deep feature extraction result includes the deep features of the image to be corrected, wherein the shallow features of the image to be corrected are the basis of the deep features.
[0060] Compared with deep features, shallow features have higher resolution and contain more location and detail information, but they are less semantic and have more noise. Conversely, deep features contain more semantic information than shallow features, but have lower resolution and poorer perception of details.
[0061] Optionally, the output of the previous residual block may be downsampled, and then the downsampled output of the previous residual block is used as the input of the next residual block.
[0062] Exemplarily, the residual block may include a multi-scale patch embedding module and a multi-branch Transformer module. The multi-scale patch embedding module may be used to reduce the resolution of the input and expand the feature dimension of the input. The multi-branch Transformer module may be used to extract feature data.
[0063] In addition, the multi-scale patch embedding module can divide the input at different scales to form multiple patches of different sizes, embed the patches at each scale, convert them into a high-dimensional vector, and then fuse the embedding results of patches at different scales to comprehensively utilize the feature information at each scale.
[0064] Exemplarily, if the at least two residual blocks include four residual blocks, namely a first residual block, a second residual block, a third residual block and a fourth residual block, deep feature extraction can be performed on the shallow feature extraction result in the following manner:
[0065] The shallow feature extraction result is input into the first residual block to obtain the first feature data, the first feature data is downsampled, and the downsampled first feature data is input into the second residual block to obtain the second feature data. Then the second feature data is downsampled, and the downsampled second feature data is input into the third residual block to obtain the third feature data. Finally, the third feature data is downsampled, and the downsampled third feature data is input into the fourth residual block to obtain the fourth feature data.
[0066] After deep feature extraction is performed on the shallow feature extraction results to obtain feature data, the feature data can be fused in the following ways to obtain the target deep feature extraction results:
[0067] The fourth feature data is upsampled, and the upsampled fourth feature data is feature fused with the third feature data to obtain a first feature fusion result, and then the first feature fusion result is dimensionally reduced, and the first feature fusion result after dimension reduction is input into the third residual block to obtain the fifth feature data. The fifth feature data is then upsampled, and the upsampled fifth feature data is feature fused with the second feature data to obtain a second feature fusion result, and the second feature fusion result is dimensionally reduced, and the second feature fusion result after dimension reduction is input into the second residual block to obtain the sixth feature data. Finally, the sixth feature data is upsampled, and the upsampled sixth feature data is feature fused with the first feature data to obtain a third feature fusion result, and the third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
[0068] S203, correcting the image to be corrected based on the target deep feature extraction result to determine the target image.
[0069] In one possible implementation, the target deep feature extraction result can be convolved so that the number of channels of the target deep feature extraction result after the convolution processing is consistent with the number of channels of the image to be corrected, and then the target deep feature extraction result after the convolution processing is superimposed on the image to be corrected to obtain the target image.
[0070] In another possible implementation, the target deep feature extraction result can also be used as the input of the residual block, and the target deep feature extraction result is processed by the residual block to obtain a residual image output by the residual block. Then, the residual image is convolved so that the number of channels of the residual image after the convolution processing is consistent with that of the image to be corrected, and then the residual image after the convolution processing is superimposed on the image to be corrected to obtain the target image.
[0071] In an embodiment of the present application, shallow feature extraction is performed on the image to be corrected in the power distribution scenario through a convolutional layer to obtain a shallow feature extraction result, deep feature extraction is performed on the shallow feature extraction result through at least 2 residual blocks, and the extraction results of each deep feature extraction are fused to obtain a target deep feature extraction result, and then the image to be corrected is corrected based on the target deep feature extraction result to determine the target image, so that the key features in the image to be corrected can be restored or enhanced through the deep features, thereby improving the quality of the image to be corrected, and then improving the accuracy of subsequent image data analysis and processing.
[0072] Reference Figure 3 , Figure 3 1 is a flow chart of a target image determination method provided by an embodiment of the present application. This embodiment involves a possible implementation method of how to correct the image to be corrected based on the target deep feature extraction result to determine the target image. Based on the above embodiment, the above S203 includes the following steps:
[0073] S301, taking the target deep feature extraction result as the input of the residual block, and processing the deep feature extraction result by the residual block to obtain a residual image output by the residual block.
[0074] Exemplarily, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module.
[0075] In the embodiment of the present application, the target deep feature extraction result can be first input into the multi-scale patch embedding module in the residual block to expand the feature dimension of the target deep feature extraction result and obtain the output of the multi-scale patch embedding module. Then, the output of the multi-scale patch embedding module is used as the input of the multi-branch Transformer module, and the output of the multi-scale patch embedding module is processed in parallel through multiple branches to obtain the residual image output by the residual block.
[0076] S302, fusing the deep feature extraction result and the residual image to obtain a feature image.
[0077] Optionally, the residual image may be directly superimposed on the deep feature extraction result to obtain the feature image. Alternatively, the weights of the deep feature extraction result and the residual image may be preset respectively, and the deep feature extraction result and the residual image may be weighted summed according to the preset weights to obtain the feature image.
[0078] S303: Correct the image to be corrected based on the feature image to determine a target image.
[0079] Exemplarily, the characteristic image may be superimposed on the image to be corrected to correct the image to be corrected, and the image to be corrected with the characteristic image superimposed thereon is used as the target image.
[0080] In an embodiment of the present application, the target deep feature extraction result is used as the input of the residual block, the deep feature extraction result is processed by the residual block to obtain a residual image output by the residual block, the deep feature extraction result and the residual image are fused to obtain a feature image, and the image to be corrected is corrected based on the feature image to determine the target image. Since in an embodiment of the present application, the deep feature extraction result is processed by the residual block, and the deep feature extraction result and the residual image are fused, the noise and interference information in the deep feature extraction result can be reduced, and the key features in the deep feature extraction result can be highlighted, and then when the image to be corrected is corrected based on the deep feature extraction result, the correction effect of the image to be corrected can be improved.
[0081] Reference Figure 4 , Figure 4 1 is a flow chart of another target image determination method provided by an embodiment of the present application. This embodiment involves a possible implementation method of how to correct the image to be corrected based on the feature image to determine the target image. Based on the above embodiment, the above S303 includes the following steps:
[0082] S401, performing convolution processing on the feature image to obtain a corresponding target feature image.
[0083] Among them, the number of channels of the target feature image is equal to the number of channels of the image to be corrected.
[0084] Exemplarily, the feature image can be input into a 3×3 convolution layer to perform convolution processing on the feature image so that the number of channels of the target feature image is equal to the number of channels of the image to be corrected, and the target feature image output by the 3×3 convolution layer is obtained.
[0085] S402, superimposing a target feature image on the image to be corrected to obtain a target image.
[0086] In the embodiment of the present application, the feature image is convolved to obtain the corresponding target feature image, and the number of channels of the target feature image is equal to the number of channels of the image to be corrected, so that the number of channels of the target feature image can be equal to the number of channels of the image to be corrected through the convolution process, which is convenient for subsequent superposition operations. Moreover, convolution processing of the feature image can reduce the number of channels of the feature image, thereby reducing the amount of data and speeding up data processing.
[0087] Reference Figure 5 , Figure 51 is a flow chart of a method for determining a target deep feature extraction result provided by an embodiment of the present application. This embodiment involves a possible implementation method of how to perform deep feature extraction on the shallow feature extraction result through at least two residual blocks, and fuse the extraction results of each deep feature extraction to obtain the target deep feature extraction result. Based on the above embodiment, the above S202 includes the following steps:
[0088] S501, inputting the shallow feature extraction result into the first residual block to obtain first feature data.
[0089] In the embodiment of the present application, the shallow feature extraction result can be first input into the multi-scale patch embedding module in the first residual block to expand the feature dimension of the shallow feature extraction result and obtain the output of the multi-scale patch embedding module. Then, the output of the multi-scale patch embedding module is used as the input of the multi-branch Transformer module, and the output of the multi-scale patch embedding module is processed in parallel through multiple branches to obtain the first feature data output by the first residual block.
[0090] S502 , down-sample the first feature data, and input the down-sampled first feature data into a second residual block to obtain second feature data.
[0091] In the embodiment of the present application, the first feature data may be downsampled, and then the downsampled first feature data may be input into the multi-scale patch embedding module in the second residual block to expand the feature dimension of the downsampled first feature data, and obtain the output of the multi-scale patch embedding module. Finally, the output of the multi-scale patch embedding module is used as the input of the multi-branch Transformer module, and the output of the multi-scale patch embedding module is processed in parallel through multiple branches to obtain the second feature data output by the second residual block.
[0092] S503 , down-sample the second feature data, and input the down-sampled second feature data into a third residual block to obtain third feature data.
[0093] In the embodiment of the present application, the second feature data may be downsampled, and then the downsampled second feature data may be input into the multi-scale patch embedding module in the third residual block to expand the feature dimension of the downsampled second feature data, and obtain the output of the multi-scale patch embedding module. Finally, the output of the multi-scale patch embedding module is used as the input of the multi-branch Transformer module, and the output of the multi-scale patch embedding module is processed in parallel through multiple branches to obtain the third feature data output by the third residual block.
[0094] S504, down-sample the third feature data, and input the down-sampled third feature data into a fourth residual block to obtain fourth feature data.
[0095] In the embodiment of the present application, the third feature data may be downsampled, and then the downsampled third feature data may be input into the multi-scale patch embedding module in the fourth residual block to expand the feature dimension of the downsampled third feature data, and obtain the output of the multi-scale patch embedding module. Finally, the output of the multi-scale patch embedding module is used as the input of the multi-branch Transformer module, and the output of the multi-scale patch embedding module is processed in parallel through multiple branches to obtain the fourth feature data output by the fourth residual block.
[0096] S505, fusing the first feature data, the second feature data, the third feature data, and the fourth feature data to obtain a target deep feature extraction result.
[0097] In a possible implementation, weights corresponding to the first feature data, the second feature data, the third feature data, and the fourth feature data can be set respectively, and the first feature data, the second feature data, the third feature data, and the fourth feature data can be weighted and summed according to the preset weights to obtain the target deep feature extraction result.
[0098] In another possible implementation, the fourth feature data may be upsampled, and the upsampled fourth feature data may be feature fused with the third feature data to obtain a first feature fusion result, and then the first feature fusion result may be dimensionally reduced, and the dimensionally reduced first feature fusion result may be input into the third residual block to obtain the fifth feature data. The fifth feature data may then be upsampled, and the upsampled fifth feature data may be feature fused with the second feature data to obtain a second feature fusion result, and the dimensionally reduced second feature fusion result may be input into the second residual block to obtain the sixth feature data. Finally, the sixth feature data may be upsampled, and the upsampled sixth feature data may be feature fused with the first feature data to obtain a third feature fusion result, and the third feature fusion result may be input into the first residual block to obtain the target deep feature extraction result.
[0099] In an embodiment of the present application, the shallow feature extraction result is input into the first residual block to obtain the first feature data, the first feature data is downsampled, and the downsampled first feature data is input into the second residual block to obtain the second feature data, the second feature data is downsampled, and the downsampled second feature data is input into the third residual block to obtain the third feature data, the third feature data is downsampled, and the downsampled third feature data is input into the fourth residual block to obtain the fourth feature data, and the first feature data, the second feature data, the third feature data, the fourth feature data are fused to obtain the target deep feature extraction result. Since in the embodiment of the present application, deep feature extraction is performed on the basis of the shallow feature extraction result, the noise and interference information in the shallow feature extraction result can be reduced, and the key features in the image to be corrected can be further highlighted. In addition, in the embodiment of the present application, each deep feature extraction result is also fused to further improve the accuracy of the target deep feature extraction result.
[0100] Reference Figure 6 , Figure 6 1 is a flow chart of another method for determining the target deep feature extraction result provided by an embodiment of the present application. This implementation involves a possible implementation method of how to fuse the first feature data, the second feature data, the third feature data, and the fourth feature data to obtain the target deep feature extraction result. Based on the above embodiment, the above S505 includes the following steps:
[0101] S601, up-sample the fourth feature data, and perform feature fusion on the up-sampled fourth feature data and the third feature data to obtain a first feature fusion result.
[0102] Optionally, the upsampled fourth feature data may be directly superimposed on the third feature data to obtain the first feature fusion result. Alternatively, the weights corresponding to the upsampled fourth feature data and the third feature data may be set respectively, and the upsampled fourth feature data and the third feature data may be weightedly fused according to the preset weights to obtain the first feature fusion result.
[0103] S602, reducing the dimension of the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data.
[0104] In an embodiment of the present application, the first feature fusion result after dimensionality reduction can be used as the input of the third residual block, the first feature fusion result after dimensionality reduction is processed by the third residual block, and the fifth feature data output by the third residual block is obtained.
[0105] S603, up-sample the fifth feature data, and perform feature fusion on the up-sampled fifth feature data and the second feature data to obtain a second feature fusion result.
[0106] Optionally, the upsampled fifth feature data may be directly superimposed on the second feature data to obtain a second feature fusion result. Alternatively, weights corresponding to the upsampled fifth feature data and the second feature data may be set respectively, and the upsampled fifth feature data and the second feature data may be weighted fused according to preset weights to obtain a second feature fusion result.
[0107] S604, reducing the dimension of the second feature fusion result, and inputting the reduced-dimensional second feature fusion result into the second residual block to obtain sixth feature data.
[0108] In an embodiment of the present application, the second feature fusion result after dimensionality reduction can be used as the input of the second residual block, the second feature fusion result after dimensionality reduction is processed by the second residual block, and the sixth feature data output by the second residual block is obtained.
[0109] S605, up-sample the sixth feature data, and perform feature fusion on the up-sampled sixth feature data and the first feature data to obtain a third feature fusion result.
[0110] Optionally, the upsampled sixth feature data may be directly superimposed on the first feature data to obtain a third feature fusion result. Alternatively, the weights corresponding to the upsampled sixth feature data and the first feature data may be respectively set, and the upsampled sixth feature data and the first feature data may be weightedly fused according to the preset weights to obtain a third feature fusion result.
[0111] S606: Input the third feature fusion result into the first residual block to obtain the target deep feature extraction result.
[0112] In an embodiment of the present application, the third feature fusion result can be used as the input of the first residual block, the third feature fusion result is processed by the first residual block, and the target deep feature extraction result output by the first residual block is obtained.
[0113] In an embodiment of the present application, the fourth feature data is upsampled, and the upsampled fourth feature data is feature fused with the third feature data to obtain a first feature fusion result, the first feature fusion result is dimensionally reduced, and the first feature fusion result after dimension reduction is input into the third residual block to obtain the fifth feature data, the fifth feature data is upsampled, and the upsampled fifth feature data is feature fused with the second feature data to obtain the second feature fusion result, the second feature fusion result is dimensionally reduced, and the second feature fusion result after dimension reduction is input into the second residual block to obtain the sixth feature data, the sixth feature data is upsampled, and the upsampled sixth feature data is feature fused with the first feature data to obtain the third feature fusion result, and the third feature fusion result is input into the first residual block to obtain the target deep feature extraction result, so that the deep feature extraction results can be fused, the noise and interference information can be further reduced, the key features in the image to be corrected can be highlighted, the quality of the image to be corrected can be improved, and the accuracy of subsequent image data analysis and processing can be improved.
[0114] Based on the above embodiment, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module.
[0115] Among them, the activation function of the multi-branch Transformer module is obtained by Taylor expansion based on the softmax function.
[0116] The multi-scale patch embedding module can be used to reduce the resolution of the input and expand the feature dimension of the input. The multi-branch Transformer module can be used to extract feature data.
[0117] Exemplarily, the multi-scale patch embedding module can divide the input at different scales to form multiple patches of different sizes, perform embedding operations on the patches at each scale, convert them into a high-dimensional vector, and then fuse the patch embedding results at different scales to comprehensively utilize the feature information at each scale, so that it can perceive the shape of the field of view flexibly, thereby making the processing of the images to be corrected in complex power distribution scenarios more flexible.
[0118] The activation function of the multi-branch Transformer module is obtained by Taylor expansion of the softmax function of the traditional Transformer module. This improvement can reduce the complexity of the activation function calculation from quadratic to linear, making it more suitable for high-resolution images, and can retain the ability of the traditional softmax function to capture long-distance dependencies without the computational burden of the traditional softmax function.
[0119] Reference Figure 7 , Figure 7: is a flow chart of an image illumination correction method in a complex power distribution scenario provided by an embodiment of the present application. The method comprises the following steps:
[0120] S701, performing shallow feature extraction on the image to be corrected in the power distribution scene through a convolutional layer to obtain a shallow feature extraction result.
[0121] S702, performing deep feature extraction on the shallow feature extraction result through four residual blocks, and fusing the extraction results of each deep feature extraction to obtain the target deep feature extraction result.
[0122] S703: taking the target deep feature extraction result as the input of the residual block, and processing the deep feature extraction result by the residual block to obtain a residual image output by the residual block.
[0123] S704, fusing the deep feature extraction result and the residual image to obtain a feature image.
[0124] S705, performing convolution processing on the feature image to obtain a corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected.
[0125] S706, superimposing the target feature image on the image to be corrected to obtain a target image.
[0126] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0127] Based on the same inventive concept, the embodiment of the present application also provides an image correction device for implementing the above-mentioned image correction method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image correction device embodiments provided below can refer to the limitations of the image correction method above, and will not be repeated here.
[0128] In one embodiment, Figure 8 As shown, Figure 8800 is a structural block diagram of an image correction device provided in an embodiment of the present application. The device 800 includes:
[0129] The first feature extraction module 801 is used to perform shallow feature extraction on the image to be corrected in the power distribution scene through a convolution layer to obtain a shallow feature extraction result.
[0130] The second feature extraction module 802 is used to perform deep feature extraction on the shallow feature extraction results through at least two residual blocks, and fuse the extraction results of each deep feature extraction to obtain the target deep feature extraction results; wherein the input of the latter residual block is the output of the previous residual block.
[0131] The correction module 803 is used to correct the image to be corrected based on the target deep feature extraction result to determine the target image.
[0132] In one embodiment, the correction module 803 includes:
[0133] The first processing unit is used to use the target deep feature extraction result as the input of the residual block, and process the deep feature extraction result through the residual block to obtain a residual image output by the residual block.
[0134] The first fusion unit is used to fuse the deep feature extraction result and the residual image to obtain a feature image.
[0135] The first correction unit is used to correct the image to be corrected based on the feature image to determine the target image.
[0136] In one of the embodiments, the first correction unit is specifically used to perform convolution processing on the feature image to obtain a corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected; and the target feature image is superimposed on the image to be corrected to obtain the target image.
[0137] In one embodiment, the second feature extraction module 802 includes:
[0138] The first acquisition unit is used to input the shallow feature extraction result into the first residual block to obtain the first feature data.
[0139] The second acquisition unit is used to downsample the first feature data and input the downsampled first feature data into the second residual block to obtain the second feature data.
[0140] The third acquisition unit is used to downsample the second feature data and input the downsampled second feature data into the third residual block to obtain third feature data.
[0141] The fourth acquisition unit is used to downsample the third feature data and input the downsampled third feature data into the fourth residual block to obtain fourth feature data.
[0142] The second fusion unit is used to fuse the first feature data, the second feature data, the third feature data, and the fourth feature data to obtain a target deep feature extraction result.
[0143] In one embodiment, the second fusion unit comprises:
[0144] The first fusion subunit is used to upsample the fourth feature data, and perform feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result.
[0145] The first acquisition subunit is used to reduce the dimension of the first feature fusion result, and input the first feature fusion result after dimension reduction into the third residual block to obtain the fifth feature data.
[0146] The second fusion subunit is used to upsample the fifth feature data, and perform feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result.
[0147] The second acquisition subunit is used to reduce the dimension of the second feature fusion result, and input the reduced-dimensional second feature fusion result into the second residual block to obtain the sixth feature data.
[0148] The third fusion subunit is used to upsample the sixth feature data, and perform feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result.
[0149] The third acquisition subunit is used to input the third feature fusion result into the first residual block to obtain the target deep feature extraction result.
[0150] In one of the embodiments, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by performing Taylor expansion based on the softmax function.
[0151] Each module in the above-mentioned image correction device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0152] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0153] The shallow feature extraction is performed on the image to be corrected in the power distribution scene through the convolution layer to obtain the shallow feature extraction result;
[0154] The shallow feature extraction results are subjected to deep feature extraction through at least two residual blocks, and the extraction results of each deep feature extraction are fused to obtain the target deep feature extraction results; wherein the input of the latter residual block is the output of the previous residual block;
[0155] The image to be corrected is corrected based on the target deep feature extraction result to determine the target image.
[0156] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0157] The target deep feature extraction result is used as the input of the residual block, and the deep feature extraction result is processed by the residual block to obtain the residual image output by the residual block;
[0158] The deep feature extraction result and the residual image are fused to obtain the feature image;
[0159] The image to be corrected is corrected based on the feature image to determine the target image.
[0160] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0161] Perform convolution processing on the feature image to obtain the corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected;
[0162] The target feature image is superimposed on the image to be corrected to obtain the target image.
[0163] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0164] Inputting the shallow feature extraction result into the first residual block to obtain first feature data;
[0165] Downsampling the first feature data, and inputting the downsampled first feature data into a second residual block to obtain second feature data;
[0166] Downsampling the second feature data, and inputting the downsampled second feature data into a third residual block to obtain third feature data;
[0167] Downsampling the third feature data, and inputting the downsampled third feature data into a fourth residual block to obtain fourth feature data;
[0168] The first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain a target deep feature extraction result.
[0169] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0170] Upsampling the fourth feature data, and performing feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result;
[0171] Performing dimension reduction on the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data;
[0172] Upsampling the fifth feature data, and performing feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result;
[0173] Performing dimension reduction on the second feature fusion result, and inputting the dimension reduced second feature fusion result into the second residual block to obtain sixth feature data;
[0174] Upsampling the sixth feature data, and performing feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result;
[0175] The third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
[0176] In one embodiment, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by performing Taylor expansion based on the softmax function.
[0177] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0178] The shallow feature extraction is performed on the image to be corrected in the power distribution scene through the convolution layer to obtain the shallow feature extraction result;
[0179] The shallow feature extraction results are subjected to deep feature extraction through at least two residual blocks, and the extraction results of each deep feature extraction are fused to obtain the target deep feature extraction results; wherein the input of the latter residual block is the output of the previous residual block;
[0180] The image to be corrected is corrected based on the target deep feature extraction result to determine the target image.
[0181] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0182] The target deep feature extraction result is used as the input of the residual block, and the deep feature extraction result is processed by the residual block to obtain the residual image output by the residual block;
[0183] The deep feature extraction result and the residual image are fused to obtain the feature image;
[0184] The image to be corrected is corrected based on the feature image to determine the target image.
[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0186] Perform convolution processing on the feature image to obtain the corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected;
[0187] The target feature image is superimposed on the image to be corrected to obtain the target image.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0189] Inputting the shallow feature extraction result into the first residual block to obtain first feature data;
[0190] Downsampling the first feature data, and inputting the downsampled first feature data into a second residual block to obtain second feature data;
[0191] Downsampling the second feature data, and inputting the downsampled second feature data into a third residual block to obtain third feature data;
[0192] Downsampling the third feature data, and inputting the downsampled third feature data into a fourth residual block to obtain fourth feature data;
[0193] The first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain a target deep feature extraction result.
[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0195] Upsampling the fourth feature data, and performing feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result;
[0196] Performing dimension reduction on the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data;
[0197] Upsampling the fifth feature data, and performing feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result;
[0198] Performing dimension reduction on the second feature fusion result, and inputting the dimension reduced second feature fusion result into the second residual block to obtain sixth feature data;
[0199] Upsampling the sixth feature data, and performing feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result;
[0200] The third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
[0201] In one embodiment, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by performing Taylor expansion based on the softmax function.
[0202] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0203] The shallow feature extraction is performed on the image to be corrected in the power distribution scene through the convolution layer to obtain the shallow feature extraction result;
[0204] The shallow feature extraction results are subjected to deep feature extraction through at least two residual blocks, and the extraction results of each deep feature extraction are fused to obtain the target deep feature extraction results; wherein the input of the latter residual block is the output of the previous residual block;
[0205] The image to be corrected is corrected based on the target deep feature extraction result to determine the target image.
[0206] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0207] The target deep feature extraction result is used as the input of the residual block, and the deep feature extraction result is processed by the residual block to obtain the residual image output by the residual block;
[0208] The deep feature extraction result and the residual image are fused to obtain the feature image;
[0209] The image to be corrected is corrected based on the feature image to determine the target image.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0211] Perform convolution processing on the feature image to obtain the corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected;
[0212] The target feature image is superimposed on the image to be corrected to obtain the target image.
[0213] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0214] Inputting the shallow feature extraction result into the first residual block to obtain first feature data;
[0215] Downsampling the first feature data, and inputting the downsampled first feature data into a second residual block to obtain second feature data;
[0216] Downsampling the second feature data, and inputting the downsampled second feature data into a third residual block to obtain third feature data;
[0217] Downsampling the third feature data, and inputting the downsampled third feature data into a fourth residual block to obtain fourth feature data;
[0218] The first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain a target deep feature extraction result.
[0219] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0220] Upsampling the fourth feature data, and performing feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result;
[0221] Performing dimension reduction on the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data;
[0222] Upsampling the fifth feature data, and performing feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result;
[0223] Performing dimension reduction on the second feature fusion result, and inputting the dimension reduced second feature fusion result into the second residual block to obtain sixth feature data;
[0224] Upsampling the sixth feature data, and performing feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result;
[0225] The third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
[0226] In one embodiment, the residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by performing Taylor expansion based on the softmax function.
[0227] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0228] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0229] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An image correction method, characterized in that: The method comprises: The shallow feature extraction is performed on the image to be corrected in the power distribution scene through the convolution layer to obtain the shallow feature extraction result; Performing deep feature extraction on the shallow feature extraction result through at least two residual blocks, and fusing the extraction results of each deep feature extraction to obtain the target deep feature extraction result; wherein the input of the latter residual block is the output of the previous residual block; The image to be corrected is corrected based on the target deep feature extraction result to determine the target image.
2. The method according to claim 1, characterized in that The step of correcting the image to be corrected based on the target deep feature extraction result to determine the target image includes: Using the target deep feature extraction result as an input of a residual block, and processing the deep feature extraction result by the residual block to obtain a residual image output by the residual block; Fusing the deep feature extraction result and the residual image to obtain a feature image; The image to be corrected is corrected based on the feature image to determine the target image.
3. The method according to claim 2, characterized in that The correcting the image to be corrected based on the feature image to determine the target image includes: Performing convolution processing on the feature image to obtain a corresponding target feature image; the number of channels of the target feature image is equal to the number of channels of the image to be corrected; The target feature image is superimposed on the image to be corrected to obtain the target image.
4. The method according to claim 1, characterized in that: The at least two residual blocks include a first residual block, a second residual block, a third residual block and a fourth residual block, and the shallow feature extraction result is subjected to deep feature extraction through at least two residual blocks, and the extraction result of each deep feature extraction is fused to obtain a target deep feature extraction result, including: Inputting the shallow feature extraction result into the first residual block to obtain first feature data; Downsampling the first feature data, and inputting the downsampled first feature data into the second residual block to obtain second feature data; Downsampling the second feature data, and inputting the downsampled second feature data into the third residual block to obtain third feature data; Downsampling the third feature data, and inputting the downsampled third feature data into the fourth residual block to obtain fourth feature data; The first feature data, the second feature data, the third feature data, and the fourth feature data are fused to obtain the target deep feature extraction result.
5. The method according to claim 4, characterized in that The fusing the first feature data, the second feature data, the third feature data, and the fourth feature data to obtain the target deep feature extraction result includes: Upsampling the fourth feature data, and performing feature fusion on the upsampled fourth feature data and the third feature data to obtain a first feature fusion result; Performing dimension reduction on the first feature fusion result, and inputting the first feature fusion result after dimension reduction into the third residual block to obtain fifth feature data; Upsampling the fifth feature data, and performing feature fusion on the upsampled fifth feature data and the second feature data to obtain a second feature fusion result; Performing dimension reduction on the second feature fusion result, and inputting the second feature fusion result after dimension reduction into the second residual block to obtain sixth feature data; Upsampling the sixth feature data, and performing feature fusion on the upsampled sixth feature data and the first feature data to obtain a third feature fusion result; The third feature fusion result is input into the first residual block to obtain the target deep feature extraction result.
6. The method according to any one of claims 1 to 5, characterized in that: The residual block includes a multi-scale patch embedding module and a multi-branch Transformer module; the activation function of the multi-branch Transformer module is obtained by Taylor expansion based on the softmax function.
7. An image correction device, characterized in that: The device comprises: A first feature extraction module is used to perform shallow feature extraction on the image to be corrected in the power distribution scene through a convolution layer to obtain a shallow feature extraction result; A second feature extraction module is used to perform deep feature extraction on the shallow feature extraction result through at least two residual blocks, and fuse the extraction results of each deep feature extraction to obtain a target deep feature extraction result; wherein the input of the latter residual block is the output of the previous residual block; A correction module is used to correct the image to be corrected based on the target deep feature extraction result to determine the target image.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Neural network algorithm and system for electric power security control image de-atomization
CN117911275A
