Electric energy meter image enhancement method and device, electronic equipment and computer storage medium

By combining multi-scale window partitioning and local-global attention networks with dual discriminators, the problem of uneven brightness in low-light energy meter image enhancement is solved, generating higher-quality images and improving fault identification accuracy and power grid safety.

CN117635437BActive Publication Date: 2026-11-27BEIJING UNIV OF POSTS & TELECOMM +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311426438.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-30
Publication Date
2026-11-27
Estimated Expiration
2043-10-30

AI Technical Summary

Technical Problem

Existing low-light energy meter image enhancement methods are difficult to adaptively handle uneven brightness in complex scenes, resulting in unbalanced brightness and insufficient detail in the generated images, which affects the accuracy of fault identification.

Method used

By employing a multi-scale window segmentation mechanism and a local-global attention network, combined with a dual discriminator network and a non-uniform cyclic training process, higher quality electricity meter images are generated through the local-global attention network, balancing brightness and preserving detail information.

Benefits of technology

The generated images have more balanced brightness and clearer details, improving the accuracy of fault detection and enhancing the status monitoring of smart meters and the security of the power grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117635437B_ABST
    Figure CN117635437B_ABST
Patent Text Reader

Abstract

The application discloses an electric energy meter image enhancement method and device, electronic equipment and computer storage medium, and belongs to the technical field of electric energy metering. The low-illumination image enhancement model can better distinguish light and dark areas in the electric meter image and provide different degrees of light compensation, and better restore detailed information. The enhanced picture can be used for subsequent visual fault identification, and the accuracy of fault detection is improved. The multi-scale window division mechanism can better retain the pixel-level detailed information by combining multi-head attention calculation, and the local-global attention network strengthening model can enhance the adaptive perception of the low-illumination image. The generated image brightness is more balanced, the details are more obvious, and the possibility of over-enhancement and under-enhancement is reduced. The uneven cycle training strategy can optimize the generalization performance of the model for diversified real electric meter images through a data enhancement method and a designed loss function, and better adapt to complex mounting scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electricity metering technology, specifically relating to an image enhancement method, device, electronic device, and computer storage medium for electricity meters. Background Technology

[0002] With the rapid development of the global economy, the intelligent global energy internet has become the direction and trend of the power industry. The goal of a smart grid is to build a panoramic, real-time system covering multiple aspects of the power system, including generation, transmission, transformation, distribution, consumption, and dispatch. Utilizing advanced technologies such as information communication, computers, and control, it aims to improve the operational efficiency of various parts of the power system, reduce costs and environmental pollution, while maximizing the reliability, stability, and self-healing capabilities of the power system. Smart meters, as devices used to measure and record electricity consumption, are the core foundation of the smart grid and are widely used in homes, businesses, and industries. With the development of the power sector and the advancement of smart grid construction, the accuracy and stability of smart meters have become increasingly important. If a fault occurs in a smart meter that is being installed and is not detected and properly handled in a timely manner, it can lead to huge economic losses and even affect the operational safety of the power grid system. In daily life, some faults in smart meters can often be identified through visual inspection (such as burnt-out or damaged meters), and are referred to as visible faults. To efficiently identify these visible faults, power supply departments often collect high-definition images of the meters and then use computer vision technology to automatically detect the occurrence of faults. However, due to factors such as ambient light and noise, the acquired images suffer from low brightness and loss of detail, affecting subsequent fault analysis. Therefore, low-light image enhancement for smart meters can provide reliable data support for visual fault identification, improve identification accuracy, and is of great significance for ensuring power supply safety, protecting user rights, and improving energy efficiency. Timely detection and repair of faults can avoid potential economic losses and safety risks, ensuring normal power supply.

[0003] Smart meters are installed in diverse and complex scenarios, and poor lighting conditions directly affect the quality of acquired images. Neither the human eye nor classification models can accurately distinguish various visible faults in low-light meter images. Image enhancement methods can clarify meter images, reducing the difficulty of fault identification and providing reliable data support for subsequent tasks. Traditional low-light image enhancement algorithms based on color histograms or image filtering mostly use manually designed fixed model structures, which are difficult to flexibly adapt to different meter image data in complex scenarios, easily leading to color distortion and insufficient detail. In recent years, deep learning-based low-light image enhancement methods have developed rapidly, improving image restoration performance with their excellent deep feature extraction capabilities. Most deep learning methods learn feature representations from pairs of images in a supervised manner, requiring images of different brightness levels in the same scene during training. However, such stringent data requirements are difficult to meet in real-world applications, and overly strict supervision can lead to overfitting. Therefore, unsupervised deep learning methods balance restoration performance with the difficulty of actual data acquisition, making them more suitable for low-light image enhancement tasks for smart meters. However, due to the inconsistent light reflection properties of various materials such as the casing, display screen, and barcode of the electricity meter, low-light smart meter image data collected even under the same dark conditions are prone to uneven brightness. Existing methods, relying on a single discriminator or a no-reference loss function, can effectively constrain the overall brightness level and various color and texture information of the enhanced image. However, when faced with the aforementioned uneven low-light meter images, they struggle to adaptively segment bright and dark areas and adjust the enhancement intensity, potentially leading to brightness imbalances and insufficient detail in the generated image. Although some researchers have mitigated the over-enhancement and under-enhancement problems to some extent by incorporating attention calculations during convolutional encoding and decoding, the inevitable information loss during convolutional compression can make the brightness features and structural texture information of some areas in the image even more difficult to capture. Summary of the Invention

