A method and device for detecting a failure of a port crane fastener

By combining the YOLO v5s algorithm with image processing technology using drone image acquisition devices, the accuracy and efficiency issues of fastener inspection for port cranes have been resolved, achieving efficient and accurate fault detection and overcoming the limitations of manual inspection and the challenges of image acquisition.

CN117094952BActive Publication Date: 2026-11-24FUQING BRANCH OF FUJIAN NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310933157.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-27
Publication Date
2026-11-24
Estimated Expiration
2043-07-27

AI Technical Summary

Technical Problem

Existing methods for inspecting fasteners on port cranes rely on manual observation, which leads to omissions, misjudgments, and subjectivity, resulting in inaccurate inspection results. Furthermore, it is difficult to efficiently collect images at port construction sites.

Method used

A fault detection model is constructed using the YOLO v5s algorithm, combined with UAV image acquisition devices and image processing technologies, including noise reduction, fastener region localization, and image enhancement. The shooting path is planned using a genetic algorithm, and the image quality is improved using BM3D and Retinex algorithms. The YOLO v5s algorithm is also improved to enhance detection accuracy.

Benefits of technology

It improves the accuracy and efficiency of fastener fault detection for port cranes, reduces manpower and time costs, ensures the accuracy of image acquisition and the objectivity of detection results, and overcomes the limitations of traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117094952B_ABST
    Figure CN117094952B_ABST
Patent Text Reader

Abstract

This invention relates to a method and apparatus for detecting fastener faults in port cranes. The method involves denoising an acquired image of the port crane fasteners to obtain a denoised image, locating the fastener region within the denoised image using the YOLO v5s algorithm, obtaining a fastener region image, enhancing this region to obtain an enhanced image, and inputting this enhanced image into a fault detection model built on the YOLO v5s algorithm for fault detection, thereby outputting the fault detection result. Therefore, this invention overcomes the subjectivity of manual detection by using the YOLO v5s algorithm to build the fault detection model, reducing manpower and time costs. The denoising of the acquired port crane fastener image avoids the influence of noise interference factors, improving the accuracy of fastener region location. The image enhancement processing of the fastener region image during fault detection improves image quality and ensures the accuracy of fault detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fault detection technology, and in particular to a method and apparatus for fault detection of fasteners for port cranes. Background Technology

[0002] Port cranes, also known as port cranes, are often subject to surface corrosion, coating peeling, and loose fasteners due to factors such as climate, sunlight, environment, and human factors during operation. This can lead to safety hazards and potentially catastrophic consequences.

[0003] Currently, the common method for inspecting fasteners on port cranes is manual inspection. However, manual inspection is difficult to implement, takes a long time, and has a high possibility of missed or incorrect inspections. Furthermore, this method relies on the experience and judgment of the inspectors, so the inspection results are often subjective and inaccurate. Summary of the Invention

[0004] The technical problem to be solved by the present invention is: to provide a method and apparatus for detecting fastener faults in port cranes, thereby improving the accuracy of fastener fault detection in port cranes.

[0005] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:

[0006] In a first aspect, the present invention provides a method for detecting fastener failures in port cranes, comprising:

[0007] Acquire images of port crane fasteners, perform noise reduction processing on the images of port crane fasteners to obtain noise-reduced images of port crane fasteners, and use the YOLO v5s algorithm to locate the fastener regions in the noise-reduced images of port crane fasteners to obtain images of the fastener regions.

[0008] The image of the fastener region is subjected to image enhancement processing to obtain an enhanced image of the fastener region;

[0009] The enhanced fastener region image is input into a fault detection model built based on the YOLO v5s algorithm for fault detection, and the fault detection result is output.

[0010] The beneficial effects of this invention are as follows: the fault detection model constructed by using the YOLO v5s algorithm overcomes the subjectivity of manual detection, reduces manpower and time costs, performs noise reduction processing on the acquired port crane fastener images to avoid the influence of noise interference factors in the port crane fastener images, improves the accuracy of fastener area positioning, and performs image enhancement processing on the fastener area images during fault detection to improve image quality and further ensure the accuracy of fault detection.

[0011] Optionally, acquiring the image of the hoist fastener includes:

[0012] Obtain the coordinate information of the fasteners of the port crane, input the coordinate information into the path planning algorithm of the genetic algorithm for path calculation, and output the shooting path;

[0013] Based on the shooting path, an unmanned aerial vehicle (UAV) image acquisition device is used to acquire images of the port crane fasteners.

[0014] As described above, using a drone image acquisition device to acquire images of port crane fasteners overcomes the problem of difficulty in using traditional methods for image acquisition at port construction sites. At the same time, the drone image acquisition device calculates the shooting path based on the coordinate information of the port crane fasteners in the path planning of the genetic algorithm, ensuring the accuracy of the images of the port crane fasteners acquired by the drone image acquisition device.

[0015] Optionally, the step of using a drone image acquisition device to acquire images of the port crane fasteners based on the shooting path includes:

[0016] The Zhang's calibration method was used to calibrate the UAV image acquisition device, resulting in a calibrated UAV image acquisition device.

[0017] Based on the shooting path, the calibrated UAV image acquisition device is used to acquire images of the port crane fasteners.

[0018] As described above, before using the UAV image acquisition device to acquire images of port crane fasteners, the UAV was calibrated using Zhang's calibration method, which determined the internal and external parameters and distortion parameters of the digital camera of the UAV image acquisition device, thereby improving the accuracy of port crane fastener image acquisition.

[0019] Optionally, the step of performing noise reduction processing on the port crane fastener image to obtain a noise-reduced port crane fastener image includes:

[0020] The image of the crane fasteners is converted to YUV mode using the YUV color space conversion matrix to obtain the original YUV crane fastener image:

[0021]

[0022] Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue;

[0023] The BM3D algorithm is used to perform a similar image block search on the original YUV port crane fastener image to obtain all first similar image blocks. All first similar image blocks are then stacked to form a first 3D array.

[0024]

[0025]

[0026]

[0027] in, A set representing similar image patches. The maximum error threshold representing the similarity between two image patches. This represents the Euclidean distance between the target block and the search block, where x represents the number of pixels in the original YUV crane fastener image, and X represents the original YUV crane fastener image. Z represents the target block of the original YUV port crane fastener image. x This represents the search block for the original YUV port crane fastener image. γ' represents the size of the image patch in the original YUV port crane fastener image, and γ' represents the hard thresholding operation. Indicates the threshold;

[0028] The first 3D array is subjected to a cooperative transform filtering process to obtain a cooperative transform filtered first 3D array. The filtered first 3D array is then placed back into the corresponding position of the original YUV port crane fastener image to obtain a filtered port crane fastener image. The filtered port crane fastener image is then subjected to an aggregation weighted filtering process to obtain a basic estimated port crane fastener image.

[0029] The BM3D algorithm is used to search for similar image blocks in the basic estimated port crane fastener image to obtain all second similar image blocks. All second similar image blocks are stacked to form a second 3D array.

[0030] The second 3D array is subjected to Wiener filtering replacement processing to obtain the replaced second 3D array. The replaced second 3D array is then placed back into the corresponding position of the basic estimated port crane fastener image to obtain the final estimated port crane fastener image.

[0031]

[0032]

[0033]

[0034]

[0035] in, This represents the second 3D array. Represents the first 3D array, This indicates the final estimated image of the hoist fasteners;

[0036] The final estimated image of the port crane fasteners is inversely converted to RGB mode using the RGB color space conversion matrix to obtain the denoised image of the port crane fasteners:

[0037]

[0038] Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue.

[0039] As described above, the BM3D algorithm is used to denoise the images of port crane fasteners. When searching for similar image blocks, the image blocks are subjected to a separable two-dimensional orthogonal transformation to calculate the Euclidean distance. This avoids the situation where two blocks with large differences in a noise-free image appear to have smaller differences in a noisy image due to the large variance, thus preventing misjudgment as similar image blocks. Furthermore, the filtered images of port crane fasteners are subjected to aggregated weighted filtering to overcome the situation where there are multiple uncertain values ​​for pixels in the overlapping area after denoising when similar image blocks overlap, thus ensuring the quality of the denoised images.

[0040] Optionally, the step of locating the fastener region in the noise-reduced port crane fastener image using the YOLO v5s algorithm to obtain the fastener region image includes:

[0041] Obtain historical fastener regions from historical images of port crane fasteners, and randomly divide the historical fastener regions into training and testing sets;

[0042] The training set is input into the YOLO v5s algorithm for training to generate a localization model. The test set is input into the localization model for testing, and the test results are output. When the test results reach the expected effect, the localization model that has achieved the expected effect is output.

[0043] The fastener region image is obtained by locating the fastener region in the noise-reduced port crane fastener image using the positioning model.

[0044] Optionally, when the test result reaches the expected effect, outputting the localization model that achieves the expected effect includes:

[0045] The detection results are evaluated based on accuracy, recall, and mean precision. When accuracy, recall, and mean precision all reach their respective thresholds, the detection results achieve the expected effect, and a localization model that achieves the expected effect is output.

[0046] As described above, the YOLO v5s algorithm is used to build a positioning model, which improves the accuracy of positioning. Furthermore, the detection results are evaluated in multiple dimensions based on precision, recall, and mean precision, ensuring the accuracy of the final output positioning model and thus improving the accuracy of fastener area positioning.

[0047] Optionally, the step of performing image enhancement processing on the fastener region image to obtain an enhanced fastener region image includes:

[0048] The fastener region image is processed using a histogram equalization method to obtain an equalized fastener region image:

[0049]

[0050]

[0051]

[0052] in, Let G represent the pixel gray level of the equalized fastener region image, and let P(t) represent the probability density function of the fastener region image with gray level G. g Let g represent the number of pixels in the fastener region image, M represent the total number of pixels in the fastener region image, and C(t) represent the cumulative distribution function of the fastener region image.

