Detection method and system of metering box
By using pre-trained basic models for transfer learning, combining metrological data, structural data and image data to train detection models, the problem of high requirements for training data in the existing technology is solved, and the detection effect and model generalization ability are improved.
Patent Information
- Application Number
- CN202411710870.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-18
AI Technical Summary
The existing metrology box defect detection system based on deep learning has high requirements for the quality and diversity of training data. If the training data is insufficient or not representative, it will lead to poor generalization capabilities of the model, resulting in poor detection results.
By obtaining the preset basic model, using the features learned by pre-training on large-scale data sets, reducing training time and data requirements, and training through transfer learning models combined with metrological data, structural data and image data, a trained metrological box detection model is obtained.
It improves detection effect, reduces training time and data requirements, enhances the generalization ability of the model, and is suitable for real-time monitoring and quality control in actual production environments.
Smart Images

Figure CN119648657A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power equipment detection, and in particular to a detection method and system for a meter box. Background Art
[0002] The meter box is a collection of metering instruments and auxiliary equipment necessary for measuring electric energy, including electric energy meters, voltage and current transformers and their secondary circuits, electric energy metering panels, cabinets, boxes, etc. With the popularization of electricity consumption, a large number of meter boxes have been installed in various electricity consumption areas.
[0003] The invention patent with application number 202310053078.9 discloses a meter box defect detection system and method based on deep learning, including an acquisition and transmission module, a data analysis module and a maintenance module; the acquisition and transmission module is used to collect meter box data, identify meter box information in the target area, collect data on the meter boxes in the target area, obtain meter box data, and send the collected meter box data to the data analysis module; the data analysis module is used to analyze meter box data, set analysis items, and establish a sub-item information table. The analysis item information table includes analysis items, weight coefficients of each analysis item, and data ranges corresponding to the analysis items. The received meter box data is split according to the set analysis item information table to obtain corresponding analysis item data, analyze the obtained analysis item data, obtain corresponding analysis item evaluation values, and perform meter box defect evaluation based on the obtained analysis item evaluation values.
[0004] However, the patent uses an analysis model based on a DNN network, which has high requirements on the quality and diversity of training data. If the training data is insufficient or unrepresentative, the model's generalization ability will be poor, resulting in poor detection results. Summary of the Invention
[0005] In order to overcome the shortcomings of the existing technology, the purpose of the present invention is to provide a detection method and system for meter boxes. By obtaining a preset basic model, the features learned by pre-training on a large-scale data set can be utilized to reduce training time and data requirements, thereby improving the detection effect.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A method for detecting a meter box, comprising:
[0008] Acquiring measurement data, structural data and image data of a sample metering box;
[0009] Annotating the image data according to the measurement data and the structural data to obtain an annotated data set; the annotated data set includes label information of defective areas of a sample measurement box;
[0010] Denoising, color enhancement and diversity enhancement are performed on the image data to obtain an enhanced image set; the diversity enhancement includes: image rotation, scaling and flipping;
[0011] Obtain a preset basic model, freeze a portion of the structure of the basic model, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model;
[0012] Inputting the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model;
[0013] The image data of the meter box to be tested is input into the meter box detection model to obtain the detection result.
[0014] Preferably, obtaining measurement data, structural data and image data of the sample meter box includes:
[0015] Using a metering and detection device to record the metering data of the sample metering box; the metering data includes: the reading of the electric energy meter and the output data of the secondary circuit;
[0016] Using a measuring device to measure the structural data of the sample meter box; the structural data includes: meter box size, material and internal component layout;
[0017] The image data of the sample meter box is photographed by using a photographing device; the image data includes: an internal image and an external image.
[0018] Preferably, the image data is annotated according to the metrological data and the structural data to obtain an annotated data set, including:
[0019] Determine the type of defect to be marked based on the metrological data and the structural data; the defect types include: cracks, deformation, poor display effect, and poor wiring;
[0020] Determine the preset marking specifications to clarify the marking method for each defect type;
[0021] Based on a preset annotation tool, the image data is loaded and annotated according to the annotation method to obtain the annotated data set.
[0022] Preferably, the step of denoising the image data comprises:
[0023] Obtaining a preset filtering window, and detecting the image data using the filtering window;
[0024] Constructing a noise point detection model according to the mean and median of each image point of the image data within the filtering window;
[0025] Detecting each image point within the filtering window using the noise point detection model to obtain a similar noise value for each image point;
[0026] The corresponding image points with a value greater than the similar noise value are regarded as noise points to be processed;
[0027] When the number of noise points to be processed in the filtering window is greater than a preset threshold, denoising the image data in the corresponding filtering window;
[0028] The filtering window is slid until the entire image data is traversed to obtain denoised image data.
[0029] Preferably, the noise point detection model is:
[0030]
[0031] Among them, f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, and u mean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x, represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Indicates the gradient value of pixel x in the horizontal direction, Indicates the gradient value of pixel x in the vertical direction.
[0032] Preferably, the color enhancement step includes:
[0033] Calculate the pixel mean of the denoised image data in the three RGB channels; the pixel mean calculation formula is: Where D represents the pixel mean, Represents the pixel mean of the denoised image data in the red channel, Represents the pixel mean of the denoised image data in the green channel, Represents the pixel mean of the denoised image data in the blue channel;
[0034] Calculating a balance coefficient for each color channel according to the pixel mean;
[0035] Performing color balance on the denoised image data using the balance coefficient to obtain a color-balanced image;
[0036] Converting the color-balanced image into an HSV image;
[0037] The HSV image is enhanced to obtain enhanced image data.
[0038] Preferably, the expression of the balance coefficient is:
[0039]
[0040] Among them, K R Indicates the balance coefficient of the red channel, K G Indicates the balance coefficient of the green channel, K B Represents the balance coefficient of the blue channel, R′ represents the pixel value of the red channel after balance, G′ represents the pixel value of the green channel after balance, B′ represents the pixel value of the blue channel after balance, R represents the pixel value of the denoised image data in the red channel, G represents the pixel value of the denoised image data in the green channel, and B represents the pixel value of the denoised image data in the blue channel.
[0041] Preferably, a preset basic model is obtained, a part of the structure of the basic model is frozen, the output layer structure of the basic model is customized, and the basic model is unfrozen to obtain a transfer learning model, including:
[0042] Determine the ResNet network as the basic model, and use a deep learning framework to load the basic model;
[0043] The embedding layer and some Transformer layers of the base model are used to retain the knowledge learned in the pre-training phase; the some Transformer layers are network layers used for feature extraction;
[0044] Replace the output layer of the base model according to preset requirements and use the replaced output layer as the new fully connected layer;
[0045] Selecting a predetermined unfrozen layer in the base model for unfreezing, so as to update parameters of the predetermined unfrozen layer during training;
[0046] During the forward propagation process of the base model, extracting the output of the predetermined unfrozen layer, so as to input the output of the predetermined unfrozen layer as a feature into the random forest model;
[0047] The base model and the random forest model are integrated into a complete end-to-end model to obtain the transfer learning model.
[0048] Preferably, the predetermined unfrozen layers are the last two residual blocks in the base model.
[0049] A detection system for a meter box, comprising:
[0050] A data acquisition module, used to acquire measurement data, structural data and image data of the sample metering box;
[0051] a labeling module, configured to label the image data according to the measurement data and the structural data to obtain a labeling data set; the labeling data set includes label information of defective areas of a sample measurement box;
[0052] An image processing module, configured to perform denoising, color enhancement, and diversification enhancement on the image data to obtain an enhanced image set; the diversification enhancement includes: image rotation, scaling, and flipping;
[0053] A transfer learning module is used to obtain a preset basic model, freeze a portion of the structure of the basic model, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model;
[0054] A training module, configured to input the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model;
[0055] The detection module is used to input the image data of the meter box to be tested into the meter box detection model to obtain the detection result.
[0056] The present invention discloses the following technical effects:
[0057] The present invention provides a method and system for detecting meter boxes, comprising: obtaining meter data, structural data, and image data of a sample meter box; annotating the image data based on the meter data and structural data to obtain an annotated dataset; the annotated dataset including label information of defective areas of the sample meter box; performing denoising, color enhancement, and diversity enhancement on the image data to obtain an enhanced image set; the diversity enhancement including image rotation, scaling, and flipping; obtaining a preset basic model, freezing a portion of the basic model's structure, customizing the output layer structure of the basic model, and unfreezing the basic model to obtain a transfer learning model; inputting the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model; and inputting image data of the meter box to be tested into the meter box detection model to obtain a detection result. By obtaining a preset basic model, the present invention can utilize the features learned through pre-training on a large-scale dataset, reducing training time and data requirements, thereby improving detection effectiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0059] Figure 1 A flow chart of a method provided by an embodiment of the present invention;
[0060] Figure 2 A schematic diagram of the system structure provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0062] The purpose of the present invention is to provide a method and system for detecting meter boxes. By obtaining a preset basic model, the features learned by pre-training on a large-scale data set can be utilized to reduce training time and data requirements, thereby improving the detection effect.
[0063] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0064] Figure 1 A flow chart of the method provided in the embodiment of the present invention is shown in FIG. Figure 1 As shown, the present invention provides a method for detecting a meter box, comprising:
[0065] Step 100: Acquire measurement data, structural data, and image data of a sample metering box;
[0066] Step 200: Annotate the image data according to the metrology data and the structural data to obtain an annotated data set; the annotated data set includes label information of defective areas of the sample metrology box;
[0067] Step 300: performing denoising, color enhancement, and diversity enhancement on the image data to obtain an enhanced image set; the diversity enhancement includes: image rotation, scaling, and flipping;
[0068] Step 400: Obtain a preset basic model, freeze a portion of the basic model structure, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model;
[0069] Step 500: Input the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model;
[0070] Step 600: input the image data of the meter box to be tested into the meter box detection model to obtain the detection result.
[0071] Preferably, step 100 of this embodiment includes:
[0072] Using a metering and detection device to record the metering data of the sample metering box; the metering data includes: the reading of the electric energy meter and the output data of the secondary circuit;
[0073] Using a measuring device to measure the structural data of the sample meter box; the structural data includes: meter box size, material and internal component layout;
[0074] The image data of the sample meter box is photographed by using a photographing device; the image data includes: an internal image and an external image.
[0075] Specifically, step 100 of this embodiment includes three processes:
[0076] 1. Recording of measurement data
[0077] First, this embodiment uses metering and testing equipment to measure a sample meter box to obtain its metering data. This process includes using an energy meter to record the meter readings to ensure the accuracy and reliability of the data. Furthermore, it is necessary to monitor the output data of the secondary circuit, which involves measuring current and voltage. This data provides a comprehensive understanding of the meter box's energy usage and performance indicators. To ensure data integrity, it is recommended to perform multiple measurements under different operating conditions, and record the time and environmental conditions of each measurement for subsequent analysis and comparison.
[0078] 2. Measurement of structural data
[0079] Next, this embodiment uses specialized measuring equipment to perform detailed measurements of the structural data of the sample meter box. This structural data includes information such as the meter box's dimensions, materials, and internal component layout. This embodiment uses tools such as laser rangefinders or calipers to accurately measure the meter box's external dimensions and internal space to ensure the proper layout of all components. In addition, the type and properties of the material (such as metal, plastic, etc.) are also recorded to account for the material's impact on performance in subsequent analysis. For the layout of internal components, this embodiment disassembles the meter box and photographs the location and connection method of each component to ensure data accuracy and completeness.
[0080] 3. Capturing image data
[0081] Finally, this embodiment uses a camera to capture image data of a sample meter box. This image data includes both internal and external images of the meter box for visual analysis and defect detection. External images can be captured using a high-resolution camera to ensure that surface details and potential defects, such as scratches and deformation, are captured. Internal images can be acquired using an endoscope or other suitable camera to observe the condition and layout of internal components. Good lighting conditions should be ensured during photography, and multiple images should be captured from different angles to facilitate subsequent image processing and analysis, ultimately forming a complete image dataset.
[0082] Preferably, step 200 of this embodiment includes:
[0083] Determine the type of defect to be marked based on the metrological data and the structural data; the defect types include: cracks, deformation, poor display effect, and poor wiring;
[0084] Determine the preset marking specifications to clarify the marking method for each defect type;
[0085] Based on a preset annotation tool, the image data is loaded and annotated according to the annotation method to obtain the annotated data set.
[0086] Specifically, the process of step 200 of this embodiment includes:
[0087] 1. Identify defect types. First, this embodiment analyzes and identifies the defect types to be labeled based on the acquired metering and structural data. These defect types include cracks, deformation, poor display quality, and poor wiring. By analyzing metering data, such as abnormal readings on the energy meter or unstable secondary circuit output data, possible defects can be inferred. Furthermore, the information provided by the structural data regarding meter box dimensions and component layout also helps identify potential defect areas. By combining these two types of data, a preliminary list of defect types is generated, laying the foundation for subsequent labeling.
[0088] 2. Determine the marking specifications
[0089] Next, this embodiment establishes preset annotation specifications to clarify how each defect type should be labeled. These specifications should describe in detail how to annotate different types of defects in an image, including the shape, color, size, and transparency of the annotation. For example, cracks can be marked with red lines, deformations can be framed with blue boxes, areas with poor display quality can be shaded, and areas with poor wiring can be highlighted in yellow. By establishing unified annotation specifications, consistency and accuracy of annotations can be ensured, facilitating subsequent data analysis and model training.
[0090] 3. Select the annotation tool
[0091] After clarifying the defect type and annotation specifications, this embodiment selects a suitable annotation tool to annotate the image data. There are a variety of image annotation tools available on the market, such as LabelImg, VGG Image Annotator (VIA) or custom-developed annotation software. These tools usually support loading image data and provide an intuitive interface for annotation. Annotators can use the drawing function in the tool (LabelImg is selected in this embodiment) to annotate the defects in the image according to the preset annotation specifications. Choosing the right tool can not only improve annotation efficiency, but also reduce human errors.
[0092] 4. Perform annotation and generate a dataset. Finally, the annotator loads and annotates the image data one by one according to the preset annotation method, ultimately generating an annotated dataset. During the annotation process, this embodiment recommends that the annotator perform regular quality checks to ensure the accuracy and consistency of the annotations. After the annotation is completed, all the annotation information is combined with the original image data to form a structured annotated dataset, typically saved in JSON or XML format. This dataset will contain the defect type, location coordinates, and annotation information for each image, providing important basic data for subsequent model training and defect detection.
[0093] Preferably, the step of denoising the image data comprises:
[0094] Obtaining a preset filtering window, and detecting the image data using the filtering window;
[0095] Constructing a noise point detection model according to the mean and median of each image point of the image data within the filtering window;
[0096] Detecting each image point within the filtering window using the noise point detection model to obtain a similar noise value for each image point;
[0097] The corresponding image points with a value greater than the similar noise value are regarded as noise points to be processed;
[0098] When the number of noise points to be processed in the filtering window is greater than a preset threshold, denoising the image data in the corresponding filtering window;
[0099] The filtering window is slid until the entire image data is traversed to obtain denoised image data.
[0100] Preferably, the noise point detection model is:
[0101]
[0102] Among them, f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, and umean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x, represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Indicates the gradient value of pixel x in the horizontal direction, Indicates the gradient value of pixel x in the vertical direction.
[0103] Preferably, the color enhancement step includes:
[0104] Calculate the pixel mean of the denoised image data in the three RGB channels; the pixel mean calculation formula is: Where D represents the pixel mean, Represents the pixel mean of the denoised image data in the red channel, Represents the pixel mean of the denoised image data in the green channel, Represents the pixel mean of the denoised image data in the blue channel;
[0105] Calculating a balance coefficient for each color channel according to the pixel mean;
[0106] Performing color balance on the denoised image data using the balance coefficient to obtain a color-balanced image;
[0107] Converting the color-balanced image into an HSV image;
[0108] The HSV image is enhanced to obtain enhanced image data.
[0109] Preferably, the expression of the balance coefficient is:
[0110]
[0111] Among them, K R Indicates the balance coefficient of the red channel, K G Indicates the balance coefficient of the green channel, K B Represents the balance coefficient of the blue channel, R′ represents the pixel value of the red channel after balance, G′ represents the pixel value of the green channel after balance, B′ represents the pixel value of the blue channel after balance, R represents the pixel value of the denoised image data in the red channel, G represents the pixel value of the denoised image data in the green channel, and B represents the pixel value of the denoised image data in the blue channel.
[0112] Specifically, this embodiment uses an image processing library (such as OpenCV or PIL) to perform a series of transformations on the original image. The specific implementation process is as follows:
[0113] First, this embodiment loads the original image and defines enhancement parameters, such as rotation angle, scaling, and flipping mode. For rotation, a random angle (e.g., between -30 and 30 degrees) is selected, and the image is rotated to the specified angle using a rotation matrix; for scaling, a random scaling factor (e.g., between 0.8 and 1.2) is selected, and scaling is achieved by adjusting the size of the image; for flipping, horizontal flipping or vertical flipping is selected, and the corresponding function is used for processing. Through these transformations, this embodiment generates multiple enhanced images and saves them to a specified directory. Ultimately, these enhanced images will be used together with the original images for model training to improve the generalization and robustness of the model.
[0114] Preferably, step 400 of this embodiment includes:
[0115] Determine the ResNet network as the basic model, and use a deep learning framework to load the basic model;
[0116] The embedding layer and some Transformer layers of the base model are used to retain the knowledge learned in the pre-training phase; the some Transformer layers are network layers used for feature extraction;
[0117] Replace the output layer of the base model according to preset requirements and use the replaced output layer as the new fully connected layer;
[0118] Selecting a predetermined unfrozen layer in the base model for unfreezing, so as to update parameters of the predetermined unfrozen layer during training;
[0119] During the forward propagation process of the base model, extracting the output of the predetermined unfrozen layer, so as to input the output of the predetermined unfrozen layer as a feature into the random forest model;
[0120] The base model and the random forest model are integrated into a complete end-to-end model to obtain the transfer learning model.
[0121] Optionally, in the ResNet model, although it is mainly a convolutional neural network (CNN), in some variants (such as ResNeXt or models combined with Transformer), Transformer layers are introduced. The "partial Transformer layer" in this embodiment refers to a specific layer used for feature extraction in the model. In a model using the Transformer architecture, the Transformer layer typically includes a self-attention mechanism and a feedforward neural network. The purpose of choosing to freeze these layers is to retain their feature representation capabilities learned in the pre-training phase. In the model of this embodiment that combines ResNet and Transformer, the self-attention layers of the first few layers can be frozen to retain their ability to understand the input features.
[0122] Furthermore, "replacing the output layer of the base model based on pre-defined requirements" refers to adjusting the output layer structure of the base model to accommodate new classification or regression tasks, based on the needs of specific tasks. The output layer is typically the last layer of the model, responsible for converting the model's feature maps into the final prediction results. The structure and activation function of the output layer will vary depending on the task. If a base model (such as ResNet) was originally designed for 1000-class image classification tasks, but is now needed for a 3-class defect detection task, the output layer needs to be replaced with a new fully connected layer with 3 output neurons and a Softmax activation function for multi-class classification.
[0123] Preferably, the predetermined unfrozen layers are the last two residual blocks in the base model.
[0124] Specifically, the "predetermined unfrozen layers" of this embodiment refer to specific layers selected in the base model. These layers will be unfrozen during the training process in order to update their parameters so that the model can better adapt to new tasks. The unfrozen layers are usually the last few layers of the model, which may require more adjustments in specific tasks in order to better learn the characteristics of new data. In ResNet, this embodiment chooses to unfreeze the last few residual blocks (Residual Blocks), which usually contain multiple convolutional layers and activation functions. By unfreezing these layers, the model can adjust the weights of these layers during training to better adapt to the new data distribution.
[0125] Optionally, the specific process of step 500 of this embodiment includes:
[0126] 1. First, this embodiment prepares a training dataset, including the enhanced images and corresponding label information. Using a deep learning framework (such as PyTorch or TensorFlow), the image data and label information are loaded into a data loader for batch processing during training. Typically, the data loader performs necessary preprocessing on the images, such as normalization and resizing, to ensure that the input data meets the model requirements. At the same time, training parameters are set, including the learning rate, batch size, and number of training rounds, for optimization during training.
[0127] 2. Next, enter the training loop. In each training round, the model receives a batch of enhanced images and corresponding label information, and performs forward propagation to calculate the prediction results. Then, a loss function (such as cross-entropy loss) is used to calculate the difference between the model output and the true label, and the model parameters are updated through the backpropagation algorithm. In order to improve the stability and convergence speed of training, optimizers (such as Adam or SGD) are usually used to adjust the learning rate and update weights. After each training cycle, the performance of the model can be evaluated on the validation set to monitor the accuracy and loss changes during the training process and ensure the model's generalization ability on unseen data. Finally, after multiple rounds of training, a trained meter box inspection model is obtained, which can be used for actual defect detection tasks.
[0128] Corresponding to the above method, this embodiment further provides a detection system for a meter box, including:
[0129] A data acquisition module, used to acquire measurement data, structural data and image data of the sample metering box;
[0130] a labeling module, configured to label the image data according to the measurement data and the structural data to obtain a labeling data set; the labeling data set includes label information of defective areas of a sample measurement box;
[0131] An image processing module, configured to perform denoising, color enhancement, and diversification enhancement on the image data to obtain an enhanced image set; the diversification enhancement includes: image rotation, scaling, and flipping;
[0132] A transfer learning module is used to obtain a preset basic model, freeze a portion of the structure of the basic model, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model;
[0133] A training module, configured to input the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model;
[0134] The detection module is used to input the image data of the meter box to be tested into the meter box detection model to obtain the detection result.
[0135] The beneficial effects of the present invention are as follows:
[0136] (1) By combining metrological data, structural data, and image data, the present method can comprehensively analyze the status of the metering box and ensure the accuracy of the detection results. The label information of the defect area contained in the annotated dataset enables the model to effectively learn specific defects, thereby improving the accuracy of detection.
[0137] (2) The present invention generates diverse training samples by performing denoising, color enhancement, and diversification enhancement (such as rotation, scaling, and flipping) on image data. This data enhancement technique helps the model adapt to different conditions, reduces overfitting, and thus improves the model's generalization ability in practical applications.
[0138] (3) This invention uses a transfer learning approach to effectively leverage existing knowledge and features by acquiring a pre-set base model and performing a customized design. This approach not only reduces training time and data requirements but also achieves higher performance on smaller datasets, adapting to specific meter box inspection tasks.
[0139] (4) The design of the present invention allows for adjustments based on different meter box types and defect characteristics, with good flexibility and scalability. As new data continues to accumulate, the model can be retrained and updated to maintain its accuracy and effectiveness.
[0140] (5) By inputting the image data of the meter box to be tested into a trained detection model, the present invention can quickly obtain detection results, which is suitable for real-time monitoring and quality control in actual production environments. This rapid feedback mechanism helps to promptly identify and address potential problems, thereby improving production efficiency.
[0141] (6) The present invention can not only be used for defect detection, but also provide data support for the quality control of metering boxes, helping enterprises to optimize production processes and improve product quality, and reduce maintenance costs.
[0142] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0143] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. At the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concept of the present invention. In summary, the contents of this specification should not be construed as limiting the present invention.
Claims
1. A method for detecting a metering box, characterized in that: include: Obtaining measurement data, structural data and image data of the sample measurement box; Annotating the image data according to the measurement data and the structural data to obtain an annotated data set; The annotated data set includes label information of defective areas of sample meter boxes; Performing denoising, color enhancement and diversity enhancement on the image data to obtain an enhanced image set; The diversified enhancement includes: rotation, scaling and flipping of images; Obtain a preset basic model, freeze a part of the structure of the basic model, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model; Inputting the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model; The image data of the meter box to be tested is input into the meter box detection model to obtain the detection result.
2. The detection method of the metering box according to claim 1, characterized in that: Obtain the measurement data, structural data and image data of the sample meter box, including: The metering data of the sample metering box is recorded by using a metering detection device; the metering data includes: the reading of the electric energy meter and the output data of the secondary circuit; Using a measuring device to measure the structural data of the sample meter box; the structural data includes: meter box size, material and internal component layout; The image data of the sample meter box is photographed by using a photographing device; the image data includes: an internal image and an external image.
3. The detection method of the metering box according to claim 1, characterized in that: The image data is annotated according to the measurement data and the structural data to obtain an annotated data set, including: Determine the defect type to be marked according to the measurement data and the structural data; the defect type includes: crack, deformation, poor display effect and poor wiring; Determine the preset annotation specifications to clarify the annotation method for each defect type; Based on a preset annotation tool, the image data is loaded and annotated according to the annotation method to obtain the annotated data set.
4. The detection method of the metering box according to claim 1, characterized in that: The step of denoising the image data comprises: Acquire a preset filter window, and use the filter window to detect the image data; Constructing a noise point detection model according to the mean and median of each image point of the image data in the filtering window; Detecting each image point in the filtering window using the noise point detection model to obtain a similar noise value for each image point; The corresponding image points that are larger than the similar noise value are regarded as the noise points to be processed; When the number of noise points to be processed in the filtering window is greater than a preset threshold, denoising the image data in the corresponding filtering window; The filter window is slid until the entire image data is traversed to obtain denoised image data.
5. The detection method of the metering box according to claim 4, characterized in that: The noise point detection model is: Among them, f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, and u mean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x. represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Represents the gradient value of pixel x in the horizontal direction, Indicates the gradient value of pixel x in the vertical direction.
6. The detection method of the metering box according to claim 4, characterized in that: The color enhancement step comprises: Calculate the pixel mean of the denoised image data in the three RGB channels; wherein the pixel mean calculation formula is: Where D represents the pixel mean, Represents the pixel mean of the denoised image data in the red channel, represents the pixel mean value of the denoised image data in the green channel, and B represents the pixel mean value of the denoised image data in the blue channel; Calculating a balance coefficient for each color channel according to the pixel mean; Performing color difference balance on the denoised image data using the balance coefficient to obtain a color difference balanced image; Converting the color-balanced image into an HSV image; The HSV image is enhanced to obtain enhanced image data.
7. The detection method of the metering box according to claim 6, characterized in that: The expression of the balance coefficient is: Among them, K R Indicates the balance coefficient of the red channel, K G Indicates the balance coefficient of the green channel, K B represents the balance coefficient of the blue channel, R′ represents the pixel value of the red channel after balance, G′ represents the pixel value of the green channel after balance, B′ represents the pixel value of the blue channel after balance, R represents the pixel value of the denoised image data in the red channel, G represents the pixel value of the denoised image data in the green channel, and B represents the pixel value of the denoised image data in the blue channel.
8. The method for detecting a metering box according to claim 1, characterized in that: Obtaining a preset basic model, freezing a part of the structure of the basic model, customizing the output layer structure of the basic model, and unfreezing the basic model to obtain a transfer learning model, including: Determine the ResNet network as the basic model, and use a deep learning framework to load the basic model; The embedding layer and some Transformer layers of the base model are used to retain the knowledge learned in the pre-training stage; the some Transformer layers are network layers used for feature extraction; Replace the output layer of the basic model according to the preset requirements, and use the replaced output layer as the new fully connected layer; Selecting a predetermined unfrozen layer in the base model for unfreezing, so as to update parameters of the predetermined unfrozen layer during training; In the forward propagation process of the base model, extracting the output of the predetermined unfrozen layer, so as to input the output of the predetermined unfrozen layer into the random forest model as a feature; The base model and the random forest model are integrated into a complete end-to-end model to obtain the transfer learning model.
9. The method for detecting a metering box according to claim 8, characterized in that: The predetermined unfrozen layers are the last two residual blocks in the base model.
10. A detection system for a metering box, characterized in that: include: A data acquisition module, used to acquire measurement data, structural data and image data of the sample measurement box; A labeling module, used for labeling the image data according to the measurement data and the structural data to obtain a labeling data set; The annotated data set includes label information of defective areas of sample meter boxes; An image processing module, used for performing denoising, color enhancement and diversity enhancement on the image data to obtain an enhanced image set; The diversified enhancement includes: rotation, scaling and flipping of images; A transfer learning module is used to obtain a preset basic model, freeze a part of the structure of the basic model, customize the output layer structure of the basic model, and unfreeze the basic model to obtain a transfer learning model; A training module, used for inputting the label information and the enhanced image set into the transfer learning model for training to obtain a trained meter box detection model; The detection module is used to input the image data of the meter box to be tested into the meter box detection model to obtain the detection result.
Citation Information
Patent Citations
Metering box defect detection system and method based on deep learning
CN116184074A
Profile defect visual inspection method based on image processing
CN117152119A
Electric energy meter assembling quality intelligent monitoring method based on image recognition algorithm
CN117635905A
Open world target detection method based on visual large model enhancement
CN118097289A
Electric power artificial intelligence visual analysis method based on lightweight network
CN118154543A
Cited By
Metering box defect self-adaptive detection method and equipment based on multi-view vision and medium
CN120672694A