[0004] In view of this, the purpose of this invention is to provide a method, device, electronic device and computer storage medium for enhancing electricity meter images. The proposed multi-scale window partitioning mechanism and local global attention network can process the illumination information of different regions more finely and effectively balance the image brightness. At the same time, the non-uniform cyclic training process can improve the model training efficiency and generalization performance, generate higher quality electricity meter images, improve the accuracy of subsequent visual fault identification, avoid huge economic losses and maintain the safety of power grid operation.

[0005] A method for enhancing an image of an electricity meter, comprising:

[0006] For input low-light electricity meter images, the image data is mapped to a high-dimensional feature space through a local-global attention network. The local and global feature representations of the image are calculated based on multi-head attention, and the local and global features are fused through multiple convolutions to generate an enhanced image.

[0007] A dual discriminator network is trained using real low-light images, normal images, and generated enhanced images as inputs. Then, a local-global attention network is trained based on the discrimination results of the dual discriminator network.

[0008] The local-global attention network and the dual discriminator network are repeatedly trained to obtain a trained generative adversarial network model; the low-light electricity meter image data is input into the trained model, and the local-global attention network outputs an enhanced image of the low-light image.

[0009] Preferably, the local-global attention network includes a multi-scale local attention feature extraction network and a global attention feature processing network;

[0010] The multi-scale local attention feature extraction network first performs image block segmentation through a 1×1 convolutional layer; then it inputs the image into a window attention calculation module with multiple windows of different sizes for window attention calculation; finally, the attention feature maps obtained by the window attention calculation modules at each scale are accumulated and then the data is standardized.

[0011] The global attention feature processing network first performs image block segmentation through convolutional layers with a kernel size of 8×8 and a stride of 8, dividing the image into multiple image blocks. Then, it performs two multi-head attention calculations to establish global connections between image blocks.

[0012] Finally, the local-global attention network stacks the extracted local attention features with the global attention features in terms of dimensions, fuses the features through a convolutional network, and generates an enhanced image.

[0013] Preferably, the dual discriminator network is used to train the local-global attention network based on the following loss function:

[0014] The losses of the global discriminator and the global attention feature processing network are as follows:

[0015]

[0016]

[0017] Where D Global (x r ) indicates that the global discriminator is applied to the input normal image x. r The identification results; D Global (xf ) represents the global discriminator's response to the input enhanced image x. f The identification results;

[0018] The losses of the local discriminator and the multi-scale local attention feature extraction network are respectively:

[0019]

[0020]

[0021] in, These represent local regions randomly cut from the normal image and the enhanced image, respectively. and This indicates that the inputs are respectively and The identification results.

[0022] Furthermore, it also includes a non-uniform cyclic training process, specifically:

[0023] First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula:

[0024] I'=αI out +(1-α)I in

[0025] Among them, I in with I out These represent the input low-light image and the corresponding enhanced image, respectively, with α being a random magnification.

[0026] The non-uniform loss function for non-uniform training is as follows:

[0027]

[0028] Where I(i,j) represents the pixel value at position (i,j) of the enhanced image output by the local-global attention network from the hybrid image I'; K(i,j) represents the pixel value at position (i,j) of the enhanced image; and m and n represent the pixel dimensions of the cropped region in length and width, respectively.

[0029] Furthermore, it also includes the identity-invariant loss training process, specifically:

[0030] The normal image is input into the generative adversarial network, and the augmented output is constrained using the following identity-invariant loss:

[0031]

[0032] Where, x rThis indicates that a real, normal image is used as the network input, G(x) r ) represents the image generated by the enhanced network.

[0033] An image enhancement device for an electricity meter includes: a local-global attention network, a dual-discrimination network, and a training control module;

[0034] The local-global attention network includes a multi-scale local attention feature extraction network and a global attention feature processing network. They respectively calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image.

[0035] The dual-discrimination network consists of a global discriminator and a local discriminator; the global discriminator is used to distinguish between the input enhanced image and the normal image to obtain the discrimination result; the local discriminator distinguishes between local regions of the input enhanced image and the normal image to obtain the discrimination result.