[0053] An improved Retinex algorithm is used to enhance the image of the equalized fastener region, resulting in an enhanced image of the fastener region. The improved Retinex algorithm replaces the logarithmic transform in the original Retinex algorithm with an adaptive power transform.

[0054]

[0055] F(i,j)=c*[r(i,j)] γ

[0056] Where R(i,j) represents the formula for replacing the logarithmic transformation with an adaptive power transformation, F(i,j) represents the image after power transformation of the pixel values ​​of the equalized fastener region image, γ1 and γ2 both represent adaptive exponents, and r(i,j) represents the pixel values ​​of the equalized fastener region image.

[0057] As described above, the histogram equalization method is used to equalize the image of the fastener region, thereby improving the contrast of the image. The logarithmic transformation in the Retinex algorithm is replaced with an adaptive power transformation to enhance the image of the equalized fastener region, ensuring image quality while preserving the image's own detailed features.

[0058] Optionally, the step of inputting the enhanced fastener region image into a fault detection model constructed based on the YOLO v5s algorithm for fault detection includes:

[0059] A historical fault dataset of port crane fasteners is obtained, and the K-Means clustering algorithm in YOLO v5s is used to cluster the historical fault dataset to obtain a clustered fault dataset.

[0060] A fault detection model is constructed using the improved YOLO v5s algorithm based on the clustered fault dataset.

[0061] The enhanced fastener region image is input into the fault detection model for fault detection.

[0062] The improved YOLO v5s algorithm replaces the classification loss function, localization loss function, and confidence loss function in the YOLO v5s algorithm with the balanced cross-entropy loss function, DIoU loss function, and center loss function.

[0063]

[0064]

[0065]

[0066]

[0067]

[0068] Where BCELoss(p,q) represents the balanced cross-entropy loss function, p i q represents the probability of the fault detection model identifying the i-th category of fault. i w represents the actual probability of the i-th class. i Let d(P,G) represent the weight of the i-th category, N represent the total number of categories, DIoU(P,G) represent the DIoU loss function, P is the predicted bounding box of the target box, G is the ground truth bounding box of the target box, d(P,G) is the negative Euclidean distance between the center points of the predicted box and the ground truth box, and x p y p Let x and x represent the coordinates of the center point of the prediction box P, respectively. g y g Let P and G represent the center coordinates of the actual bounding box G, respectively. CenterLoss(P,G) represents the center loss function, where P... cen G is the center of the feature vector of the predicted box P. cen It is the center of the feature vector of the actual bounding box G. ||·||2 represents the Euclidean distance. denoted as the squared Euclidean distance between the center of the predicted box and the center of the actual box, and c represents the weight of the balancing center loss.

[0069] As described above, replacing the classification loss function, localization loss function, and confidence loss function in the YOLO v5s algorithm with the balanced cross-entropy loss function, DIoU loss function, and center loss function fully utilizes the ability of the balanced cross-entropy loss function to solve class imbalance, the ability of the DIoU loss function to be more robust to discrete group samples, and the ability of the center loss function to more accurately predict the target center, thereby improving the accuracy of the fault detection model in fault detection.

[0070] Optionally, the improved YOLO v5s algorithm includes:

[0071] Add SENet attention mechanism and CBAM attention mechanism to the CSP module of YOLO v5s algorithm:

[0072] y = F SE (x)=z'×x

[0073] z'=F Excitation (z,W)=σ(W2g(W1z))

[0074]

[0075] M channel =σ(z2(ReLU(z1(AvgPool(x)))))×x+σ(z2(ReLU(z1(MaxPool(x)))))×x

[0076] M spatial =σ(z4(ReLU(z3(Conv) 1×1 (M channel )))))×M channel +σ(z6(ReLU(z5(Conv 1×1 (M channel )))))×M channel

[0077] Where z' represents the feature importance weights obtained from the Excitation operation, x represents the feature map of the enhanced fastener region image, y represents the feature map output after adding the SENet attention mechanism, z represents the feature vector obtained from the Squeeze operation, W1 and W2 represent the learnable weights of the fully connected layer, g represents the ReLU activation function, σ represents the Sigmoid function, AvgPool(x) represents average pooling of the feature map of the enhanced fastener region image, MaxPool(x) represents max pooling of the feature map of the enhanced fastener region image, z1 and z2 represent the learned weights of the fully connected layer, M channel The output representing channel attention, Conv 1×1This represents a 1x1 convolutional layer, where z3, z4, z5, and z6 represent the learned weights of the convolutional layer, and M... spatial This represents the output of spatial attention.

[0078] As described above, the SENet attention mechanism and CBAM attention mechanism have been added to the CSP module of the YOLO v5s algorithm to further optimize the fault detection model and improve the accuracy of fault detection.

[0079] In a second aspect, an apparatus for detecting fastener failures of port cranes is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method for detecting fastener failures of port cranes as described in the first aspect.

[0080] The technical effect of the device for detecting fastener failures of port cranes provided in the second aspect is the same as that described in the relevant description of the method for detecting fastener failures of port cranes provided in the first aspect. Attached Figure Description

