Defect identification method, device and computer equipment

By determining the depth threshold based on the actual shooting distance during drone inspections, extracting the region of interest for small hardware fittings and identifying the sharpness, the problem of inconsistent image quality for small hardware fittings is solved, achieving efficient and accurate defect identification and screening, and meeting the automation and intelligent requirements of large-scale drone inspections.

CN122636627APending Publication Date: 2026-08-25CHINA SOUTHERN POWER GRID ARTIFICIAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611133404.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-29
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

The inconsistent image quality of small hardware components during drone inspections leads to misjudgments and omissions in defect identification. Manual screening is inefficient and costly, failing to meet the automation and intelligent requirements of large-scale drone inspections.

Method used

By obtaining the actual shooting distance of the image acquisition device, the depth threshold is determined, the region of interest is extracted, the sharpness is determined based on the pixel value difference, and defect identification is performed when the sharpness meets the threshold. The small hardware area is accurately extracted using depth images and foreground mask images, and the image is reshot if necessary to improve the sharpness.

Benefits of technology

It achieves efficient and accurate image screening and defect identification, improving efficiency by 100 times, reducing labor costs, and increasing identification accuracy, thus meeting the automation needs of large-scale drone inspections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122636627A_ABST
    Figure CN122636627A_ABST
Patent Text Reader

Abstract

The application relates to a defect identification method, device and computer equipment, which comprises the following steps: acquiring an image containing a power small fitting collected by an image collection device; determining a depth threshold according to an actual shooting distance of the image; wherein the actual shooting distance is the actual distance between the image collection device and the power small fitting, and the depth threshold is positively correlated with the actual shooting distance; extracting a region of interest containing the power small fitting from the image according to the depth threshold; determining the definition of the region of interest according to the pixel value difference of different pixel points in the region of interest; and performing defect identification of the power small fitting according to the region of interest and the definition when the definition is greater than a preset definition threshold. The application can improve the accuracy and efficiency of image screening to ensure the accuracy and efficiency of defect identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to a defect identification method, apparatus, and computer device. Background Technology

[0002] As the "main artery" of power transmission, the safe and stable operation of power transmission lines is directly related to national economic development and public safety. Power fittings (bolts and nuts), as key components for connecting and fixing core components such as transmission line towers, conductors and insulators, are exposed to complex outdoor environments for a long time and must withstand the erosion of natural factors such as wind, sun, rain and snow. They are prone to defects such as aging, corrosion, loosening or missing parts.

[0003] With the rapid development of drone and artificial intelligence technologies, drone inspection has gradually replaced traditional manual tower climbing and ground visual inspection, becoming the mainstream method for power transmission line inspection. Drone inspection has advantages such as high efficiency, wide coverage, high operational safety, and controllable cost. It can achieve all-round, no-blind-spot imaging of all components of the power transmission line, and can complete the inspection of 100-150 kilometers of power transmission line in a single day, which is more than 50 times more efficient than manual inspection. However, in the actual inspection process, due to the complexity of the outdoor environment (background interference such as sky, vegetation, adjacent tower materials or terrain), fluctuations in drone flight attitude (pitch, tilt or shaking), inconsistent shooting distance (fluctuating within 5-15 meters), and changes in lighting conditions (strong light, cloudy or backlight), the quality of the small fitting inspection images collected is inconsistent. This leads to misjudgments and missed defects in the defect identification results. Not only does it fail to give full play to the advantages of intelligent inspection, but it may also lead to incorrect operation and maintenance decisions due to incorrect judgment, increasing the power grid safety risks and operation and maintenance costs. Therefore, prior to identifying defects in small electrical fittings, quality assessment and screening of the fitting inspection images, eliminating low-quality images and retaining high-quality images, is a crucial prerequisite for ensuring the accuracy of defect identification.

[0004] Currently, the screening of small hardware inspection images mainly relies on manual labor. Power maintenance personnel review each image captured by drones to determine its clarity and whether it meets defect identification requirements. For example, a provincial power company collects 12,000 small hardware images daily via drone inspections, requiring three experienced maintenance personnel 20 days to complete the screening. This demonstrates that manual screening is not only labor-intensive but also suffers from subjectivity, low efficiency, and a high rate of missed images. In short, manual screening has low efficiency and accuracy, failing to meet the automation and intelligent requirements of large-scale drone inspections. Summary of the Invention

[0005] Therefore, it is necessary to provide a defect identification method, apparatus, and computer equipment that can improve the accuracy and efficiency of image screening to ensure the accuracy and efficiency of defect identification, thereby addressing the aforementioned technical problems.

[0006] In a first aspect, this application provides a defect identification method, comprising: acquiring an image to be processed containing a small power fitting captured by an image acquisition device; determining a depth threshold based on the actual shooting distance of the image to be processed; wherein the actual shooting distance is the actual distance between the image acquisition device and the small power fitting, and the depth threshold is positively correlated with the actual shooting distance; extracting a region of interest containing the small power fitting from the image to be processed based on the depth threshold; determining the sharpness of the region of interest based on the pixel value differences of different pixels in the region of interest; and, if the sharpness is greater than a preset sharpness threshold, identifying defects in the small power fitting based on the region of interest and the sharpness.

[0007] In one embodiment, extracting a region of interest containing a small power fitting from an image to be processed based on a depth threshold includes: extracting a target region containing the small power fitting from the image to be processed; determining a depth image corresponding to the target region; wherein the pixel value of each pixel in the depth image is the depth information of the corresponding pixel in the target region; and extracting the region of interest containing the small power fitting from the target region based on the depth image and the depth threshold.