[0036] The training control module is used to train the dual discriminator network and to train the local-global attention network based on the discrimination results of the dual discriminator network. Finally, the low-light meter image data is input into the trained local-global attention network to obtain the enhanced image of the low-light image.

[0037] Furthermore, it also includes a non-uniform cyclic training module;

[0038] This module generates uneven training data from existing enhanced images and original low-light images, which is used to iteratively train the generator network. Specifically:

[0039] The image blending process includes random region cropping and random magnification blending. First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula:

[0040] I'=αI out +(1-α)I in

[0041] Among them, I in with I out These represent the input low-light image and the corresponding enhanced image, respectively. α is a random magnification factor, ranging from 0 to 1. The larger α is, the closer the random region is to the already enhanced image.

[0042] The constructed non-uniform loss function is as follows:

[0043]

[0044] Where I(i,j) represents the pixel value at position (i,j) of the enhanced image output by the local-global attention network from the hybrid image I'; K(i,j) represents the pixel value at position (i,j) of the enhanced image; and m and n represent the pixel dimensions of the cropped region in length and width, respectively.

[0045] Furthermore, it also includes an identity-invariant loss module; normal images are input into the generative adversarial network (GAN), and the following identity-invariant loss is used to constrain the output of the GAN:

[0046]

[0047] Where, x r This indicates that a real, normal image is used as the network input, G(x) r ) represents the image generated by the enhanced network.

[0048] An electronic device for image enhancement of an electricity meter includes a processor (400) and a memory (401);

[0049] The memory (401) is used to store the computer program (402) and to transfer the computer program (402) to the processor (400);

[0050] The processor (400) is configured to execute the steps of any one of the energy meter image enhancement methods according to the instructions in the computer program (402).

[0051] A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform any one of the energy meter image enhancement methods according to claims 1 to 5, the method comprising the following steps:

[0052] Input a three-channel RGB low-light image, map the image data to a high-dimensional feature space through a local-global attention network, calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image;

[0053] A dual discriminator network is trained using real low-light images, normal images, and generated enhanced images as inputs, and then a local-global attention network is trained based on the discrimination results.

[0054] The generative adversarial network model is trained multiple times to obtain a well-trained model. The low-light electricity meter image data is input into the trained model, and the local-global attention network outputs an enhanced image of the low-light image.

[0055] The present invention has the following beneficial effects:

[0056] This invention proposes a low-light image enhancement method for electricity meters based on a multi-scale attention network. The proposed low-light image enhancement model can better distinguish between bright and dark areas in the electricity meter image and provide different degrees of illumination compensation. At the same time, it can better restore details such as text and barcodes. The enhanced image can be used for subsequent visual fault identification, improving the accuracy of fault detection. This is of great significance for strengthening the status monitoring of smart electricity meters and ensuring power grid safety.

[0057] The proposed multi-scale window partitioning mechanism can better preserve pixel-level details by combining multi-head attention computation. At the same time, it enhances the model's adaptive perception of low-light images through a local global attention network, resulting in more balanced brightness and more obvious details in the generated images, reducing the possibility of over-enhancement and under-enhancement.

[0058] The proposed non-uniform cyclic training strategy can optimize the model's generalization performance on diverse real-world meter images through data augmentation and a designed loss function, thus better adapting to complex mounting scenarios. Attached Figure Description

[0059] Figure 1 This is an overall flowchart of the energy meter image enhancement method of the present invention;

[0060] Figure 2 This is a diagram of the local and global attention network structure of the present invention;

[0061] Figure 3 This is a flowchart of the low-light image non-uniform mixing process of the present invention;

[0062] Figure 4 The image comparison is performed on the LOL test set using various existing methods and the method of this invention, where Input is the low-light image and Ground Truth is the normal real image for comparison.

[0063] Figure 5 The images are partially enhanced using various existing methods and the method of this invention in the absence of a reference dataset, respectively, from the datasets DICM, MEF, and VV, where red boxes represent bright areas and blue boxes represent dark areas;

[0064] Figure 6 The graph shows the test results of various existing methods and the method of this invention on an electricity meter dataset. Detailed Implementation

[0065] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0066] According to a review of relevant domestic and international literature, current low-light image enhancement for smart meters mainly uses traditional methods such as Gaussian filtering and wavelet transform to improve image brightness and contrast. While these traditional methods can improve image quality and restore image information to a certain extent, they may suffer from insufficient detail and color distortion when dealing with diverse and more complex low-light meter images. Existing deep learning-based low-light image enhancement methods possess better deep feature extraction capabilities, thereby improving image restoration performance and enabling more accurate reconstruction of the collected low-light meter image information for subsequent visual fault identification. In deep learning methods, supervised learning requires rigorous pairwise data for model training, and fully supervised training strategies are prone to overfitting and poor generalization performance. Therefore, many methods have adopted unsupervised approaches to address low-light image enhancement tasks. In reality, due to differences in the reflective properties of materials in different parts of the meter, low-light meter images often exhibit uneven brightness. When enhancing such images, many methods may struggle to adaptively perceive the brightness differences in different areas, resulting in over-enhancement of bright areas and under-enhancement of dark areas.