[0081] Figure 1 A flowchart illustrating a method for detecting fastener faults in port cranes provided in an embodiment of the present invention;

[0082] Figure 2 This is a schematic diagram of the overall process of a method for detecting fastener faults in port cranes provided in an embodiment of the present invention;

[0083] Figure 3 This refers to the UAV image acquisition device involved in the embodiments of the present invention;

[0084] Figure 4 This is a schematic diagram illustrating the addition of the SENet attention mechanism to the CSP module of the YOLO v5s algorithm as described in this embodiment of the invention.

[0085] Figure 5 This is a schematic diagram of a port tugboat scheduling device provided in an embodiment of the present invention.

[0086] [Explanation of Labels in the Attached Image]

[0087] 1. A device for detecting fastener failures in port cranes;

[0088] 2. Processor;

[0089] 3. Memory. Detailed Implementation

[0090] To better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the present invention can be understood more clearly and thoroughly, and that the scope of the present invention can be fully conveyed to those skilled in the art.

[0091] Example 1

[0092] Please refer to Figures 1 to 4 This invention provides a method for detecting fastener failures in port cranes, comprising the following steps:

[0093] S1. Obtain the image of the port crane fastener, perform noise reduction processing on the image of the port crane fastener to obtain the noise-reduced image of the port crane fastener, and use the YOLO v5s algorithm to locate the fastener region in the noise-reduced image of the port crane fastener to obtain the fastener region image.

[0094] At this point, obtaining the image of the crane fasteners in step S1 includes:

[0095] S101. Obtain the coordinate information of the fasteners of the port crane, input the coordinate information into the path planning algorithm of the genetic algorithm for path calculation, and output the shooting path;

[0096] In this embodiment, the coordinate information of the port crane fasteners is input into the path planning algorithm of the genetic algorithm. The target area, i.e., the port crane area, is divided into multiple squares, and a certain number of paths are randomly generated. These paths are used as the initial solutions of the population. The fitness value of each path is calculated by comprehensively considering factors such as the length of each path, the degree of obstacle avoidance, and the distribution of fastener positions. According to the roulette wheel algorithm, the path with the higher fitness value is selected as the next generation population. Two paths are randomly selected from the next generation population for crossover operation to generate new paths. The new paths are mutated to obtain mutated paths. The mutated paths replace the original paths according to the fitness function. The genetic operation is repeated on the replaced paths until the preset termination condition is reached, and the optimal path, i.e., the shooting path, is output.

[0097] S102. Based on the shooting path, use a drone image acquisition device to acquire images of the port crane and obtain images of the port crane fasteners.

[0098] In this embodiment, as Figure 3As shown, the UAV image acquisition device consists of a software system and a hardware system. The software system comprises a control system, an image acquisition system, and a data transmission system. The control system controls the flight of the UAV, the image acquisition system captures and stores images taken by the UAV, and the data transmission system transmits images to the ground station in real time via a wireless network. The hardware system consists of a UAV, a digital camera, a GPS module, and a wireless image transmission module. The UAV carries the digital camera, the digital camera captures and stores the captured images, the GPS records the UAV's location, and the wireless image transmission module transmits images to the ground station in real time.

[0099] At this point, step S102 includes:

[0100] S1021. The UAV image acquisition device is calibrated using Zhang's calibration method to obtain the calibrated UAV image acquisition device.

[0101] In this embodiment, Zhang's calibration method is used to calibrate the digital camera in the UAV image acquisition device to determine the intrinsic and extrinsic parameters and distortion parameters of the digital camera.

[0102] S1022. Based on the shooting path, use the calibrated UAV image acquisition device to acquire images of the port crane.

[0103] At this point, the noise reduction processing of the port crane fastener image in step S1 to obtain the noise-reduced port crane fastener image includes:

[0104] S103. Convert the crane fastener image to YUV mode according to the YUV color space conversion matrix to obtain the original YUV crane fastener image:

[0105]

[0106] Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue;

[0107] In this embodiment, the acquired image of the port crane fastener is an RGB image, which is converted to YUV mode according to the YUV color space conversion matrix to obtain the original YUV port crane fastener image.

[0108] S104. The BM3D algorithm is used to perform a similar image block search on the original YUV port crane fastener image to obtain all first similar image blocks, and all first similar image blocks are stacked to form a first 3D array:

[0109]

[0110]

[0111]

[0112] in, A set representing similar image patches. The maximum error threshold representing the similarity between two image patches. This represents the Euclidean distance between the target block and the search block, where x represents the number of pixels in the original YUV crane fastener image, and X represents the original YUV crane fastener image. Z represents the target block of the original YUV port crane fastener image. x This represents the search block for the original YUV port crane fastener image. γ' represents the size of the image patch in the original YUV port crane fastener image, and γ' represents the hard thresholding operation. Indicates the threshold;

