Hydrogen storage tank surface defect detection method based on improved Faster R-CNN and FPN

Through the improved Faster R-CNN and FPN models, the detection problems of microcracks and slender corrosion defects on the surface of hydrogen storage tanks are solved, and high-precision and real-time defect identification are achieved, which improves detection efficiency and safety.

CN120259263APending Publication Date: 2025-07-04CENT SOUTH UNIV +1

Patent Information

Application Number
CN202510400229.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The existing hydrogen storage tank surface defect detection technology cannot effectively identify microcracks (width <0.1mm) and elongated corrosion defects, the detection range is limited, and it fails to adapt to industrial camera images of different resolutions in real time, and lacks dynamic correlation models, resulting in high missed detection rates and high misjudgment rates, which cannot meet the safety assessment needs of the hydrogen energy industry.

Method used

Using the improved Faster R-CNN and FPN models, multi-scale detection and real-time identification of surface defects of hydrogen storage tanks are achieved through deformable convolutional layer, bidirectional feature pyramid structure, adaptive feature selection module and dynamic anchor box optimization, combined with the RankSort loss function.

Benefits of technology

It improves the detection accuracy of microcracks and slender corrosion defects, enhances the generalization ability of the model, reduces the missed detection rate and misjudgment rate, adapts to complex industrial environments, and reduces the risk of safety accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259263A_ABST
    Figure CN120259263A_ABST
Patent Text Reader

Abstract

The invention relates to a hydrogen storage tank surface defect detection method based on improved Faster R-CNN and FPN, an image size dynamic scaling strategy is implemented, multi-scale statistics are maintained to adapt to input of images with different resolutions, and a deformable convolutional layer is introduced into a backbone network ResNet50 of the Faster R-CNN to enhance the capture capability of microcrack and corrosion defect features; a RankSort loss function is adopted to relieve the class imbalance problem, and the model detection precision is improved; constructing a bidirectional feature pyramid structure FPN and an adaptive feature selection module, and optimizing multi-scale feature fusion; the method effectively improves the detection precision of hydrogen storage tank surface microcracks (the width is less than 0.1 mm) and slender corrosion defects, can accurately identify various defects on the hydrogen storage tank surface in real time, improves the detection efficiency, can better adapt to different types of defects of the hydrogen storage tank and industrial camera images with different resolutions, and improves the detection accuracy. And the generalization ability of the model is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial inspection, and particularly to a method for detecting surface defects of hydrogen storage tanks based on improved Faster R-CNN and FPN. Background Art

[0002] With the development of the hydrogen energy industry, hydrogen storage tanks, as key energy storage devices, have attracted much attention for their safety and reliability; various surface defect problems may occur during the use of hydrogen storage tanks, such as microcracks, corrosion, etc. If these defects cannot be detected and repaired in time, serious safety accidents may be triggered, resulting in huge economic losses; the existing health assessment technologies for hydrogen storage tanks mainly focus on non-destructive testing and data analysis. The traditional non-destructive testing technology, Patent CN202411165533.5, uses ultrasonic testing and focuses on local detection of the weld area. By extracting characteristic values to construct a safety index model, this patent is the closest prior art to the solution proposed by the present invention, but the defects of this method are typically representative; the detection range is limited to a specific area, and the high-incidence area of surface microcracks is not covered, so full-surface coverage detection cannot be achieved. Moreover, feature extraction relies on traditional edge detection algorithms, and the recognition sensitivity to microcracks (width < 0.1 mm) is insufficient. Also, it relies on manually set threshold rules, resulting in an error rate of up to 30% for capturing the texture features of microcracks and a missed detection rate of more than 15% for tiny defects. At the same time, the safety assessment model uses a static threshold and does not consider the cumulative effect of material fatigue of the hydrogen storage tank, leading to a significant increase in the misjudgment rate in the later service period. More critically, there is a lack of effective monitoring means for corrosion defects in the stress concentration area of the hydrogen storage tank and a lack of prediction ability for dynamic defect expansion; these technical shortcomings directly restrict the reliability of the health assessment of hydrogen storage tanks. Especially under high-pressure cyclic working conditions, the defect expansion prediction error of Patent CN202411165533.5 can reach ±25%, which cannot meet the stringent requirements of the hydrogen energy industry for safety assessment.