[0008] In one embodiment, extracting a region of interest containing small power fittings from a target region based on a depth image and a depth threshold includes: determining a foreground mask image corresponding to the depth image based on the relationship between the pixel values ​​of each pixel in the depth image and the depth threshold; and extracting the region of interest containing small power fittings from the target region based on the foreground mask image.

[0009] In one embodiment, determining the foreground mask image corresponding to the depth image based on the relationship between the pixel value of each pixel in the depth image and the depth threshold includes: for each pixel in the depth image, if the pixel value of the pixel is greater than the depth threshold, configuring the pixel value of the corresponding pixel in the foreground mask image as a first value; if the pixel value of the pixel is less than or equal to the depth threshold, configuring the pixel value of the corresponding pixel in the foreground mask image as a second value; wherein the first value and the second value are different.

[0010] In one embodiment, extracting the region of interest containing the small power fittings from the target region based on the foreground mask image includes: multiplying the pixel value of each pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image to obtain a multiplication result; and determining the region of interest containing the small power fittings based on the multiplication results.

[0011] In one embodiment, the method further includes: determining a recommended shooting distance when the sharpness is less than or equal to a preset sharpness threshold; generating a reshooting instruction based on the location data of the target area in the image to be processed and the recommended shooting distance; and sending the reshooting instruction to the image acquisition device; wherein the reshooting instruction is used to instruct the image acquisition device to adjust its pose based on the location data and the recommended shooting distance, and to re-acquire the image to be processed containing the small power fittings.

[0012] In one embodiment, the method further includes: acquiring multiple sample images and determining the sharpness of each sample image; wherein the multiple sample images include sharp sample images and blurry sample images; for each candidate sharpness threshold within a preset threshold range, determining the true positive rate and false positive rate corresponding to the candidate sharpness threshold based on the sharpness of each sample image; wherein the true positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each sharp sample image, and the false positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each blurry sample image; and selecting a preset sharpness threshold from each candidate sharpness threshold based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold.

[0013] In one embodiment, selecting a preset sharpness threshold from each candidate sharpness threshold based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold includes: for each candidate sharpness threshold, determining a discrimination coefficient corresponding to the candidate sharpness threshold based on the difference between the true positive rate and false positive rate corresponding to the candidate sharpness threshold; wherein, the discrimination coefficient characterizes the ability to distinguish between sharp sample images and blurry sample images based on the candidate sharpness threshold; and selecting the candidate sharpness threshold with the highest discrimination coefficient from each candidate sharpness threshold as the preset sharpness threshold.

[0014] Secondly, this application also provides a defect identification device, comprising: an image acquisition module for acquiring an image to be processed containing a small power fitting captured by an image acquisition device; a threshold determination module for determining a depth threshold based on the actual shooting distance of the image to be processed; wherein the actual shooting distance is the actual distance between the image acquisition device and the small power fitting, and the depth threshold is positively correlated with the actual shooting distance; a region extraction module for extracting a region of interest containing the small power fitting from the image to be processed based on the depth threshold; a sharpness determination module for determining the sharpness of the region of interest based on the pixel value differences of different pixels in the region of interest; and a type identification module for identifying defects in the small power fitting based on the region of interest and the sharpness when the sharpness is greater than a preset sharpness threshold.

[0015] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method provided in the first aspect.

[0016] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect.

[0017] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method provided in the first aspect.

[0018] The aforementioned defect identification method, apparatus, and computer equipment determine a depth threshold based on the actual shooting distance of the image to be processed. This depth threshold is positively correlated with the actual shooting distance, thus obtaining a depth threshold that matches the actual shooting distance. Based on this depth threshold, the region of interest (ROI) containing the small power fittings can be accurately extracted from the image to be processed, minimizing background interference. The sharpness of the ROI is determined based on the pixel value differences between different pixels within the ROI. Since the main content of the ROI is the pixel information of the small power fittings, the sharpness of the ROI accurately reflects the clarity of the small power fittings within the ROI. The relationship between the sharpness and a preset sharpness threshold determines whether the ROI meets the sharpness requirements. If the ROI meets the sharpness requirements, the defect identification of the small power fittings is performed using the ROI and the sharpness. Because this process does not rely on manual intervention, it avoids the problems of high labor costs, low efficiency, and low accuracy associated with manual intervention. In other words, this embodiment can improve the efficiency and accuracy of screening image regions that meet the sharpness requirements, thereby improving the efficiency and accuracy of defect identification of small power fittings and meeting the automation and intelligent requirements of large-scale UAV inspections. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating a defect identification method in one embodiment;

[0021] Figure 2 This is a flowchart illustrating the region of interest extraction step in S130 of one embodiment;

[0022] Figure 3 This is a flowchart illustrating the region of interest extraction step in S230 of one embodiment;

[0023] Figure 4 This is a schematic diagram of a foreground mask image in one embodiment;

[0024] Figure 5 This is a flowchart illustrating the foreground mask image determination steps in one embodiment;

[0025] Figure 6 This is a flowchart illustrating the region of interest extraction step in S320 of one embodiment;

[0026] Figure 7 This is a flowchart illustrating the reshooting step in one embodiment;

[0027] Figure 8 This is a flowchart illustrating the threshold determination step in one embodiment;

[0028] Figure 9 This is a flowchart illustrating the preset sharpness threshold selection step in one embodiment;

[0029] Figure 10 This is a structural block diagram of a defect identification device in one embodiment;

[0030] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0031] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0032] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.

[0033] In one exemplary embodiment, a defect identification method is provided. This method can be applied to a terminal, a server, or an interactive system formed by a terminal and a server, such as... Figure 1 As shown, the defect identification method includes the following steps:

[0034] S110: Acquire the image to be processed, which includes small electrical fittings, acquired by the image acquisition device.

[0035] Among them, image acquisition equipment can be, but is not limited to, drones.

[0036] Among them, small power fittings are small-sized power fittings such as screws or nuts. Different types of small power fittings have different size ranges. For example, the length of screws ranges from 3mm to 300mm, and the inner diameter of nuts ranges from 1.57mm to 21.50mm.

[0037] Among them, the images to be processed are inspection images of small electrical fittings taken by the image acquisition equipment.

[0038] In real-world scenarios, the image to be processed can be preprocessed before proceeding with subsequent steps. Preprocessing methods can include image size normalization and pixel value normalization.

[0039] Image size normalization can be performed using the following formula:

[0040]

[0041] In the formula, W is the width of the image to be processed, and H is the height of the image to be processed. The preset standard width, The preset standard height, Let (x, y) be the image to be processed, and (x, y) be the pixel coordinates in the image to be processed. The image to be processed is after size normalization.

[0042] Understandably, size normalization can eliminate the impact of different image sizes on subsequent processing.

[0043] The pixel value normalization can be performed using the following formula:

[0044]

[0045] In the formula, The image to be processed is the pixel value after normalization.

[0046] Understandably, by normalizing pixel values, the pixel values ​​in the image to be processed can be normalized to the [0, 1] range, eliminating the influence of different pixel value ranges on subsequent processing.

[0047] S120, determine the depth threshold based on the actual shooting distance of the image to be processed.

[0048] The actual shooting distance is the actual distance between the image acquisition device and the small power fittings.

[0049] Among them, the depth threshold is positively correlated with the actual shooting distance.

[0050] For example, the depth threshold can be determined by the following formula: Dth = 0.05d - 0.05, where d is the actual shooting distance and Dth is the depth threshold.

[0051] The actual shooting distance is usually in the range of [5m, 15m], and the depth threshold is usually in the range of [0.3, 0.5].

[0052] Of course, besides a simple linear relationship between the depth threshold and the actual shooting distance, a piecewise linear relationship can also exist. For example, when the actual shooting distance is relatively short, within a first preset range (e.g., within [5m, 8m]), a smaller depth threshold value is used (e.g., a depth threshold selected from [0.3, 0.4]). When the actual shooting distance is relatively long, within a second preset range (e.g., within [12m, 15m]), a larger depth threshold value can be used (e.g., a depth threshold selected from [0.6, 0.7]). When the actual shooting distance is moderate, within a third preset range (e.g., within [8m, 12m]), the depth threshold can be set to 0.5.

[0053] S130, Based on a depth threshold, extract the region of interest containing small electrical fittings from the image to be processed.

[0054] Understandably, the small electrical fittings are located in the foreground region of the image to be processed, while the background information is located in the background region. Therefore, based on the depth threshold, the region of interest located in the foreground region can be extracted from the image to be processed.

[0055] The areas of interest include small electrical fittings, and may also include a small amount of adjacent background information.

[0056] S140: Determine the sharpness of the region of interest based on the pixel value differences of different pixels in the region of interest.

[0057] The specific process of determining sharpness may include: performing grayscale processing on the region of interest to obtain a grayscale image; determining the pixel value differences between different pixels in the grayscale image; and determining the sharpness of the region of interest based on the differences in pixel values.

[0058] Specifically, grayscale processing can be performed using the following formula:

[0059]

[0060] In the formula, R(x) y ) represents the pixel point (x) in the region of interest. y The color data of the red channel of G(x) y ) represents the pixel point (x) in the region of interest. y The color data of the green channel of B(x) y G(x) represents the color data of the blue channel of pixel (x, y) in the region of interest. y ) represents the pixel point (x) in the region of interest. y The grayscale value of ).

[0061] Understandably, to eliminate interference from different color channels, simplify the calculation process, and preserve the image's detailed gradient information, grayscale processing is performed on the region of interest. The above calculation formula uses a weighted average method to achieve grayscale processing, which conforms to the human eye's color perception characteristics and can preserve the original image's detailed information to the greatest extent.

[0062] Specifically, the following formula can be used to calculate sharpness:

[0063]

[0064] In the formula, For the clarity of the i-th region of interest, Let be the width of the i-th region of interest. Let be the height of the i-th region of interest. pixels in a grayscale image The pixel value.

[0065] The width and height of the region of interest can be determined using the following formula:

[0066]

[0067] In the formula, For pixels in the region of interest.

[0068] As can be seen, the above calculation formula sums the squares of the differences between the pixel values ​​of two pixels in the same column of any two rows separated by a row, and uses this sum as the sharpness. This effectively captures the detail gradient of the image while controlling the computational load, balancing evaluation accuracy and efficiency. Moreover, the difference between the pixel values ​​of two pixels in the same column of any two rows separated by a row reflects the gradient value; the higher the gradient, the richer the image details and the sharper the image.

[0069] If the size of the region of interest is 320×240, then The value range of is [1, 318]. The value range is [1, 238].

[0070] To ensure consistency with subsequent comparisons to a preset sharpness threshold, the above sharpness can be normalized. The normalization formula is as follows:

[0071]

[0072] In the formula, For normalized clarity, To preset the minimum resolution, Set to the maximum preset resolution. The closer it is to 1, the higher the clarity of the region of interest.

[0073] S150 identifies defects in small power fittings based on the region of interest and the resolution when the resolution is greater than a preset resolution threshold.