[0067] The goal of low-light image enhancement for smart meters is to generate normal-light images from input images, highlighting and restoring key meter information and improving image quality. This invention, based on deep learning, first pre-trains an enhancement model using existing publicly available datasets containing both low-light and normal image data, enabling the model to enhance illumination. Then, the collected low-light and normal smart meter images are divided into training and testing datasets. The model is retrained on the training set to obtain a deep learning model suitable for low-light image enhancement of smart meters. In practical applications, the trained smart meter low-light image enhancement model is used to process the obtained meter images, balancing image brightness to obtain higher-quality, more information-rich normal images.

[0068] Example 1:

[0069] This embodiment provides a method for enhancing the image of an electricity meter, such as... Figure 1 As shown, the generative adversarial network employed includes a local-global attention network and a dual discriminator structure. The local-global attention network acts as the generator, completing the end-to-end low-light image enhancement task. To better train the local-global attention network, a dual discriminator structure is used in the adversarial process. The global discriminator determines the category of the entire image, while the local discriminator identifies the category of small image patches randomly cut from the input image, helping to enhance the brightness and detail of local regions. Specifically, this includes the following steps:

[0070] Step 1: Input a three-channel RGB low-light image. Map the image data to a high-dimensional feature space through a local-global attention network. Calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image. Through this local-global attention network, establish pixel-level feature associations to achieve bright and dark area discrimination and adaptive enhancement, while maintaining good detail and noise levels.

[0071] Based on this embodiment, such as Figure 2 As shown, the local-global attention network mainly includes: a multi-scale local attention feature extraction network and a global attention feature processing network;

[0072] A multi-scale local attention feature extraction network focuses on local details through in-window attention. The Swin-transformer-based local attention mechanism effectively addresses the detail recovery problem in low-light image enhancement. To handle significant differences in brightness and color between different regions, this invention proposes a multi-scale window partitioning mechanism, which effectively improves the model's ability to extract diverse features. Especially for continuous changes in brightness and darkness under uneven lighting, a larger window can perceive more levels of brightness information, while for discontinuous changes in brightness and darkness, a smaller window helps the model locate the boundary between light and dark areas.

[0073] Therefore, the multi-scale local attention feature extraction network first segments the image into blocks using 1×1 convolutional layers to achieve pixel-level detail feature extraction. Then, it sequentially passes through multiple window attention calculation modules with different window sizes (2, 4, and 8 in this embodiment). Window attention calculation is performed within each module. Because a global attention branch performs global attention calculation, window shifting is not used to reduce computational complexity; the specific process is shown in Algorithm 1. Then, the attention feature maps obtained from each window attention calculation module are accumulated and then data standardization is performed.

[0074] Since attention computation and pixel-level feature extraction have been implemented within a maximum 8×8 window in the local attention branch, the global network focuses on establishing feature connections between these windows. Based on this attention computation method, feature relationships between pixels and regions can be established, enabling more refined and comprehensive image generation with limited computational resources.

[0075] The global attention feature processing network first segments the image into multiple image blocks using convolutional layers with a kernel size of 8×8 and a stride of 8. Then, it performs two multi-head attention calculations to establish global connections between the image blocks. To unify local and global features, it performs subsequent feature fusion by adjusting the dimension of the global feature vector through multi-layer upsampling and deconvolution.

[0076] Finally, the local-global attention network stacks the extracted local attention features with the global attention features in terms of dimensions, fuses the features through a convolutional network, and generates a three-channel RGB enhanced image.

[0077] Step 2: Using real low-light images, normal images, and generated enhanced images as input, train a dual discriminator network, and then train a local-global attention network based on the discrimination results.

[0078] To constrain the generative network and accomplish the task of low-light image enhancement, the adversarial process uses a local-global dual discriminator for unsupervised learning of the network. The performance of the local-global attention network is evaluated by the judgment of the generated image by the dual discriminator network, encouraging the generated image to be closer to the distribution of normal real images.

[0079] Based on this embodiment, the losses of the global discriminator and the global attention feature processing network are respectively:

[0080]

[0081]

[0082] Where D Global (x r ) indicates that the global discriminator is applied to the input normal image x. r The identification results; D Global (x f ) represents the global discriminator's response to the input enhanced image x. f The identification results;

[0083] The losses of the local discriminator and the multi-scale local attention feature extraction network are respectively:

[0084]

[0085]

[0086] in, These represent local regions randomly cut from the normal image and the enhanced image, respectively. and For the input respectively The identification results;