[0003] For the recently emerging deep learning image recognition technology, the Surrogate model proposed in Patent CN113724804A, although improving the detection efficiency, has obvious defects in the hydrogen storage tank scenario. The existing model does not design a special anchor box for slender cracks (aspect ratio greater than 5:1) on the surface of the hydrogen storage tank, resulting in a decrease in the positioning accuracy of irregular defects; in terms of multi-scale adaptability, the mainstream solutions do not integrate an industrial camera resolution difference compensation mechanism, and the detection accuracy fluctuates by more than 20% in the image scaling scenario of 0.5 - 2.0 times. In addition, the existing deep learning technology severs the correlation between detection and safety assessment, only outputting defect coordinates without establishing a dynamic correlation model with working condition parameters such as pressure and temperature.

[0004] The multi-objective optimization model proposed in Patent CN117724338A is a comprehensive risk assessment method that attempts to break through the limitations of single-dimensional assessment. However, it faces three major challenges in practical applications: First, the data fusion mechanism is imperfect, and the ultrasonic physical parameters and visual detection data have not achieved multi-modal feature cross-validation; Second, the real-time performance of the algorithm is insufficient, and complex fuzzy calculations result in an assessment delay exceeding 500ms, making it difficult to meet the real-time monitoring requirements of the production line; Third, the dynamic adaptability is poor, and the impact of renewable energy fluctuations on the working conditions of hydrogen storage tanks is not considered, and it is impossible to construct an association model between the defect expansion rate and environmental parameters. Summary of the Invention

[0005] In view of this, the present invention provides a method for detecting surface defects of hydrogen storage tanks based on improved Faster R-CNN and FPN, which effectively solves the problem of high missed detection rate of irregular defects such as microcracks (width < 0.1mm) and slender corrosion in existing detection methods, and improves the recognition sensitivity of complex-shaped defects.

[0006] To achieve the above object, a method for detecting surface defects of hydrogen storage tanks based on improved Faster R-CNN and FPN of the present invention includes the following steps:

[0007] S1. Obtain the surface image dataset of the hydrogen storage tank;

[0008] S2. Preprocess the surface image dataset of the hydrogen storage tank, process the surface image of the hydrogen storage tank by using an image size dynamic scaling strategy, and divide the surface image dataset of the hydrogen storage tank into a training set P and a test set Q;

[0009] S3. Construct an improved Faster R-CNN model and process the training set P of the surface image data of the hydrogen storage tank;

[0010] S301. Replace the third and fourth convolutional layers of the Faster R-CNN backbone network ResNet50 with deformable convolutional layers, and set the learning rate of the spatial offset of the sampling points of the deformable convolutional layer kernel to 0.1 times that of the basic convolutional layer to capture the slender morphology of microcracks and the irregular edges of corrosion defects in the surface image of the hydrogen storage tank;

[0011] S302. Calculate the eigenvalue of the surface image data of the hydrogen storage tank after offset by using the bilinear interpolation algorithm;

[0012] S303. Construct a bidirectional feature pyramid structure FPN, align the convolutional channels by superimposing 3×3 convolutions on the feature layers of ResNet50 outputs {C3, C4, C5}, and inject the C2 feature layer into the top layer of the FPN by using skip connections to obtain a new surface image dataset P of the hydrogen storage tank ′ ;

[0013] S304. Construct an adaptive feature selection module to dynamically adjust the contribution degree of features at each level through learnable weights;

[0014] S4. Dynamically optimize the anchor boxes according to the surface image of the hydrogen storage tank;

[0015] S401. Statistically calculate the local density distribution of defects in the training set of the surface image data of the hydrogen storage tank through a sliding window. In the area where the density is higher than the preset threshold, reduce the anchor box spacing and increase the number of anchor boxes in the defect-dense area;

[0016] S402. Set three groups of anchor boxes of 1:5, 1:3, and 1:1 according to the morphological characteristics of the hydrogen storage tank defects;

[0017] S403. Optimize the scale distribution of the anchor box size to match the actual defect through the K-means clustering method;