[0074] Specifically, the region of interest and resolution can be input into a pre-trained defect identification model. The defect identification model outputs whether there is a defect in the power fittings in the region of interest, and if so, the specific type of defect.

[0075] In real-world scenarios, after obtaining the defect identification results, maintenance information can be generated. This information includes whether the region of interest meets the clarity requirements, the clarity, the defect type, the timestamp, the latitude and longitude of the image acquisition device when it acquired the corresponding image to be processed, the camera focal length, the actual shooting distance, and the flight altitude. This allows maintenance personnel to accurately locate the defective small electrical fittings based on the maintenance information and carry out repairs.

[0076] Understandably, this embodiment automates the entire process of small fitting image defect detection, enabling rapid processing of a large number of small fitting images obtained from image acquisition equipment (e.g., drones) inspections. Statistics show that 12,000 small fitting images can be identified in just 1.5 hours per day, equivalent to traditional manual screening, improving efficiency by nearly 100 times and significantly reducing labor costs. Simultaneously, it avoids the subjectivity and missed screening rate of manual screening, ensuring the consistency and reliability of quality assessment. It adapts to the automation needs of large-scale drone inspections of transmission lines, effectively supporting the large-scale construction of intelligent operation and maintenance systems for transmission lines. Furthermore, this embodiment increases the detection rate of small fitting defects from 81% to 92%, and reduces the false detection rate from 1.7% to 0.8%, providing reliable support for power grid operation and maintenance decisions, truly achieving the goal of "algorithms replacing humans" in intelligent operation and maintenance, and reducing operation and maintenance costs.

[0077] The aforementioned defect identification method determines a depth threshold based on the actual shooting distance of the image to be processed. This depth threshold is positively correlated with the actual shooting distance, thus obtaining a depth threshold that matches the actual shooting distance. Based on this depth threshold, the region of interest (ROI) containing the small power fittings can be accurately extracted from the image to be processed, minimizing background interference. The sharpness of the ROI is determined based on the pixel value differences between different pixels within the ROI. Since the main content of the ROI is the pixel information of the small power fittings, the sharpness of the ROI accurately reflects the clarity of the small power fittings within the ROI. The relationship between the sharpness and a preset sharpness threshold determines whether the ROI meets the sharpness requirements. If the ROI meets the sharpness requirements, the defect identification of the small power fittings is performed using the ROI and the sharpness. Because this process is manual, it avoids the problems of high labor costs, low efficiency, and low accuracy associated with manual intervention. In other words, this embodiment can improve the efficiency and accuracy of screening image regions that meet the sharpness requirements, thereby improving the efficiency and accuracy of defect identification of small power fittings and meeting the automation and intelligent requirements of large-scale UAV inspections.

[0078] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the region of interest extraction step in S130 is refined.

[0079] See Figure 2 The refined region of interest extraction steps include:

[0080] S210: Extract the target area where the small power fittings are located from the image to be processed.

[0081] Specifically, the image to be processed can be input into a pre-trained small appliance target detection model. The model outputs the bounding box containing the small appliance, i.e., the target region where the small appliance is located. When the image contains multiple small appliances, the model outputs the location information (x1, y1, x2, y2) of the target region for each appliance. (x1, y1) are the coordinates of the top-left corner of the target region, (x2, y2) are the coordinates of the bottom-right corner, the width of the target region is x2-x1, and the height is y1-y2. Along with the location information, the model also outputs a confidence score. Target regions with a confidence score greater than a preset threshold are considered valid and participate in subsequent steps. Target regions with a confidence score less than or equal to the preset threshold are considered invalid and are discarded, not participating in subsequent steps.

[0082] In practical scenarios, to avoid cropping the edge details of the small power fittings, the target area containing the small power fittings can be expanded. The position information of the expanded target area is (x1-Δp, y1+Δp, x2+Δp, y2-Δp). Of course, if the edge of the expanded target area exceeds the boundary of the image to be processed, then the boundary of the image to be processed is taken as the edge of the expanded target area. That is, the position information of the expanded target area is (max(1, x1-Δp), min(H1, y1+Δp), min(W1, x2+Δp), max(1, y2-Δp)). H1 is the height of the image to be processed, and W1 is the width of the image to be processed.

[0083] In real-world scenarios, the target area is typically 200×200 to 400×400, which ensures that the entire small metal tool target is included while reducing the processing range for subsequent depth estimation and improving computational efficiency.

[0084] Understandably, if multiple target regions are extracted from the image to be processed, subsequent steps are performed for each target region.

[0085] S220, Determine the depth image corresponding to the target region.

[0086] In the depth image, the pixel value of each pixel is the depth information of the corresponding pixel in the target region.

[0087] As can be seen, the target region has the same size as the depth image.

[0088] Specifically, the target region can be input into a pre-trained monocular depth estimation model to obtain a depth image corresponding to the target region.

[0089] The monocular depth estimation model employs a "teacher-student" dual-model framework. The teacher model is trained on high-quality synthetic images and then generates pseudo-depth labels on a large scale of unlabeled real images. The student model is trained on real images with pseudo-depth labels, thereby achieving efficient and high-precision depth prediction capabilities. The monocular depth estimation model is applicable to depth estimation needs in complex outdoor scenarios of power transmission lines (such as changes in lighting, vegetation obstruction, and overlapping tower materials).

[0090] Understandably, the depth information of a pixel represents the distance between the pixel's position on the real object and the image acquisition device; the greater the distance, the greater the depth; the smaller the distance, the smaller the depth.

[0091] Of course, pixel values ​​in depth images can also be normalized:

[0092]

