Bridge cable disease millimeter-level positioning method and system based on small sample learning
By employing a method that combines few-shot learning with deep information fusion, and using a twin feature extraction network and attention mechanism module, the problem of difficulty in identifying unknown defects and low localization accuracy in traditional deep learning models is solved, achieving pixel-level segmentation and millimeter-level localization of bridge cable defects.
Patent Information
- Application Number
- CN202610531429.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-21
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2046-04-21
AI Technical Summary
In the detection of bridge cable defects, traditional deep learning models rely on massive amounts of labeled data, which cannot cope with unknown new defects. Furthermore, pure vision algorithms have low positioning accuracy due to the loss of spatial information and lack of depth information, making it impossible to achieve millimeter-level precision in dimensional measurement.
We employ a method that combines few-shot learning with deep information fusion. By using a twin feature extraction network to preserve high-resolution spatial information, we combine an attention mechanism module to overcome the perspective distortion of the cable surface, and fuse depth information with camera intrinsics to perform physical size mapping, thereby achieving pixel-level segmentation and millimeter-level localization.
It enables the identification of unknown defects with only a small number of samples, avoids retraining costs, and significantly improves the generalization ability and positioning accuracy of bridge cable defect detection, achieving millimeter-level physical size positioning.
Smart Images

Figure CN122415508B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary field of computer vision and structural health monitoring, and in particular to a method and system for millimeter-level localization of bridge cable defects based on few-shot learning. Background Technology
[0002] Bridge cables are key load-bearing components of cable-stayed and suspension bridges, and the integrity of their surface PE sheaths directly affects the safety and lifespan of the bridge. Currently, the industry is gradually adopting climbing robots or drones equipped with high-resolution cameras for automated cable inspection, and using deep learning-based target detection algorithms to identify defects in the acquired images.
[0003] However, existing technologies have the following drawbacks: First, traditional deep learning models require massive amounts of labeled data to converge. When faced with unknown new defects appearing on the engineering site, the models completely fail. Collecting new data and retraining is time-consuming, costly, and prone to catastrophic forgetting, making it difficult to meet the actual needs of bridge inspection for rapid response and generalization capabilities. Second, the cable surface is a cylindrical curved surface and the defects are very small. Existing deep convolutional networks severely lose spatial coordinate information during downsampling, and pure vision algorithms lack depth information, resulting in serious pixel-level and physical-level deviations in defect localization, making it impossible to achieve millimeter-level precision in dimensional measurement.
[0004] Therefore, this invention proposes a millimeter-level localization method and system for bridge cable defects based on few-sample learning. Summary of the Invention
[0005] This invention provides a method and system for millimeter-level localization of bridge cable defects based on few-sample learning. By using few-sample learning and deep information fusion, it can achieve pixel-level segmentation and millimeter-level physical size localization of bridge cable surface defects with only a small number of samples.
[0006] This invention provides a millimeter-level localization method for bridge cable defects based on few-shot learning, comprising the following steps: Acquire at least one reference image containing the target disease as the support set image, acquire the image to be inspected collected in real time by the inspection equipment as the query set image, and simultaneously acquire the depth information collected by the inspection equipment. The support set image and the query set image are respectively input into the weight-shared twin feature extraction network. The twin feature extraction network adopts a truncated structure to avoid excessive loss of spatial information caused by global downsampling. The twin feature extraction network outputs a high-dimensional feature tensor containing high-resolution spatial information. The high-dimensional feature tensors of the support set image and the query set image are input into the attention mechanism module. The high-dimensional feature tensors of the support set image are used as reference features and the high-dimensional feature tensors of the query set image are used as features to be interacted with. Feature interaction and fusion in spatial dimension are performed, and the attention mechanism module outputs a joint feature map. The joint feature map is input into a relational metric network based on a convolutional neural network. The relational metric network generates a response map that reflects the degree of similarity between diseases and outputs the location information of similar regions in the query set image and the support set image based on the response map. Pixel size information is extracted based on the positioning information, and combined with depth information and intrinsic parameters of the inspection camera, the pixel size is converted into absolute physical size.
[0007] Furthermore, the twin feature extraction network is a truncated deep residual network. The truncated deep residual network removes the deep high-magnification global downsampling layers and outputs high-dimensional feature tensors while preserving spatial resolution.
[0008] Furthermore, the attention mechanism module is a cross-attention alignment module, which performs the following operations: Use the high-dimensional feature tensor of the support set image as the key and value, and the high-dimensional feature tensor of the query set image as the query. Calculate the similarity attention matrix between the query and the key; The attention matrix is applied to the values to generate aligned feature maps; The aligned feature map is fused with the high-dimensional feature tensor of the query set image to output a joint feature map.
[0009] Furthermore, the joint feature map is input into a relation metric network based on a convolutional neural network. The relation metric network generates a response map reflecting the degree of disease similarity. Based on the response map, it outputs the location information of similar regions in the query set image and the support set image, specifically including: The joint feature map is input into the relation prediction head, and dense cross-correlation calculation is performed at each spatial location of the joint feature map. The relation prediction head generates a response heatmap that reflects the degree of similarity between diseases. The response heatmap is upsampled and thresholded by the decoder, and a pixel-level binary mask of the region similar to the support set image in the query set image is output. The pixel bounding box coordinates are generated based on the pixel-level binary mask.
[0010] Furthermore, pixel size information is extracted based on the positioning information, and combined with depth information and intrinsic parameter information from the inspection camera, the pixel size is converted into absolute physical size, specifically including: Depth information is obtained as the vertical depth from the lens to the cable surface. Pre-calibrated camera intrinsic information is also obtained, including the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution. The physical size mapping relationship is constructed based on the principle of similar triangles, and the pixel span is converted into the actual physical length using the following calculation formula: ; in, The actual physical length of the disease; The pixel span in the location information; This is depth information, which is the vertical depth from the lens to the cable surface; This refers to the physical diagonal size of the camera's image sensor. The calibrated focal length for a camera lens; The total number of pixels diagonally across the image's resolution; The conversion process is performed by the physical size mapping unit in response to the positioning information output by the similarity measurement unit. Its inputs are positioning information and real-time depth information, and its output is the absolute physical size value marked on the disease detection result.
[0011] Furthermore, the twin feature extraction network, attention mechanism module, and relation measurement network based on convolutional neural network are trained in a meta-learning paradigm to obtain network weights. The network weights are frozen in the application stage, and only one or more support set images need to be input in the application stage to perform inference and recognition of new diseases.
[0012] Furthermore, at least one reference image containing the target disease is acquired as a support set image, and the region of interest in the reference image is extracted as the input for feature extraction; simultaneously, depth information collected by the inspection equipment is acquired, specifically: depth information is collected synchronously through a laser rangefinder, the depth information is the vertical depth from the lens to the cable surface, and the depth information corresponds one-to-one with the query set image.
[0013] Furthermore, the internal parameters of the inspection camera include the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution; the positioning information includes pixel-level binary mask or pixel bounding box coordinates.
[0014] Furthermore, the truncated deep residual network uses ResNet50 as the backbone network. The truncated deep residual network removes the fourth stage of ResNet50 and the subsequent global average pooling layer and fully connected layer. The truncated deep residual network only retains the high-dimensional feature tensor output up to the third stage.
[0015] This invention provides a millimeter-level localization system for bridge cable defects based on few-shot learning, comprising: Image acquisition module, used to acquire images of the surface of bridge cables; The depth acquisition module is triggered synchronously with the image acquisition module. The depth acquisition module is used to acquire depth information from the lens to the cable surface. The storage module is used to store at least one reference image containing the target lesion as a support set image; The edge computing module is communicatively connected to the image acquisition module, the depth acquisition module, and the storage module. The edge computing module includes a feature extraction unit, a feature interaction unit, a similarity measurement unit, and a physical size mapping unit. The feature extraction unit is equipped with a twin feature extraction network, which is used to extract high-dimensional feature tensors of the support set image and the query set image; The feature interaction unit is equipped with an attention mechanism module. The feature interaction unit is used to perform feature interaction and fusion in the spatial dimension using the high-dimensional feature tensor of the support set image as the reference feature and the high-dimensional feature tensor of the query set image as the feature to be interacted with. The feature interaction unit outputs a joint feature map. The similarity measurement unit is used to input the joint feature map into the relation measurement network based on the convolutional neural network. The similarity measurement unit generates a response map that reflects the degree of similarity between diseases. Based on the response map, the similarity measurement unit outputs the location information of the similar regions in the query set image and the support set image. The physical size mapping unit is used to extract pixel size based on positioning information. The physical size mapping unit combines depth information and camera intrinsic parameters to convert pixel size into absolute physical size. The display module is used to output the disease detection results and the positioning information that marks the actual physical dimensions.
[0016] The beneficial effects of this invention compared to existing technologies are as follows: This invention addresses the shortcomings of traditional deep learning models in bridge cable defect detection, which rely on massive amounts of labeled data and cannot handle unknown or novel defects, as well as the low positioning accuracy of pure visual algorithms due to spatial information loss and lack of depth information. By constructing a small-sample learning paradigm for support sets and query sets, it can identify unknown defects with only a few reference samples, avoiding the cost of retraining and catastrophic forgetting problems. Simultaneously, it employs a truncated twin-feature extraction network to retain high-resolution spatial information, combines an attention mechanism module to overcome the perspective distortion caused by the cable surface, and integrates depth information with camera intrinsic parameters for physical size mapping, achieving pixel-level precise segmentation and millimeter-level absolute size positioning of defect areas. This significantly improves the generalization ability and positioning accuracy of bridge cable defect detection.
[0017] More importantly, this invention is not a simple application of existing few-shot learning or attention mechanisms, but rather a collaborative innovation at the algorithmic architecture level addressing two interconnected physical challenges in the specific industrial scenario of bridge cable defect detection: "viewpoint geometric deformation caused by the cylindrical surface of the cable" and "spatial information annihilation of micrometer-wide defects in deep networks." By preserving high-resolution spatial coordinate information through a truncated ResNet, a feature foundation is provided to overcome surface deformation. Then, through a cross-attention module, explicit alignment compensation for surface deformation is performed in the feature space. This organic combination enables a pure vision algorithm to achieve pixel-level accurate segmentation on the cable surface for the first time. Finally, by integrating depth information and geometric correction, the overall technical effect of millimeter-level physical size localization is achieved.
[0018] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in this application.
[0019] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings: Figure 1 This is an overall flowchart of the millimeter-level localization method for bridge cable defects based on few-sample learning in an embodiment of the present invention; Figure 2 This is a schematic diagram of the network architecture of the twin feature extraction and cross-attention alignment module in an embodiment of the present invention; Figure 3This is a schematic diagram illustrating the physical size mapping principle of fusing depth information in an embodiment of the present invention. Detailed Implementation
[0021] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0022] refer to Figure 1 , Figure 2 , Figure 3 This invention provides an embodiment of a millimeter-level localization method for bridge cable defects based on few-sample learning, comprising the following steps: Acquire at least one reference image containing the target disease as the support set image, acquire the image to be inspected collected in real time by the inspection equipment as the query set image, and simultaneously acquire the depth information collected by the inspection equipment. The support set image and the query set image are respectively input into the weight-shared twin feature extraction network. The twin feature extraction network adopts a truncated structure to avoid excessive loss of spatial information caused by global downsampling. The twin feature extraction network outputs a high-dimensional feature tensor containing high-resolution spatial information. The high-dimensional feature tensors of the support set image and the query set image are input into the attention mechanism module. The high-dimensional feature tensors of the support set image are used as reference features and the high-dimensional feature tensors of the query set image are used as features to be interacted with. Feature interaction and fusion in spatial dimension are performed, and the attention mechanism module outputs a joint feature map. The joint feature map is input into a relational metric network based on a convolutional neural network. The relational metric network generates a response map that reflects the degree of similarity between diseases and outputs the location information of similar regions in the query set image and the support set image based on the response map. Pixel size information is extracted based on the positioning information, and combined with depth information and intrinsic parameters of the inspection camera, the pixel size is converted into absolute physical size.
[0023] In this embodiment, the support set image and the query set image constitute the input paradigm for few-shot learning. The support set image serves as a reference sample containing only a small number of known defects, used to define the type of defect to be identified. The query set image serves as the field-collected image to be detected, and defect identification is achieved by comparing the two. For example, before an inspection, an engineer uploads a photo containing circumferential microcracks as the support set image, while the cable surface image transmitted back in real time by the climbing robot serves as the query set image.
[0024] In this embodiment, the truncated deep residual network refers to removing the deep, high-magnification global downsampling layers from the deep residual network, retaining only the intermediate layers, thereby avoiding excessive reduction in the spatial resolution of the feature map. Conventional deep residual networks typically contain multiple downsampling stages. After multiple stride convolutions or pooling operations, the spatial resolution of the feature map is significantly reduced, for example, from one-thirty-second of the input image size. This results in the almost complete loss of spatial location information for minute defects such as cracks less than two millimeters wide in the feature map. This embodiment, by removing the deep, high-magnification global downsampling layers, reduces the output feature map to only one-sixteenth of the input image size, far less than the downsampling factor of conventional networks, thus preserving sufficient spatial details for subsequent pixel-level segmentation.
[0025] In this embodiment, outputting high-dimensional feature tensors while preserving spatial resolution means that the twin feature extraction network maintains high spatial resolution during the output stage, ensuring that the precise location and contour information of the lesions are fully preserved at the feature level. Specifically, ResNet50 is used as the backbone network. The fourth layer and subsequent global average pooling layers and fully connected layers are removed, retaining only the third layer. The output feature map of this layer has 1024 channels, with a spatial resolution one-quarter that of the input image. After further downsampling, the image is effectively reduced by a factor of sixteen, ensuring sufficient semantic information while preserving the spatial details of minute lesions.
[0026] In this embodiment, the attention mechanism module calculates a similarity attention matrix between query set features and support set features, using the disease texture information in the support set features as a reference to perform spatial dimension weighted enhancement on the query set features. This mechanism can effectively overcome the perspective distortion caused by the curved surface of the cable-stayed bridge and the scale changes caused by equipment shaking during the inspection process of climbing robots or drones. Specifically, the support set features are used as keys and values, and the query set features are used as queries. The attention matrix projects the disease texture features in the support set onto the spatial location of the query set features, and then performs residual fusion with the original query set features, so that the disease-related areas in the query set features are enhanced and irrelevant areas are suppressed.
[0027] In this embodiment, the relational metric network based on a convolutional neural network consists of multiple convolutional layers and upsampling layers, used to learn the implicit relational mapping between support set features and query set features. This network performs dense cross-correlation calculations at each spatial location of the joint feature map, generating a heatmap reflecting the similarity of disease lesions. High-response regions in the heatmap represent locations highly similar to diseases in the support set. Subsequently, an upsampling operation restores the heatmap to its original size, and threshold segmentation is performed, ultimately outputting a binary mask accurate to the pixel level. This mask can completely delineate the contours of the disease region, rather than just outputting bounding boxes. For example, for irregularly shaped cracks, the mask can accurately depict their meandering direction and branching structure.
[0028] In this embodiment, depth information is acquired by a laser rangefinder sensor triggered synchronously with the image acquisition module. This depth information represents the vertical distance from the lens to the cable surface and corresponds one-to-one with each frame of the query set image. Camera intrinsic parameters include the physical diagonal size of the image sensor, the lens calibration focal length, and the total number of diagonal pixels in the image resolution. These parameters collectively form the basis for transforming the image coordinate system to the world coordinate system. Using the principle of similar triangles, the pixel span is converted into a millimeter-level physical size. Taking the detection of circumferential microcracks as an example, when the system detects a crack occupying a span of 120 pixels in the image, combined with the 150 mm shooting distance measured by the current laser rangefinder sensor, the 9 mm sensor diagonal size, the 12 mm lens focal length, and the total number of 4,500 diagonal pixels, the actual physical length of the crack can be calculated to be 3 mm. Actual engineering verification shows that the positioning error of this method can be controlled within one millimeter, meeting the millimeter-level accuracy requirements for microcrack detection in bridge cables.
[0029] In this embodiment, to improve the robustness of few-shot learning in real-world engineering environments, the system performs a support set image quality assessment and enhancement step after acquiring the support set images and before inputting them into the twin feature extraction network. This step includes: First, the system performs a quality pre-check on the user-uploaded reference images, calculating the image sharpness (e.g., using Laplacian variance), the integrity of the target disease area, and the foreground-background contrast. When the sharpness is below a preset threshold, the disease area is occluded by more than 20%, or the contrast is too low, the system issues a prompt message, requiring the user to provide a higher-quality support set image or manually adjust the region of interest.
[0030] Secondly, for support set images that pass the pre-detection but still have slight blurring or uneven illumination, the system employs a lightweight enhancement network to adaptively deblur and normalize the illumination, generating enhanced reference images as the actual input to the twin feature extraction network. This enhancement network, along with the subsequent twin feature extraction network, attention module, and relation metric network, is jointly optimized during the meta-learning training phase, enabling the model to tolerate a certain degree of fluctuation in support set image quality.
[0031] Through the aforementioned quality assessment and enhancement mechanisms, even if the reference images provided by on-site personnel are not professionally taken, the system can still stably identify and locate defects, significantly improving the reliability and ease of use of this invention in actual bridge inspection applications.
[0032] Furthermore, the twin feature extraction network is a truncated deep residual network. The truncated deep residual network removes the deep high-magnification global downsampling layers and outputs high-dimensional feature tensors while preserving spatial resolution.
[0033] In this embodiment, the twin feature extraction network is a truncated deep residual network. A truncated deep residual network refers to a network structure that removes the deep, high-magnification global downsampling layers from a standard deep residual network, retaining only the intermediate layers. Conventional deep residual networks typically contain multiple downsampling stages. After multiple stride convolutions or pooling operations, the spatial resolution of the feature map is significantly reduced. For example, the ResNet50 network shrinks its input-to-output feature map to one-thirty-second of its original size, resulting in the almost complete loss of spatial location information for minute defects such as cracks less than two millimeters wide in the feature map. This embodiment, by employing a truncated deep residual network and removing the deep, high-magnification global downsampling layers, reduces the output feature map to only one-sixteenth of the input image, far less than the downsampling factor of conventional networks.
[0034] In this embodiment, removing deep, high-rate global downsampling layers specifically refers to removing downsampling operations located in deeper stages of the deep residual network. Taking ResNet50 as an example, this network contains four residual stages, with downsampling operations in stages two through four. Stage four has the highest downsampling factor and causes the most significant loss of spatial resolution. This embodiment removes stage four and subsequent global average pooling layers and fully connected layers, retaining only stages up to the third stage, thereby avoiding excessive loss of spatial information caused by high-rate downsampling.
[0035] In this embodiment, outputting high-dimensional feature tensors while preserving spatial resolution means that the twin feature extraction network maintains high spatial resolution during the output stage, ensuring that the precise location and contour information of the lesions are fully preserved at the feature level. The spatial resolution of the output feature map is reduced by a factor of sixteen compared to the input image, with 1024 channels. This ensures sufficient semantic information to distinguish between diseased and non-diseased areas while preserving the spatial location details of minute lesions, providing a sufficient feature foundation for subsequent pixel-level segmentation and millimeter-level physical size mapping. For example, a microcrack with a width of only 1.5 millimeters may occupy only a few pixels in the input image. If a conventional 32x downsampling network is used, the crack may only correspond to less than one pixel in the feature map, making it impossible to effectively identify and locate. However, using the truncated network of this embodiment, the crack can still retain a response area of multiple pixels in the feature map, thus enabling accurate detection and segmentation.
[0036] Furthermore, the attention mechanism module is a cross-attention alignment module, which performs the following operations: Use the high-dimensional feature tensor of the support set image as the key and value, and the high-dimensional feature tensor of the query set image as the query. Calculate the similarity attention matrix between the query and the key; The attention matrix is applied to the values to generate aligned feature maps; The aligned feature map is fused with the high-dimensional feature tensor of the query set image to output a joint feature map.
[0037] In this embodiment, the attention mechanism module is a cross-attention alignment module. The cross-attention alignment module is a feature interaction structure based on an attention mechanism, used to enhance and align the spatial dimensions of the features in the query set image by using the disease texture information in the support set image as a reference, thereby overcoming the viewpoint distortion caused by the curved surface of the cable-stayed cylinder and the scale changes caused by equipment shaking.
[0038] In this embodiment, the high-dimensional feature tensor of the support set image is used as the key and value, and the high-dimensional feature tensor of the query set image is used as the query. Both the key and value originate from the support set features, representing the texture pattern of the reference disease; the query originates from the query set features, representing the feature representation of each local region in the image to be detected. This setup allows subsequent attention calculations to use the support set disease as a reference, measuring the similarity between each location in the query set features and the reference disease.
[0039] In this embodiment, a similarity attention matrix between the query and the key is calculated. Specifically, the query matrix and the key matrix are multiplied to obtain an attention weight matrix, where each element represents the similarity score between a spatial location in the query set features and a spatial location in the support set features. The attention weight matrix is then normalized using a normalized exponential function, ensuring that the sum of the weights in each row is one, thereby obtaining a stable attention distribution.
[0040] In this embodiment, an attention matrix is applied to the values to generate an aligned feature map. Specifically, the attention matrix and the value matrix are multiplied to obtain a weighted feature map. This feature map is essentially a weighted combination of support set features based on the spatial location of query set features. Since the attention matrix reflects the similarity between each location in the query set and the disease texture in the support set, regions with high similarity to the disease are enhanced, while regions with low similarity are suppressed in the weighted feature map, thus achieving an aligned mapping of support set disease features to the query set feature space.
[0041] In this embodiment, the aligned feature map and the high-dimensional feature tensor of the query set image are fused to output a joint feature map. The fusion method uses residual connection, which adds the aligned feature map to the original query set features and introduces learnable weight parameters to control the contribution of the aligned features. Through this fusion, the disease-related regions in the original query set features are further enhanced, while irrelevant regions remain unchanged or are relatively weakened. The final output joint feature map retains the original spatial structure information of the query set image and incorporates the texture prior of the support set reference disease, providing a more accurate feature representation for subsequent similarity measurement. For example, when the climbing robot's shooting perspective is tilted due to the cable surface, the cracks in the query set image may exhibit different deformations than those in the support set reference image. The cross-attention alignment module can automatically find the correspondence between the crack regions in the two images through an attention mechanism and map the crack texture features in the support set to the corresponding positions in the query set, thereby effectively overcoming the interference caused by perspective deformation.
[0042] Furthermore, the joint feature map is input into a relation metric network based on a convolutional neural network. The relation metric network generates a response map reflecting the degree of disease similarity. Based on the response map, it outputs the location information of similar regions in the query set image and the support set image, specifically including: The joint feature map is input into the relation prediction head, and dense cross-correlation calculation is performed at each spatial location of the joint feature map. The relation prediction head generates a response heatmap that reflects the degree of similarity between diseases. The response heatmap is upsampled and thresholded by the decoder, and a pixel-level binary mask of the region similar to the support set image in the query set image is output. The pixel bounding box coordinates are generated based on the pixel-level binary mask.
[0043] In this embodiment, the joint feature map is input into a relation metric network based on a convolutional neural network. The relation metric network is a network structure that determines disease similarity by learning an implicit relational mapping between support set features and query set features. Its core function is to transform feature-level similarity into pixel-level response intensity.
[0044] In this embodiment, the joint feature map is input to the relation prediction head, and dense cross-correlation calculation is performed at each spatial location of the joint feature map. The relation prediction head consists of multiple convolutional layers. By sliding convolutional kernels on the joint feature map, local convolution operations are performed on each spatial location and its neighboring features. This is equivalent to calculating the implicit similarity score between the feature at each location in the feature map and the reference features of the support set. The dense cross-correlation calculation covers every spatial location in the feature map, ultimately generating a response heatmap. The value of each pixel in the heatmap represents the similarity between that location and the disease in the support set; a higher value indicates a greater probability that the target disease exists at that location.
[0045] In this embodiment, the response heatmap is upsampled and thresholded using a decoder. The decoder consists of multiple upsampling layers and convolutional layers, used to progressively restore the low-resolution heatmap to the size of the original input image. The upsampling operation is typically implemented using bilinear interpolation or transposed convolution to ensure that the spatial resolution of the heatmap is consistent with the original query set image, thereby achieving pixel-level localization of lesion locations. Subsequently, thresholding is performed on the restored heatmap, identifying areas in the heatmap exceeding a preset threshold as lesion areas and areas below the threshold as background, ultimately obtaining a binarized segmentation result.
[0046] In this embodiment, a pixel-level binary mask is output for regions similar to the support set image in the query set image. Pixel bounding box coordinates are then generated based on this mask. The pixel-level binary mask is a binary image with the same dimensions as the original image, where foreground pixels have a value of one, representing the affected area, and background pixels have a value of zero, representing the non-affected area. This mask can accurately delineate the precise outline of the affected area, rather than just outputting a rough bounding box. For irregularly shaped defects such as meandering cracks or forked scratches, the mask can precisely depict their complex forms. After obtaining the mask, the bounding rectangle of the mask is extracted using an image processing algorithm to generate the pixel bounding box coordinates. This bounding box is used to determine the pixel span of the defect during subsequent physical size mapping. For example, when a curved crack is detected, the pixel-level binary mask can accurately output the complete direction of the crack, including all its branches and bends, while the bounding box provides the smallest rectangle that can contain the entire crack. The diagonal length of this rectangle is used as the pixel span of the crack for subsequent size calculations.
[0047] Furthermore, pixel size information is extracted based on the positioning information, and combined with depth information and intrinsic parameter information from the inspection camera, the pixel size is converted into absolute physical size, specifically including: Depth information is obtained as the vertical depth from the lens to the cable surface. Pre-calibrated camera intrinsic information is also obtained, including the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution. The physical size mapping relationship is constructed based on the principle of similar triangles, and the pixel span is converted into the actual physical length using the following calculation formula: ; in, The actual physical length of the disease; The pixel span in the location information; This is depth information, which is the vertical depth from the lens to the cable surface; This refers to the physical diagonal size of the camera's image sensor. The calibrated focal length for a camera lens; The total number of pixels diagonally across the image's resolution; The conversion process is performed by the physical size mapping unit in response to the positioning information output by the similarity measurement unit. Its inputs are positioning information and real-time depth information, and its output is the absolute physical size value marked on the disease detection result.
[0048] In this embodiment, pixel size information is extracted based on the positioning information, and combined with depth information and the intrinsic parameters of the inspection camera, the pixel size is converted into an absolute physical size. Pixel size information refers to the number of pixels occupied by the defect in the image, such as the pixel span or pixel diameter extracted from a pixel-level binary mask; depth information refers to the vertical distance from the lens to the cable surface synchronously acquired by the laser rangefinder; camera intrinsic parameters include the physical diagonal size of the image sensor, the lens calibration focal length, and the total number of diagonal pixels in the image resolution. These parameters together describe the imaging geometry of the camera.
[0049] In this embodiment, a mapping formula based on the principle of similar triangles is used to convert pixel size into absolute physical size. The principle of similar triangles is a fundamental principle of optical imaging. When the camera's optical axis is perpendicular to the surface being measured, the ratio of the actual size of the object to the image size is equal to the ratio of the object distance to the focal length. Specifically, in this embodiment, the physical size of the defect imaged on the sensor is equal to the pixel span multiplied by the ratio of the sensor's physical size to the total number of pixels in the image. Then, according to the similar triangle relationship, the actual physical length of the defect is equal to the physical size of the image multiplied by the object distance divided by the focal length. The above relationships are mathematically derived to obtain the expression in the formula.
[0050] In this embodiment, each parameter in the formula has a clear physical meaning. The actual physical length of the defect is the final millimeter-level size result, used to assess the severity of the defect and determine whether repair is needed. The pixel span is the pixel distance of the defect in the image extracted from the positioning information. For example, for a crack, the pixel span is usually taken as the diagonal length of its circumscribed rectangle or the number of pixels in the maximum width direction. The depth information is obtained in real time by a laser rangefinder sensor and corresponds one-to-one with each frame of the query set image. It reflects the distance between the inspection equipment and the cable surface. Since the distance of the climbing robot or drone fluctuates with the curvature of the cable during the inspection process, the introduction of real-time depth information eliminates the scale drift caused by distance changes in pure visual detection.
[0051] In this embodiment, the physical diagonal size of the camera image sensor, the lens calibration focal length, and the total number of diagonal pixels in the image resolution are all inherent parameters of the camera, obtained through pre-calibration. The physical diagonal size of the image sensor reflects the actual size of the sensor chip, typically provided by the camera manufacturer or calculated through calibration. The lens calibration focal length reflects the lens's magnification; a longer focal length results in a larger image. The total number of diagonal pixels in the image resolution reflects the image resolution. For example, for a 40-megapixel image, the total number of diagonal pixels can be calculated by taking the square root of the sum of the squares of the pixels in the width and height directions. These three parameters together constitute the conversion benchmark from image pixel coordinates to sensor physical coordinates.
[0052] This embodiment uses the detection of circumferential microcracks as an example. Assume the system detects a crack occupying a pixel span of 120 pixels in the image, the current laser rangefinder measures a vertical depth of 150 mm from the lens to the cable surface, the camera image sensor's physical diagonal size is 9 mm, the lens's calibrated focal length is 12 mm, and the total number of diagonal pixels in the image resolution is 4500 pixels. Substituting these values into the formula, the actual physical length of the crack is calculated to be 3 mm. Actual engineering verification shows that the error in the physical dimension obtained using this method compared to manual measurement can be controlled within one millimeter, meeting the millimeter-level accuracy requirements for microcrack detection in bridge cables.
[0053] To address the issues of misalignment between the laser rangefinder and the camera's optical center, as well as the impact of curved cable surfaces on depth measurement in practical engineering, this invention further includes a depth alignment correction step. This step does not simply use the original depth measurement value, but rather obtains the corrected vertical depth through the following logical flow: The first step is to obtain a spatial mapping reference: a fixed spatial offset vector between the laser rangefinder and the camera optical center is determined in advance through a rigid body calibration experiment. This vector includes a component along the camera optical axis and a planar component perpendicular to the optical axis.
[0054] The second step is to establish the pixel-ray correspondence: For any pixel in the diseased area of the query set image, the image coordinates of the pixel are reverse-mapped into a normalized ray direction vector that starts from the camera optical center and points to the corresponding real space point of the pixel using a pre-calibrated camera intrinsic parameter matrix.
[0055] The third step is to determine the spatial location of the sensor measurement point: obtain the original depth measurement value synchronously collected by the laser rangefinder, and combine it with the spatial offset vector to determine the precise three-dimensional coordinates of the sensor measurement point in the camera coordinate system.
[0056] The fourth step is to construct the cylindrical surface equation: obtain the cylindrical surface radius parameters of the cable to be detected, and set the spatial straight line equation of the cable's central axis in the camera coordinate system to construct a cylindrical surface geometric model representing the cable surface.
[0057] Step 5: Solve for the ray-surface intersection point: Find the intersection point between the ray originating from the camera's optical center and following the normalized ray direction vector, and the cylindrical surface geometric model. This intersection point represents the actual three-dimensional spatial location of the defect point corresponding to that pixel on the cable surface.
[0058] Step 6: Calculate the corrected depth: Calculate the spatial straight-line distance from the camera's optical center to the intersection point, and use this distance as the corrected vertical depth.
[0059] Step 7, Generate Compensation Amount (Optional): Based on the difference between the corrected vertical depth and the original depth measurement, generate a depth compensation amount related to the pixel coordinate position, and establish a compensation amount lookup table for quick retrieval during online real-time inference.
[0060] Finally, the corrected vertical depth calculated in the above steps is used to replace the original depth information and substituted into the aforementioned physical size mapping relationship for calculation, thereby ensuring that the defects in all areas within the image plane (especially the edge areas on both sides of the cable) can achieve millimeter-level positioning accuracy. Engineering verification shows that after using this logic flow for depth alignment correction, the measurement error of cracks located at the image edge, which was 7.2 mm before correction, is significantly reduced to less than 0.8 mm.
[0061] Furthermore, the twin feature extraction network, attention mechanism module, and relation measurement network based on convolutional neural network are trained in a meta-learning paradigm to obtain network weights. The network weights are frozen in the application stage, and only one or more support set images need to be input in the application stage to perform inference and recognition of new diseases.
[0062] In this embodiment, the twin feature extraction network, attention mechanism module, and convolutional neural network-based relation metric network are trained using a meta-learning paradigm to obtain network weights. The meta-learning paradigm is a training strategy that teaches the model "how to learn." Its core idea is to simulate few-shot learning scenarios on a large number of source datasets containing different defect types, training the model's feature comparison ability by constructing numerous episodic tasks. Each episodic task randomly selects a small number of samples from the source dataset as a support set and another batch of samples as a query set. The model is required to identify defects in the query set samples when only seeing the support set samples. Through continuous iterative optimization, the model acquires the ability to quickly compare and generalize, rather than simply memorizing the appearance features of specific defects. In specific implementation, each episodic task can be constructed using an N-way K-shot approach, that is, randomly selecting N defect categories, selecting K samples from each category as a support set, and selecting K samples as a query set. The network parameters are updated by minimizing the prediction loss of the query set samples, and this process is repeated multiple times until the model converges.
[0063] In this embodiment, the network weights are frozen during the application phase. Freezing means that after the model completes initial training, the parameters of all network layers are no longer updated and are directly used for subsequent disease identification tasks. Since the model has already learned general feature comparison capabilities during the pre-training phase, no parameter adjustments or retraining are needed for new diseases during the application phase. Only the reference image of the new disease needs to be used as the support set input, and the model can automatically compare whether similar regions exist in the query set images, achieving a plug-and-play deployment method.
[0064] In this embodiment, only one or more support set images need to be input during the application phase to perform inference and identification of new diseases. The number of support set images can be flexibly selected according to actual needs. When only one support set image is input, the model adopts a single-sample learning method, identifying diseases based on the features of a single reference sample. When multiple support set images are input, the model can fuse the features of multiple reference images to obtain a more stable and comprehensive disease representation, thereby improving the accuracy and robustness of identification. The support set images are temporarily uploaded by engineers at the inspection site based on the actual types of diseases found, without any additional annotation or training operations.
[0065] This embodiment uses the detection of a rare type of "circumferential microcrack in the PE sheath of a cable" as an example. In traditional deep learning methods, the model cannot identify this type of crack because such crack samples are extremely rare and do not appear in the training set. However, using the technical solution of this embodiment, after engineers discover this type of crack during inspection, they only need to take a clear photo of the crack as the support set image input to the system. The system can then compare the features of the crack with subsequent inspection images to identify all areas with the same crack in real time. Because the network weights have already acquired general feature comparison capabilities through numerous panel tasks during the pre-training phase, the model can accurately identify even circumferential microcracks that have never been trained on, without the need for re-collecting data, labeling, and training. This significantly reduces the threshold and cost of applying artificial intelligence technology in the field of bridge inspection.
[0066] Furthermore, at least one reference image containing the target disease is acquired as a support set image, and the region of interest in the reference image is extracted as the input for feature extraction; simultaneously, depth information collected by the inspection equipment is acquired, specifically: depth information is collected synchronously through a laser rangefinder, the depth information is the vertical depth from the lens to the cable surface, and the depth information corresponds one-to-one with the query set image.
[0067] In this embodiment, at least one reference image containing the target disease is acquired as the support set image, and the region of interest (ROI) in the reference image is extracted as the input for feature extraction. The ROI refers to the specific local area where the disease is located in the reference image, which is cropped from the entire reference image through manual annotation or automatic detection. Extracting the ROI as the input for feature extraction effectively eliminates interference from irrelevant background information in the reference image, allowing the twin feature extraction network to focus on learning the texture, shape, and edge features of the disease itself, thereby obtaining a purer and more discriminative representation of the disease features. For example, after an engineer uploads a reference image containing circumferential microcracks, the system prompts them to select the rectangular area where the cracks are located in the image. Subsequently, the twin feature extraction network only processes the image content within this rectangular area, rather than the entire image, thus avoiding interference from irrelevant information such as normal surface texture, lighting, and shadows on the cable and causing interference with feature learning.
[0068] In this embodiment, depth information collected by the inspection equipment is acquired synchronously, specifically through a laser rangefinder. The laser rangefinder and the image acquisition module are synchronized using a hardware trigger signal to ensure that each frame of the query set image corresponds to a unique depth measurement value. The depth information is the vertical depth from the lens to the cable surface, that is, the straight-line distance from the camera's optical center along the optical axis to the cable surface. Since the bridge cable has a cylindrical curved surface, the distance from the lens to the cable surface will fluctuate with the cable curvature and equipment attitude adjustments as the climbing robot or drone moves along the cable. Real-time synchronous acquisition of depth information provides an accurate distance reference for subsequent physical dimension mapping.
[0069] In this embodiment, depth information corresponds one-to-one with the query set images. This one-to-one correspondence means that each frame of the query set image is associated with a depth measurement value acquired simultaneously, and the two are strictly aligned in time. Specifically, the image acquisition module continuously acquires images of the cable surface at a fixed frame rate, while the laser rangefinder synchronously acquires depth data at the same or higher sampling frequency. A timestamp or hardware trigger signal ensures the matching relationship between the image and depth data. For example, a climbing robot acquires images at a frame rate of thirty frames per second, and the laser rangefinder synchronously outputs depth values at the same frequency. The system binds and stores the Nth frame image with the Nth depth value, thus ensuring that the depth information used in subsequent calculations completely corresponds spatially to the image content. This one-to-one correspondence eliminates distance errors caused by asynchronous acquisition, providing data consistency assurance for achieving millimeter-level physical size mapping.
[0070] Furthermore, the internal parameters of the inspection camera include the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution; the positioning information includes pixel-level binary mask or pixel bounding box coordinates.
[0071] In this embodiment, the intrinsic parameters of the inspection camera include the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels in the image resolution. The physical diagonal size of the camera image sensor refers to the physical length of the diagonal of the effective imaging area of the image sensor chip, typically measured in millimeters. This parameter reflects the actual size of the sensor and is a crucial bridge connecting the pixel coordinate system and the physical world coordinate system. The calibrated focal length of the camera lens refers to the distance from the optical center of the lens to the image sensor plane, also measured in millimeters. This parameter determines the magnification of the image; the longer the focal length, the larger the image of the object at the same object distance. The total number of diagonal pixels in the image resolution is the square root of the sum of the squares of the number of pixels in the horizontal direction and the number of pixels in the vertical direction. This parameter reflects the total pixel scale of the image and is used to convert the number of pixels into the physical size on the sensor. These three parameters together constitute a complete conversion link from image pixel coordinates to sensor physical coordinates and then to world physical coordinates.
[0072] In this embodiment, the positioning information includes pixel-level binary mask or pixel bounding box coordinates. The pixel-level binary mask is a binary image of the same size as the original query set image, where foreground pixels have a value of one, representing the diseased area, and background pixels have a value of zero, representing the non-diseased area. This mask can accurately depict the complete outline of the disease, including its shape, direction, branches, and other details. It is suitable for scenarios requiring precise understanding of the disease morphology, such as for winding cracks or forked scratches, the mask can completely outline their complex structure. Pixel bounding box coordinates refer to the vertex coordinates of the smallest bounding rectangle that can completely contain the diseased area. They are usually represented by the coordinates of the top-left and bottom-right corners of the rectangle, or by the center point coordinates combined with the width and height. The bounding box only provides the rough location and approximate size of the disease, without containing morphological details, but it has the advantages of simple calculation and small storage footprint. In practical applications, the output mask or bounding box can be selected according to specific needs. For example, a mask is used when it is necessary to accurately calculate the disease area or evaluate the crack width, while a bounding box is used when only rapid location of the disease is required. The system outputs a pixel-level binary mask by default, and automatically generates pixel bounding box coordinates based on the mask for use in subsequent physical size mapping steps. For example, when calculating the pixel span of a lesion, the diagonal length of the bounding box is extracted as a representative size.
[0073] Furthermore, the truncated deep residual network uses ResNet50 as the backbone network. The truncated deep residual network removes the fourth stage of ResNet50 and the subsequent global average pooling layer and fully connected layer. The truncated deep residual network only retains the high-dimensional feature tensor output up to the third stage.
[0074] In this embodiment, a truncated deep residual network removes deep, high-magnification global downsampling layers. Deep residual networks typically consist of stacked residual stages, each containing several residual blocks. Downsampling operations are performed between stages using strided convolutions or pooling layers to expand the receptive field and reduce computational cost. Taking ResNet50 as an example, this network contains four residual stages, with the second, third, and fourth stages all including downsampling operations. The fourth stage has the highest downsampling factor, reducing the spatial resolution of the feature map relative to the input image to 1 / 32. Removing deep, high-magnification global downsampling layers specifically means removing the fourth stage and its subsequent global average pooling and fully connected layers, retaining only the third stage. This reduces the spatial resolution of the output feature map to only 1 / 16 of the input image. This structural design avoids the loss of spatial information for minor defects caused by excessively high downsampling, ensuring that even minor defects such as cracks less than two millimeters wide retain identifiable response regions in the feature map.
[0075] In this embodiment, the truncated deep residual network outputs a high-dimensional feature tensor while preserving spatial resolution. Preserving spatial resolution means that the twin feature extraction network maintains a high spatial resolution in the output stage, i.e., the width and height of the output feature map are relatively small compared to the downsampling factor of the input image, thus allowing the precise location and contour information of the lesion to be fully preserved at the feature level. A high-dimensional feature tensor refers to the output feature map having a high dimensionality in the channel dimension. For example, when ResNet50 is used as the backbone network and truncated to the third stage, the number of channels in the output feature map is 1024. The rich number of channels provides sufficient semantic information for lesion identification and can effectively distinguish the texture and edge features of different types of lesions. Taking the detection of a microcrack with a width of only 1.5 mm as an example, when the input image resolution is 1024 by 1024 pixels, the crack may only occupy about five pixels in width in the image. If a conventional 32x downsampling network is used, the crack will only correspond to less than one pixel in the feature map, and cannot be effectively identified and located. The truncated network in this embodiment outputs a feature map that is 16 times smaller than the input image. The crack can still retain the response area of multiple pixels in the feature map, thus providing a sufficient feature basis for subsequent pixel-level segmentation. This realizes a complete technical path from accurate detection of tiny defects to millimeter-level physical size mapping.
[0076] This invention provides an embodiment of a millimeter-level localization system for bridge cable defects based on few-shot learning, comprising: Image acquisition module, used to acquire images of the surface of bridge cables; The depth acquisition module is triggered synchronously with the image acquisition module. The depth acquisition module is used to acquire depth information from the lens to the cable surface. The storage module is used to store at least one reference image containing the target lesion as a support set image; The edge computing module is communicatively connected to the image acquisition module, the depth acquisition module, and the storage module. The edge computing module includes a feature extraction unit, a feature interaction unit, a similarity measurement unit, and a physical size mapping unit. The feature extraction unit is equipped with a twin feature extraction network, which is used to extract high-dimensional feature tensors of the support set image and the query set image; The feature interaction unit is equipped with an attention mechanism module. The feature interaction unit is used to perform feature interaction and fusion in the spatial dimension using the high-dimensional feature tensor of the support set image as the reference feature and the high-dimensional feature tensor of the query set image as the feature to be interacted with. The feature interaction unit outputs a joint feature map. The similarity measurement unit is used to input the joint feature map into the relation measurement network based on the convolutional neural network. The similarity measurement unit generates a response map that reflects the degree of similarity between diseases. Based on the response map, the similarity measurement unit outputs the location information of the similar regions in the query set image and the support set image. The physical size mapping unit is used to extract pixel size based on positioning information. The physical size mapping unit combines depth information and camera intrinsic parameters to convert pixel size into absolute physical size. The display module is used to output the disease detection results and the positioning information that marks the actual physical dimensions.
[0077] In this embodiment, the image acquisition module is used to acquire images of the bridge cable surface. The image acquisition module is typically mounted on a climbing robot or drone and uses a high-resolution industrial camera, capable of continuously acquiring images of the cable surface at a rate of tens of frames per second, providing raw visual data for defect detection. For example, as the climbing robot ascends the cable at a constant speed, the image acquisition module captures real-time images of the cable surface at a resolution of 40 million pixels, ensuring that minute defects such as microcracks less than two millimeters wide can be clearly imaged.
[0078] In this embodiment, the depth acquisition module and the image acquisition module are triggered synchronously to acquire depth information from the lens to the cable surface. The depth acquisition module uses a laser rangefinder sensor and is synchronized with the image acquisition module through a hardware trigger signal, ensuring that each frame of the image corresponds to a unique and time-aligned depth measurement value. Since the bridge cable has a cylindrical curved surface, the distance from the lens to the cable surface will fluctuate with the curvature of the cable during the movement of the climbing robot or drone. Real-time synchronous acquisition of depth information provides an accurate distance reference for subsequent physical dimension mapping, eliminating the scale drift caused by changes in shooting distance in pure visual detection.
[0079] In this embodiment, the storage module stores at least one reference image containing the target defect as a support set image. The storage module can be a local solid-state drive or cloud storage space, used to save reference defect images uploaded by engineers during inspections. The support set images typically contain one or more clear photos of the target defect. For example, after an engineer discovers a rare circumferential microcrack, they take a clear photo of the crack and store it in the storage module as a reference for defect identification during subsequent real-time inspections.
[0080] In this embodiment, the edge computing module is communicatively connected to the image acquisition module, the depth acquisition module, and the storage module. The edge computing module is a computing unit deployed at the inspection equipment end or near-end server, equipped with a high-performance graphics processor or neural network acceleration chip, capable of processing the data streams input from the image acquisition module and the depth acquisition module in real time. Communication between the edge computing module and each module can be achieved via wired or wireless connections, ensuring low latency and high reliability of data transmission.
[0081] In this embodiment, the edge computing module includes a feature extraction unit, a feature interaction unit, a similarity measurement unit, and a physical size mapping unit. The feature extraction unit is equipped with a twin feature extraction network to extract high-dimensional feature tensors from the support set image and the query set image. This network employs a truncated deep residual network structure, removing deep, high-magnification global downsampling layers to output high-dimensional feature tensors containing high-resolution spatial information, thus preserving the spatial location information of minute defects. The feature interaction unit is equipped with an attention mechanism module to perform spatial feature interaction and fusion using the high-dimensional feature tensor of the support set image as a reference feature and the high-dimensional feature tensor of the query set image as the feature to be interacted with, outputting a joint feature map. This unit effectively overcomes the perspective distortion caused by the curved surface of the cable-stayed cylinder and the scale changes caused by equipment shaking. The similarity measurement unit inputs the joint feature map into a relational measurement network based on a convolutional neural network to generate a response map reflecting the degree of defect similarity. Based on the response map, it outputs the location information of similar regions in the query set image and the support set image. This unit outputs pixel-level binary masks and pixel bounding box coordinates, achieving pixel-level precise localization of defect areas. The physical size mapping unit is used to extract pixel size based on positioning information, combine depth information and camera intrinsic parameters to convert pixel size into absolute physical size, and convert pixel span into actual length at the millimeter level. For example, the length of a 120-pixel crack is converted into a physical size of 3 millimeters, achieving millimeter-level positioning accuracy.
[0082] In this embodiment, the display module is used to output the detection results of defects and the positioning information with actual physical dimensions. The display module can be a display screen in the inspection control center, a handheld terminal screen, or augmented reality glasses, used to display the detection results in real time. When the system detects a defect, the display module overlays the annotation information on the query set image, such as selecting the defect area with a red border and displaying the calculated actual physical dimensions next to the border, such as "crack length 3 mm". At the same time, it outputs auxiliary information such as defect type, detection time, and location coordinates for engineers to judge and record on site. For example, during the inspection of a climbing robot, the display module transmits images of the cable surface in real time. When a circumferential microcrack is detected, the crack area is automatically covered with a green mask in the image and labeled "circumferential microcrack, length 3 mm, positioning error less than 1 mm". Engineers can intuitively obtain the precise location and size information of the defect without stopping the inspection.
[0083] 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 this invention and its equivalents, this invention also intends to include these modifications and variations.
Claims
1. A millimeter-level localization method for bridge cable defects based on few-sample learning, characterized in that, Includes the following steps: Acquire at least one reference image containing the target disease as the support set image, acquire the image to be inspected collected in real time by the inspection equipment as the query set image, and simultaneously acquire the depth information collected by the inspection equipment. The support set images undergo quality assessment and enhancement, specifically including: performing quality pre-detection on user-uploaded reference images, calculating image sharpness, the integrity of the target disease area, and foreground-background contrast; when the sharpness is below a preset threshold, the disease area is occluded beyond a preset threshold, or the contrast is too low, a prompt message is issued, requiring the user to provide a higher-quality support set image or manually adjust the region of interest; for support set images that pass the pre-detection but still have slight blur or uneven illumination, a lightweight enhancement network is used to adaptively deblur and normalize the illumination, generating an enhanced reference image as the actual input to the twin feature extraction network; the enhancement network, along with the subsequent twin feature extraction network, attention module, and relation measurement network, are jointly optimized during the meta-learning training phase; The support set image and the query set image are respectively input into the weight-shared twin feature extraction network. The twin feature extraction network adopts a truncated structure to avoid excessive loss of spatial information caused by global downsampling. The twin feature extraction network outputs a high-dimensional feature tensor containing high-resolution spatial information. The high-dimensional feature tensors of the support set image and the query set image are input into the attention mechanism module. The high-dimensional feature tensors of the support set image are used as reference features and the high-dimensional feature tensors of the query set image are used as features to be interacted with. Feature interaction and fusion in spatial dimension are performed, and the attention mechanism module outputs a joint feature map. The joint feature map is input into a relational metric network based on a convolutional neural network. The relational metric network generates a response map that reflects the degree of similarity between diseases and outputs the location information of similar regions in the query set image and the support set image based on the response map. Extract pixel span based on location information; Depth information is obtained as the vertical depth from the lens to the cable surface. Pre-calibrated camera intrinsic information is also obtained, including the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution. The physical size mapping relationship is constructed based on the principle of similar triangles, and the pixel span is converted into the actual physical length using the following calculation formula: ; in, The actual physical length of the disease; The pixel span in the location information; This is depth information, which is the vertical depth from the lens to the cable surface; This refers to the physical diagonal size of the camera's image sensor. The calibrated focal length for a camera lens; The total number of pixels diagonally across the image's resolution; The conversion process is performed by the physical size mapping unit in response to the positioning information output by the similarity measurement unit. The input of the physical size mapping unit is the positioning information and the depth information, and the output of the physical size mapping unit is the absolute physical size value marked on the disease detection result. The depth information is obtained through a depth alignment correction step, which includes: firstly determining a fixed spatial offset vector between the laser rangefinder and the camera optical center through a rigid body calibration experiment; the spatial offset vector includes a component along the camera optical axis and a planar component perpendicular to the optical axis; for any pixel in the diseased area of the query set image, using a pre-calibrated camera intrinsic parameter matrix, the image coordinates of the pixel are reverse-mapped into a normalized ray direction vector originating from the camera optical center and pointing to the corresponding real spatial point of the pixel; the original depth measurement value synchronously acquired by the laser rangefinder is obtained and combined with the spatial offset vector, and then... The precise three-dimensional coordinates of the sensor measurement points are determined in the coordinate system; the cylindrical radius parameters of the cable to be detected are obtained, and the spatial straight line equation of the cable's central axis is set in the camera coordinate system to construct a cylindrical curved surface geometric model representing the cable surface; the intersection point between the ray originating from the camera optical center along the normalized ray direction vector and the cylindrical curved surface geometric model is solved, and the intersection point is the actual three-dimensional spatial position of the defect point corresponding to the pixel on the cable surface; the spatial straight line distance from the camera optical center to the intersection point is calculated, and the spatial straight line distance is used as the corrected vertical depth; the corrected vertical depth replaces the original depth information and is substituted into the physical size mapping relationship for calculation.
2. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, The twin feature extraction network is a truncated deep residual network. The truncated deep residual network removes the deep high-magnification global downsampling layers and outputs high-dimensional feature tensors while preserving spatial resolution.
3. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, The attention mechanism module is a cross-attention alignment module, which performs the following operations: Use the high-dimensional feature tensor of the support set image as the key and value, and the high-dimensional feature tensor of the query set image as the query. Calculate the similarity attention matrix between the query and the key; The attention matrix is applied to the values to generate aligned feature maps; The aligned feature map is fused with the high-dimensional feature tensor of the query set image to output a joint feature map.
4. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, The joint feature map is input into a relation metric network based on a convolutional neural network. The relation metric network generates a response map reflecting the degree of disease similarity. Based on the response map, it outputs the location information of similar regions in the query set image and the support set image, specifically including: The joint feature map is input into the relation prediction head, and dense cross-correlation calculation is performed at each spatial location of the joint feature map. The relation prediction head generates a response heatmap that reflects the degree of similarity between diseases. The response heatmap is upsampled and thresholded by the decoder, and a pixel-level binary mask of the region similar to the support set image in the query set image is output. The pixel bounding box coordinates are generated based on the pixel-level binary mask.
5. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, The twin feature extraction network, attention mechanism module, and relation measurement network based on convolutional neural network are trained in a meta-learning paradigm to obtain network weights. The network weights are frozen in the application stage, and only one or more support set images need to be input in the application stage to perform inference and recognition of new diseases.
6. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, At least one reference image containing the target disease is acquired as a support set image, and the region of interest in the reference image is extracted as the input for feature extraction. Simultaneously, depth information collected by the inspection equipment is acquired, specifically: depth information is collected synchronously through a laser rangefinder, and the depth information is the vertical depth from the lens to the cable surface. The depth information corresponds one-to-one with the query set image.
7. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 1, characterized in that, The internal parameters of the inspection camera include the physical diagonal size of the camera image sensor, the calibrated focal length of the camera lens, and the total number of diagonal pixels of the image resolution; the positioning information includes pixel-level binary mask or pixel bounding box coordinates.
8. The millimeter-level localization method for bridge cable defects based on few-sample learning according to claim 2, characterized in that, The truncated deep residual network uses ResNet50 as the backbone network. The truncated deep residual network removes the fourth stage of ResNet50 and the subsequent global average pooling layer and fully connected layer. The truncated deep residual network only retains the high-dimensional feature tensor output up to the third stage.
9. A millimeter-level positioning system for bridge cable defects based on few-sample learning, characterized in that, The method for performing millimeter-level localization of bridge cable defects based on few-sample learning as described in any one of claims 1 to 8 includes: Image acquisition module, used to acquire images of the surface of bridge cables; The depth acquisition module is triggered synchronously with the image acquisition module. The depth acquisition module is used to acquire depth information from the lens to the cable surface. The storage module is used to store at least one reference image containing the target lesion as a support set image; The edge computing module is communicatively connected to the image acquisition module, the depth acquisition module, and the storage module. The edge computing module includes a feature extraction unit, a feature interaction unit, a similarity measurement unit, and a physical size mapping unit. The feature extraction unit is equipped with a twin feature extraction network, which is used to extract high-dimensional feature tensors of the support set image and the query set image; The feature interaction unit is equipped with an attention mechanism module. The feature interaction unit is used to perform feature interaction and fusion in the spatial dimension using the high-dimensional feature tensor of the support set image as the reference feature and the high-dimensional feature tensor of the query set image as the feature to be interacted with. The feature interaction unit outputs a joint feature map. The similarity measurement unit is used to input the joint feature map into the relation measurement network based on the convolutional neural network. The similarity measurement unit generates a response map that reflects the degree of similarity between diseases. Based on the response map, the similarity measurement unit outputs the location information of the similar regions in the query set image and the support set image. The physical size mapping unit is used to extract pixel size based on positioning information. The physical size mapping unit combines depth information and camera intrinsic parameters to convert pixel size into absolute physical size. The display module is used to output the disease detection results and the positioning information that marks the actual physical dimensions.
Citation Information
Patent Citations
Pavement disease size accurate quantification method based on binocular vision
CN120411199A