[0018] S5. Set the loss function L total , and use the training set P to train the improved Faster R-CNN model;

[0019] S6. Detect the test set Q, and input the test set to be detected into the surface defect detection of the hydrogen storage tank.

[0020] Preferably, the preprocessing includes annotating the surface image set of the hydrogen storage tank, using a bounding box to mark the position of the defect, and classifying and annotating the defect type, and normalizing the image, and normalizing the pixel value to the range of [0,1].

[0021] Preferably, the image size dynamic scaling strategy includes:

[0022] Randomly scale the surface image of the hydrogen storage tank to 0.5 to 2 times the original state, keeping the aspect ratio unchanged;

[0023] Use the bicubic interpolation method to resample the scaled surface image dataset P of the hydrogen storage tank to obtain a new surface image dataset P of the hydrogen storage tank.

[0024] Preferably, using the training set P to train the improved Faster R-CNN model includes the following steps:

[0025] S501. Initialize the parameters of the improved Faster R-CNN model and set the hyperparameters of the training;

[0026] S502. Load the data of the surface image training set P of the hydrogen storage tank;

[0027] S503. Input the data in the training set P into the improved Faster R-CNN model for forward propagation calculation to obtain the prediction results of the model, including the classification probability of the defect and the bounding box coordinates;

[0028] S504. Calculate the value of the loss function according to the prediction result and the true label;

[0029] S505. Calculate the gradient through the backpropagation algorithm and update the parameters of the model using the Adam optimizer;

[0030] S506. After reaching the preset number of iterations, save the optimal model parameters to complete the training.

[0031] Preferably, the loss function L total Adopt the RankSort loss function based on sorting, calculate the IoU sorting value of the intersection of each anchor box and the true box, and dynamically adjust the weights of positive and negative samples;

[0032] The loss function L total The expression of is:

[0033] L total = λ1L RankSort + λ2L reg + λ3L anchor_reg

[0034] Among them, λ1, λ2, and λ3 respectively represent the balance coefficients of the classification loss function, the regression loss function, and the L1 regularization term, and L RankSort represents the classification loss function, L reg represents the regression loss function, and L anchor_reg represents the L1 regularization term;

[0035] The expression of the classification loss function L RankSort is:

[0036]

[0037] Among them, N represents the number of difficult samples participating in the calculation, IoU i represents the intersection over union of the i-th anchor box and the true box, τ represents the temperature coefficient to control the sensitivity of sorting, and Ω i represents the set of neighboring samples whose difference in intersection over union with the current anchor box is less than 0.2, and p i represents the defect confidence predicted by the model;

[0038] The expression of the regression loss function L reg is:

[0039]

[0040] Among them, represents the difference between the predicted coordinate offset t k and the true offset ;

[0041] The expression of the L1 regularization term is:

[0042]

[0043] Among them, M represents the number of grids of the feature map, and n m represents the number of anchor boxes in the m-th grid, and represents the preset reference anchor box density.

[0044] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0045] 1. By improving the Faster R-CNN and the multi-scale feature pyramid network FPN, the present invention effectively improves the detection accuracy of micro-cracks (width < 0.1 mm) and slender corrosion defects on the surface of the hydrogen storage tank, can identify various defects on the surface of the hydrogen storage tank in real time and accurately, improves the detection efficiency, and at the same time avoids the further expansion of the defects of the hydrogen storage tank, reduces the maintenance cost of the hydrogen storage tank and effectively reduces the risk of safety accidents;

[0046] 2. The design of the dedicated anchor box and the multi-scale training strategy adopted by the present invention enable the model to better adapt to different types of defects of the hydrogen storage tank and industrial camera images with different resolutions, and enhance the generalization ability of the model;

[0047] 3. The present invention implements an image size dynamic scaling strategy and maintains multi-scale statistics in the batch normalization layer to ensure the consistency of feature distributions at different resolutions. Facing images under different devices and different environments, the improved Faster R-CNN model provided by the present invention can maintain stable detection performance and adapt to complex industrial detection environments. Description of the Drawings

[0048] Figure 1 is the flow chart of the present invention;

[0049] Figure 2 is the training flow chart of the hydrogen storage tank surface data set of the present invention;