[0093] In the formula, For pixels in a depth image pixel values, To Normalized pixel values, To preset the minimum depth value, This is the preset maximum depth value.

[0094] S230, based on the depth image and depth threshold, extract the region of interest containing the small power fittings from the target area.

[0095] In this embodiment, the target region containing the small power fittings is first extracted from the image to be processed. Then, the region of interest (ROI) is extracted from the target region. This stepwise extraction method improves the accuracy of ROI extraction. Furthermore, extracting the ROI containing the small power fittings from the target region based on the depth image and a depth threshold further ensures the accuracy of ROI extraction.

[0096] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the region of interest extraction step in S230 is refined.

[0097] See Figure 3 The refined region of interest extraction steps include:

[0098] S310, determine the foreground mask image corresponding to the depth image based on the relationship between the pixel value of each pixel in the depth image and the depth threshold.

[0099] In this context, a foreground mask image refers to a mask image that represents the range of pixels belonging to the foreground portion of the target region. For example, Figure 4 The foreground mask image shown.

[0100] In one alternative implementation, see Figure 5 The foreground mask image determination step in S310 may include:

[0101] S410: For each pixel in the depth image, if the pixel value of the pixel is greater than the depth threshold, configure the pixel value of the corresponding pixel in the foreground mask image as the first value.

[0102] S420: If the pixel value of a pixel is less than or equal to the depth threshold, configure the pixel value of the corresponding pixel in the foreground mask image to the second value.

[0103] The first value is different from the second value. For example, the first value is 0 and the second value is 1.

[0104] That is, a foreground mask image is set, the size of which is the same as the depth image, that is, the size of the target region.

[0105] For example, the foreground mask image can be determined using the following calculation formula:

[0106]

[0107] In the formula, D th For depth threshold, The values ​​represent the corresponding pixel values ​​in the foreground mask image. Using the above calculation formula, the range of pixels with a value of 1 can be considered the foreground portion, which includes small electrical fittings. The range of pixels with a value of 0 can be considered the background portion, which includes the sky, vegetation, and distant tower structures. Therefore, the foreground mask image is a binary image.

[0108] Understandably, if a pixel value in the depth image is greater than the depth threshold, it indicates that the pixel belongs to the background. If a pixel value in the depth image is less than or equal to the depth threshold, it indicates that the pixel belongs to the foreground. In the foreground mask image, pixels belonging to the foreground have a second value, and pixels belonging to the background have a first value, thus distinguishing between the foreground and background.

[0109] In a real-world scenario, the foreground mask image obtained in S310 is preprocessed so that in S320, the region of interest containing the small electrical fittings can be extracted from the target region based on the preprocessed foreground mask image. The preprocessing can include morphological processing, such as dilation and erosion. Specifically, a 3×3 rectangular kernel K can be used to dilate the foreground mask image to fill in small holes in the foreground mask region. Then, the same 3×3 rectangular kernel K is used to erode the dilated foreground mask image to remove edge burrs and improve the image quality.

[0110] The rectangular core is:

[0111]

[0112] The expansion formula is as follows:

[0113]

[0114] In the formula, These are the pixel values ​​of the pixels in the foreground mask image after dilation.

[0115] The corrosion formula is as follows:

[0116]

[0117] In the formula, The pixel value of the pixel in the foreground mask image after erosion processing.

[0118] As can be seen, by comparing the pixel value of each pixel in the depth image with the depth threshold, it is determined whether the pixel belongs to the foreground or the background, thus accurately, simply and quickly determining the foreground mask image.

[0119] S320: Based on the foreground mask image, extract the region of interest containing the small electrical fittings from the target area.

[0120] Since the foreground and background parts can be distinguished in the foreground mask image, the foreground part can be extracted from the target area based on the foreground mask image, and this foreground part is taken as the region of interest containing the small power fittings.

[0121] In one alternative implementation, see Figure 6 The region of interest extraction steps in S320 include:

[0122] S510, multiply the pixel value of each pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image to obtain the multiplication result.

[0123] For example, the result of multiplication can be determined using the following formula:

[0124]

[0125] In the formula, The pixel value of the pixel in the target region. This is the result of multiplying the pixel value of a pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image.

[0126] S520 determines the region of interest containing small power fittings based on the results of each multiplication.

[0127] Specifically, when the first value is 0 and the second value is 1, the region formed by the pixels whose multiplication result is not 0 can be taken as the region of interest of the power fitting.

[0128] In the above implementation, the region of interest containing the small power fittings can be accurately and quickly determined by multiplying the pixel value of each pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image.

[0129] In this embodiment, based on the relationship between the pixel values ​​of each pixel in the depth image and the depth threshold, a foreground mask image is determined that can distinguish the foreground and background parts in the depth image. Therefore, based on this foreground mask image, the foreground and background parts of the target area can be accurately and quickly determined. The foreground part can then be used as the region of interest (ROI) containing the power fittings, allowing subsequent steps to focus on the power fittings themselves and minimizing background interference. Furthermore, this embodiment achieves precise separation of the foreground and background parts, accurately extracting the ROI regardless of the complexity of the background environment (e.g., strong light, cloudy days, vegetation obstruction, dense tower materials, backlighting), ensuring the effectiveness of quality assessment and effectively solving the problem of traditional image assessment methods failing in complex backgrounds.

[0130] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the defect identification method is further refined to include a re-shooting step.

[0131] See Figure 7 The reshooting process includes:

[0132] The S610 determines the recommended shooting distance when the sharpness is less than or equal to a preset sharpness threshold.

