Distribution box defect detection method, medium and equipment

By grayscale, filtering and denoising and image enhancement processing on the surface image of the distribution box, and combining the multi-feature fusion network and the YOLOv4 feature network, the problem of poor detection accuracy of the existing distribution box defect detection method is solved, and the problem of poor detection accuracy is realized. Accurate detection of surface defects of distribution boxes.

CN119444733AInactive Publication Date: 2025-02-14ZHEJIANG HANGDU HLDG CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510013770.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-06
Publication Date
2025-02-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing distribution box defect detection methods lack the fusion processing of defect characteristics, resulting in poor detection accuracy.

Method used

Grayscale processing, filtering and denoising and image enhancement are used to optimize the image feature details of the distribution box surface, and defect area extraction, fusion and positioning detection are performed through multi-feature fusion network structure and YOLOv4 feature network.

Benefits of technology

The accuracy of surface defect detection of distribution box is improved and accurate detection of different types of defect images can be carried out.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119444733A_ABST
    Figure CN119444733A_ABST
Patent Text Reader

Abstract

The invention discloses a distribution box defect detection method, and the distribution box surface defect detection method comprises the steps: obtaining a distribution box surface image, carrying out the graying processing of the distribution box surface image, and carrying out the filtering, denoising and image enhancement of the processed image; inputting the obtained enhanced image into a multi-feature fusion network structure to carry out defect area extraction and fusion; during feature extraction, calculating the pixel sum of a distribution box surface defect image, constructing a projection discrete curve according to the size m * n of the distribution box surface image, calculating edge pixel values in the direction of the size m and the direction of the size n according to the projection discrete curve, and extracting a defect area; and positioning and detecting the fused defect image through a YOLOv4 feature network. According to the method, the distribution box surface image is subjected to graying, filtering denoising and image enhancement to obtain the image with high contrast and linear smoothness, the feature details of the distribution box surface image are optimized, and the distribution box defect image can be accurately detected in combination with the YOLOv4 algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method, medium and equipment for detecting defects in a distribution box. Background Art

[0002] It is essential to inspect the surface of the distribution box for defects, because the distribution box must maintain insulation when in use, so anti-corrosion insulating paint will be applied to the surface during processing and manufacturing. When the distribution box is shipped out of the warehouse, the surface of the distribution box needs to be inspected to ensure that there is no exposed metal on the surface of the distribution box.

[0003] In the past, distribution boxes were inspected by human eyes. With the development of science and technology, industrial cameras are gradually used to detect surface defects of distribution boxes. Using industrial cameras for inspection means that in industrial production, a specific industrial camera system is used to inspect the surface of distribution boxes to identify and record possible defects, such as scratches, dents, cracks, etc. This kind of inspection usually involves machine vision technology and image processing algorithms. By analyzing the surface image of the distribution box, it can realize automated defect detection and quality control.

[0004] However, when performing defect detection on distribution boxes, there is a lack of fusion processing of defect features, resulting in poor detection accuracy. Summary of the invention

[0005] The purpose of the present invention is to provide a distribution box defect detection method, medium and equipment to solve the above technical problems.

[0006] The present invention provides a distribution box defect detection method, comprising a distribution box surface defect detection step, wherein the distribution box surface defect detection step comprises: S100, obtaining a distribution box surface image, performing grayscale processing on the distribution box surface image, and performing filtering, denoising and image enhancement on the processed image; S200, inputting the enhanced image obtained in S100 into a multi-feature fusion network structure to extract and fuse the defect area; when extracting features, calculating the pixel sum of the defect image on the surface of the distribution box, and constructing a projection discrete curve according to the size m×n of the surface image of the distribution box, calculating the edge pixel value in the direction of size m and the direction of size n according to the projection discrete curve, thereby extracting the defect area; S300, positioning and detecting the fused defect image through the YOLOv4 feature network.

[0007] When the surface image of the distribution box is grayed out, the processing expression is: ; Where gray is the gray value of the image; R, G, B are the pixel values ​​in the three color pixel channels of red, green, and blue respectively; max{R, G, B} is the maximum value of the pixels in the three pixel channels of the RGB color image.