[0113] In this embodiment, when calculating the Euclidean distance between the target block and the search block, the two image blocks are subjected to a separable two-dimensional orthogonal transformation, and the coefficients with hard thresholding operation amplitude less than the threshold are set to 0. Only image blocks with Euclidean distance less than the maximum error threshold are retained, thereby obtaining a set of similar image blocks.

[0114] S105. Perform collaborative transformation filtering on the first 3D array to obtain a collaboratively transformed filtered first 3D array. Place the filtered first 3D array back into the corresponding position of the original YUV port crane fastener image to obtain a filtered port crane fastener image. Perform aggregation weighted filtering on the filtered port crane fastener image to obtain a basic estimated port crane fastener image.

[0115] In this embodiment, when performing aggregation and weighted filtering on the filtered image of the crane fasteners, Euclidean distance is used. and block-by-block estimates As a reference weight, aggregated weighted filtering is performed. When similar image blocks overlap, there will be multiple noise reduction results for pixels in the overlapping area. Therefore, different estimates for the same pixel need to be assigned weights separately, and the weighted average result is taken as the final noise reduction result. The formula for block-by-block estimation is as follows:

[0116]

[0117] S106. Use the BM3D algorithm to perform similar image block search on the basic estimated port crane fastener image to obtain all second similar image blocks, and stack all the second similar image blocks to form a second 3D array.

[0118] S107. Perform Wiener filtering replacement processing on the second 3D array to obtain the replaced second 3D array. Put the replaced second 3D array back into the corresponding position of the basic estimated port crane fastener image to obtain the final estimated port crane fastener image.

[0119]

[0120]

[0121]

[0122]

[0123] in, This represents the second 3D array. Represents the first 3D array, This indicates the final estimated image of the hoist fasteners;

[0124] S108. Convert the final estimated port crane fastener image to RGB mode according to the RGB color space conversion matrix to obtain the denoised port crane fastener image:

[0125]

[0126] Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue.

[0127] At this point, the step S1, which involves locating the fastener region in the noise-reduced port crane fastener image using the YOLO v5s algorithm to obtain the fastener region image, includes:

[0128] S109. Obtain the historical fastener region of historical port crane fastener images, and randomly divide the historical fastener region into a training set and a test set.

[0129] In this embodiment, the historical fastener images of port cranes can be obtained through methods such as manually captured historical images, drone images, or images obtained from the internet. When randomly dividing the historical fastener regions into training and test sets, the division can be done according to a preset ratio, such as 8:2. That is, the historical fastener regions are randomly divided into training and test sets in a ratio of 8:2. The preset ratio can be adjusted according to the actual situation.

[0130] S110. Input the training set into the YOLO v5s algorithm for training to generate a localization model. Input the test set into the localization model for testing and output the test results. When the test results reach the expected effect, output the localization model that has achieved the expected effect.

[0131] At this point, step S110, when the test result reaches the expected effect, outputs the localization model that achieves the expected effect, including:

[0132] S1101. The detection results are evaluated based on accuracy, recall, and mean precision. When accuracy, recall, and mean precision all reach the corresponding thresholds, the detection results achieve the expected effect, and a positioning model that achieves the expected effect is output.

[0133] In this embodiment, the corresponding thresholds for precision, recall, and mean precision are preset, and the calculation formulas for precision, recall, and mean precision are as follows:

[0134]

[0135]

[0136]

[0137] Where P represents precision, TP represents the number of samples that correctly located the fastener region, FP represents the number of samples that incorrectly located the fastener region, R represents recall, FN represents the number of samples that did not locate the fastener region, mAP represents mean precision, and P(r) represents the recall curve.

[0138] S111. The fastener region is located in the noise-reduced port crane fastener image using the positioning model to obtain the fastener region image.

[0139] S2. Perform image enhancement processing on the fastener region image to obtain an enhanced fastener region image;

[0140] At this point, step S2 includes:

[0141] S201. The fastener region image is processed by histogram equalization to obtain an equalized fastener region image:

[0142]

[0143]

[0144]

[0145] in, Let G represent the pixel gray level of the equalized fastener region image, and let P(t) represent the probability density function of the fastener region image with gray level G. gLet g represent the number of pixels in the fastener region image, M represent the total number of pixels in the fastener region image, and C(t) represent the cumulative distribution function of the fastener region image.

[0146] In this embodiment, the fastener region image with gray level G is defined as F, F∈F(x,y), and its gray level interval is [0,G-1]. Thus, the probability density function of F is represented by P(t).

[0147] S202. The equalized fastener region image is enhanced using an improved Retinex algorithm to obtain an enhanced fastener region image. The improved Retinex algorithm replaces the logarithmic transform in the Retinex algorithm with an adaptive power transform.

[0148]

[0149] F(i,j)=c*[r(i,j)] γ

[0150] Where R(i,j) represents the formula for replacing the logarithmic transformation with an adaptive power transformation, F(i,j) represents the image after power transformation of the pixel values ​​of the equalized fastener region image, γ1 and γ2 both represent adaptive exponents, and r(i,j) represents the pixel values ​​of the equalized fastener region image.