[0050] Figure 3 is the training loss and validation loss data graph of the training of the hydrogen storage tank surface data set in this embodiment;

[0051] Figure 4 is the confusion matrix graph obtained by testing with the improved Faster R-CNN model in this embodiment. Detailed Embodiments

[0052] To further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following describes in detail the specific embodiments, structures, features and their effects of the present invention in conjunction with the accompanying drawings and preferred embodiments.

[0053] Embodiment 1

[0054] In order to achieve high-precision identification and safety assessment of microcracks and corrosion defects on the surface of hydrogen storage tanks, the present invention proposes a method for detecting surface defects of hydrogen storage tanks based on improved Faster R-CNN and FPN (Feature Pyramid Network). In view of the limitations of traditional algorithms in complex industrial environments, especially the deficiencies in the detection of slender cracks and irregular corrosion defects, systematic improvements and optimizations are carried out. By introducing key technologies such as deformable convolutional network, RankSort loss function, improved FNP architecture, multi-scale training strategy, and dynamic anchor box optimization, the specific steps are as follows:

[0055] S1. Obtain a dataset of surface images of hydrogen storage tanks, including surface images of normal surfaces, surfaces with microcracks, corrosion and other defects.

[0056] S2. Preprocess the dataset of surface images of hydrogen storage tanks, including annotating the surface image set of hydrogen storage tanks, using bounding boxes to mark the positions of defects, classifying and annotating the types of defects, normalizing the images, normalizing the pixel values to the range of [0, 1], implementing data augmentation techniques to increase the diversity of the image dataset and the generalization ability of the model; adopting an image size dynamic scaling strategy to process the surface images of hydrogen storage tanks, and dividing the dataset of surface images of hydrogen storage tanks into a training set P and a test set Q;

[0057] In the actual industrial environment, different devices may be equipped with cameras of different resolutions, resulting in large differences in the sizes of input images. In view of the problems caused by the differences in the resolutions of industrial cameras, an image size dynamic scaling strategy is implemented, including:

[0058] Randomly scale the surface images of hydrogen storage tanks to 0.5 to 2 times the original state, keeping the aspect ratio unchanged;

[0059] Use bicubic interpolation method to resample the scaled dataset P of surface images of hydrogen storage tanks to obtain a new dataset P of surface images of hydrogen storage tanks to minimize the detail loss caused by scaling;

[0060] Maintain multi-scale statistics in the batch normalization layer to ensure the consistency of feature distributions at different resolutions;

[0061] Through the image size dynamic scaling strategy, it helps the subsequent improved Faster R-CNN model to learn richer feature information from images of different scales, thereby improving the detection accuracy.

[0062] S3. Construct an improved Faster R-CNN model and process the training set P of surface image data of hydrogen storage tanks;

[0063] S301. Replace the third and fourth convolutional layers of the Faster R-CNN backbone network ResNet50 with deformable convolutional layers to capture the slender morphology of microcracks and the irregular edges of corrosion defects in the surface image of the hydrogen storage tank. The deformable convolutional layer can adaptively capture the slender morphology of microcracks and the irregular edges of corrosion defects by dynamically adjusting the spatial offsets of the convolutional kernel sampling points, which can solve the problem that traditional convolutional networks are difficult to adapt to the geometric deformation of the target with fixed convolutional kernels when dealing with defects with slender morphology and irregular edges. To avoid overfitting, set the learning rate of the spatial offsets of the deformable convolutional layer convolutional kernel sampling points to 0.1 times that of the basic convolutional layer to slow down the learning speed of the offsets.

[0064] S302. Use the bilinear interpolation algorithm to calculate the eigenvalue of the surface image data of the hydrogen storage tank after offset, ensure the stability of gradient propagation, enhance the adaptability of the model to changes in the target geometry, and ensure the reliability during the training process.