[0008] The present invention further provides that when filtering and denoising is performed, the following method is adopted: Use the initial filter window W to traverse the points f(x, y) in the grayscale image in sequence, and then form a × a Find the maximum grayscale value f in the filter window area max , minimum gray value f min ; If f min <f(x,y)<f max , then it is determined that there is no noise point in this window and the original gray value is output; otherwise, the filter window is increased W The size continues to be judged until a > L; When a>L, calculate the minimum grayscale difference g min , g min =min{|f(x,y)-f min |,| f(x,y)- f max |}, and calculate the maximum grayscale value f max , minimum gray value f min The difference T, if g min If <0.5T, the original grayscale value is output; otherwise, it is considered that the window contains noise points; The filter value f is obtained by weighted calculation of the pixels in the window. replace , the calculation formula is as follows: f replace =kf aver +(1-k)f m ; Where: f aver and f m are the grayscale mean and grayscale median of all pixels in the filter window except the grayscale maximum and grayscale minimum, respectively, where the grayscale median f m =0.5T; Repeat the above steps until all pixels in the image are filtered through the adaptive filtering window to obtain a filtered output image.

[0009] The present invention further arranges that when enhancing the image, it is achieved by the following formula: ; ; Where D represents the contrast parameter of the distribution box surface image; Z represents the entropy parameter of the distribution box surface image; h1 and h2 represent the grayscale data of pixels in two different regions in the image, and the grayscale value range of the pixels in these two regions is [h min ,h max ]; `h represents the grayscale average; g n represents the probability data of the grayscale value of the regional pixel p; T (a, b) represents the local gain function of the region with the pixel coordinates (a, b) in the distribution box surface image; μ represents the proportional constant; h a,b Represents the grayscale data of the area with pixel coordinates (a, b) in the distribution box surface image.

[0010] The present invention further arranges that the multi-feature fusion network structure includes a plurality of residual units, each residual unit corresponds to a pixel unit of a histogram area; the pixel sum formula of the surface defect image of the distribution box is as follows: ; In the formula, is the number of pixels with non-zero grayscale values ​​in the i-th row of the pixel set of the distribution box surface defect image; n is the horizontal size of the distribution box surface image; is the grayscale size corresponding to the grayscale image coordinates.

[0011] In addition, the size of the distribution box surface image in the vertical direction is m, so the projection discrete curve expression of the image constructed in the vertical direction is: When the horizontal size of the distribution box surface image is n0, the grayscale projection discrete curve is searched according to the size of n0 to obtain the edge of the defect image; the edge pixel value is obtained by calculating the maximum value of the projection discrete curve in the vertical and horizontal directions, and the calculation method is as follows: ; Where s(m) and s(n) are the number of edge pixels on both sides of the surface defect of the distribution box, respectively; L(m)max and L(n)max are the maximum values ​​of the projection discrete curve in the vertical and horizontal directions, respectively; α is the projection mapping parameter.

[0012] After defect feature extraction and fusion, the YOLOv4 feature network is used to locate and detect surface defects of distribution boxes. The YOLOv4 feature network includes a backbone feature layer, an enhanced feature layer, and a prediction layer. The input data in the backbone feature layer is the fusion result of the extracted defect features. After deep separation of the fused features through a 1×1 extended convolution structure, the separation results are mapped to the original features. Finally, the defect position is predicted through activation functions and attention mechanisms.

[0013] The present invention further arranges that the activation function is: Mish=x·tanh(ln(1+υ x)), where x is the input data, i.e., the fused distribution box surface defect feature result; tanh(·) is the activation function; υ is the neuron activation parameter; the input data is processed by the Mish activation function, and the processed data is input into the SE attention mechanism for pooling processing, and finally the defect coordinate prediction result is obtained.

[0014] The present invention also provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the distribution box defect detection method.

[0015] The present invention also provides a readable storage medium on which a program is stored. When the program is executed by a processor, the distribution box defect detection method is implemented.

[0016] Beneficial effects of the present invention: In the present invention, the surface image of the distribution box is firstly grayed, filtered, denoised and enhanced to obtain an image with high contrast and linear smoothness, thereby optimizing the feature details of the surface image of the distribution box, and combined with the YOLOv4 algorithm, accurate detection can be performed on different types of defective images. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 The figure is a flowchart of an embodiment of the present invention.

[0018] Figure 2 Schematic diagram of a multi-feature fusion network structure according to an embodiment of the present invention.

[0019] Figure 3 Schematic diagram of the YOLOv4 feature network according to an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The following will describe the implementation methods of the present application in detail with the help of accompanying drawings and examples, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.

[0021] Example 1

[0022] This embodiment provides a distribution box defect detection method, including a distribution box surface defect detection step, wherein the distribution box surface defect detection step includes: S100, obtaining a distribution box surface image, performing grayscale processing on the distribution box surface image, and performing filtering, denoising and image enhancement on the processed image; S200, inputting the enhanced image obtained in S100 into a multi-feature fusion network structure to extract and fuse the defect area; when extracting features, calculating the pixel sum of the defect image on the surface of the distribution box, and constructing a projection discrete curve according to the size m×n of the surface image of the distribution box, calculating the edge pixel value in the direction of size m and the direction of size n according to the projection discrete curve, thereby extracting the defect area; S300, positioning and detecting the fused defect image through the YOLOv4 feature network.

[0023] In this embodiment, the color pixel data contained in the RGB color image is likely to increase the workload of the algorithm. Therefore, in order to improve the operation efficiency of the algorithm, when the surface image of the distribution box is grayed, the processing expression is: ; Where gray is the gray value of the image; R, G, B are the pixel values ​​in the three color pixel channels of red, green, and blue respectively; max{R, G, B} is the maximum value of the pixels in the three pixel channels of the RGB color image.

[0024] When filtering and denoising, the following method is used: Use the initial filter window W to traverse the points f(x, y) in the grayscale image in sequence, and then form a × a Find the maximum grayscale value f in the filter window area max , minimum gray value f min ; If f min <f(x,y)<f max , then it is determined that there is no noise point in this window and the original gray value is output; otherwise, the filter window is increased W The size continues to be judged until a > L; When a>L, calculate the minimum grayscale difference g min , g min =min{|f(x,y)-f min |,| f(x,y)- f max |}, and calculate the maximum grayscale value f max , minimum gray value f min The difference T, if g min If <0.5T, the original grayscale value is output; otherwise, it is considered that the window contains noise points; The filter value f is obtained by weighted calculation of the pixels in the window. replace , the calculation formula is as follows: f replace =kf aver +(1-k)f m; Where: f aver and f m are the grayscale mean and grayscale median of all pixels in the filter window except the grayscale maximum and grayscale minimum, respectively, where the grayscale median f m =0.5T, k=0.3-0.5; Repeat the above steps until all pixels in the image are filtered through the adaptive filtering window to obtain a filtered output image.

[0025] In this embodiment, the image enhancement is achieved through the following formula: ; ; Where D represents the contrast parameter of the distribution box surface image; Z represents the entropy parameter of the distribution box surface image; h1 and h2 represent the grayscale data of pixels in two different regions in the image, and the grayscale value range of the pixels in these two regions is [h min ,h max ]; `h represents the grayscale average; g n represents the probability data of the grayscale value of the regional pixel p; T (a, b) represents the local gain function of the region with the pixel coordinates (a, b) in the distribution box surface image; μ represents the proportional constant; h a,b Represents the grayscale data of the area with pixel coordinates (a, b) in the distribution box surface image.