[0133] Understandably, if the sharpness is less than or equal to the preset sharpness threshold, it indicates that the sharpness of the region of interest (ROI) is insufficient. Using this ROI for defect identification may lead to identification errors, thus triggering a re-image process. To ensure that the sharpness of the ROI in the re-image is improved, a recommended shooting distance is provided.

[0134] For example, the recommended shooting distance drec can be determined using the following formula:

[0135] Drec=f×S rec / s

[0136] In the formula, f is the camera focal length of the image acquisition device (e.g., a drone), and S rec The recommended pixel size is s, where s is the current pixel size.

[0137] S620 generates a retake instruction based on the location data of the target area in the image to be processed and the recommended shooting distance.

[0138] That is, the retake instruction includes the location data of the target area in the image to be processed and the recommended shooting distance.

[0139] S630 sends a retake command to the image acquisition device.

[0140] The retake instruction is used to instruct the image acquisition device to adjust its pose based on the location data and recommended shooting distance, and to re-acquire the image to be processed containing the small power fittings.

[0141] Understandably, when the image acquisition device receives a retake instruction, it adjusts its position and orientation based on the information in the instruction. This ensures the image acquisition device is positioned at the recommended shooting distance from the small power fitting, allowing for a frontal shot. Then, the image acquisition device refocuses and takes a picture of the small power fitting, resulting in an image containing the fitting for processing. This allows the defect identification method described above to be re-executed.

[0142] Of course, in addition to reshooting, images containing regions of interest with a resolution less than or equal to a preset resolution threshold can be marked as low-quality images and stored in a preset database for manual review, thus avoiding the omission of high-quality images due to misjudgment by the aforementioned defect identification method.

[0143] In this embodiment, if the sharpness is less than or equal to a preset sharpness threshold, a retake is required. Furthermore, the retake quality includes the position data of the target area in the image to be processed and a recommended shooting distance. This allows the image acquisition device to adjust its pose based on the position data and the recommended shooting distance. After the pose adjustment, the sharpness of the subsequently re-acquired image to be processed can be improved, thereby enhancing the accuracy of defect identification.

[0144] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the defect identification method is further refined to include a threshold determination step.

[0145] See Figure 8 The threshold determination steps include:

[0146] S710 acquires multiple sample images and determines the sharpness of each sample image.

[0147] Among them, multiple sample images include clear sample images and blurry sample images.

[0148] In a real-world scenario, a quantity of n (n ranging from 1000 to 2000) of small hardware images captured by image acquisition equipment can be collected. These images should cover conditions including vegetation obstruction, overlapping tower materials, strong light, cloudy days, and different shooting distances. These small hardware images will be used as sample images, and staff will label each image with clear and blurry tags. Sample images with clear tags are considered clear sample images, and those with blurry tags are considered blurry sample images.

[0149] Among them, the proportion of clear sample images in the sample images is r. clear The percentage (r) of blurred sample images in the total sample images is 60%~70%. blur It is 30%~40%. clear S is a set of clear sample images. blur It is a collection of blurred sample images.

[0150] Among them, the number of clear sample images |S clear | Can be:

[0151]

[0152] Among them, the number of blurred sample images |S blur | Can be:

[0153]

[0154] For each sample image, the sharpness of the sample image can be determined according to the sharpness calculation process in the above embodiments.

[0155] S720: For each candidate sharpness threshold within a preset threshold range, determine the true positive rate and false positive rate corresponding to the candidate sharpness threshold based on the sharpness of each sample image.

[0156] The true positive rate represents the proportion of images with a sharpness greater than the candidate sharpness threshold among all sharp sample images. It can be calculated using the following formula:

[0157]

[0158] In the formula, TPR is the true positive rate, TP is the number of true positive sample images, that is, the number of clear sample images that are judged to meet the clarity requirements; FN is the number of false positive samples, that is, the number of blurry sample images that are judged to meet the clarity requirements.

[0159] The sharpness requirement refers to the requirement that the sharpness of the sample image is greater than the candidate sharpness threshold.

[0160] The false positive rate represents the proportion of images with a sharpness greater than the candidate sharpness threshold in each blurred sample image. It can be calculated using the following formula:

[0161]

[0162] In the formula, FPR is the false positive rate, and TN is the number of true negative sample images, that is, the number of blurry sample images that are judged to not meet the clarity requirements.

[0163] S730: Select a preset sharpness threshold from each candidate sharpness threshold based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold.

[0164] Specifically, with the goal of maximizing the true positive rate and minimizing the false positive rate, candidate sharpness thresholds that meet the above objectives are selected within a preset threshold range and used as the preset sharpness thresholds.

[0165] In this embodiment, for each candidate sharpness threshold within a preset threshold range, the true positive rate and false positive rate corresponding to the candidate sharpness threshold are determined based on the sharpness of each sample image. Then, based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold, the preset sharpness threshold is selected from the candidate sharpness thresholds. Using this method to determine the preset sharpness threshold, instead of setting a fixed value based on manual experience, can improve the accuracy of subsequent judgment on whether the region of interest meets the sharpness requirements based on the preset sharpness threshold, thereby improving the accuracy of defect identification.

[0166] Based on the technical solutions provided in the above embodiments, an optional embodiment is provided, in which the preset sharpness threshold selection step in S730 is refined.

[0167] See Figure 9 The detailed preset sharpness threshold selection steps include:

[0168] S810, for each candidate sharpness threshold, determine the discrimination coefficient corresponding to the candidate sharpness threshold based on the difference between the true positive rate and the false positive rate corresponding to the candidate sharpness threshold.

