Power equipment quantity calculation method and system based on target detection
By using an improved YOLOv12 target detection model and multi-scene image acquisition technology, combined with high-definition industrial cameras and mobile inspection equipment, the automated management system for power equipment was solved, the problem of power equipment quantity statistics was solved, and the automated identification and quantity management of power equipment was realized. This solved the problem of efficient, accurate, and stable identification and quantity statistics of equipment in existing technologies, and realized the automated management of power equipment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, the counting of electrical equipment relies on manual inventory, which is inefficient, prone to omissions and errors, and poses safety hazards in complex environments. RFID electronic tag solutions are easily damaged, and image comparison-based solutions have insufficient recognition accuracy under changing light conditions and occlusion.
An improved YOLOv12 target detection model is used to calculate the number of power equipment. High-definition industrial cameras and mobile inspection equipment are combined to acquire and preprocess images in multiple scenes. The CBAM attention mechanism and multi-scale anchor boxes are introduced. Adaptive anchor boxes are generated by K-means++ clustering for equipment identification and quantity statistics. A distributed database is established to support efficient retrieval and model optimization.
It has achieved automated counting of the number of power equipment, improved operational efficiency, adapted to complex scenarios, reduced the need for manual intervention, has continuous optimization capabilities, improved recognition accuracy and generalization ability, and met dynamic management needs.
Smart Images