[0065] S303. Generally speaking, deep features usually contain rich semantic information but lack detailed information, while shallow features are just the opposite, containing more texture details but less semantic information. In terms of multi-scale feature fusion, construct a bidirectional feature pyramid network (FPN) by stacking 3×3 convolutional channels on the feature layers {C3, C4, C5} output by ResNet50 to make the features at different levels have consistency in the channel dimension. At the same time, use skip connections to inject the C2 feature layer into the top layer of the FPN to obtain a new surface image dataset P of the hydrogen storage tank. ′ , thus enhancing the ability to capture the texture features of microcracks. Then construct an adaptive feature selection module to dynamically adjust the contribution degree of each level of features through learnable weights. Since the importance of each level of features may be different under different defect types and scales, it can automatically assign weights according to the actual situation to improve the effect of feature fusion.

[0066] S4. Dynamically optimize the anchor boxes according to the surface image of the hydrogen storage tank. Traditional anchor box configurations are often fixed and difficult to adapt to different densities of defect distributions. Therefore, in this embodiment, the RPN anchor box density is dynamically configured based on the distribution heatmap, which specifically includes the following steps:

[0067] S401. Statistically analyze the local density distribution of defects in the training set of the surface image data of the hydrogen storage tank through a sliding window. In the area where the density is higher than the preset threshold (such as greater than 0.3 defects / cm 2 ), reduce the anchor box spacing to increase the number of anchor boxes in the defect-dense area. This design can improve the recall rate of detection, but increasing the number of anchor boxes will cause a significant increase in the amount of calculation. Therefore, L1 regularization is introduced into the subsequent loss function to constrain the number of anchor boxes and prevent the exponential growth of the amount of calculation, improving the calculation efficiency while ensuring the detection accuracy.

[0068] S402. According to the morphological characteristics of the hydrogen storage tank defects, after statistically analyzing the aspect ratio distribution of the microcracks, three groups of anchor boxes with ratios of 1:5, 1:3, and 1:1 are set; this is because microcracks usually present an elongated shape, so a larger aspect ratio is required to cover their geometric characteristics. For corrosion defects, a rotating anchor box mechanism is adopted to support angle offset detection of ±15° to capture irregular shapes;

[0069] S403. Optimize the anchor box sizes to match the scale distribution of the actual defects through the K-means clustering method, which can more accurately cover defects of different sizes and shapes, further improving the detection accuracy;

[0070] S5. Set the loss function L total and use the training set P to train the improved Faster R-CNN model. The training flow chart for the hydrogen storage tank surface dataset is as Figure 2 shown;

[0071] S501. Initialize the parameters of the improved Faster R-CNN model and set the hyperparameters for training;

[0072] S502. Load the data of the hydrogen storage tank surface image training set P;

[0073] S503. Input the data in the training set P into the improved Faster R-CNN model for forward propagation calculation to obtain the prediction results of the model, including the classification probability of the defects and the bounding box coordinates;

[0074] S504. Calculate the value of the loss function according to the prediction results and the true labels;

[0075] Aiming at the deficiency of the traditional cross-entropy loss function in dealing with the class imbalance problem, this embodiment uses the RankSort loss function based on sorting; in the actual industrial environment, microcracks and corrosion defects often present a class imbalance phenomenon, that is, the positive samples (defects) are far fewer than the negative samples (normal regions). The traditional cross-entropy loss function is prone to causing the model to bias towards predicting the majority class (normal regions) and ignoring the minority class (defects) in this case; the RankSort loss function dynamically adjusts the positive and negative sample weights by calculating the IoU ranking value of each anchor box and the true box, enabling the model to pay more attention to the difficult samples with high IoU but low confidence. These difficult samples are usually the samples that are easily misjudged and are crucial for improving the detection accuracy; in addition, a temperature coefficient τ is introduced to control the sorting sensitivity to balance the learning stability and the convergence speed; the loss function provided in this embodiment can effectively alleviate the class imbalance problem and improve the model's detection ability for complex defects;

[0076] The loss function L totalThe expression is:

[0077] L total = λ1L RankSort + λ2L reg + λ3L anchor_reg

[0078] Among them, λ1, λ2, and λ3 respectively represent the balance coefficients of the classification loss function, the regression loss function, and the L1 regularization term. L RankSort represents the classification loss function, L reg represents the regression loss function, L anchor_reg represents the L1 regularization term;

[0079] Regarding the class imbalance problem of the traditional cross-entropy loss in slender crack detection, based on the sorted loss function, the classification loss function L RankSort The expression is:

[0080]

[0081] Among them, N represents the number of difficult samples participating in the calculation, IoU i represents the intersection over union of the i-th anchor box and the ground truth box, τ represents the temperature coefficient to control the sensitivity of sorting, and Ω i represents the set of neighboring samples with an intersection over union difference less than 0.2 from the current anchor box, and p i represents the defect confidence predicted by the model;

[0082] The bounding box regression loss uses an improved Smooth L1 loss function. The regression loss function L reg The expression is:

[0083]

[0084] Among them, represents the difference between the predicted coordinate offset t k and the true offset and performs weighted processing on the aspect ratio of microcracks;

[0085] To prevent the computational complexity from surging due to the optimization of dynamic anchor boxes, L1 regularization is introduced. The expression of the L1 regularization term is:

[0086]

[0087] Among them, M represents the number of feature map grids, n m represents the number of anchor boxes in the m-th grid, represents the preset reference anchor box density; L1 regularization controls the computational complexity within a reasonable range when reducing the anchor box spacing in the defect-dense area (such as greater than 0.3 defects / cm 2 );

[0088] S505. Calculate the gradient through the backpropagation algorithm and update the model parameters using the Adam optimizer;

[0089] S506. After reaching the preset number of iterations, save the optimal model parameters to complete the training.

[0090] S6. Detect the test set Q and input the test set to be detected into the surface defect detection of the hydrogen storage tank.

[0091] The training loss and validation loss recorded during the training process are as Figure 3 shown. The training loss finally stabilizes at 0.125, indicating that the model provided in this embodiment can fit the training data well during the training process; the test loss is 0.095, indicating that the model provided in this embodiment has high generalization ability; the confusion matrix obtained from the model test is as Figure 4 shown, and the model can distinguish the 10 types of damages well.

[0092] Embodiment 2

[0093] A mobile robot using a depth camera and multiple sensors patrols the hydrogen storage tank along a preset path, collects the surface images of the hydrogen storage tank in real time, deploys an industrial camera and a robotic arm on the hydrogen storage tank production line to detect the surface state of the hydrogen storage tank. The portable handheld detection device is built-in with a lightweight improved Faster R-CNN model for on-site workers to quickly scan the surface of the hydrogen storage tank. Then, the improved Faster R-CNN model and the FPN algorithm are used to perform real-time identification and classification of the surface defects of the hydrogen storage tank, and the results are uploaded to the cloud management system through wireless transmission for subsequent hydrogen storage tank maintenance decision-making.

[0094] The above is only a preferred embodiment of the present invention, and does not impose any form of limitation on the present invention. Although the present invention has been disclosed above with a preferred embodiment, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to the above-disclosed technical content to make equivalent embodiments with equivalent changes, but as long as it does not depart from the technical content of the present invention, any brief modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention still fall within the scope of the technical solution of the present invention.

Claims

1. An improved Faster R-CNN and FPN-based method for detecting surface defects of hydrogen storage tanks, characterized in that, It includes the following steps: S1. Obtain the surface image dataset of the hydrogen storage tank; S2. Preprocess the surface image dataset of the hydrogen storage tank, adopt the dynamic image size scaling strategy to process the surface image of the hydrogen storage tank, and divide the surface image dataset of the hydrogen storage tank into a training set P and a test set Q; S3. Build an improved Faster R-CNN model and process the training set P of the surface image data of the hydrogen storage tank; S301. Replace the third and fourth convolutional layers of the Faster R-CNN backbone network ResNet50 with deformable convolutional layers, and set the learning rate of the spatial offset of the sampling points of the deformable convolutional layer kernel to 0.1 times that of the basic convolutional layer to capture the slender morphology of microcracks and the irregular edges of corrosion defects in the surface image of the hydrogen storage tank; S302. Use the bilinear interpolation algorithm to calculate the eigenvalue of the offset surface image data of the hydrogen storage tank; S303. Build a bidirectional feature pyramid structure FPN, align the convolutional channels by stacking 3×3 on the feature layers {C3, C4, C5} output by ResNet50, and inject the C2 feature layer into the top layer of the FPN through skip connections to obtain a new surface image dataset P' of the hydrogen storage tank; S304. Build an adaptive feature selection module to dynamically adjust the contribution degree of each level feature through learnable weights; S4. Dynamically optimize the anchor boxes according to the surface image of the hydrogen storage tank; S401. Statistically calculate the local density distribution of defects in the training set of the surface image data of the hydrogen storage tank through a sliding window, and reduce the anchor box spacing in the area where the density is higher than the preset threshold to increase the number of anchor boxes in the defect-dense area; S402. Set three groups of anchor boxes of 1:5, 1:3, and 1:1 according to the morphological characteristics of the hydrogen storage tank defects; S403. Optimize the anchor box size to match the scale distribution of the actual defects through the K-means clustering method; S5. Set the loss function L total , and use the training set P to train the improved Faster R-CNN model; S6. Detect the test set Q, and input the test set to be detected into the surface defect detection of the hydrogen storage tank.