[0087] Step 3: Repeat steps 1 and 2 multiple times to train the model and obtain a trained generative adversarial network model; input the low-light electricity meter image data into the trained model, and the local-global attention network outputs an enhanced image of the low-light image.

[0088] Example 2:

[0089] Building upon the energy meter image enhancement method in Example 1, this example generates non-uniform training data based on existing enhanced images and original low-light images. This data is used to iteratively train the generator network, thereby optimizing the model's adaptive processing capability and generalization performance. The non-uniform iterative training process mainly includes cross-region image blending and non-uniform loss function constraint training, which can effectively improve the model's discrimination and enhancement of bright and dark regions.

[0090] Preferably, the image blending process includes random region cropping and random magnification blending. First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula:

[0091] I'=αI out +(1-α)I in

[0092] Among them, I in with I out These represent the input low-light image and the corresponding enhanced image, respectively. α is a random magnification factor, ranging from 0 to 1. The larger the α, the closer the random region is to the already enhanced image.

[0093] To constrain model training and enhance the model's ability to handle uneven regions separately, the uneven loss function is constructed as follows:

[0094]

[0095] Where I(i,j) represents the pixel value at position (i,j) of the enhanced image output by the local-global attention network from the hybrid image I'; K(i,j) represents the pixel value at position (i,j) of the enhanced image; and m and n represent the pixel dimensions of the cropped region in length and width, respectively.

[0096] Example 3:

[0097] Based on the methods of embodiments 1, 2, or 3 above, in order to avoid over-enhancement and accelerate the model's fitting and learning convergence to normal images, normal images are input into the generative adversarial network during model training, and the following identity-invariant loss is used to constrain the enhanced output:

[0098]

[0099] Where, x r This indicates that a real, normal image is used as the network input, G(x) r The image generated by the augmentation network is represented by the identity invariant loss, which encourages the augmentation network to maintain the normal brightness level of the image, thereby avoiding overexposure and information loss.

[0100] Example 4:

[0101] This embodiment provides an apparatus for implementing the methods of Embodiments 1, 2, or 3, including: a local-global attention network, a dual-discrimination network, and a training control module;

[0102] The local-global attention network includes a multi-scale local attention feature extraction network and a global attention feature processing network. They respectively calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image.

[0103] The dual-discrimination network consists of a global discriminator and a local discriminator; the global discriminator is used to distinguish between the input enhanced image and the normal image to obtain the discrimination result; the local discriminator distinguishes between local regions of the input enhanced image and the normal image to obtain the discrimination result.

[0104] The training control module is used to train the dual discriminator network and to train the local-global attention network based on the discrimination results of the dual discriminator network. Finally, the low-light meter image data is input into the trained local-global attention network to obtain the enhanced image of the low-light image.

[0105] In this embodiment, the multi-scale local attention feature extraction network focuses on local details through in-window attention. The network first segments the image into blocks using 1×1 convolutional layers to extract pixel-level details. Then, it sequentially passes through multiple window attention calculation modules with different window sizes (2, 4, and 8 pixels in this embodiment). Window attention calculation is performed within each module. Because a global attention branch performs global attention calculation, window shifting is not used to reduce computational complexity; the specific process is shown in Algorithm 1. The attention feature maps obtained from each window attention calculation module are then accumulated and subjected to data standardization.

[0106] The global attention feature processing network first segments the image into multiple image blocks using convolutional layers with a kernel size of 8×8 and a stride of 8. Then, it performs two multi-head attention calculations to establish global connections between the image blocks. To unify local and global features, it performs subsequent feature fusion by adjusting the dimension of the global feature vector through multi-layer upsampling and deconvolution.

[0107] Finally, the local-global attention network stacks the extracted local attention features with the global attention features in terms of dimensions, fuses the features through a convolutional network, and generates a three-channel RGB enhanced image.

[0108] Example 5: Based on Example 4, this device further includes a non-uniform cyclic training module;

[0109] This module generates non-uniform training data from existing enhanced images and original low-light images. This data is used to iteratively train the generator network, optimizing the model's adaptive processing capabilities and generalization performance. The non-uniform iterative training process mainly includes cross-region image blending and training constrained by a non-uniform loss function, which effectively improves the model's ability to distinguish and enhance bright and dark regions.

[0110] Preferably, the image blending process includes random region cropping and random magnification blending. First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula:

[0111] I'=αI out +(1-α)I in

[0112] Among them, I in with I out These represent the input low-light image and the corresponding enhanced image, respectively. α is a random magnification factor, ranging from 0 to 1. The larger the α, the closer the random region is to the already enhanced image.

[0113] To constrain model training and enhance the model's ability to handle uneven regions separately, the uneven loss function is constructed as follows:

[0114]

[0115] Where I(i,j) represents the pixel value at position (i,j) of the enhanced image output by the local-global attention network from the hybrid image I'; K(i,j) represents the pixel value at position (i,j) of the enhanced image; and m and n represent the pixel dimensions of the cropped region in length and width, respectively.