[0026] The preprocessing also includes histogram equalization processing to obtain the processed distribution box surface image, and the processing method is: J=h(I'(x), r); histogram equalization processing is performed after image enhancement; in the above formula, J is the distribution box surface image after histogram equalization processing; r is the number of image grayscale levels; h(·) is the histogram equalization algorithm.

[0027] After preprocessing the distribution box surface image, the image is input into the multi-feature fusion network structure for extraction and fusion. Specifically, the multi-feature fusion network structure includes multiple residual units, each of which corresponds to a pixel unit in a histogram area. Its structure is as follows: Figure 2 As shown, in the multi-feature fusion network structure of this embodiment, each convolution group contains 4 residual structure units, and each residual unit can be assigned to a different grayscale pixel area to complete the feature extraction of the area.

[0028] The pixels and formula of the distribution box surface defect image are as follows: ; In the formula, is the number of pixels with non-zero grayscale values ​​in the i-th row of the pixel set of the distribution box surface defect image; n is the horizontal size of the distribution box surface image; is the grayscale size corresponding to the grayscale image coordinates.

[0029] In this embodiment, the size of the distribution box surface image in the vertical direction is m, and the projection discrete curve expression of the image constructed thereby in the vertical direction is: When the horizontal size of the distribution box surface image is n0, the grayscale projection discrete curve is searched according to the size of n0 to obtain the edge of the defect image; the edge pixel value is obtained by calculating the maximum value of the projection discrete curve in the vertical and horizontal directions, and the calculation method is as follows: ; Where s(m) and s(n) are the number of edge pixels on both sides of the surface defect of the distribution box, respectively; L(m)max and L(n)max are the maximum values ​​of the projection discrete curve in the vertical and horizontal directions, respectively; α is the projection mapping parameter.

[0030] In this embodiment, the YOLOv4 feature network includes a backbone feature layer, an enhanced feature layer, and a prediction layer. Figure 3 As shown in the figure, the input data in the backbone feature layer is the fusion result of the extracted defect features. After the fused features are deeply separated by a 1×1 extended convolution structure, the separation results are mapped to the original features, and finally the defect position is predicted through the activation function and attention mechanism.

[0031] The activation function is: Mish = x·tanh(ln(1+υ x )), where x is the input data, i.e., the fused distribution box surface defect feature result; tanh(·) is the activation function; υ is the neuron activation parameter; the input data is processed by the Mish activation function, and the processed data is input into the SE attention mechanism for pooling processing, and finally the defect coordinate prediction result is obtained.

[0032] The SE attention mechanism mainly performs two operations on the input data to obtain the defect prediction coordinates. The expressions of the compression operation and the excitation operation are: In the formula, z(u c ) is the defect feature compression result; s is the defect feature weight value; u c is the cth convolution kernel in the YOLOv4 network structure; W1 is the linear mean.

[0033] The defective pixel location result obtained is: I(i',j')=I(i·s,j·s) / ψ; In the above formula, (i', j') is the predicted location coordinate value of the surface defect of the distribution box; (i, j) is the original pixel coordinate; ψ is the weight distribution parameter, which represents the grayscale value corresponding to different pixel coordinates.

[0034] The above scheme is used to locate and detect surface defects of low-voltage power distribution boxes. After combining with image data preprocessing and feature fusion extraction, a defect detection method for distribution boxes is proposed.

[0035] Example 2

[0036] The present invention also provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the distribution box defect detection method.

[0037] Example 3

[0038] The present invention also provides a readable storage medium on which a program is stored. When the program is executed by a processor, the distribution box defect detection method is implemented.

[0039] In the present invention, the surface image of the distribution box is firstly grayed, filtered, denoised and enhanced to obtain an image with high contrast and linear smoothness, thereby optimizing the feature details of the surface image of the distribution box, and combined with the YOLOv4 algorithm, accurate detection of different types of defect images can be performed.

[0040] For example, certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that hardware manufacturers may use different terms to refer to the same component. This specification and claims do not use differences in names as a way to distinguish components, but use differences in the functions of components as the criteria for distinction. For example, "including" mentioned throughout the specification and claims is an open term, so it should be interpreted as "including but not limited to". "Approximately" means that within an acceptable error range, those skilled in the art can solve technical problems within a certain error range and basically achieve technical effects.

[0041] It should be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0042] The above description shows and describes several preferred embodiments of the present invention, but as before, it should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be modified within the scope of the invention concept of this article through the above teachings or the technology or knowledge of the relevant field. And the changes and modifications made by those skilled in the art do not depart from the spirit and scope of the present invention, and should be within the scope of protection of the claims attached to the present invention.