Figure CN121811099A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power equipment management technology, specifically relating to a method and system for calculating the number of power equipment based on target detection. Background Technology
[0002] Currently, the power industry relies primarily on manual on-site verification of nameplate information and manual summarization for the quantity statistics of core equipment such as transformers and switchgear. This method is inefficient, time-consuming, and ill-suited to dynamic management needs. Due to the wide distribution of equipment and complex environments, manual inventory checks are susceptible to fatigue, visual errors, and equipment obstructions, leading to frequent omissions and errors, resulting in significant discrepancies between the ledger data and the actual quantity. Furthermore, conducting manual inventory checks in high-voltage and high-risk environments poses safety hazards.
[0003] In existing technologies, some companies have attempted to use RFID electronic tag solutions for equipment management. However, this solution requires dedicated hardware to be installed on each device, and the tags are susceptible to physical damage or signal interference, making large-scale application difficult. Other solutions based on simple image comparison can only identify devices in ideal scenarios with fixed angles and no obstructions. They cannot adapt to complex conditions in actual warehouses or substations, such as changes in lighting, diverse angles, and partial obstructions, resulting in insufficient recognition accuracy and generalization ability. Summary of the Invention
[0004] To address the aforementioned shortcomings of existing technologies, this invention provides a method, system, terminal, and storage medium for calculating the number of power devices based on target detection.
[0005] In a first aspect, the present invention provides a method for calculating the number of power equipment based on target detection, comprising: S1. Collect image data of power equipment in multiple scenarios and preprocess the power equipment images, including noise reduction, illumination correction and size normalization. S2. Input the preprocessed power equipment images into the pre-trained improved YOLOv12 object detection model to batch identify and output the location, category information and confidence information of each power equipment in the power equipment images; wherein, the improved YOLOv12 object detection model includes introducing the CBAM attention mechanism module into the general YOLOv12 object detection model and performing multi-scale anchor box adjustment; S3. Based on the model recognition results, count the number of various types of power equipment in the image, generate the quantity statistics, and compare them with the preset ledger. If the difference exceeds the preset threshold, trigger the early warning mechanism to prompt for review. S4. Synchronize the statistical results, power equipment images, and operation logs to the management platform, update the ledger data, and mark low-confidence power equipment images whose confidence level is lower than the preset confidence threshold as samples to be reviewed, in order to support further optimization of the model.
[0006] Further improvements to this technical solution include step S1, which includes: S11. Collect images of power equipment in multiple scenarios by combining fixed-deployment high-definition industrial cameras with mobile inspection equipment. The fixed industrial cameras take pictures of indoor equipment in substations in a timed trigger manner. The mobile inspection equipment includes inspection robots or drones equipped with cameras, which are used to take pictures of equipment in warehouse stacking and complex outdoor angle scenarios. S12. Perform Gaussian filtering noise reduction on the acquired raw image; S13. Perform illumination correction and size normalization on the denoised image in sequence.
[0007] Further improvements to this technical solution include constructing a standardized visual sample library for power equipment before training the improved YOLOv12 object detection model. The specific methods for this include: S211. Classify and archive the preprocessed power equipment images according to equipment type, shooting angle, and ambient lighting conditions, and assign a unique identifier to each image. Establish an image metadata index table; S212. A two-person collaborative annotation mechanism is used to annotate the bounding boxes and attributes of the power equipment in the image. The occlusion information is quantitatively represented by calculating the area ratio of the occluded region and recording the equipment model parameters. S213. Store the annotation results in a structured format in a distributed database, and establish a mapping relationship between image identifiers and annotation records, supporting efficient retrieval based on occlusion ratio, device type, or multi-view combination conditions; among which, the first... The proportion of each power device's obstruction Defined as: ; in, For the first The pixel area of the visible portion of an electrical device in the image; For the first The estimated projected area of each electrical device is derived from the average bounding box area of unobstructed devices. Approximately obtained: ; in, This indicates that the visual sample library of power equipment belongs to the equipment category. And the occlusion ratio The set of unobstructed samples; For the visual sample library of power equipment belonging to the equipment category The number of samples, i.e. ; and The first The width and height of each sample bounding box.
[0008] Further improvements to this technical solution include the following method in step S2 for batch identification of power equipment using an improved YOLOv12 target detection model: S221. Embed a CBAM attention mechanism module at the output of the backbone network of the general YOLOv12 model to calculate channel attention weights and spatial attention weights respectively, so as to enhance the feature response to key areas of occluded or low-contrast power equipment; wherein, the CBAM attention mechanism module focuses on the input feature map Channel attention weights The calculation formula is: ; in, and These are the average and max pooling results along the spatial dimension, respectively; It is a multilayer perceptron with one hidden layer; It is the Sigmoid activation function. Image size, Number of channels; Spatial attention weights Generation based on channel-compressed feature maps: ; in, and For average and max pooling along the channel dimension; Indicates channel splicing; for Convolutional layers; and feature maps modulated by CBAM for: ; in, This represents element-wise multiplication; S222. Based on the distribution of real bounding box sizes in the visual sample library of power equipment, the K-means++ clustering algorithm is used to regenerate a multi-scale anchor box set that adapts to different power equipment scales and replace the default anchor boxes of the original model. S223. Input the preprocessed image collected on site into the YOLOv12 target detection model that has been improved and trained as described above, and output a detection result set including device category, bounding box coordinates and confidence score.
[0009] Further improvements to this technical solution include the following method in step S222: using the K-means++ clustering algorithm to regenerate a multi-scale anchor frame set adapted to different power equipment scales. Let the set be composed of all the width-to-height pairs of real bounding boxes in the visual sample library of power equipment. Multi-scale anchor boxes are obtained by clustering by minimizing the objective function: ; in, This represents the total number of anchor frames; For the first Clusters; Distance Metrics Use 1 minus the intersection-union ratio : ; in, For the first The cluster centers, i.e., the optimized anchor frame size. , For the first The width of the frame of each power device For the first The height of the frame of each power device; For the first The width of the frame of each power device For the first The height of the electrical equipment frame; the anchor frame set is configured to the YOLOv12 detection head.
[0010] Further improvements to this technical solution include the following method in step S3 for comparing quantity statistics with the ledger based on the identification results: S31. For each frame of image detection results output by the improved YOLOv12 target detection model, group them according to the category of power equipment, and filter out detection boxes with confidence scores lower than the preset confidence threshold to obtain the effective set of equipment. S32. Perform spatiotemporal fusion on the detection results of the same type of power equipment in multiple consecutive frames of images, and use a weighted voting strategy to generate the final statistical number of the power equipment of that type. S33. Calculate the relative error between the final statistical quantity and the standard quantity of the corresponding power equipment category in the preset ledger. If the absolute value of the error exceeds the preset difference threshold, trigger a difference warning and generate a review task.
[0011] Further improvements to this technical solution include the following method in step S4: synchronizing the statistical results and image data to the management platform and marking them as samples to be reviewed. S41. After encrypting the equipment quantity statistics, original power equipment images, and operation logs containing model version, confidence distribution, and operation time, upload them to the management platform via the transmission protocol and trigger incremental update transactions of ledger data. S42. Based on the confidence score of each device detection box output by the improved YOLOv12 target detection model, images with confidence scores lower than the preset confidence threshold are selected as low-confidence samples and marked as samples to be reviewed, and their sample value scores are calculated. S43. Automatically inject high-value, low-confidence samples with a value score higher than the preset value score into the power equipment visual sample library and trigger the incremental adjustment process.
[0012] Secondly, the present invention provides a power equipment quantity calculation system based on target detection, comprising: The equipment image acquisition module is used to acquire image data of power equipment in multiple scenarios and to preprocess the power equipment images, including noise reduction, illumination correction and size normalization. The batch recognition module is used to input the pre-processed power equipment images into the pre-trained improved YOLOv12 object detection model, and batch recognize and output the location, category information and confidence information of each power equipment in the power equipment images; the improved YOLOv12 object detection model includes the introduction of the CBAM attention mechanism module into the general YOLOv12 object detection model and the adjustment of anchor boxes at multiple scales. The equipment statistics module is used to count the number of various types of power equipment in the image based on the model recognition results, generate the quantity statistics results, and compare them with the preset ledger. If the difference exceeds the preset threshold, an early warning mechanism is triggered to prompt a review. The model optimization module is used to synchronize statistical results, power equipment images, and operation logs to the management platform, update ledger data, and mark low-confidence power equipment images whose confidence level is lower than the preset confidence threshold as samples to be composited, so as to support further optimization of the model.
[0013] Thirdly, the present invention provides a terminal, comprising: Processor, memory, among which, This memory is used to store computer programs. The processor is used to retrieve and run the computer program from memory, causing the terminal to perform the terminal method described above.
[0014] Fourthly, the present invention provides a computer storage medium storing instructions that, when executed on a computer, cause the computer to perform the methods described in the above aspects.
[0015] The beneficial effects of this invention are as follows: This invention achieves automated statistical analysis of power equipment quantity through "multi-scene image acquisition + intelligent algorithm recognition," significantly improving operational efficiency. On one hand, the combination of fixed industrial cameras for timed shooting and mobile data collection by inspection robots and drones can cover all scenarios, including indoor substations, warehouse stacks, and complex outdoor angles, eliminating the need for manual on-site visits and shortening the inventory cycle from several days to several hours, thus meeting the real-time requirements of dynamic equipment management. On the other hand, the improved YOLOv12 model enhances the extraction of key equipment features through the CBAM attention module, adapts multi-scale anchor frames to equipment of different sizes, and, combined with Gaussian filtering for noise reduction and illumination correction, effectively overcomes interference from equipment occlusion and changes in lighting.
[0016] In terms of scene adaptability, this invention breaks through the limitation of simple image comparison that can only identify fixed-angle, unobstructed devices. Through K-means++ clustering to generate anchor frames adapted to power equipment and spatiotemporal fusion statistics, it can stably cope with actual working conditions such as changes in light intensity, multi-angle placement of equipment, and partial occlusion. Its generalization ability covers most application scenarios in the power industry, eliminating the need to develop separate adaptation solutions for different scenarios and greatly improving the practicality of the technology.
[0017] This invention designs an iterative mechanism of "low-confidence sample feedback - incremental model training" to form a continuous optimization closed loop: by screening images with confidence levels below a threshold, calculating sample value scores, and then injecting high-value samples into a visual sample library, the model is fine-tuned monthly based on newly added samples. This allows the model to continuously learn new scene and device features with use, resulting in continuous improvement in recognition accuracy and statistical accuracy over long-term use, avoiding performance degradation due to device updates and scene changes. Simultaneously, a distributed database stores labeled data and image metadata, supporting efficient retrieval by multiple dimensions such as occlusion ratio and device category, providing high-quality data support for model training and subsequent functional expansion, and exhibiting good technical scalability. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic flowchart illustrating a method according to an embodiment of the present invention.
[0020] Figure 2 This is a schematic block diagram of a system according to an embodiment of the present invention.
[0021] Figure 3 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the specific embodiments. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0024] Figure 1 This is a schematic flowchart illustrating a method for calculating the number of power devices based on target detection, provided by the present invention. Figure 1 The executing entity can be a power equipment quantity calculation system based on target detection. Depending on different requirements, the order of steps in this flowchart can be changed, and some can be omitted.
[0025] like Figure 1 As shown, the method includes: S1. Collect image data of power equipment in multiple scenarios and preprocess the power equipment images, including noise reduction, illumination correction and size normalization. S2. Input the preprocessed power equipment images into the pre-trained improved YOLOv12 object detection model to batch identify and output the location, category information and confidence information of each power equipment in the power equipment images; wherein, the improved YOLOv12 object detection model includes introducing the CBAM attention mechanism module into the general YOLOv12 object detection model and performing multi-scale anchor box adjustment; S3. Based on the model recognition results, count the number of various types of power equipment in the image, generate the quantity statistics, and compare them with the preset ledger. If the difference exceeds the preset threshold, trigger the early warning mechanism to prompt for review. S4. Synchronize the statistical results, power equipment images, and operation logs to the management platform, update the ledger data, and mark low-confidence power equipment images whose confidence level is lower than the preset confidence threshold as samples to be reviewed, in order to support further optimization of the model.
[0026] To facilitate understanding of the present invention, the following description further illustrates the method for calculating the number of power equipment based on target detection, using the principle of the present invention and the process of batch calculation of the number of power equipment based on target detection in the embodiments.
[0027] First, step S1 includes: S11. Collect images of power equipment in multiple scenarios by combining fixed-deployment high-definition industrial cameras with mobile inspection equipment. The fixed industrial cameras take pictures of indoor equipment in substations in a timed trigger manner. The mobile inspection equipment includes inspection robots or drones equipped with cameras, which are used to take pictures of equipment in warehouse stacking and complex outdoor angle scenarios. S12. Perform Gaussian filtering noise reduction on the acquired raw image; S13. Perform illumination correction and size normalization on the denoised image in sequence.
[0028] Specifically, the output image of Gaussian filtering Represented as: ; in, Original image of the power equipment; and The integral variable is used to represent the original image. Local neighborhood coordinates on; These are pixel coordinates; Let Gaussian kernel function be defined as: ; Among them, standard deviation Dynamically determined by the mean of local image gradient magnitude: ; in, , These are the lower and upper limits of the Gaussian kernel standard deviation, respectively. , ; The attenuation coefficient is... ; It is the average gradient magnitude within a 5×5 neighborhood centered on the current pixel, used to characterize the complexity of the device surface texture.
[0029] Based on the improved single-scale Retinex theory, illumination correction is performed on the denoised image to compensate for brightness imbalances caused by strong light reflection or low-light environments. Image after illumination correction Calculate using the following formula: ; in, To estimate the illumination components, ambient illuminance is simulated using Gaussian blur: ; in, This represents the convolution operation; For large-scale Gaussian kernel standard deviation, ; For the reflection component weighting coefficient, Finally, size normalization is achieved by center padding while maintaining the aspect ratio. Let the original image size be... The target size is scaling factor Normalized image Fill the area outside the effective region with a grayscale value of 128 to ensure consistency of subsequent target detection model inputs.
[0030] Fixed HD industrial camera deployment: Install a high-definition industrial camera (Hikvision MV-CA020-10GM model) with at least 2 megapixels (3-5 meters directly in front of indoor equipment in the substation, such as 10kV switchgear or low-voltage distribution boxes) at a fixed position. Set the camera resolution to 1920×1080 pixels, the frame rate to 15 frames per second, and the exposure time to be dynamically adjusted according to the indoor light intensity (range 50-200μs) to avoid excessive glare on the equipment surface. Utilize the camera's built-in timer function to automatically capture 5 frames every 30 minutes to ensure the capture of visual features under stable conditions.
[0031] Mobile inspection equipment configuration: The inspection robot is a DJI RoboMaster S1, equipped with a 1 / 2.3-inch CMOS camera (4000×3000 pixels resolution) and a 360° rotating gimbal. When the inspection path is preset, it stops and takes a picture every 1 meter along the direction of the equipment arrangement, and collects images from three angles: the front, left side and right side of the equipment. The drone is a DJI Mavic 3, equipped with a Hasselblad L2D-20c camera. For stacked equipment in outdoor substations and power warehouses, it takes one frame of image from a height of 10 meters (top view), 5 meters (45° tilt angle) and 3 meters (bottom view), covering key identification areas such as the nameplate on the top of the equipment and the side operation panel.
[0032] Image storage and transmission: Fixed industrial cameras transmit images to a local edge server (using Huawei FusionServer Pro 2288H V5) in real time via Ethernet. After the mobile inspection equipment completes its shooting, it uploads the images to the edge server via 4G / 5G network. All images are named according to "device location-acquisition time-device category" (e.g., "substation A-202405201030-10kV switchgear-001.jpg") to avoid data confusion.
[0033] Scene Coverage List: The collection scenes are clearly defined as including four core scenes: indoor substations (normal lighting, direct fluorescent light), outdoor substations (strong light on sunny days, weak light on cloudy days, rainy days), power warehouses (equipment stacking, shelves obstructing), and temporary construction areas (equipment placed in the open, obstructed by debris). No fewer than 500 images will be collected for each scene to ensure sample diversity.
[0034] Anomaly Handling Mechanism: If the fixed industrial camera captures blurry images three times in a row (determined by an image sharpness algorithm, with a sharpness value below 0.3), the device will automatically trigger a self-check (checking lens cleanliness and focus status) and send an SMS alert to the administrator. When the mobile inspection device is shooting, if it detects that the equipment area is completely obstructed (obstruction area ≥ 80%), it will automatically adjust the shooting angle or position and reshoot. If it still cannot effectively capture images after five consecutive adjustments, it will be marked as "awaiting manual reshoot" and the location information will be recorded.
[0035] Secondly, before training the improved YOLOv12 object detection model, a standardized visual sample library for power equipment is constructed. The specific methods include: S211. Classify and archive the preprocessed power equipment images according to equipment type, shooting angle, and ambient lighting conditions, and assign a unique identifier to each image. Establish an image metadata index table; S212. A two-person collaborative annotation mechanism is used to annotate the bounding boxes and attributes of the power equipment in the image. The occlusion information is quantitatively represented by calculating the area ratio of the occluded region and recording the equipment model parameters. S213. Store the annotation results in a structured format in a distributed database, and establish a mapping relationship between image identifiers and annotation records, supporting efficient retrieval based on occlusion ratio, device type, or multi-view combination conditions; among which, the first... The proportion of each power device's obstruction Defined as: ; in, For the first The pixel area of the visible portion of an electrical device in the image; For the first The estimated projected area of each electrical device is derived from the average bounding box area of unobstructed devices. Approximately obtained: ; in, This indicates that the visual sample library of power equipment belongs to the equipment category. And the occlusion ratio The set of unobstructed samples; For the visual sample library of power equipment belonging to the equipment category The number of samples, i.e. ; and The first The width and height of each sample bounding box.
[0036] Furthermore, to ensure consistency in annotation, an annotation quality score is defined. For each image Conduct an assessment: ; in, The mean intersection-union ratio (CIU) of the bounding boxes of the same device by two annotators; The number of inconsistencies between the two individuals in their labeling of equipment model parameters; , These are weighting coefficients; only Only then can the image annotation results be stored in the database.
[0037] Ultimately, each labeled record in the distributed database The structure is represented as: ; in, For equipment category labels; Center coordinates; The total number of devices in image i; For equipment model parameters; Includes shooting angle, lighting level, and scene type, which are used for sample weighting or grouping during subsequent model training.
[0038] Next, the method for batch identification of power equipment using the improved YOLOv12 target detection model in step S2 includes: S221. Embed a CBAM attention mechanism module at the output of the backbone network of the general YOLOv12 model to calculate channel attention weights and spatial attention weights respectively, so as to enhance the feature response to key areas of occluded or low-contrast power equipment; wherein, the CBAM attention mechanism module focuses on the input feature map Channel attention weights The calculation formula is: ; in, and These are the average and max pooling results along the spatial dimension, respectively; It is a multilayer perceptron with one hidden layer; It is the Sigmoid activation function. Image size, Number of channels; Spatial attention weights Generation based on channel-compressed feature maps: ; in, and For average and max pooling along the channel dimension; Indicates channel splicing; for Convolutional layers; and feature maps modulated by CBAM for: ; in, This represents element-wise multiplication; S222. Based on the distribution of real bounding box sizes in the visual sample library of power equipment, the K-means++ clustering algorithm is used to regenerate a multi-scale anchor box set that adapts to different power equipment scales and replace the default anchor boxes of the original model. S223. Input the preprocessed image collected on site into the YOLOv12 target detection model that has been improved and trained as described above, and output a detection result set including device category, bounding box coordinates and confidence score.
[0039] Furthermore, the method for regenerating a multi-scale anchor frame set adapted to different power equipment scales using the K-means++ clustering algorithm in step S222 includes: Let the set be composed of all the width-to-height pairs of real bounding boxes in the visual sample library of power equipment. Multi-scale anchor boxes are obtained by clustering by minimizing the objective function: ; in, This represents the total number of anchor frames; For the first Clusters; Distance Metrics Use 1 minus the intersection-union ratio : ; in, For the first The cluster centers, i.e., the optimized anchor frame size. , For the first The width of the frame of each power device For the first The height of the frame of each power device; For the first The width of the frame of each power device For the first The height of the frame of the electrical equipment; the anchor frame set is configured to the detection head of YOLOv12, which significantly improves the positioning accuracy of cross-scale equipment such as small distribution boxes and large transformers.
[0040] In addition, the method for comparing the quantity statistics and ledger based on the identification results in step S3 includes: S31. For each frame of image detection results output by the improved YOLOv12 target detection model, group them according to the category of power equipment, and filter out detection boxes with confidence scores lower than the preset confidence threshold to obtain the effective set of equipment. S32. Perform spatiotemporal fusion on the detection results of the same type of power equipment in multiple consecutive frames of images, and use a weighted voting strategy to generate the final statistical number of the power equipment of this type in order to suppress instantaneous false detections or missed detections. S33. Calculate the relative error between the final statistical quantity and the standard quantity of the corresponding power equipment category in the preset ledger. If the absolute value of the error exceeds the preset difference threshold, trigger a difference warning and generate a review task.
[0041] Let the number of effective detections of category c in frame t be . Its confidence level is as follows: Then the voting weight of that frame Defined as: ; in, To pre-set the reliability threshold; The confidence level weighting coefficient; This is the time decay coefficient; It is the center frame number of a continuous frame sequence, used to give intermediate frames higher credibility.
[0042] Subsequently, the final statistical count of category c Determined by weighted mode: ; in, The total number of consecutive image frames. ; This is an indicator function.
[0043] Furthermore, let the standard quantity of category c in the ledger be... Define the relative difference rate for: ; If satisfied ,in, If a preset difference threshold is set, the system will automatically generate a review work order that includes the device category, image sequence, and confidence level distribution, and push it to the mobile terminal.
[0044] Finally, the method for synchronizing the statistical results and image data to the management platform and marking them as samples to be reviewed in step S4 includes: S41. After encrypting the equipment quantity statistics, original power equipment images, and operation logs containing model version, confidence distribution, and operation time, upload them to the management platform via the transmission protocol and trigger incremental update transactions of ledger data. S42. Based on the confidence score of each device detection box output by the improved YOLOv12 target detection model, images with confidence scores lower than the preset confidence threshold are selected as low-confidence samples and marked as samples to be reviewed, and their sample value scores are calculated. S43. Automatically inject high-value, low-confidence samples with a value score higher than the preset value score into the power equipment visual sample library and trigger the incremental adjustment process.
[0045] Among them, the sample value score of image i Defined as: ; in, The total number of devices detected in image i; Let j be the confidence level of the j-th device; The confidence level weighting coefficient; The scene novelty index is determined by the average cosine distance between image features and existing samples in the sample library: ; in, is the 512-dimensional global feature vector output by the pre-trained ResNet-18 feature extractor, and is the value threshold; Randomly sampled from the sample library A set of image indexes; This represents the cosine similarity.
[0046] Furthermore, only when ( When the value threshold is reached, image i is labeled as a high-value sample and added to the sample library; in subsequent incremental fine-tuning, the model parameters are updated by minimizing the following contrastive learning loss: ; in, To compare the learning loss, the feature distance between the corrected sample and the query sample is narrowed, while the distance from irrelevant samples is increased; Batch size; To define the features of the query sample (i.e., the low-confidence sample); The features of its corresponding positive samples (labeled after manual correction); Features of negative samples; This represents the normalized dot product similarity. This is the temperature coefficient.
[0047] In some embodiments, the target detection-based power equipment quantity calculation system 200 may include multiple functional modules composed of computer program segments. The computer programs for each program segment in the target detection-based power equipment quantity calculation system 200 may be stored in the memory of a computer device and executed by at least one processor to perform (see details). Figure 1 (Description) Function for calculating the number of power devices based on target detection.
[0048] In this embodiment, the target detection-based power equipment quantity calculation system 200 can be divided into multiple functional modules according to its functions, such as... Figure 2 As shown. The functional modules may include: a device image acquisition module 210, a batch recognition module 220, a device statistics module 230, and a model optimization module 240. The module referred to in this invention is a series of computer program segments that can be executed by at least one processor and perform a fixed function, and are stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
[0049] Specifically, the equipment image acquisition module 210 is used to acquire power equipment image data in multiple scenarios and preprocess the power equipment images, including noise reduction, illumination correction, and size normalization; the batch recognition module 220 is used to input the preprocessed power equipment images into a pre-trained improved YOLOv12 object detection model, batch recognize and output the location, category information, and confidence information of each power equipment in the power equipment images; wherein, the improved YOLOv12 object detection model includes introducing a CBAM attention mechanism module into the general YOLOv12 object detection model and performing multi-scale anchor box adjustment; the equipment statistics module 230 is used to count the number of various types of power equipment in the images based on the model recognition results, generate the quantity statistics results, and compare them with the preset ledger. If the difference exceeds the preset threshold, an early warning mechanism is triggered to prompt for review; the model optimization module 240 is used to synchronize the statistical results, power equipment images, and operation logs to the management platform, update the ledger data, and mark low-confidence power equipment images with model recognition confidence below the preset confidence threshold as samples to be composited to support further model optimization.
[0050] Figure 3 This is a schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention. The terminal 300 can be used to execute the power equipment quantity calculation method based on target detection provided in an embodiment of the present invention.
[0051] The terminal 300 may include a processor 310, a memory 320, and a communication module 330. These components communicate via one or more buses. Those skilled in the art will understand that the server structure shown in the figure does not constitute a limitation of the present invention. It may be a bus topology or a star topology, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0052] The memory 320 can be used to store the execution instructions of the processor 310. The memory 320 can be implemented by any type of volatile or non-volatile memory terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the terminal 300 is able to perform some or all of the steps in the above method embodiments.
[0053] The processor 310 serves as the control center of the storage terminal, connecting various parts of the electronic terminal via various interfaces and lines. It executes software programs and / or modules stored in the memory 320, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of integrated circuits (ICs), such as a single packaged IC or multiple packaged ICs with the same or different functions connected together. For example, the processor 310 may consist only of a central processing unit (CPU). In this embodiment of the invention, the CPU may have a single processing core or include multiple processing cores.
[0054] The communication module 330 is used to establish a communication channel, enabling the storage terminal to communicate with other terminals. It receives user data sent by other terminals or sends user data to other terminals.
[0055] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, which, when executed, may include some or all of the steps provided in the embodiments of the present invention. The storage medium may be a magnetic disk, an optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0056] Those skilled in the art will clearly understand that the techniques in the embodiments of the present invention can be implemented using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions in the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium such as a USB flash drive, mobile hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or other media capable of storing program code. It includes several instructions to cause a computer terminal (which may be a personal computer, server, or a second terminal, network terminal, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0057] The same or similar parts between the various embodiments in this specification can be referred to mutually. In particular, the terminal embodiments are basically similar to the method embodiments, so the description is relatively simple, and the relevant parts can be referred to the description in the method embodiments.
[0058] In the embodiments provided by this invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules 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; the indirect coupling or communication connection between systems or modules may be electrical, mechanical, or other forms.
[0059] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0060] In addition, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0061] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the present invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the present invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should also be covered within the protection scope of the present invention.
Claims
1. A method for calculating the number of power equipment based on target detection, characterized in that, include: S1. Collect image data of power equipment in multiple scenarios and preprocess the power equipment images, including noise reduction, illumination correction and size normalization. S2. Input the preprocessed power equipment images into the pre-trained improved YOLOv12 object detection model to batch identify and output the location, category information and confidence information of each power equipment in the power equipment images; wherein, the improved YOLOv12 object detection model includes introducing the CBAM attention mechanism module into the general YOLOv12 object detection model and performing multi-scale anchor box adjustment; S3. Based on the model recognition results, count the number of various types of power equipment in the image, generate the quantity statistics, and compare them with the preset ledger. If the difference exceeds the preset threshold, trigger the early warning mechanism to prompt for review. S4. Synchronize the statistical results, power equipment images, and operation logs to the management platform, update the ledger data, and mark low-confidence power equipment images whose confidence level is lower than the preset confidence threshold as samples to be reviewed, in order to support further optimization of the model.
2. The method for calculating the number of power equipment based on target detection according to claim 1, characterized in that, Step S1 includes: S11. Collect images of power equipment in multiple scenarios by combining fixed-deployment high-definition industrial cameras with mobile inspection equipment. The fixed industrial cameras take pictures of indoor equipment in substations in a timed trigger manner. The mobile inspection equipment includes inspection robots or drones equipped with cameras, which are used to take pictures of equipment in warehouse stacking and complex outdoor angle scenarios. S12. Perform Gaussian filtering noise reduction on the acquired raw image; S13. Perform illumination correction and size normalization on the denoised image in sequence.
3. The method for calculating the number of power equipment based on target detection according to claim 1, characterized in that, Before training the improved YOLOv12 object detection model, a standardized visual sample library for power equipment is constructed. The specific methods include: S211. Classify and archive the preprocessed power equipment images according to equipment type, shooting angle, and ambient lighting conditions, and assign a unique identifier to each image. Establish an image metadata index table; S212. A two-person collaborative annotation mechanism is used to annotate the bounding boxes and attributes of the power equipment in the image. The occlusion information is quantitatively represented by calculating the area ratio of the occluded region and recording the equipment model parameters. S213. Store the annotation results in a structured format in a distributed database, and establish a mapping relationship between image identifiers and annotation records, supporting efficient retrieval based on occlusion ratio, device type, or multi-view combination conditions; among which, the first... The proportion of each power device's obstruction Defined as: ; in, For the first The pixel area of the visible portion of an electrical device in the image; For the first The estimated projected area of each electrical device is derived from the average bounding box area of unobstructed devices. Approximately obtained: ; in, This indicates that the visual sample library of power equipment belongs to the equipment category. And the occlusion ratio The set of unobstructed samples; For the visual sample library of power equipment belonging to the equipment category The number of samples, i.e. ; and The first The width and height of each sample bounding box.
4. The method for calculating the number of power equipment based on target detection according to claim 3, characterized in that, The method for batch identification of power equipment using the improved YOLOv12 target detection model in step S2 includes: S221. Embed a CBAM attention mechanism module at the output of the backbone network of the general YOLOv12 model to calculate channel attention weights and spatial attention weights respectively, so as to enhance the feature response to key areas of occluded or low-contrast power equipment; wherein, the CBAM attention mechanism module focuses on the input feature map Channel attention weights The calculation formula is: ; in, and These are the average and max pooling results along the spatial dimension, respectively; It is a multilayer perceptron with one hidden layer; It is the Sigmoid activation function. Image size, Number of channels; Spatial attention weights Generation based on channel-compressed feature maps: ; in, and For average and max pooling along the channel dimension; Indicates channel splicing; for Convolutional layers; and feature maps modulated by CBAM for: ; in, This represents element-wise multiplication; S222. Based on the distribution of real bounding box sizes in the visual sample library of power equipment, the K-means++ clustering algorithm is used to regenerate a multi-scale anchor box set that adapts to different power equipment scales and replace the default anchor boxes of the original model. S223. Input the preprocessed image collected on site into the YOLOv12 target detection model that has been improved and trained as described above, and output a detection result set including device category, bounding box coordinates and confidence score.
5. The method for calculating the number of power equipment based on target detection according to claim 4, characterized in that, The method for regenerating a multi-scale anchor frame set adapted to different power equipment scales using the K-means++ clustering algorithm in step S222 includes: Let the set be composed of all the width-to-height pairs of real bounding boxes in the visual sample library of power equipment. Multi-scale anchor boxes are obtained by clustering by minimizing the objective function: ; in, This represents the total number of anchor frames; For the first Clusters; Distance Metrics Use 1 minus the intersection-union ratio : ; in, For the first The cluster centers, i.e., the optimized anchor frame size. , For the first The width of the frame of each power device For the first The height of the frame of each power device; For the first The width of the frame of each power device For the first The height of the electrical equipment frame; the anchor frame set is configured to the YOLOv12 detection head.
6. The method for calculating the number of power equipment based on target detection according to claim 1, characterized in that, The method for comparing quantity statistics with ledgers based on model recognition results in step S3 includes: S31. For each frame of image detection results output by the improved YOLOv12 target detection model, group them according to the category of power equipment, and filter out detection boxes with confidence scores lower than the preset confidence threshold to obtain the effective set of equipment. S32. Perform spatiotemporal fusion on the detection results of the same type of power equipment in multiple consecutive frames of images, and use a weighted voting strategy to generate the final statistical number of the power equipment of that type. S33. Calculate the relative error between the final statistical quantity and the standard quantity of the corresponding power equipment category in the preset ledger. If the absolute value of the error exceeds the preset difference threshold, trigger a difference warning and generate a review task.
7. The method for calculating the number of power equipment based on target detection according to claim 6, characterized in that, The method for synchronizing the statistical results and image data to the management platform and marking them as samples to be reviewed in step S4 includes: S41. After encrypting the equipment quantity statistics, original power equipment images, and operation logs containing model version, confidence distribution, and operation time, upload them to the management platform via the transmission protocol and trigger incremental update transactions of ledger data. S42. Based on the confidence score of each device detection box output by the improved YOLOv12 target detection model, images with confidence scores lower than the preset confidence threshold are selected as low-confidence samples and marked as samples to be reviewed, and their sample value scores are calculated. S43. Automatically inject high-value, low-confidence samples with a value score higher than the preset value score into the power equipment visual sample library and trigger the incremental adjustment process.
8. A power equipment quantity calculation system based on target detection, characterized in that, include: The equipment image acquisition module is used to acquire image data of power equipment in multiple scenarios and to preprocess the power equipment images, including noise reduction, illumination correction and size normalization. The batch recognition module is used to input the pre-processed power equipment images into the pre-trained improved YOLOv12 object detection model, and batch recognize and output the location, category information and confidence information of each power equipment in the power equipment images; the improved YOLOv12 object detection model includes the introduction of the CBAM attention mechanism module into the general YOLOv12 object detection model and the adjustment of anchor boxes at multiple scales. The equipment statistics module is used to count the number of various types of power equipment in the image based on the model recognition results, generate the quantity statistics results, and compare them with the preset ledger. If the difference exceeds the preset threshold, an early warning mechanism is triggered to prompt a review. The model optimization module is used to synchronize statistical results, images of power equipment, and operation logs to the management platform, update ledger data, and mark low-confidence power equipment whose confidence level is lower than the preset confidence threshold as samples to be composited, so as to support further optimization of the model.
9. A terminal, characterized in that, include: processor; Memory used to store the processor's execution instructions; The processor is configured to perform the method according to any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.