[0116] Example 6:

[0117] Based on Embodiment 4 or 5, this device further includes an identity-invariant loss module; to avoid over-enhancement and accelerate the model's fitting and learning convergence to normal images, normal images are input into the generative adversarial network during model training, and the following identity-invariant loss is used to constrain the enhanced output:

[0118]

[0119] Where, x r This indicates that a real, normal image is used as the network input, G(x) r The image generated by the augmentation network is represented by the identity invariant loss, which encourages the augmentation network to maintain the normal brightness level of the image, thereby avoiding overexposure and information loss.

[0120] Example 7:

[0121] This embodiment provides an electronic device for enhancing the image of an energy meter, including a processor 400 and a memory 401;

[0122] Memory 401 is used to store computer program 402 and transfer computer program 402 to processor 400;

[0123] The processor 400 is used to execute the steps of any of the above-described methods for enhancing the image of an energy meter according to the instructions in the computer program 402.

[0124] For example, computer program 402 may be divided into one or more modules / units, one or more of which are stored in memory 401 and executed by processor 400 to complete this application. One or more modules / units may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of computer program 402 in an image enhancement electronic device for an electricity meter.

[0125] The energy meter image enhancement electronic device can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. The energy meter image enhancement electronic device may include, but is not limited to, a processor 400 and a memory 401. Those skilled in the art will understand that this embodiment is merely an example of an energy meter image enhancement electronic device and does not constitute a limitation on the energy meter image enhancement electronic device. It may include more or fewer components than illustrated, or combine certain components, or different components. For example, the energy meter image enhancement electronic device may also include input / output devices, network access devices, buses, etc.

[0126] The processor 400 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), or application-specific integrated circuits (ASICs).

[0127] Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0128] The memory 401 can be an internal storage unit of the energy meter image enhancement electronic device, such as a hard disk or RAM. The memory 401 can also be an external storage device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), or flash card. Furthermore, the memory 401 can include both internal and external storage units. The memory 401 is used to store computer programs and other programs and data required by the energy meter image enhancement electronic device. The memory 401 can also be used to temporarily store data that has been output or will be output.

[0129] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0130] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0131] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0132] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0133] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing computer programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0134] Example 8: This example also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform an image enhancement method for an electricity meter, the method comprising the following steps:

[0135] Input a three-channel RGB low-light image, map the image data to a high-dimensional feature space through a local-global attention network, calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image;

[0136] A dual discriminator network is trained using real low-light images, normal images, and generated enhanced images as inputs, and then a local-global attention network is trained based on the discrimination results.

[0137] Based on repeated training steps 2 and 3, a trained generative adversarial network model is obtained; low-light electricity meter image data is input into the trained model, and the local-global attention network outputs an enhanced image of the low-light image.

[0138] Example 9:

[0139] This embodiment compares the proposed electricity meter image enhancement method with nine typical or advanced models on authoritative public datasets and smart meter datasets for six low-light image enhancement tasks. The results demonstrate the effectiveness and advancement of the proposed low-light image enhancement method for electricity meters based on multi-scale attention networks and non-uniform cyclic training processes.

[0140] 1) Public datasets

[0141] Of the six publicly available datasets used, the LOL dataset contains 485 pairs of low-light and normal-light training images and 15 pairs of test images. In addition, five no-reference natural dark image datasets—DICM, LIME, ME, NPE, and VV—were used to test the generalization performance of the trained model.

[0142] 2) Comparison Method

[0143] As shown in Table 1, to verify the effectiveness of the proposed algorithm, nine typical low-light image enhancement algorithms were used as comparison algorithms in this embodiment of the invention. All models were fully retrained and tested using the official code in the same experimental environment.

[0144] Table 1. Comparison Methods and Detailed Information

[0145]

[0146] 3) Evaluation Indicators

[0147] This invention primarily uses PSNR, SSIM, LPIPS, and NIQE to evaluate the quality of enhanced images and model performance. The first three are reference metrics, requiring comparison calculations with normal images. PSNR reflects the difference in pixel values ​​between the image being evaluated and the reference image; SSIM reflects the similarity in brightness, contrast, and structure between the two images; and LPIPS reflects the difference between the feature maps obtained from the feature extractor and the two images. NIQE is a no-reference evaluation metric that reflects the difference between the image being evaluated and a set of artificial natural images. A lower NIQE value indicates that the image being evaluated is closer to a natural image, meaning higher image quality.

[0148] 4) Implementation details

[0149] The model is implemented in PyTorch and optimized using the Adam optimizer, with values ​​set to 0.9 and 0.999 respectively. The initial learning rate is 5e-5, which decays continuously during training. During training, a fixed number of low-light and normal-light images are randomly selected from the dataset in each round, and a 256*256 portion is randomly cropped from each image for training. During testing, the test image is resized to 512*512 and used as input.