Claims

1. A method for detecting defects in a distribution box, characterized in that: The method comprises the steps of detecting surface defects of the distribution box, wherein the step of detecting surface defects of the distribution box comprises: S100, obtaining a distribution box surface image, performing grayscale processing on the distribution box surface image, and performing filtering, denoising and image enhancement on the processed image; S200, inputting the enhanced image obtained in S100 into a multi-feature fusion network structure to extract and fuse the defect area; when extracting features, calculating the pixel sum of the defect image on the surface of the distribution box, and constructing a projection discrete curve according to the size m×n of the surface image of the distribution box, calculating the edge pixel value in the direction of size m and the direction of size n according to the projection discrete curve, thereby extracting the defect area; S300, positioning and detecting the fused defect image through the YOLOv4 feature network.

2. A method for detecting defects in a distribution box according to claim 1, characterized in that: When the surface image of the distribution box is grayed out, the processing expression is: ; Where gray is the gray value of the image; R, G, B are the pixel values ​​in the three color pixel channels of red, green, and blue respectively; max{R, G, B} is the maximum value of the pixels in the three pixel channels of the RGB color image.

3. A method for detecting defects in a distribution box according to claim 1, characterized in that: When filtering and denoising, the following method is used: Use the initial filter window W to traverse the points f(x, y) in the grayscale image in sequence, and then form a × a Find the maximum grayscale value f in the filter window area max , minimum gray value f min ; If f min <f(x,y)<f max , then it is determined that there is no noise point in this window and the original gray value is output; Otherwise, increase the filter window W The size continues to be judged until a > L; When a>L, calculate the minimum grayscale difference g min , g min =min{|f(x,y)-f min |,| f(x,y)- f max |}, and calculate the maximum grayscale value f max , minimum gray value f min The difference T, if g min If <0.5T, the original grayscale value is output; otherwise, it is considered that the window contains noise points; The filter value f is obtained by weighted calculation of the pixels in the window. replace , the calculation formula is as follows: f replace =kf aver +(1-k)f m ; Where: f aver and f m are the grayscale mean and grayscale median of all pixels in the filter window except the grayscale maximum and grayscale minimum, respectively, where the grayscale median f m =0.5T; Repeat the above steps until all pixels in the image are filtered through the adaptive filtering window to obtain a filtered output image.