[0151] S3. Input the enhanced fastener region image into the fault detection model constructed based on the YOLO v5s algorithm for fault detection, and output the fault detection result.

[0152] At this point, step S3, which involves inputting the enhanced fastener region image into the fault detection model constructed based on the YOLO v5s algorithm for fault detection, includes:

[0153] S301. Obtain the historical fault dataset of the port crane fasteners, and use the K-Means clustering algorithm in the YOLO v5s algorithm to cluster the historical fault dataset to obtain the clustered fault dataset.

[0154] In this embodiment, when using the K-Means clustering algorithm in the YOLO v5s algorithm to cluster the historical fault dataset, k cluster centers (C1, C2, ..., C5) are randomly initialized from the historical fault dataset. j For each data point i, calculate its distance to each cluster center, and assign data point i to the nearest cluster center. The index of the nearest cluster center j can be expressed by the following formula:

[0155] j = arg min(||x i -Cj ||)

[0156] Where |||| represents Euclidean distance or other distance metric, x i C is the pixel coordinate of data point i. j These are the pixel coordinates of cluster center j;

[0157] For each cluster, calculate the average coordinates of all data points within it, and use each average coordinate as the new cluster center. The average coordinates can be expressed by the following formula:

[0158]

[0159] Where, N j It is the number of data points belonging to cluster j;

[0160] Based on the new cluster centers, recalculate the distance from each data point to each cluster center, and repeat this process until the cluster centers no longer change or the predetermined maximum number of iterations is reached. Then stop clustering to obtain the clustered fault dataset.

[0161] S302. Based on the clustered fault dataset, a fault detection model is constructed using the improved YOLO v5s algorithm;

[0162] S303. Input the enhanced fastener area image into the fault detection model to perform fault detection;

[0163] S304, wherein the improved YOLO v5s algorithm replaces the classification loss function, localization loss function, and confidence loss function in the YOLO v5s algorithm with the balanced cross-entropy loss function, DIoU loss function, and center loss function:

[0164]

[0165]

[0166]

[0167]

[0168]

[0169] Where BCELoss(p,q) represents the balanced cross-entropy loss function, p i q represents the probability of the fault detection model identifying the i-th category of fault. i w represents the actual probability of the i-th class. iLet d(P,G) represent the weight of the i-th category, N represent the total number of categories, DIoU(P,G) represent the DIoU loss function, P is the predicted bounding box of the target box, G is the ground truth bounding box of the target box, d(P,G) is the negative Euclidean distance between the center points of the predicted box and the ground truth box, and x p y p Let x and x represent the coordinates of the center point of the prediction box P, respectively. g y g Let P and G represent the center coordinates of the actual bounding box G, respectively. CenterLoss(P,G) represents the center loss function, where P... cen G is the center of the feature vector of the predicted box P. cen It is the center of the feature vector of the actual bounding box G. ||·||2 represents the Euclidean distance. denoted as the squared Euclidean distance between the center of the predicted box and the center of the actual box, and c represents the weight of the balancing center loss.

[0170] At this point, the improved YOLO v5s algorithm described in step S304 includes:

[0171] S3041. Add SENet attention mechanism and CBAM attention mechanism to the CSP module of YOLO v5s algorithm:

[0172] y = F SE (x)=z'×x

[0173] z'=F Excitation (z,W)=σ(W2g(W1z))

[0174]

[0175] M channel =σ(z2(ReLU(z1(AvgPool(x)))))×x+σ(z2(ReLU(z1(MaxPool(x)))))×x

[0176] M spatial =σ(z4(ReLU(z3(Conv) 1×1 (M channel )))))×M channel +σ(z6(ReLU(z5(Conv 1×1 (M channel )))))×M channel

[0177] Where z' represents the feature importance weights obtained from the Excitation operation, x represents the feature map of the enhanced fastener region image, y represents the feature map output after adding the SENet attention mechanism, z represents the feature vector obtained from the Squeeze operation, W1 and W2 represent the learnable weights of the fully connected layer, g represents the ReLU activation function, σ represents the Sigmoid function, AvgPool(x) represents average pooling of the feature map of the enhanced fastener region image, MaxPool(x) represents max pooling of the feature map of the enhanced fastener region image, z1 and z2 represent the learned weights of the fully connected layer, M channel The output representing channel attention, Conv 1×1 This represents a 1x1 convolutional layer, where z3, z4, z5, and z6 represent the learned weights of the convolutional layer, and M... spatial This represents the output of spatial attention.

[0178] In this embodiment, as Figure 4 As shown, the SENet attention mechanism and CBAM attention mechanism are added to the CSP module of the YOLO v5s algorithm. The feature map of the input enhanced fastener region image is fed into the SENet attention mechanism after passing through the GSP module. The SENet attention mechanism consists of a Squeeze part and an Excitation part. The Squeeze part performs global average pooling on the enhanced fastener region image to obtain the global feature vector of each feature map. Then, the first fully connected layer in the Excitation part learns the correlation between channels, that is, it maps the feature vector to a small intermediate dimension. The ReLU activation function is used to enhance the non-linear expressive power. Then, it enters the second fully connected layer to restore the channel dimension, thereby obtaining the feature importance score of each channel. Finally, the sigmoid function is used to assign weight coefficients to obtain the channel feature weights.