[0150] 5) Experimental results on public datasets

[0151] A) Experimental results with reference datasets

[0152] Table 2 presents a quantitative comparison of the embodiments of the present invention with other comparative methods on the LOL test set. The embodiments of the present invention are represented by MSATr in the table. It can be seen that the low-light image enhancement method for smart meters proposed in this invention significantly outperforms other existing advanced unsupervised algorithms in all reference metrics, and is close to the best supervised method. It also achieves the best score under NIQE, which means that the enhanced image has a more natural and realistic visual effect. Some test image results for LOL are shown below. Figure 4 As shown, the image generated by MSATR has a more uniform lighting level and fewer artifacts, and can take into account the overall brightness, color and local details. Other contrast methods mostly suffer from insufficient enhancement, color distortion and noise residue.

[0153] Table 2 shows the PSNR, SSIM, LPIPS, and NIQE metrics for each method in League of Legends. The best result is indicated in bold, the second best by underline, and the third best by italics.

[0154]

[0155] B) Experimental results without a reference dataset

[0156] This section uses the model trained on the LOL dataset mentioned above to perform image enhancement tests on five unsupervised datasets, and then evaluates the quality of the generated images. Table 3 shows a quantitative comparison of the embodiments of the present invention with other comparative methods on the no-reference dataset. The embodiments of the present invention are denoted by MSATr in the table. Except for LIME, the low-light image enhancement method for smart meters proposed in this invention achieves the best results on the other four unsupervised datasets, and outperforms all state-of-the-art supervised and unsupervised methods on the average of the five datasets.

[0157] Table 3 shows the NIQE metrics for each method on the no-reference dataset. The best result is indicated in bold, the second best by underline, and the third best by italics.

[0158]

[0159] Figure 5The presentation showcases some no-reference test images and their enhancement effects. It can be seen that the enhanced images generated by this method have the best visual effect. When processing images with uneven lighting, it can adaptively balance the enhancement brightness according to the different brightness levels between regions, making the overall image brightness more natural. It effectively enhances objects in dark areas while avoiding overexposure in bright areas. In contrast, most other comparative methods suffer from over-enhancement and under-enhancement issues.

[0160] 6) Smart energy meter dataset

[0161] The specific characteristics of the low-light image dataset for smart meters are shown in Table 4. This dataset collects low-light images and normal images of various models of smart meters.

[0162] Table 4 Number of images in the actual electricity meter dataset

[0163]

[0164] 7) Experimental results of smart energy meter dataset

[0165] Table 5 shows the NIQE results of the embodiments of the present invention and other comparative methods on the low-light smart meter image dataset.

[0166] Table 5 shows the AUC results compared with other methods on the smart energy meter dataset.

[0167] method LDR LIME Retinex-Net Uretinex-Net Bread NIQE value 4.1660 4.0997 4.1726 4.3940 4.7389 method EnlightenGAN ZeroDCE LE-GAN SCI MSATr NIQE value 4.1099 4.3913 4.5247 4.4850 3.9755

[0168] Figure 6 The invention demonstrates the enhancement effect on low-light smart meter images. The enhanced images generated by the low-light image enhancement method for smart meters proposed in this invention can not only restore clear dial readings and barcode information, but also avoid color distortion and overexposure on the meter casing, thus exhibiting the best visual quality. This provides better data support for subsequent visual fault identification and improves the identification accuracy.

[0169] In summary, the above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for enhancing the image of an electricity meter, characterized in that, include: For input low-light electricity meter images, the image data is mapped to a high-dimensional feature space through a local-global attention network. The local and global feature representations of the image are calculated based on multi-head attention, and the local and global features are fused through multiple convolutions to generate an enhanced image. A dual discriminator network is trained using real low-light images, normal images, and generated enhanced images as inputs. Then, a local-global attention network is trained based on the discrimination results of the dual discriminator network. The local-global attention network and the dual discriminator network are repeatedly trained to obtain a trained generative adversarial network model; the low-light electricity meter image data is input into the trained local-global attention network to output an enhanced image of the low-light image; The local-global attention network includes a multi-scale local attention feature extraction network and a global attention feature processing network; The multi-scale local attention feature extraction network first performs image block segmentation through a 1×1 convolutional layer; then it inputs the image into a window attention calculation module with multiple windows of different sizes for window attention calculation; finally, the attention feature maps obtained by the window attention calculation modules at each scale are accumulated and then the data is standardized. The global attention feature processing network first performs block segmentation by using convolutional layers with a kernel size of 8×8 and a stride of 8 to divide the image into multiple image blocks. Then, it performs two multi-head attention calculations to establish global connections between image blocks. Finally, the local-global attention network stacks the extracted local attention features with the global attention features in terms of dimensions, fuses the features through a convolutional network, and generates an enhanced image.