2. The hydrogen storage tank surface defect detection method based on improved Faster R-CNN and FPN according to claim 1, characterized in that, The preprocessing includes annotating the surface image set of the hydrogen storage tank, using bounding boxes to mark the positions of the defects, classifying and annotating the defect types, and normalizing the image to normalize the pixel values to the range of [0, 1].

3. A method for detecting surface defects of a hydrogen storage tank based on improved Faster R-CNN and FPN according to claim 1, characterized in that, The dynamic image size scaling strategy includes: Randomly scale the surface image of the hydrogen storage tank to 0.5 to 2 times the original state, keeping the aspect ratio unchanged; Resample the scaled surface image dataset P of the hydrogen storage tank by using the bicubic interpolation method to obtain a new surface image dataset P of the hydrogen storage tank.

4. A method for detecting surface defects of a hydrogen storage tank based on improved Faster R-CNN and FPN according to claim 1, characterized in that, Training the improved Faster R-CNN model using the training set P includes the following steps: S501. Initialize the parameters of the improved Faster R-CNN model and set the hyperparameters of the training; S502. Load the data of the training set P of the surface image of the hydrogen storage tank; S503. Input the data in the training set P into the improved Faster R-CNN model for forward propagation calculation to obtain the prediction results of the model, including the classification probability of the defect and the bounding box coordinates; S504. Calculate the value of the loss function according to the prediction results and the true labels; S505. Calculate the gradient through the backpropagation algorithm and update the model parameters using the Adam optimizer; S506. After reaching the preset number of iterations, save the optimal model parameters to complete the training.

5. A method for detecting surface defects of a hydrogen storage tank based on improved Faster R-CNN and FPN according to claim 4, characterized in that, The loss function L total Adopt the RankSort loss function based on sorting, calculate the sorting value of the intersection over union (IoU) between each anchor box and the ground truth box, and dynamically adjust the weights of positive and negative samples; The loss function L total has the following expression: L total = λ1L RankSort + λ2L reg + λ3L anchor_reg Among them, λ1, λ2, and λ3 respectively represent the balance coefficients of the classification loss function, the regression loss function, and the L1 regularization term, and L RankSort represents the classification loss function, and L reg represents the regression loss function, and L anchor_reg represents the L1 regularization term; Classification loss function L RankSort The expression is as follows: Among them, N represents the number of difficult samples involved in the calculation, IoU i represents the intersection over union of the i-th anchor box and the ground truth box, τ represents the temperature coefficient to control the sensitivity of sorting, and Ω i represents the set of neighboring samples whose intersection over union difference with the current anchor box is less than 0.2, and p i represents the defect confidence predicted by the model; Regression loss function L reg The expression is as follows: where, t represents the predicted coordinate offset k and the difference from the true offset ; The expression of the L1 regularization term is: Among them, M represents the number of feature map grids, and n m represents the number of anchor boxes in the m-th grid, representing the preset reference anchor box density.

Citation Information

Patent Citations

  • Visual detection method for defect of large-size light guide plate

    CN114092415A

  • Method for detecting surface defects, model construction method and device and electronic equipment

    CN114519693A

Cited By

  • Pavement defect analysis and detection method and system

    CN120563521A

  • Image enhancement method and device, electronic equipment, storage medium and program product

    CN121599861A