[0179] y = F SE (x)=z'×x

[0180] z'=F Excitation (z,W)=σ(W2g(W1z))

[0181]

[0182] Where y is the final output feature map, z' is the feature importance weight obtained by the Excitation operation, x is the feature map of the input enhanced fastener region image, C is the number of channels, z is the feature vector, z' is the feature vector obtained by the Squeeze operation, W1 and W2 are the weights of the learnable fully connected layer, g is the ReLU activation function, and σ is the Sigmoid function.

[0183] The CBAM attention mechanism is introduced on the feature map output by the SENet attention mechanism. The CBAM attention mechanism includes a channel attention module (CAM) and a spatial attention module (SAM). The channel attention module performs a weighted average based on the importance of each channel in the feature map, introducing an attention mechanism in the channel dimension. The spatial attention module performs a weighted average based on the importance of each pixel in the feature map, introducing an attention mechanism in the spatial dimension.

[0184] Example 2

[0185] Please refer to Figure 5 A device 1 for detecting fastener failures of port cranes includes a memory 3, a processor 2, and a computer program stored in the memory 3 and executable on the processor 2. When the processor 2 executes the computer program, it implements the steps in Embodiment 1 above.

[0186] Since the systems / devices described in the above embodiments of the present invention are systems / devices used to implement the methods of the above embodiments of the present invention, those skilled in the art can understand the specific structure and modifications of the systems / devices based on the methods described in the above embodiments of the present invention, and therefore will not be repeated here. All systems / devices used in the methods of the above embodiments of the present invention fall within the scope of protection of the present invention.

[0187] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0188] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions.

[0189] It should be noted that any reference numerals placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In claims that enumerate several means, several of these means may be embodied by the same hardware. The use of the terms first, second, third, etc., is merely for convenience of expression and does not indicate any order. These terms can be understood as part of the component names.

[0190] Furthermore, it should be noted that in the description of this specification, the terms "one embodiment," "some embodiments," "embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0191] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the claims should be interpreted to include both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0192] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, then this invention should also include these modifications and variations.

Claims

1. A method of port crane fastener failure detection, characterized by, include: Acquire images of port crane fasteners, perform noise reduction processing on the images of port crane fasteners to obtain noise-reduced images of port crane fasteners, and use the YOLO v5s algorithm to locate the fastener regions in the noise-reduced images of port crane fasteners to obtain images of the fastener regions. The image of the fastener region is subjected to image enhancement processing to obtain an enhanced image of the fastener region; The enhanced fastener region image is input into a fault detection model built based on the YOLO v5s algorithm for fault detection, and the fault detection result is output. The enhanced fastener region image is input into a fault detection model built based on the YOLO v5s algorithm for fault detection, including: A historical fault dataset of port crane fasteners is obtained, and the K-Means clustering algorithm in YOLO v5s is used to cluster the historical fault dataset to obtain a clustered fault dataset. A fault detection model is constructed using the improved YOLO v5s algorithm based on the clustered fault dataset. The enhanced fastener region image is input into the fault detection model for fault detection. The improved YOLO v5s algorithm replaces the classification loss function, localization loss function, and confidence loss function in the YOLO v5s algorithm with the balanced cross-entropy loss function, DIoU loss function, and center loss function. in, This represents the balanced cross-entropy loss function. This indicates the fault detected by the fault detection model. The probability of the category, Indicates the actual number The probability of the category, Indicates the first Category weights Indicates the total number of categories. Represents the DIoU loss function. It is the predicted bounding box of the target box. It is the true bounding box of the target box. It is the negative Euclidean distance between the center points of the predicted bounding box and the ground truth bounding box. , These represent the prediction boxes. The coordinates of the center point, , Representing the actual boxes The coordinates of the center point, Represents the central loss function. It is a prediction box The center of the eigenvector, It is the actual box The center of the eigenvector, Represents Euclidean distance. This represents the squared Euclidean distance between the centers of the predicted bounding box and the actual bounding box. The weight representing the loss at the equilibrium center; The improved YOLO v5s algorithm includes: Add SENet attention mechanism and CBAM attention mechanism to the CSP module of YOLO v5s algorithm: in, This represents the feature importance weights obtained from the excitation operation. This represents a feature map of the enhanced fastener region image. This represents the feature map output after incorporating the SENet attention mechanism. This represents the feature vector obtained from the Squeeze operation. and This represents the weights of the learnable fully connected layer. Indicates activation function , This represents the Sigmoid function. This indicates that average pooling is performed on the feature map of the enhanced fastener region image. This indicates that max pooling is performed on the feature map of the enhanced fastener region image. and This represents the learned weights of the fully connected layer. The output representing channel attention, This represents a 1x1 convolutional layer. , , and This represents the learned weights of the convolutional layer. This represents the output of spatial attention.