4. A method for detecting defects in a distribution box according to claim 1, characterized in that: When enhancing the image, it is achieved through the following formula: ; ; Where D represents the contrast parameter of the distribution box surface image; Z represents the entropy parameter of the distribution box surface image; h1 and h2 represent the grayscale data of pixels in two different regions in the image, and the grayscale value range of the pixels in these two regions is [h min ,h max ]; `h represents the grayscale average; g n represents the probability data of the grayscale value of the regional pixel p; T (a, b) represents the local gain function of the region with the pixel coordinates (a, b) in the distribution box surface image; μ represents the proportional constant; h a,b Represents the grayscale data of the area with pixel coordinates (a, b) in the distribution box surface image.

5. A method for detecting defects in a distribution box according to claim 1, characterized in that: The multi-feature fusion network structure includes multiple residual units, each of which corresponds to a pixel unit in a histogram area; the pixel sum formula of the distribution box surface defect image is as follows: ; In the formula, is the number of pixels with non-zero grayscale values ​​in the i-th row of the distribution box surface defect image pixel set; n is the horizontal size of the distribution box surface image; It is the grayscale size corresponding to the grayscale image coordinates.

6. A method for detecting defects in a distribution box according to claim 1, characterized in that: The vertical dimension of the distribution box surface image is m, and the vertical projection discrete curve expression of the image constructed by this is: When the horizontal size of the distribution box surface image is n0, the grayscale projection discrete curve is searched according to the size of n0 to obtain the edge of the defect image; the edge pixel value is obtained by calculating the maximum value of the projection discrete curve in the vertical and horizontal directions, and the calculation method is as follows: ; Where s(m) and s(n) are the number of edge pixels on both sides of the surface defect of the distribution box, respectively; L(m)max and L(n)max are the maximum values ​​of the projection discrete curve in the vertical and horizontal directions, respectively; α is the projection mapping parameter.

7. A method for detecting defects in a distribution box according to claim 1, characterized in that , The YOLOv4 feature network includes a backbone feature layer, an enhanced feature layer and a prediction layer. The input data in the backbone feature layer is the fusion result of the extracted defect features. After the fusion features are deeply separated by a 1×1 extended convolution structure, the separation results are mapped to the original features. Finally, the defect position is predicted through the activation function and attention mechanism.

8. A method for detecting defects in a distribution box according to claim 7, characterized in that: The activation function is: Mish = x·tanh(ln(1+υ x )), where x is the input data, i.e. the fused surface defect feature results of the distribution box; tanh(·) is the activation function; υ is the neuron activation parameter; the input data is processed by the Mish activation function, and the processed data is input into the SE attention mechanism for pooling processing, and finally the defect coordinate prediction result is obtained.

9. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the distribution box defect detection method according to any one of claims 1 to 8.

10. A readable storage medium, characterized in that: A program is stored thereon, and when the program is executed by a processor, the distribution box defect detection method described in any one of claims 1-8 is implemented.

Citation Information

Cited By

  • Power distribution system multi-element power equipment target identification and anomaly detection algorithm and device based on joint convolutional neural network

    CN121527025A