Electric meter defect detection method and system based on image recognition and storage medium
Through the image recognition method, the pre-trained model is used to detect the nameplate model, character and screen defects of the meter, which solves the problem of large error in the surface defect detection of the meter in the prior art, and realizes high-precision meter defect detection.
Patent Information
- Application Number
- CN202411219247.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art lacks effective methods to detect surface defects of the electricity meter in use or after recycling, especially when character defects and screen debris affect each other, there is a large error in the detection results.
Using an image recognition method, the surface image of the electricity meter is detected through pre-trained nameplate detection model, text recognition model and neural network model, and the nameplate model, character defects and screen defects are identified, and the grayscale processing and noise superposition technology is improved. Detection accuracy and robustness.
It effectively solves the problem of surface defect detection of electricity meter in use or after recycling, improves detection accuracy, reduces the model's demand for computing power, and detects character and screen defects through the same surface image, avoiding misidentification.
Smart Images

Figure CN119168968A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric meter defect detection, and is an electric meter defect detection method, system and storage medium based on image recognition. Background Art
[0002] Electricity meters are common instruments in daily life. Newly manufactured electricity meters may have surface defects due to process problems. Electricity meters returned to the warehouse usually have more serious surface defects due to poor installation environment and improper maintenance. The surface defects of electricity meters mainly include display screen defects, nameplate defects and other surface defects.
[0003] The meter display screen is used to display electricity consumption information. Display screen defects include screen appearance defects and character defects. Screen appearance defects are generally generated during use, such as scratches, pollution, screen cracks, etc. Mild screen appearance defects will affect the appearance of the meter, and serious ones will affect the reading of electricity consumption information, and even affect the metering accuracy and safety of use. Character defects refer to the problem that the optical characters in the meter display screen are not clearly displayed. This problem may occur during the generation and use of the meter. The display of electricity consumption information is one of the basic functions of the meter. Unclear display of electricity consumption information will cause users to be unable to obtain electricity consumption information. The meter nameplate is used to mark the meter parameters. Nameplate defects include missing ink, scratches and pollution. Meter nameplate defects will cause safety hazards in the use of the meter and are not convenient for the maintenance and classification storage of the meter. Other surface defects refer to defects in the area other than the nameplate and display screen on the meter surface. Minor other surface defects include scratches and pollution on the meter, which do not affect the normal use of the meter. Severe other surface defects are meter damage, which will seriously affect the use of the meter and the safety of the user.
[0004] In the prior art, when detecting surface defects of electric meters through image recognition, only the newly produced electric meters are focused on, and the defects of newly produced electric meters are simple, mainly character defects and printing defects of nameplates. For electric meters that are in use or classified and stored after recycling, there is no method for detecting surface defects of electric meters in the prior art. In the paper "Automatic Detection and Analysis of Appearance Defects of Intelligent Electric Meters Based on Image Processing" (Hao Linqian, Wang Minghui. Journal of Taiyuan University (Natural Science Edition), 2018, 36(03):45-50), it is proposed to detect the appearance defects of electric energy meters through image processing technology, but it does not take into account the mutual influence between the character defects of the electric meter and the screen contamination, resulting in large errors in the detection results.
[0005] Therefore, there is an urgent need for an electric meter defect detection method based on image recognition to solve the above problems. Summary of the invention
[0006] The present invention provides an electric meter defect detection method, system and storage medium based on image recognition, which overcome the shortcomings of the above-mentioned prior art and can effectively solve the problem in the prior art that there is no surface defect detection method for electric meters in use or classified and stored after recycling.
[0007] One of the technical solutions of the present invention is achieved by the following measures: A method for detecting electric meter defects based on image recognition, comprising the following steps:
[0008] Collecting a plurality of surface images of the electric meter to be inspected, wherein the combination of the surface images includes all the surfaces of the electric meter to be inspected;
[0009] Preprocess the surface image to make it meet the requirements of each model;
[0010] The meter nameplate is detected by using the pre-trained nameplate detection model and the surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects;
[0011] The surface image used for meter character defect detection is annotated with the meter model obtained by the nameplate detection model;
[0012] The electric meter character defects are detected by using a text recognition model and a surface image used for electric meter character defect detection to obtain the electric meter character defects;
[0013] Detect electricity meter screen defects and other defects using a pre-trained neural network model and surface images.
[0014] The following is a further optimization and / or improvement of one of the above-mentioned technical solutions:
[0015] The above-mentioned method of detecting the meter nameplate by using the pre-trained nameplate detection model and the surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects may specifically include the following steps:
[0016] Acquire surface images A of several electric meters, where the surface images A include nameplate information of the electric meters;
[0017] Construct a nameplate detection model, which includes a nameplate matching model and a nameplate information recognition model. The nameplate matching model is used to detect the nameplate model, and the nameplate information recognition model is used to detect the text and symbols in each area of the nameplate;
[0018] The surface image A is annotated to obtain a surface image B, where the annotated content includes the electric meter model; the nameplate matching model is trained through the surface image B to obtain a pre-trained nameplate matching model;
[0019] Grayscale processing is performed on the surface image A; the surface image A that has been grayscale processed and the surface image A that has not been grayscale processed are respectively prepared into training samples, wherein the preparation step includes labeling the surface image A, and the labeling content includes the electric meter model corresponding to the nameplate and the text and symbols in each area of the nameplate; the nameplate information recognition model is trained through the training samples to obtain a pre-trained nameplate information recognition model;
[0020] Input the surface image C of the electric meter to be tested into the pre-trained nameplate matching model to obtain the meter model of the electric meter to be tested, and the surface image C includes the nameplate information of the electric meter; grayscale processing is performed on the surface image C; and the surface image C that has been grayscale processed and that has not been grayscale processed is labeled with the meter model obtained by the nameplate matching model;
[0021] Input the grayscale processed and ungrayscale processed surface images C into the nameplate information recognition model to obtain prediction results; compare the prediction results of the grayscale processed and ungrayscale processed surface images C with the pre-stored nameplate information respectively, and mark the areas different from the pre-stored nameplate information as defects;
[0022] The surface image B of the electric meter to be detected is matched with the nameplates of various preset electric meters through the nameplate matching model to accurately obtain the electric meter model.
[0023] The nameplate matching model may adopt a Siamese network, which includes a first feature extraction module and a second feature extraction module, wherein the first feature extraction module and the second feature extraction module have the same structure and share weights;
[0024] The first feature extraction module and the second feature extraction module include four convolutional layers connected in sequence, and each convolutional layer is connected to a maximum pooling layer;
[0025] The features extracted by the first feature extraction module and the second feature extraction module are measured for similarity, and the similarity measurement adopts a cross-correlation function; the nameplate matching model is optimized using binary cross entropy as a loss function;
[0026] During pre-training, the nameplate image with the meter model marked is input into the first feature extraction module, and the surface image B is input into the second feature extraction module for training.
[0027] The cross-correlation function may specifically be to use the features extracted by the first feature extraction module as a convolution kernel and perform a convolution operation on the features extracted by the second feature extraction module.
[0028] The above-mentioned detection of the meter character defects by using the text recognition model and the annotated surface image to obtain the meter character defects may specifically include the following steps:
[0029] Constructing a text recognition model, wherein the text recognition model includes a third feature extraction module and a U-Net network;
[0030] During training, the surface image D used to train the text recognition model is input into the third feature extraction module, wherein the surface image D is annotated with the meter model and the screen display content;
[0031] The third feature extraction module includes four residual blocks connected in sequence;
[0032] After superimposing the surface image D with the features extracted by the third feature extraction module, the superimposed surface image D is input into the U-Net network through the first convolutional layer;
[0033] The U-Net network includes a first residual block, a second residual block, a third residual block, a fourth residual block, a fifth residual block, a sixth residual block, a seventh residual block and an eighth residual block;
[0034] The first residual block, the second residual block, the third residual block and the fourth residual block are connected in sequence;
[0035] Superimposing noise on the surface image D and inputting the resultant image into the first residual block;
[0036] After superimposing the features extracted by the fourth residual block and the output of the first convolutional layer, the features are input into the sequentially connected downsampling layer, residual block, linear attention module, residual block and upsampling layer;
[0037] After splicing the output of the upsampling layer and the features extracted by the fourth residual block, the output is input into the fifth residual block and the sixth residual block connected in sequence;
[0038] After concatenating the features extracted by the sixth residual block and the features extracted by the second residual block, the features are input into the seventh residual block and the eighth residual block connected in sequence;
[0039] The eighth residual block outputs a prediction result, and updates the parameters of the text recognition model according to the prediction result;
[0040] After the training is completed, the meter character defects are detected through the pre-trained text recognition model and the annotated surface image to obtain the meter character defects.
[0041] The surface image D after superimposing the noise can be:
[0042]
[0043]
[0044] Among them, D t is the surface image D with noise added after time step t, D is the original surface image D, E is the noise, β jis the ratio of adding noise at the jth time step.
[0045] When the meter screen defects and other meter defects are detected by using the pre-trained neural network model and the surface image, the neural network model may adopt the Faster RCNN network.
[0046] If an electric meter detects a character defect and a screen defect at the same time, the positions of the character defect and the screen defect are compared. If the overlap between the character defect and the screen defect is greater than a preset value, it is determined that the electric meter does not have the character defect. Specifically, the following steps may be included:
[0047] For a surface image in which character defects and screen defects are detected simultaneously, obtaining character defect coordinates;
[0048] Calculate the overlap between a character defect and each screen defect, and add them together:
[0049]
[0050] Among them, A is the total overlap, a i is the overlap between the character defect and the i-th screen defect;
[0051] If A is greater than the preset value, it is determined that the meter does not have the character defect.
[0052] The second technical solution of the present invention is achieved through the following measures: an electric meter defect detection system based on image recognition, including a memory and a processor, the memory stores a program that can be run on the processor, and the processor implements the above-mentioned electric meter defect detection method based on image recognition when executing the program.
[0053] The third technical solution of the present invention is achieved through the following measures: a storage medium, the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned electric meter defect detection method based on image recognition.
[0054] The present invention identifies the meter model through the nameplate detection model, and marks the surface image according to the meter model, which effectively improves the accuracy of surface image defect detection and reduces the model's demand for computing power. The meter characters and screen defects are detected through the same surface image without cutting, and the character defect detection results are corrected according to the screen defect detection results to avoid screen defects being identified as character defects. After the surface image is marked by the meter model, the difficulty of detecting meter character defects and screen defects can be reduced. The meter characters are identified through the text recognition model, and then compared with the pre-stored characters of the same model meter, so that the character defects and defect locations can be quickly determined. By superimposing noise on high-quality images to simulate image quality problems, the model learns how to deal with low-quality images, thereby improving the accuracy and robustness of the final text recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The figure is a schematic diagram of a method flow of an embodiment of the present invention.
[0056] Figure 2 Schematic diagram of the network structure of the nameplate matching model according to an embodiment of the present invention.
[0057] Figure 3 Schematic diagram of the network structure of the text recognition model according to an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The present invention is not limited by the following embodiments, and specific implementation methods can be determined based on the technical solution of the present invention and actual conditions.
[0059] The present invention will be further described below in conjunction with embodiments:
[0060] Embodiment 1: As attached Figure 1 , 2 As shown in , 3, the electric meter defect detection method based on image recognition includes the following steps:
[0061] Collecting a plurality of surface images of the electric meter to be inspected, wherein the combination of the surface images includes all the surfaces of the electric meter to be inspected;
[0062] Preprocess the surface image to make it meet the requirements of each model;
[0063] The meter nameplate is detected by using the pre-trained nameplate detection model and the surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects;
[0064] The surface image used for meter character defect detection is annotated with the meter model obtained by the nameplate detection model;
[0065] The electric meter character defects are detected by using a text recognition model and a surface image used for electric meter character defect detection to obtain the electric meter character defects;
[0066] Detect electricity meter screen defects and other defects using a pre-trained neural network model and surface images.
[0067] In this embodiment, the surface image used for detecting meter character defects and the surface image used for detecting meter screen defects are obtained by preprocessing the same surface image. The surface image is not cropped during preprocessing, and the surface image is obtained from the front of the meter screen when the meter characters are fully displayed. If a meter detects both a character defect and a screen defect, the positions of the character defect and the screen defect are compared. If there is a character defect and a screen defect whose overlap is greater than a preset value, it is determined that the meter does not have the character defect.
[0068] In this embodiment, the defect detection results of each model are used to mark the meter to be tested. Different types of meters have different nameplates. The most accurate method is to use the nameplate detection to determine the meter model. Since the screen display content of different types of meters is different, after marking the surface image with the meter model, the difficulty of detecting meter character defects and screen defects can be reduced.
[0069] In this embodiment, the meter characters are recognized by a text recognition model and then compared with the pre-stored characters of the same model meter, so that character defects and defect locations can be quickly determined.
[0070] The meter character defects determined by the text recognition model are not necessarily real meter character defects. There are also meter character defects caused by screen contamination, such as part of the screen being contaminated, which makes the meter character unrecognizable. In this embodiment, the degree of overlap between the character defect and the screen defect is calculated to determine whether the character defect position is the screen defect position. If so, the character defect is likely to be caused by the screen defect and needs to be removed.
[0071] In this embodiment, the surface image used for meter character defect detection and the surface image used for meter screen defect detection are set to be the same image and are not cropped, so that no additional processing is required when calculating the overlap of the detected defects. Even if the surface image used for meter character defect detection and the surface image used for meter screen defect detection have different resolutions, since the images are not cropped, the position of the character defect caused by the screen defect is still the same as the position of the screen defect.
[0072] In this embodiment, the meter nameplate is detected by using a pre-trained nameplate detection model and a surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects, which specifically includes the following steps:
[0073] Acquire surface images A of several electric meters, where the surface images A include nameplate information of the electric meters;
[0074] Construct a nameplate detection model, which includes a nameplate matching model and a nameplate information recognition model. The nameplate matching model is used to detect the nameplate model, and the nameplate information recognition model is used to detect the text and symbols in each area of the nameplate;
[0075] The surface image A is annotated to obtain a surface image B, where the annotated content includes the electric meter model; the nameplate matching model is trained through the surface image B to obtain a pre-trained nameplate matching model;
[0076] Grayscale processing is performed on the surface image A; the surface image A that has been grayscale processed and the surface image A that has not been grayscale processed are respectively prepared into training samples, wherein the preparation step includes labeling the surface image A, and the labeling content includes the electric meter model corresponding to the nameplate and the text and symbols in each area of the nameplate; the nameplate information recognition model is trained through the training samples to obtain a pre-trained nameplate information recognition model;
[0077] Input the surface image C of the electric meter to be tested into the pre-trained nameplate matching model to obtain the meter model of the electric meter to be tested, and the surface image C includes the nameplate information of the electric meter; grayscale processing is performed on the surface image C; and the surface image C that has been grayscale processed and that has not been grayscale processed is labeled with the meter model obtained by the nameplate matching model;
[0078] Input the grayscale processed and ungrayscale processed surface images C into the nameplate information recognition model to obtain prediction results; compare the prediction results of the grayscale processed and ungrayscale processed surface images C with the pre-stored nameplate information respectively, and mark the areas different from the pre-stored nameplate information as defects;
[0079] The surface image B of the electric meter to be detected is matched with the preset nameplates of various types of electric meters through the nameplate matching model, so that the model of the electric meter can be accurately obtained.
[0080] When recognizing the text and symbols on the nameplate, there may be differences between the color image and the grayscale image. For example, if there are convex or concave text on the nameplate, it is still possible to recognize the original text after the ink of the text is removed or contaminated. However, the nameplate information recognition model has different recognition capabilities for such text in color images and grayscale images. Therefore, the surface image C that has been processed with grayscale and the surface image C that has not been processed with grayscale are respectively input into the nameplate information recognition model, and the prediction results obtained can more comprehensively reflect the nameplate defects. When marking the nameplate defects, you only need to compare the prediction results with the nameplate pre-stored in the corresponding model of the meter to obtain the defects and defect locations.
[0081] In this embodiment, the nameplate matching model adopts a Siamese network, which includes a first feature extraction module and a second feature extraction module. The first feature extraction module and the second feature extraction module have the same structure and share weights.
[0082] The first feature extraction module and the second feature extraction module include four convolutional layers connected in sequence, and each convolutional layer is connected to a maximum pooling layer;
[0083] The features extracted by the first feature extraction module and the second feature extraction module are measured for similarity, and the similarity measurement adopts a cross-correlation function; the nameplate matching model is optimized using binary cross entropy as a loss function;
[0084] During pre-training, the nameplate image with the meter model marked is input into the first feature extraction module, and the surface image B is input into the second feature extraction module for training; wherein the nameplate image only includes the nameplate area of the meter.
[0085] In this embodiment, the cross-correlation function is specifically to use the features extracted by the first feature extraction module as a convolution kernel and perform a convolution operation on the features extracted by the second feature extraction module, so as to avoid the boundary effect.
[0086] Since there is no fixed way to collect the nameplate image of the meter to be tested, and the models and installation locations of the meters are different, the position and size of the nameplate in the surface image are uncertain. This model can quickly locate the nameplate position and match it.
[0087] In this embodiment, the nameplate information recognition model is obtained by training the fonts and symbols of each meter nameplate; during training, the Chinese characters and symbols are the Chinese characters and symbols displayed on the meter nameplate, where the numbers are the numbers 0 to 9, and the letters are the letters a to z and A to Z. Different types of meter nameplates may use different fonts, but the Chinese characters on the meter nameplate are limited, so only the Chinese characters and symbols displayed on the nameplate need to be trained to recognize all the Chinese characters and symbols. The numbers and letters on the meter nameplates of the same model may be different, so all the numbers and letters need to be trained. However, the total number of numbers and letters is small, and the training difficulty is low. The model trained in this way has extremely high recognition accuracy and efficiency.
[0088] In this embodiment, the meter character defects are detected by using a text recognition model and annotated surface image to obtain meter character defects, which are specifically:
[0089] Constructing a text recognition model, wherein the text recognition model includes a third feature extraction module and a U-Net network;
[0090] During training, the surface image D used to train the text recognition model is input into the third feature extraction module, wherein the surface image D is annotated with the meter model and the screen display content;
[0091] The third feature extraction module includes four residual blocks connected in sequence;
[0092] After superimposing the surface image D with the features extracted by the third feature extraction module, the superimposed surface image D is input into the U-Net network through the first convolutional layer;
[0093] The U-Net network includes a first residual block, a second residual block, a third residual block, a fourth residual block, a fifth residual block, a sixth residual block, a seventh residual block and an eighth residual block;
[0094] The first residual block, the second residual block, the third residual block and the fourth residual block are connected in sequence;
[0095] Superimposing noise on the surface image D and inputting the resultant image into the first residual block;
[0096] After superimposing the features extracted by the fourth residual block and the output of the first convolutional layer, the features are input into the sequentially connected downsampling layer, residual block, linear attention module, residual block and upsampling layer;
[0097] After splicing the output of the upsampling layer and the features extracted by the fourth residual block, the output is input into the fifth residual block and the sixth residual block connected in sequence;
[0098] After concatenating the features extracted by the sixth residual block and the features extracted by the second residual block, the features are input into the seventh residual block and the eighth residual block connected in sequence;
[0099] The eighth residual block outputs a prediction result, and updates the parameters of the text recognition model according to the prediction result;
[0100] After the training is completed, the meter character defects are detected through the pre-trained text recognition model and the annotated surface image to obtain the meter character defects.
[0101] The third feature extraction module of the text recognition model consists of four residual blocks connected in sequence and a skip connection, which helps to better understand the complex characteristics of text characters and accurately restore details. A linear attention module is deployed in the middle of the U-Net network to effectively learn the importance level of text characters and the importance of key parts in the image context. The surface images collected in actual scenes have low quality problems due to light, resolution and other reasons. The model simulates the image quality problem by superimposing noise on high-quality images, so that the model learns how to deal with low-quality images, improving the accuracy and robustness of the final text recognition.
[0102] In this embodiment, the surface image D after superimposing noise is:
[0103]
[0104] Among them, D t is the surface image D with noise added after time step t, D is the original surface image D, E is the noise, β j is the proportion of noise added at the jth time step;
[0105] During the training process, noise is gradually added to the high-quality original surface image D.
[0106] In this embodiment, when detecting the screen defects and other defects of the electric meter through the pre-trained neural network model and the surface image, the neural network model adopts the Faster RCNN network.
[0107] In this embodiment, if an electric meter detects a character defect and a screen defect at the same time, the positions of the character defect and the screen defect are compared. If the overlap between a character defect and a screen defect is greater than a preset value, it is determined that the electric meter does not have the character defect, which specifically includes the following steps:
[0108] For a surface image in which character defects and screen defects are detected simultaneously, obtaining character defect coordinates;
[0109] Calculate the overlap between a character defect and each screen defect, and add them together:
[0110]
[0111] Among them, A is the total overlap, a i is the overlap between the character defect and the i-th screen defect;
[0112] If A is greater than the preset value, it is determined that the meter does not have the character defect.
[0113] This embodiment uses the nameplate detection model to identify the meter model and annotates the surface image according to the meter model, which effectively improves the accuracy of surface image defect detection and reduces the model's demand for computing power. The meter character and screen defect detection are performed on the same surface image without cutting, and the character defect detection result is corrected according to the screen defect detection result to avoid screen defects being identified as character defects.
[0114] Example 2: This example provides an electric meter defect detection system based on image recognition, which includes a memory, a processor, a communication interface, and a communication bus. The memory stores a program that can be run on the processor, and when the processor executes the program, the electric meter defect detection method based on image recognition in the above example is implemented.
[0115] The processor may be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, field programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0116] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and units, such as the corresponding program units in the above method embodiments of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, the electric meter defect detection method based on image recognition in the above embodiment is realized.
[0117] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. The memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. One or more programs are stored in the memory, and when executed by the processor, the electric meter defect detection method based on image recognition in the above embodiment is executed.
[0118] Embodiment 3: This embodiment provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the electric meter defect detection method based on image recognition as provided in the above method embodiment.
[0119] The storage medium may be an internal storage unit of the electric meter defect detection system based on image recognition, such as a hard disk or memory of the electric meter defect detection system based on image recognition. The storage medium may also be an external storage device of the electric meter defect detection system based on image recognition, such as a plug-in hard disk, smart memory card, secure digital card, flash memory card, etc. equipped on the electric meter defect detection system based on image recognition.
[0120] The above technical features constitute the embodiments of the present invention, which have strong adaptability and implementation effect. Non-essential technical features can be added or reduced according to actual needs to meet the requirements of different situations.
Claims
1. A method for detecting electric meter defects based on image recognition, characterized in that The following steps are involved: Collecting a plurality of surface images of the electric meter to be inspected, wherein the combination of the surface images includes all the surfaces of the electric meter to be inspected; Preprocess the surface image to make it meet the requirements of each model; The meter nameplate is detected by using the pre-trained nameplate detection model and the surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects; The surface image used for meter character defect detection is annotated with the meter model obtained by the nameplate detection model; The electric meter character defects are detected by using a text recognition model and a surface image used for electric meter character defect detection to obtain the electric meter character defects; Detect electricity meter screen defects and other defects using a pre-trained neural network model and surface images.
2. The electric meter defect detection method based on image recognition according to claim 1 is characterized in that The meter nameplate is detected by using the pre-trained nameplate detection model and the surface image containing the meter nameplate to obtain the meter nameplate model and nameplate defects, which specifically includes the following steps: Acquire surface images A of several electric meters, where the surface images A include nameplate information of the electric meters; Construct a nameplate detection model, which includes a nameplate matching model and a nameplate information recognition model. The nameplate matching model is used to detect the nameplate model, and the nameplate information recognition model is used to detect the text and symbols in each area of the nameplate; The surface image A is annotated to obtain a surface image B, where the annotated content includes the electric meter model; the nameplate matching model is trained through the surface image B to obtain a pre-trained nameplate matching model; Grayscale processing is performed on the surface image A; the surface image A that has been grayscale processed and the surface image A that has not been grayscale processed are respectively prepared into training samples, wherein the preparation step includes labeling the surface image A, and the labeling content includes the electric meter model corresponding to the nameplate and the text and symbols in each area of the nameplate; the nameplate information recognition model is trained through the training samples to obtain a pre-trained nameplate information recognition model; Input the surface image C of the electric meter to be tested into the pre-trained nameplate matching model to obtain the meter model of the electric meter to be tested, and the surface image C includes the nameplate information of the electric meter; grayscale processing is performed on the surface image C; and the surface image C that has been grayscale processed and that has not been grayscale processed is labeled with the meter model obtained by the nameplate matching model; Input the grayscale processed and ungrayscale processed surface images C into the nameplate information recognition model to obtain prediction results; compare the prediction results of the grayscale processed and ungrayscale processed surface images C with the pre-stored nameplate information respectively, and mark the areas different from the pre-stored nameplate information as defects; The surface image B of the electric meter to be detected is matched with the nameplates of various preset electric meters through the nameplate matching model to accurately obtain the electric meter model.
3. The electric meter defect detection method based on image recognition according to claim 2 is characterized in that The nameplate matching model adopts a Siamese network, which includes a first feature extraction module and a second feature extraction module. The first feature extraction module and the second feature extraction module have the same structure and share weights. The first feature extraction module and the second feature extraction module include four convolutional layers connected in sequence, and each convolutional layer is connected to a maximum pooling layer; The features extracted by the first feature extraction module and the second feature extraction module are measured for similarity, and the similarity measurement adopts a cross-correlation function; the nameplate matching model is optimized using binary cross entropy as a loss function; During pre-training, the nameplate image with the meter model marked is input into the first feature extraction module, and the surface image B is input into the second feature extraction module for training.
4. The electric meter defect detection method based on image recognition according to claim 3 is characterized in that The cross-correlation function specifically uses the features extracted by the first feature extraction module as a convolution kernel and performs a convolution operation on the features extracted by the second feature extraction module.
5. The electric meter defect detection method based on image recognition according to claim 1, 2, 3 or 4, characterized in that The meter character defects are detected by using the text recognition model and the annotated surface image to obtain the meter character defects, which specifically includes the following steps: Constructing a text recognition model, wherein the text recognition model includes a third feature extraction module and a U-Net network; During training, the surface image D used to train the text recognition model is input into the third feature extraction module, wherein the surface image D is annotated with the meter model and the screen display content; The third feature extraction module includes four residual blocks connected in sequence; After superimposing the surface image D with the features extracted by the third feature extraction module, the superimposed surface image D is input into the U-Net network through the first convolutional layer; The U-Net network includes a first residual block, a second residual block, a third residual block, a fourth residual block, a fifth residual block, a sixth residual block, a seventh residual block and an eighth residual block; The first residual block, the second residual block, the third residual block and the fourth residual block are connected in sequence; Superimposing noise on the surface image D and inputting the resultant image into the first residual block; After superimposing the features extracted by the fourth residual block and the output of the first convolutional layer, the features are input into the sequentially connected downsampling layer, residual block, linear attention module, residual block and upsampling layer; After splicing the output of the upsampling layer and the features extracted by the fourth residual block, the output is input into the fifth residual block and the sixth residual block connected in sequence; After concatenating the features extracted by the sixth residual block and the features extracted by the second residual block, the features are input into the seventh residual block and the eighth residual block connected in sequence; The eighth residual block outputs a prediction result, and updates the parameters of the text recognition model according to the prediction result; After the training is completed, the meter character defects are detected through the pre-trained text recognition model and the annotated surface image to obtain the meter character defects.
6. The method for detecting electric meter defects based on image recognition according to claim 5 is characterized in that The surface image D after superimposing noise is: Among them, D t is the surface image D with noise added after time step t, D is the original surface image D, E is the noise, β j is the ratio of adding noise at the jth time step.
7. The electric meter defect detection method based on image recognition according to claim 1, 2, 3, 4 or 6, characterized in that When detecting meter screen defects and other meter defects through a pre-trained neural network model and surface images, the neural network model uses the Faster RCNN network.
8. The electric meter defect detection method based on image recognition according to claim 1, 2, 3, 4 or 6, characterized in that If an electric meter detects both a character defect and a screen defect, the positions of the character defect and the screen defect are compared. If the overlap between a character defect and a screen defect is greater than a preset value, it is determined that the electric meter does not have the character defect, which specifically includes the following steps: For a surface image in which character defects and screen defects are detected simultaneously, obtaining character defect coordinates; Calculate the overlap between a character defect and each screen defect, and add them together: Among them, A is the total overlap, a i is the overlap between the character defect and the i-th screen defect; If A is greater than the preset value, it is determined that the meter does not have the character defect.
9. An electric meter defect detection system based on image recognition, comprising a memory and a processor, wherein the memory stores a program that can be run on the processor, characterized in that: When the processor executes the program, the electric meter defect detection method based on image recognition as described in any one of claims 1 to 8 is implemented.
10. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the electric meter defect detection method based on image recognition as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Visual inspection system suitable for power supply circuit board
CN113327237A
Vehicle nameplate inspection method and device, electronic equipment and storage medium
CN115147827A
Power distribution room switch cabinet nameplate character recognition method and device
CN116597436A
Ammeter nameplate image registration method
CN116823903A
Method for automatically detecting curved surface defect and device thereof
WO2018000731A1
Cited By
Breaker quality detection system and method based on big data analysis
CN121563876A