2. The method for detecting fastener faults in port cranes as described in claim 1, characterized in that, The acquisition of the image of the crane fastener includes: Obtain the coordinate information of the fasteners of the port crane, input the coordinate information into the path planning algorithm of the genetic algorithm for path calculation, and output the shooting path; Based on the shooting path, an unmanned aerial vehicle (UAV) image acquisition device is used to acquire images of the port crane fasteners.

3. The method for detecting fastener faults in port cranes as described in claim 2, characterized in that, The step of using a drone image acquisition device to acquire images of the port crane fasteners based on the shooting path includes: The Zhang's calibration method was used to calibrate the UAV image acquisition device, resulting in a calibrated UAV image acquisition device. Based on the shooting path, the calibrated UAV image acquisition device is used to acquire images of the port crane fasteners.

4. The method for detecting fastener failures in port cranes as described in claim 1, characterized in that, The noise reduction process for the port crane fastener image to obtain the noise-reduced port crane fastener image includes: The image of the crane fasteners is converted to YUV mode using the YUV color space conversion matrix to obtain the original YUV crane fastener image: Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue; The BM3D algorithm is used to perform a similar image block search on the original YUV port crane fastener image to obtain all first similar image blocks. All first similar image blocks are then stacked to form a first 3D array. in, A set representing similar image patches. The maximum error threshold representing the similarity between two image patches. This represents the Euclidean distance between the target block and the search block. This represents the pixels in the original YUV port crane fastener image. This represents the original YUV port crane fastener image. This represents the target block of the original YUV harbor crane fastener image. This represents the search block for the original YUV port crane fastener image. This refers to the size of the image block in the original YUV port crane fastener image. This indicates a hard threshold operation. Indicates the threshold; The first 3D array is subjected to a cooperative transform filtering process to obtain a cooperative transform filtered first 3D array. The filtered first 3D array is then placed back into the corresponding position of the original YUV port crane fastener image to obtain a filtered port crane fastener image. The filtered port crane fastener image is then subjected to an aggregation weighted filtering process to obtain a basic estimated port crane fastener image. The BM3D algorithm is used to search for similar image blocks in the basic estimated port crane fastener image to obtain all second similar image blocks. All second similar image blocks are stacked to form a second 3D array. The second 3D array is subjected to Wiener filtering replacement processing to obtain the replaced second 3D array. The replaced second 3D array is then placed back into the corresponding position of the basic estimated port crane fastener image to obtain the final estimated port crane fastener image. in, This represents the second 3D array. Represents the first 3D array, This indicates the final estimated image of the hoist fasteners; The final estimated image of the port crane fasteners is inversely converted to RGB mode using the RGB color space conversion matrix to obtain the denoised image of the port crane fasteners: Where Y represents grayscale value, U represents chroma, V represents density, R represents red, G represents green, and B represents blue.

5. The method for detecting fastener faults in port cranes as described in claim 1, characterized in that, The step of locating the fastener region in the noise-reduced port crane fastener image using the YOLOv5s algorithm to obtain the fastener region image includes: Obtain historical fastener regions from historical images of port crane fasteners, and randomly divide the historical fastener regions into training and testing sets; The training set is input into the YOLO v5s algorithm for training to generate a localization model. The test set is input into the localization model for testing, and the test results are output. When the test results reach the expected effect, the localization model that has achieved the expected effect is output. The fastener region image is obtained by locating the fastener region in the noise-reduced port crane fastener image using the positioning model.

6. The method for detecting fastener faults in port cranes as described in claim 5, characterized in that, When the test results reach the expected effect, the output of the localization model that achieves the expected effect includes: The detection results are evaluated based on accuracy, recall, and mean precision. When accuracy, recall, and mean precision all reach their respective thresholds, the detection results achieve the expected effect, and a localization model that achieves the expected effect is output.

7. The method for detecting fastener failures in port cranes as described in claim 1, characterized in that, The step of performing image enhancement processing on the fastener region image to obtain the enhanced fastener region image includes: The fastener region image is processed using a histogram equalization method to obtain an equalized fastener region image: in, This represents the pixel grayscale level of the image of the equalized fastener region. Let G be the probability density function of the image of the fastener region with gray level G. The pixel value g represents the number of pixels in the fastener region image, and M represents the total number of pixels in the fastener region image. The cumulative distribution function represents the image of the fastener region; An improved Retinex algorithm is used to enhance the image of the equalized fastener region, resulting in an enhanced image of the fastener region. The improved Retinex algorithm replaces the logarithmic transform in the original Retinex algorithm with an adaptive power transform. in, This represents the formula for replacing the logarithmic transformation with an adaptive power transformation. This represents the image after performing a power transformation on the pixel values ​​of the equalized fastener region image. and Both represent adaptive exponents. This represents the pixel values ​​of the image of the equalized fastener region.

8. A device for detecting fastener failures in port cranes, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Insulator fault identification method and system based on target detection and instance segmentation

    CN115294473A

  • Insulator defect detection method based on CS-YOLOv5s network

    CN115761416A