2. The method for enhancing an electricity meter image as described in claim 1, characterized in that, The dual discriminator network is trained on the local-global attention network based on the following loss function: The losses of the global discriminator and the global attention feature processing network are as follows: in, This indicates that the global discriminator is effective for normal input images. The identification results; This indicates the global discriminator's response to the input enhanced image. The identification results; The losses of the local discriminator and the multi-scale local attention feature extraction network are respectively: in, , These represent local regions randomly cut from the normal image and the enhanced image, respectively. and This indicates that the inputs are respectively and The identification results.

3. A method for enhancing the image of an electricity meter as described in claim 1 or 2, characterized in that, It also includes a non-uniform cyclic training process, specifically: First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula: in, and These represent the input low-light image and the corresponding enhanced image, respectively. Random multipliers; The non-uniform loss function for non-uniform training is as follows: in, Represents a mixed image The enhanced image output by the local-global attention network is located at... Pixel value at; Indicates the location of the enhanced image. The pixel value at the location; m and n represent the pixel dimensions of the cropped area in length and width, respectively.

4. A method for enhancing the image of an electricity meter as described in claim 1 or 2, characterized in that, It also includes the identity-invariant loss training process, specifically: The normal image is input into the generative adversarial network, and the augmented output is constrained using the following identity-invariant loss: in, This indicates that a real, normal image is used as the network input. This represents the image generated by the augmentation network.

5. A device for enhancing the image of an electricity meter, characterized in that, include: Local-global attention network, dual discrimination network, and training control module; The local-global attention network includes a multi-scale local attention feature extraction network and a global attention feature processing network. They respectively calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image. The dual-discrimination network consists of a global discriminator and a local discriminator; the global discriminator is used to distinguish between the input enhanced image and the normal image to obtain the discrimination result; the local discriminator distinguishes between local regions of the input enhanced image and the normal image to obtain the discrimination result. The training control module is used to train the dual discriminator network and to train the local-global attention network based on the discrimination results of the dual discriminator network. Finally, the low-light meter image data is input into the trained local-global attention network to obtain the enhanced image of the low-light image. The multi-scale local attention feature extraction network first performs image block segmentation through a 1×1 convolutional layer; then it inputs the image into a window attention calculation module with multiple windows of different sizes for window attention calculation; finally, the attention feature maps obtained by the window attention calculation modules at each scale are accumulated and then the data is standardized. The global attention feature processing network first performs block segmentation by using convolutional layers with a kernel size of 8×8 and a stride of 8 to divide the image into multiple image blocks. Then, it performs two multi-head attention calculations to establish global connections between image blocks. Finally, the local-global attention network stacks the extracted local attention features with the global attention features in terms of dimensions, fuses the features through a convolutional network, and generates an enhanced image.

6. The energy meter image enhancement device as described in claim 5, characterized in that, It also includes a non-uniform cyclic training module; This module generates uneven training data from existing enhanced images and original low-light images, which is used to iteratively train the generator network. Specifically: The image blending process includes random region cropping and random magnification blending. First, regions are randomly divided in the low-light image and the enhanced image. Then, the images are blended within the random regions using the following formula: in, and These represent the input low-light image and the corresponding enhanced image, respectively. The multiplier is random, ranging from 0 to 1. A larger value indicates that the random region is closer to the already enhanced image; The constructed non-uniform loss function is as follows: in, Represents a mixed image The enhanced image output by the local-global attention network is located at... Pixel value at; Indicates the location of the enhanced image. The pixel value at the location; m and n represent the pixel dimensions of the cropped area in length and width, respectively.

7. The energy meter image enhancement device as described in claim 5, characterized in that, It also includes an identity-invariant loss module; a normal image is input into the generative adversarial network (GAN), and the following identity-invariant loss is used to constrain the output of the GAN: in, This indicates that a real, normal image is used as the network input. This represents the image generated by the augmentation network.

8. An electronic device for image enhancement of an electricity meter, characterized in that, Includes a processor (400) and a memory (401); The memory (401) is used to store the computer program (402) and to transfer the computer program (402) to the processor (400). The processor (400) is configured to execute the steps of any one of the energy meter image enhancement methods according to the instructions in the computer program (402).

9. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform any one of the energy meter image enhancement methods according to claims 1 to 4, the method comprising the following steps: Input a three-channel RGB low-light image, map the image data to a high-dimensional feature space through a local-global attention network, calculate the local and global feature representations of the image based on multi-head attention, and fuse the local and global features through multiple convolutions to generate an enhanced image; A dual discriminator network is trained using real low-light images, normal images, and generated enhanced images as inputs, and then a local-global attention network is trained based on the discrimination results. The generative adversarial network model is trained multiple times to obtain a well-trained model. The low-light electricity meter image data is input into the trained model, and the local-global attention network outputs an enhanced image of the low-light image.