[0169] The discrimination coefficient characterizes the ability to distinguish between sharp and blurry sample images based on the candidate sharpness threshold. In other words, the discrimination coefficient characterizes the ability to determine whether a sharp sample image meets the sharpness requirement and whether a blurry sample image does not meet the sharpness requirement based on the candidate sharpness threshold.

[0170] Specifically, the difference between the true positive rate and the false positive rate corresponding to the candidate sharpness threshold is directly used as the discrimination coefficient corresponding to that candidate sharpness threshold. That is, T = TPR - FPR.

[0171] S820: Select the candidate sharpness threshold with the highest discrimination coefficient from all candidate sharpness thresholds as the preset sharpness threshold.

[0172] That is, the candidate sharpness threshold corresponding to the largest discrimination coefficient among the candidate sharpness thresholds is used as the preset sharpness threshold.

[0173] In practical scenarios, the specific implementation of S820 may include: plotting an ROC (Receiver Operating Characteristic) curve with resolution as the upper horizontal axis, true positive rate as the vertical axis, and false positive rate as the lower horizontal axis; then calculating the area under the curve (AUC). The closer the AUC is to 1, the higher the match between quality assessment and defect identification requirements. AUC can be expressed as:

[0174]

[0175] In the formula, I() is an indicator function, if it satisfies If I is 1, then I is 1; otherwise, it is 0. Bnorm is the normalized sharpness.

[0176] Then, the sharpness corresponding to the point with the highest Youden index (discrimination coefficient mentioned above) in the ROC curve is selected as the preset sharpness threshold.

[0177] In the above process, ROC curve analysis avoids the subjectivity of manual experience settings and adapts to the image quality assessment needs under different shooting distances, camera parameters, and lighting conditions.

[0178] In this embodiment, the discrimination coefficient corresponding to the candidate sharpness threshold is determined based on the difference between the true positive rate and the false positive rate corresponding to the candidate sharpness threshold. The candidate sharpness threshold with the largest discrimination coefficient among all candidate sharpness thresholds is then used as the preset sharpness threshold. The preset sharpness threshold obtained in this way has the strongest ability to determine whether a clear sample image meets the sharpness requirements and whether a blurry sample image does not meet the sharpness requirements. Therefore, in the step of participating in the defect identification method based on the preset sharpness threshold, the region of interest that meets the sharpness requirements can be accurately identified, thereby improving the accuracy of defect identification.

[0179] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0180] Based on the same inventive concept, this application also provides a defect identification device for implementing the defect identification method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more defect identification device embodiments provided below can be found in the limitations of the defect identification method described above, and will not be repeated here.

[0181] In one exemplary embodiment, a defect identification device is provided, such as Figure 10 As shown, the device includes:

[0182] Image acquisition module 910 is used to acquire the image to be processed, which includes small electrical fittings, acquired by the image acquisition device;

[0183] The threshold determination module 920 is used to determine the depth threshold based on the actual shooting distance of the image to be processed; wherein, the actual shooting distance is the actual distance between the image acquisition device and the small power fitting, and the depth threshold is positively correlated with the actual shooting distance;

[0184] The region extraction module 930 is used to extract the region of interest containing small electrical fittings from the image to be processed based on a depth threshold.

[0185] The sharpness determination module 940 is used to determine the sharpness of the region of interest based on the differences in pixel values ​​of different pixels in the region of interest.

[0186] The type recognition module 950 is used to identify defects in small power fittings based on the region of interest and the resolution when the resolution is greater than a preset resolution threshold.

[0187] In one embodiment, the region extraction module includes: a region extraction unit, used to extract the target region where the power fittings are located from the image to be processed; a depth determination unit, used to determine the depth image corresponding to the target region; wherein, the pixel value of each pixel in the depth image is the depth information of the corresponding pixel in the target region; and a region extraction unit, used to extract the region of interest containing the power fittings from the target region based on the depth image and a depth threshold.

[0188] In one embodiment, the region extraction unit includes: a mask determination subunit, configured to determine a foreground mask image corresponding to the depth image based on the relationship between the pixel value of each pixel in the depth image and a depth threshold; and a region extraction subunit, configured to extract a region of interest containing small power fittings from the target region based on the foreground mask image.

[0189] In one embodiment, the mask determination subunit is specifically configured to: for each pixel in the depth image, if the pixel value of the pixel is greater than the depth threshold, configure the pixel value of the corresponding pixel in the foreground mask image as a first value; if the pixel value of the pixel is less than or equal to the depth threshold, configure the pixel value of the corresponding pixel in the foreground mask image as a second value; wherein the first value and the second value are different.

[0190] In one embodiment, the region extraction subunit is specifically used to: multiply the pixel value of each pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image to obtain the multiplication result; and determine the region of interest containing the small power fittings based on the multiplication results.

[0191] In one embodiment, the apparatus further includes: a distance determination module, configured to determine a recommended shooting distance when the sharpness is less than or equal to a preset sharpness threshold; an instruction generation module, configured to generate a retake instruction based on the position data of the target area in the image to be processed and the recommended shooting distance; and a quality delivery module, configured to send the retake instruction to the image acquisition device; wherein the retake instruction is used to instruct the image acquisition device to adjust its pose based on the position data and the recommended shooting distance, and to re-acquire the image to be processed containing the small power fittings.

[0192] In one embodiment, the apparatus further includes: an image acquisition module, configured to acquire multiple sample images and determine the sharpness of each sample image; wherein the multiple sample images include sharp sample images and blurry sample images; an index determination module, configured to determine the true positive rate and false positive rate corresponding to each candidate sharpness threshold within a preset threshold range, based on the sharpness of each sample image; wherein the true positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each sharp sample image, and the false positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each blurry sample image; and a threshold selection module, configured to select a preset sharpness threshold from each candidate sharpness threshold based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold.

[0193] In one embodiment, the threshold selection module is specifically used to: for each candidate sharpness threshold, determine the discrimination coefficient corresponding to the candidate sharpness threshold based on the difference between the true positive rate and the false positive rate corresponding to the candidate sharpness threshold; wherein, the discrimination coefficient characterizes the ability to distinguish between sharp sample images and blurry sample images based on the candidate sharpness threshold; and select the candidate sharpness threshold with the highest discrimination coefficient from each candidate sharpness threshold as the preset sharpness threshold.

[0194] Each module in the aforementioned defect identification device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0195] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a defect identification method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0196] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0197] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the defect identification method described above.

[0198] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the defect identification method described in the above embodiment.

[0199] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the defect identification method described above.

[0200] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0201] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0202] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0203] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A defect identification method, characterized in that, include: Acquire the image to be processed, which includes small electrical fittings, captured by the image acquisition device; A depth threshold is determined based on the actual shooting distance of the image to be processed; wherein, the actual shooting distance is the actual distance between the image acquisition device and the small power fitting, and the depth threshold is positively correlated with the actual shooting distance; Based on the depth threshold, extract the region of interest containing the small power fitting from the image to be processed; The sharpness of the region of interest is determined based on the differences in pixel values ​​among different pixels in the region of interest. When the resolution is greater than a preset resolution threshold, the defect identification of the power fitting is performed based on the region of interest and the resolution.

2. The method according to claim 1, characterized in that, Extracting the region of interest containing the small power fitting from the image to be processed based on the depth threshold includes: Extract the target area where the small power fitting is located from the image to be processed; Determine the depth image corresponding to the target region; wherein, the pixel value of each pixel in the depth image is the depth information of the corresponding pixel in the target region; Based on the depth image and the depth threshold, a region of interest containing the power fitting is extracted from the target region.

3. The method according to claim 2, characterized in that, The step of extracting the region of interest containing the small power fitting from the target region based on the depth image and the depth threshold includes: Based on the relationship between the pixel values ​​of each pixel in the depth image and the depth threshold, the foreground mask image corresponding to the depth image is determined; Based on the foreground mask image, extract the region of interest containing the power fitting from the target region.

4. The method according to claim 3, characterized in that, The step of determining the foreground mask image corresponding to the depth image based on the relationship between the pixel values ​​of each pixel in the depth image and the depth threshold includes: For each pixel in the depth image, if the pixel value of the pixel is greater than the depth threshold, the pixel value of the corresponding pixel in the foreground mask image is configured as a first value. If the pixel value of the pixel is less than or equal to the depth threshold, the pixel value of the corresponding pixel in the foreground mask image is configured as the second value; The first value is different from the second value.

5. The method according to claim 3, characterized in that, The step of extracting the region of interest containing the small power fitting from the target region based on the foreground mask image includes: Multiply the pixel value of each pixel in the target region with the pixel value of the corresponding pixel in the foreground mask image to obtain the multiplication result; Based on the multiplication results, the region of interest containing the power fitting is determined.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Multiple sample images are acquired, and the sharpness of each sample image is determined; wherein the multiple sample images include sharp sample images and blurry sample images; For each candidate sharpness threshold within a preset threshold range, the true positive rate and false positive rate corresponding to the candidate sharpness threshold are determined based on the sharpness of each sample image; wherein, the true positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each of the sharp sample images, and the false positive rate represents the proportion of images with sharpness greater than the candidate sharpness threshold in each of the blurry sample images. Based on the true positive rate and false positive rate corresponding to each of the candidate sharpness thresholds, the preset sharpness threshold is selected from each of the candidate sharpness thresholds.

7. The method according to claim 6, characterized in that, The step of selecting the preset sharpness threshold from each of the candidate sharpness thresholds based on the true positive rate and false positive rate corresponding to each candidate sharpness threshold includes: For each candidate sharpness threshold, a discrimination coefficient corresponding to the candidate sharpness threshold is determined based on the difference between the true positive rate and the false positive rate corresponding to the candidate sharpness threshold; wherein, the discrimination coefficient characterizes the ability to distinguish between sharp sample images and blurry sample images based on the candidate sharpness threshold; From the candidate sharpness thresholds, select the candidate sharpness threshold with the highest discrimination coefficient as the preset sharpness threshold.

8. The method according to any one of claims 2 to 5, characterized in that, The method further includes: If the sharpness is less than or equal to the preset sharpness threshold, a recommended shooting distance is determined; Based on the location data of the target area in the image to be processed and the recommended shooting distance, a reshoot instruction is generated; The retake instruction is sent to the image acquisition device; wherein, the retake instruction is used to instruct the image acquisition device to adjust its pose according to the position data and the recommended shooting distance, and to re-acquire the image to be processed containing the small power fitting.

9. A defect identification device, characterized in that, include: The image acquisition module is used to acquire images containing small electrical fittings from the image acquisition device. A threshold determination module is used to determine a depth threshold based on the actual shooting distance of the image to be processed; wherein the actual shooting distance is the actual distance between the image acquisition device and the small power fitting, and the depth threshold is positively correlated with the actual shooting distance; The region extraction module is used to extract the region of interest containing the small power fitting from the image to be processed based on the depth threshold. A sharpness determination module is used to determine the sharpness of the region of interest based on the differences in pixel values ​​of different pixels in the region of interest. The type recognition module is used to identify defects in the power fittings based on the region of interest and the resolution when the resolution is greater than a preset resolution threshold.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.