A high-speed rail overhead line system component few-sample anomaly detection method, device and medium

CN122929352APending Publication Date: 2026-10-16CHINA RAILWAY FIRST GROUP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611178743.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-05
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

传统的有监督学习方法高度依赖大量带有精确标注的缺陷数据,但在实际场景中,难以收集到覆盖所有故障类型的完备数据集,导致模型对未知形态缺陷的泛化能力极差

Benefits of technology

[0010] According to the specific embodiments provided in this application, the following technical effects are disclosed: After extracting the mask, this application introduces geometric prior and adaptive edge enhancement to optimize the mask. Then, it performs multi-scale feature clustering for mask space alignment and target purification to obtain a component mask set and a purified target image. Through the above processing, the segmentation mask space of the target component is standardized, accurately decoupling the complex hanging clues from the physical background of the core component is achieved, alleviating the problem of oversegmentation or false alarms in small component areas caused by interference from complex backgrounds in the field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122929352A_ABST
    Figure CN122929352A_ABST
Patent Text Reader

Abstract

The application discloses a high-speed rail contact network component few sample anomaly detection method, equipment and medium, relates to high-speed railway image intelligent detection and computer vision technology, and includes the following steps: extracting target content label and mask based on the high-speed rail contact network component image set, introducing geometric priori and adaptive edge reinforcement, performing mask space alignment and target purification of multi-scale feature clustering, and extracting features of the pure target image by using the parameter frozen basic visual encoder; combining the frequency-space dual domain spatial displacement distance and the multi-modal semantic similarity, calculating the structure anomaly score matrix; modeling the component semantic features as graph network nodes, calculating the logical anomaly score matrix by using the graph attention mechanism and the geometric feature measurement; weighting the two score matrices to obtain an anomaly heat map, and then obtaining hierarchical positioning warning information. The application realizes multi-class high-precision detection of component surface damage and global logical errors under the conditions of free training and few normal samples.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of intelligent image detection and computer vision technology for high-speed railways, and in particular to a method, equipment and medium for detecting anomalies in a small number of samples of high-speed railway catenary components. Background Technology

[0002] The overhead contact line is a core component of the high-speed railway electric traction power supply system, directly affecting the safety and stability of train operation. Because the overhead contact line is exposed to the outdoor environment year-round, it is constantly subjected to the intense mechanical vibrations caused by high-speed train operation and the complex and ever-changing environmental erosion. Its key components (such as insulators, droppers, pins, and cantilever arms) are highly susceptible to physical structural damage, including breakage, loosening, and even fracture. If these defects are not detected and eliminated in a timely manner, they can potentially lead to train accidents, causing significant economic losses and social impact. Faced with the extremely challenging operating conditions in actual railway scenarios, existing automated anomaly detection algorithms mainly encounter the following technical bottlenecks.

[0003] (1) Abnormal samples are extremely difficult to obtain and have diverse forms: In actual operation lines, contact network fault samples are extremely rare compared to normal samples, and negative sample data is extremely scarce. Traditional supervised learning methods rely heavily on a large amount of defect data with precise annotations, but in real-world scenarios, it is difficult to collect a complete dataset covering all fault types, resulting in extremely poor generalization ability of the model for unknown defect forms.

[0004] (2) Severe interference from complex backgrounds: The background of overhead contact line images usually includes intricate steel frame structures, vegetation, sky, and variable lighting conditions. In addition, due to the limitations of the shooting angle of intelligent devices, existing detection algorithms often have difficulty effectively separating target components from the background when processing high-resolution and highly complex railway images, resulting in a large number of false alarms or missed alarms for the abnormal detection of small components (such as pins, washers, etc.).

[0005] (3) High model deployment cost and lack of logical semantic understanding: Existing anomaly detection models often follow the "one model per class" paradigm, requiring individual customization and lengthy model training for hundreds or thousands of different specifications of components in the overhead contact system. This lacks flexibility and scalability in the face of rapidly iterating inspection operations. In addition, existing methods are mostly limited to low-level pixel-level comparison, making it difficult to understand the complex mechanical assembly constraints between components, thus failing to effectively identify "logical anomalies" at the high semantic level, such as missing components and misaligned combinations. Summary of the Invention

[0006] The purpose of this application is to provide a method, equipment, and medium for detecting anomalies in high-speed rail catenary components with a small number of samples. Under conditions of no training required and very few normal samples, it achieves high-precision detection of multiple types of surface damage and global logic errors in components.

[0007] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a method for detecting anomalies in a small number of samples of high-speed railway overhead contact system components, including: Acquire a preset normal sample set and an image set of high-speed rail catenary components; Based on the image set of the high-speed rail catenary components, target content labels and masks are extracted, and geometric priors and adaptive edge enhancement are introduced to optimize the mask. Then, combined with the preset normal sample set, multi-scale feature clustering is performed to perform mask space alignment and target purification to obtain component mask set and purified target image. The basic visual encoder with parameter freezing is used to extract features from the purified target image to obtain multi-scale feature representation. Using the preset normal sample set as a reference, and based on the component mask set, the target content label, and the multi-scale feature representation, combined with the frequency-space dual-domain spatial displacement distance and multimodal semantic similarity, the structural anomaly score matrix is ​​calculated. Using the preset normal sample set as a reference, based on the component mask set, the multi-scale feature representation, and the high-speed rail catenary component image set, the semantic features of the components are modeled as graph network nodes, and the logical anomaly score matrix is ​​calculated using graph attention mechanism and geometric feature measurement. The structural anomaly score matrix and the logical anomaly score matrix are weighted to obtain an anomaly heatmap. Dynamic threshold segmentation and connected component analysis based on the preset normal sample set are performed on the anomaly heatmap to obtain graded location and early warning information for faults in high-speed rail catenary components.

[0008] Secondly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a method for detecting anomalies in a small number of high-speed rail catenary components.

[0009] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for detecting anomalies in low-sample components of high-speed rail overhead contact lines.

[0010] According to the specific embodiments provided in this application, the following technical effects are disclosed: After extracting the mask, this application introduces geometric prior and adaptive edge enhancement to optimize the mask. Then, it performs multi-scale feature clustering for mask space alignment and target purification to obtain a component mask set and a purified target image. Through the above processing, the segmentation mask space of the target component is standardized, accurately decoupling the complex hanging clues from the physical background of the core component is achieved, alleviating the problem of oversegmentation or false alarms in small component areas caused by interference from complex backgrounds in the field.

[0011] Building upon this foundation, this application introduces a parameter-freezing-based visual and multimodal text encoder, achieving zero-cost generalization detection of cross-category parts under conditions requiring minimal training and only a few normal samples. In this application, by combining frequency-space dual-domain spatial displacement distance and multimodal semantic similarity, robust resistance to motion blur and sudden illumination changes is achieved, and the structural anomaly score matrix is ​​accurately calculated. This application models the semantic features of parts as graph network nodes, utilizing graph attention mechanisms and geometric feature calculations to compute the logical anomaly score matrix. This enables dual-level joint detection of physical damage to part surfaces and global assembly logic errors (such as missing or misaligned parts). It can more effectively cross-align deep features at the part level, multidimensional spatial geometric features, and the adaptively evolved adjacency matrix of graph attention, and compute logical anomaly scores, thereby improving the advanced semantic anomaly detection capabilities for missing, loose, and misaligned parts.

[0012] This application fundamentally reduces the false alarm rate of minor defects, significantly improving the detection accuracy and engineering deployment efficiency of the model in complex railway scenarios. Attached Figure Description

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

[0014] Figure 1 This is a flowchart illustrating a method for detecting anomalies in a small number of high-speed rail overhead contact system components according to an embodiment of this application.

[0015] Figure 2 A flowchart illustrating the process of the low-sample anomaly detection method for high-speed rail catenary components based on a training-free visual language model provided in this application.

[0016] Figure 3 A panoramic view of the overhead contact line support components was taken for a self-propelled intelligent inspection vehicle.

[0017] Figure 4 This is a typical diagram showing the abnormality categories of overhead contact line components.

[0018] Figure 5 Create a flowchart for overhead contact line image acquisition and dataset preprocessing.

[0019] Figure 6 A framework diagram for mask space alignment and target purification in multi-scale feature clustering.

[0020] Figure 7A framework diagram for calculating component logic anomaly scores to enhance topological associations and multidimensional geometric feature constraints.

[0021] Figure 8 A visualization of the results of abnormal component detection. Detailed Implementation

[0022] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] Large-scale pre-trained vision-language models have demonstrated superior cross-modal feature representation and few-shot generalization capabilities. Based on this, this application overcomes the granularity bottleneck of general-purpose large models in specialized industrial scenarios, deeply adapting them to the highly complex field of high-speed rail catenary detection. It achieves accurate identification of surface structural damage to components and precise capture of logical assembly anomalies between components under extreme conditions requiring no specific model training (training-free) and only a very small number of normal reference samples, thus solving a core technical challenge in the current field of intelligent railway operation and maintenance.

[0024] Specifically, this application designs a novel few-shot anomaly detection model for high-speed railway catenary components, called FC-MAD. This model is built on a training-free vision-language multimodal mapping and graph topology enhancement framework. It includes a context-based component clustering module with geometric prior enhancement. This module normalizes the segmentation mask space of target components by fusing a general segmentation model, an adaptive edge enhancement operator, and a geometric constraint filtering algorithm for slender catenary cues, thereby mitigating the problem of oversegmentation or false alarms in small component areas caused by complex background interference in the field. A frequency-space dual-domain component perception and matching module is also designed. This module uses Fast Fourier Transform to extract high-frequency texture components to construct joint frequency-space dual-domain features, and combines this with dynamically generated semantic-like text prompts from general visual recognition labels to perform cross-modal alignment. This achieves robust resistance to motion blur and sudden changes in illumination and accurately calculates structural anomaly scores. In addition, a graph-enhanced component modeling module was designed to more effectively cross-align deep features at the component level, multi-dimensional spatial geometric features, and the adjacency matrix of graph attention adaptive evolution, and to calculate logical anomaly scores, thereby improving the advanced semantic anomaly detection capabilities for component-level missing, loose, and assembly misalignment.

[0025] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0026] In one exemplary embodiment, such as Figure 1 and Figure 2 As shown, a method for detecting anomalies in a small number of components of a high-speed railway catenary is provided. This method is executed by computer equipment, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method includes the following steps 101 to 105.

[0027] Step 101: Obtain a preset normal sample set and an image set of high-speed railway catenary components; wherein, the preset normal sample set includes multiple preset normal samples, and the high-speed railway catenary support and suspension device is image collected by a self-propelled intelligent inspection vehicle to obtain the high-speed railway catenary component image set.

[0028] The training-test dataset for the overhead contact line self-propelled intelligent inspection vehicle (CSCUD) required in this application was acquired by the self-propelled intelligent inspection vehicle flying over the railway along a pre-planned route. That is, multi-angle raw inspection images containing the components to be inspected (such as insulators, positioners, etc.) were obtained using a high-resolution inspection terminal. .

[0029] Step 102: Extract target content labels and masks based on the high-speed rail catenary component image set, and optimize the masks by introducing geometric priors and adaptive edge enhancement. Then, combine the preset normal sample set to perform multi-scale feature clustering mask space alignment and target purification to obtain component mask set and purified target image. Use a parameter-frozen basic visual encoder to extract features from the purified target image to obtain multi-scale feature representation.

[0030] To extract localized and background-free images of overhead contact line components from complex global images captured by a self-propelled intelligent inspection vehicle, such as... Figure 3 As shown, this application abandons the traditional fixed target localization method. Instead, it sequentially uses a RAM model to extract target content tags and imports them as prompt words into a Grounded SAM large model to generate an initial target mask. Subsequently, combining the geometric prior constraints of the catenary clues with feature clustering alignment operations, it physically filters complex suspended clues and field backgrounds to obtain clean component binary masks. The images of the catenary components are input into a basic visual encoder with frozen parameters to extract multi-scale feature representations containing local texture and global topology. Finally, eight categories of key components with relatively high anomaly rates (including insulators, locator pipe joints, bushing lugs, bolts, etc.) are obtained. Figure 4 As shown in the figure, the overall data processing flow and data distribution of components at different scales are as follows: Figure 5 As shown.

[0031] In a specific application, step 102 includes the following steps (21)-(28).

[0032] (21) Input the high-speed rail contact network component images (i.e., the multi-angle original inspection images mentioned above) from the high-speed rail contact network component image set into the pre-trained Recognize Anything Model to extract target content labels.

[0033] (22) Input the target content tags as prompts into the pre-trained GroundedSAM model to obtain... A set of initial target binary masks covering the entire map. This yields the initial target mask set.

[0034] (23) Based on geometric prior features, the initial target mask set is filtered to obtain the filtered candidate mask set.

[0035] To address the issue of oversegmentation caused by the slender catenary wires and contact wires inherent in overhead contact systems, geometric prior features of each connected component in the initial target binary mask set are extracted, including the aspect ratio of the minimum bounding rectangle. and physical density Set the geometric rejection threshold. When the connected components satisfy Furthermore, when the density is extremely low, the mask is determined to be a non-target dangling clue and is discarded, and the filtered candidate mask set is output. .

[0036] (24) Apply an adaptive edge enhancement operator to the candidate mask set to perform morphological smoothing and edge correction to obtain an optimized mask set.

[0037] To address the issue of false edges under complex weather conditions, an adaptive edge enhancement operator is applied to the candidate mask set. This is achieved by calculating the original inspection image. Gradient matrices in the horizontal and vertical directions By combining morphological closing operations to perform nonlinear smoothing and expansion / contraction correction on the mask boundaries, a high-quality mask set with perfectly fitted edges is generated. The edge gradient weight function is expressed as: .

[0038] (25) Based on the preset normal sample set, the optimized mask set, and the high-speed rail contact network component image set, perform multi-scale feature clustering for mask space alignment and target purification to obtain the component mask set and purified target image. Step (25) specifically includes the following steps: 1) For the images in the preset normal sample set, extract deep features and perform spatial clustering to generate a set of spatial clustering masks; such as Figure 6 As shown, to control the segmentation granularity with few samples, deep features of a very small number of normal samples are extracted and clustered using the K-means algorithm. For each feature cluster, calculate the cosine similarity between the features of the image to be detected and the centroid of each cluster to generate a spatial clustering mask. .

[0039] 2) Filter out the set of valid spatial clustering masks from the set of spatial clustering masks.

[0040] 3) Calculate the intersection-union ratio (IUR) between each optimized mask in the optimized mask set and each effective spatial clustering mask in the effective spatial clustering mask set, and use the maximum IUR for label remapping.

[0041] Calculate the mask one by one Clustering masks for each effective space The intersection-over-union ratio (IoU) between labels is used for label remapping, and the formula is as follows: .

[0042] 4) Reassign the remapped elements to the same label Perform a union operation on all optimized masks to generate a component mask set. The calculation formula is as follows: .

[0043] 5) Logically add the active regions of the component mask set and then add them to the high-speed rail catenary component image (i.e., the original inspection image). Perform the Hadamard product operation to remove all non-informative background information and obtain a clean target image. The function is represented as: .

[0044] (26) For the purified target image, resampling and channel-level normalization are performed to map the pixels to a normal distribution range, resulting in a standardized image. Specifically, the purified target image... Unified resampling to a fixed spatial resolution size Then, channel-level normalization is performed to map the pixels to the standard normal distribution range.

[0045] (27) Introduce a tile segmentation mechanism to divide the standardized image into preset sizes (e.g., The algorithm first extracts non-overlapping image patches, then uses a learnable linear projection layer to reduce the dimensionality of each patch into a multi-dimensional feature vector, and superimposes absolute spatial location encoding to generate an initial feature token sequence representing local topological relationships in the latent space. , of which, the total number of tokens .

[0046] (28) Input the initial feature token sequence into the parameter-frozen basic visual encoder, perform feature evolution through multi-head self-attention mechanism and feedforward neural network in sequence, and stitch multiple intermediate-level feature response maps in the channel dimension to obtain multi-scale feature representation with both local fine texture and global topological semantics.

[0047] Specifically, after the initial feature token sequence is input into the parameter-frozen basic visual encoder, within the first Transformer block, the feature tokens alternately undergo nonlinear evolution through a multi-head self-attention mechanism (MSA) and a feedforward neural network (FFN), with the following function representations: .

[0048] .

[0049] Extract the internal code of the encoder The intermediate-level feature response maps of the layer are aligned in spatial dimension and then concatenated and aggregated in the channel dimension to finally output a multi-scale feature representation that combines local subtle textures with global topological semantics. The function is represented as: .

[0050] The multi-scale feature representation This serves as a general feature base for subsequent dual-domain structural anomaly perception and multi-perspective logical computation.

[0051] Step 103: Using the preset normal sample set as a reference, and based on the component mask set, the target content label, and the multi-scale feature representation, combined with the frequency-space dual-domain spatial displacement distance and multimodal semantic similarity, calculate the structural anomaly score matrix.

[0052] In a specific application, a spliced ​​text prompt is dynamically generated based on the identified component category labels and imported into a multimodal text encoder to obtain a semantic text feature token. A fast Fourier transform operation is performed on the multi-scale feature representation to obtain frequency-space dual-domain patch features. Under the constraint of the component binary mask, the dual-domain spatial displacement distance between the patch to be inspected and the normal reference patch, as well as the multimodal visual-linguistic semantic similarity, are calculated to generate a weighted structural anomaly score matrix. Based on this, step 103 includes the following steps (31)-(35).

[0053] (31) Input the target content label into the basic semantic framework to obtain the text prompt; input the text prompt into the pre-trained multimodal text encoder to obtain the semantic text feature token.

[0054] To achieve adaptive semantic guidance for different overhead contact line components under a training-free paradigm, the content labels of the target entities to be inspected (such as insulators, clamps, bolts, etc.) output by the RAM model for the current inspection image are obtained. Then, using an automated natural language splicing mechanism, the content labels are dynamically filled into the basic semantic framework to automatically generate a health status description text for the current specific component, i.e., an output text prompt.

[0055] By using a pre-trained multimodal text encoder (such as CLIP Text Encoder) to project dynamically concatenated text prompts into a high-dimensional space, they are transformed into normal text feature tokens containing prior semantic categories. With abnormal text feature token This allows for the construction of semantic anchors for target perception without the need for a pre-set expert knowledge base.

[0056] (32) Based on two-dimensional fast Fourier transform and high-pass filter, feature extraction is performed on the multi-scale feature representation to obtain a frequency-space dual-domain patch feature set. Specifically, the following steps are included: 1) Interpolate and resample the multi-scale feature representation to obtain spatial domain patch features.

[0057] To effectively combat motion blur and illumination variations that occur during high-speed train inspections, multi-scale spatial feature representations are interpolated and resampled to obtain spatial domain patch features. .

[0058] 2) Perform a two-dimensional fast Fourier transform on each channel of the spatial domain patch features to convert it to the frequency domain, and introduce a high-pass filter. The low-frequency background components, mainly caused by motion blur and global illumination changes, are filtered out, while the high-frequency texture components reflecting the small cracks on the edges and surfaces are extracted.

[0059] 3) Based on the spatial domain tile features and the high-frequency texture components, the high-frequency spatial features are restored using inverse Fourier transform (2D-IFFT). Its frequency domain extraction formula is expressed as: .

[0060] 4) Perform dual-domain splicing and linear mapping between the spatial domain patch features and the high-frequency spatial features to generate dual-domain joint patch features; multiple dual-domain joint patch features constitute a frequency-space dual-domain patch feature set.

[0061] Through a learnable feature fusion weight matrix Spatial domain tile features and high-frequency texture features are combined and linearly mapped in a dual-domain manner to generate dual-domain joint tile features with anti-blur and anti-illumination properties. The function formula is: .

[0062] (33) Determine the region constraint based on the component mask set, and under the region constraint, calculate the feature space distance between the frequency-space dual-domain block features of the high-speed rail contact network component image and the frequency-space dual-domain block features of the preset normal sample, and select the minimum feature space distance as the dual-domain spatial anomaly score of the frequency-space dual-domain block features.

[0063] When establishing a small sample reference set, the pre-defined normal sample set is used as an example. Zhang Zhengchang extracted the corresponding normal dual-domain block features from the overhead contact line component samples. ; Utilizing refined component mask sets Divide the image into Each independent component sub-region is extracted, and the components belonging to the first sub-region are extracted. mask sub-regions ( subset of features to be detected Compared with normal reference feature subset The function is represented as: .

[0064] .

[0065] Within identical components that are strictly isolated by the mask, the cosine distance between the feature patch to be inspected and all normal reference feature patches is calculated, and the minimum distance is selected as the bi-domain spatial anomaly score for that patch. This quantifies the physical span by which a tile deviates from a normal, healthy manifold, expressed as a function: .

[0066] (34) Calculate the cross-modal cosine similarity between the frequency-space dual-domain tile features in the frequency-space dual-domain tile feature set and the semantic text feature token to obtain the visual-language semantic anomaly score.

[0067] In addition to physical tile displacement, high-level semantic constraints across modalities are introduced; within a unified latent space, the features of the detected dual-domain tiles are computed. With the semantic text feature tokens generated earlier and The cosine similarity between them is calculated. Specifically, normalization is performed using the Softmax activation function, and the probability distribution of the detected image patch belonging to an abnormal state is calculated, thereby obtaining the visual-linguistic anomaly score at the image-text semantic level. The calculation formula is as follows: .

[0068] in, This represents the calculation of the cosine similarity matrix between cross-modal features.

[0069] (35) The bi-domain spatial anomaly scores of each frequency-space bi-domain patch feature are weighted with the visual-linguistic semantic anomaly scores to obtain a structural anomaly score matrix.

[0070] To address the physical differences in defect responses among different components of the overhead contact system (such as ceramic insulators and metal clamps), a dynamic weighting adjustment factor is introduced. and ; The dual-domain spatial anomaly score based on physical displacement measurement Visual-language anomaly scores based on cross-modal semantic evaluation By performing joint weighting, the final component structural anomaly score matrix is ​​obtained. The calculation formula is: .

[0071] The structural anomaly scoring matrix can accurately remove false responses caused by complex backgrounds and motion blur, achieving high-fidelity detection of underlying structural deformations such as broken insulator skirts, rust or cracks on metal surfaces of overhead contact line components.

[0072] Step 104: Using the preset normal sample set as a reference, based on the component mask set, the multi-scale feature representation, and the high-speed rail catenary component image set, the semantic features of the components are modeled as graph network nodes, and the logical anomaly score matrix is ​​calculated using graph attention mechanism and geometric feature measurement.

[0073] In a specific application, multi-scale feature representations and normal reference sample features in a preset normal sample set are subjected to group average pooling (GAP) under the constraint of component binary mask to obtain deep semantic features of independent components; the deep semantic features are modeled as topological graph nodes, and the cosine similarity between features is calculated to construct an adjacency matrix; the deep semantic features and the adjacency matrix are jointly input into the graph attention mechanism (GAT) to obtain evolutionary features, and the distance measurement of geometric features such as the area of ​​connected domains and spatial coordinates of each component is combined to generate a logical anomaly score matrix. Specifically, step 104 includes the following steps (41)-(46).

[0074] (41) Determine the region constraints based on the component mask set, and perform group average pooling operation on the multi-scale feature representation under the region constraints to obtain the deep semantic feature set.

[0075] like Figure 7 As shown, to capture the overall semantic features of individual components of the overhead contact system (such as insulators, positioners, bolts, etc.), a group average pooling (GAP) operation is introduced; the multi-scale original feature representations are combined with the feature representations of a very small number of normal reference samples. In the fine component mask set Group average pooling is performed under spatial constraints. This process aggregates pixel-level features within each independent mask region to generate a deep feature set representing each part of the image under inspection. and deep feature sets of each component in the normal reference image ,in, and These represent the total number of components in the image to be inspected and the normal reference image, respectively. These deep features will be directly initialized as nodes in the subsequent spatial topology graph.

[0076] (42) Model each feature in the deep semantic feature set as a graph network node, calculate the cosine similarity between any two graph network nodes as the topological edge weight, and thus obtain the adjacency matrix.

[0077] A Component Feature Aggregator (CFA) is introduced. Based on modeling each component feature as a graph network node, the cosine similarity between any two component features is used as the topological edge weight connecting these two points. Specifically, the similarity between all pairs of nodes is calculated, and row-level normalization is performed to construct an adjacency matrix representing the global spatial distribution and assembly relationships of the catenary components. The calculation formula is as follows: .

[0078] Among them, the normalized similarity edge weight The calculation formula is as follows: .

[0079] The cosine similarity function represents the feature vectors of nodes. This represents the total number of nodes in the graph.

[0080] (43) The adjacency matrix is ​​used to perform graph attention operation on the graph network nodes to obtain evolutionary features through cross-node information interaction.

[0081] For multi-scale feature representation and feature representation of normal samples, the constructed adjacency matrix is ​​used. and Each node to be inspected With normal reference graph nodes The graph attention operation is performed again; through cross-node information aggregation in the graph network, the features of each component not only contain its own information, but also incorporate its topological assembly relationships with other components globally, outputting the evolved high-dimensional feature embeddings of the components. and , Represents the graph attention operator.

[0082] (44) Calculate the minimum distance between the evolutionary features corresponding to the multi-scale feature representation and the evolutionary features corresponding to all preset normal samples in the preset normal sample set to obtain the deep logic anomaly score.

[0083] Feature embedding for each evolved component to be inspected Calculate its embedding with all normal features. The minimum cosine distance between them is used as the deep logic anomaly score for this component. The calculation formula is: .

[0084] (45) Extract the physical geometric features of each component of the high-speed rail contact network, and calculate the nonlinear distance between the physical geometric features corresponding to the preset normal sample to obtain the geometric anomaly score.

[0085] Specifically, in addition to deep semantic features, the physical geometric attributes of the overhead contact system components are equally crucial in the assembly logic determination. This application extracts explicit geometric features with multiple attributes from images of high-speed railway overhead contact system components, including the spatial connected domain area of ​​the components, color histogram distribution, and pixel center coordinates, and obtains the physical geometric features by stitching them together.

[0086] In practical applications, geometric features are explicitly calculated based on component masks or bounding boxes generated in the original image space by front-end modules (such as SAM and its filtering mechanism). For example, center coordinates and area are calculated and normalized through the pixel distribution of the mask at the original image size. Multi-scale feature representation (extracted by the visual encoder) is mainly used to provide high-dimensional semantic and texture information. This application decouples "abstract visual semantic features" from "intuitive physical geometric properties," so that in subsequent graph modeling (or logical reasoning) modules, not only can the texture anomalies of components be perceived, but also their macroscopic structural positions and scale anomalies can be accurately located.

[0087] For each individual component in the test sample and normal samples, its explicit geometric features are extracted separately, and the above attributes are concatenated into a high-dimensional geometric feature vector, which is represented as the geometric feature to be tested. With normal geometric features .

[0088] A geometric anomaly score is generated by calculating the minimum distance between the geometric features of the component under inspection and the corresponding geometric features of components in the normal reference set, as shown in the following formula: .

[0089] in, Let i be the geometric anomaly score of the i-th component of the high-speed rail overhead contact system. It is a minimum value function. It is a non-linear distance function. Let be the physical and geometric characteristics of the i-th component of the high-speed railway overhead contact system. The physical geometric features corresponding to the preset normal samples are defined.

[0090] (46) The deep logic anomaly score and the geometric anomaly score are weighted to obtain the logic anomaly score matrix.

[0091] Because incorrect splicing of overhead contact line components (such as reversed cotter pins or missing bolts) often manifests simultaneously in both deep-seated topological breaks and abrupt changes in apparent geometric properties, hyperparameter weighting coefficients are set. and Scoring deep logic anomalies Geometric anomaly score Joint weighted calculations are performed to ultimately generate a comprehensive logical anomaly score matrix that effectively reflects high-level semantic defects in the overhead contact system (such as missing components, additions, or misplacement of components). The calculation formula is as follows: .

[0092] Step 105: Weight the structural anomaly score matrix and the logical anomaly score matrix to obtain an anomaly heatmap. Perform dynamic threshold segmentation and connected component analysis based on the preset normal sample set on the anomaly heatmap to obtain graded location and early warning information for high-speed rail catenary component faults.

[0093] In a specific application, the structural anomaly score matrix and the logical anomaly score matrix are linearly weighted and fused to obtain a comprehensive anomaly score matrix. The comprehensive anomaly score matrix is ​​then sequentially input into bilinear interpolation upsampling and Gaussian filtering operators to generate an anomaly heatmap with coherent defect edges. The anomaly heatmap is then processed using a dynamic threshold segmentation algorithm and connected component analysis to output graded location and early warning information for faults in overhead contact system components. Specifically, step 105 includes the following steps (51) to (5).

[0094] (51) The structural anomaly score matrix and the logical anomaly score matrix are linearly weighted to obtain the comprehensive anomaly score matrix.

[0095] To comprehensively assess the health status of overhead contact line components, a fusion mechanism for multi-level defect scores is introduced; a global balance hyperparameter is set. and (In this embodiment, both values ​​are 0.5 by default), and the structural anomaly score matrix reflecting local surface physical damage is used. Logical anomaly score matrix reflecting global assembly topology errors Perform linear weighted fusion to generate a comprehensive anomaly score matrix. The calculation formula is: .

[0096] The comprehensive anomaly score matrix takes into account both the local distortion of low-level visual features and the structural collapse of high-level semantic logic, and realizes a unified quantitative assessment of cross-category and cross-scale defects such as contact wire insulator damage, wire clamp breakage and bolt loss.

[0097] (52) The comprehensive anomaly score matrix is ​​upsampled using the bilinear interpolation algorithm to obtain a rough anomaly map.

[0098] Because the spatial resolution of the composite anomaly score matrix after feature space mapping is low, image-level spatial topology restoration is required. This application utilizes a bilinear interpolation algorithm to perform image-level spatial topology restoration on the composite anomaly score matrix. Upsampling is performed to restore the spatial resolution from the feature latent space size to the high-resolution size of the original input image. This yields a rough anomaly map of the original dimensions. : .

[0099] (53) A spatial convolution filtering operation is performed on the rough anomaly map using a Gaussian filter operator to obtain an anomaly heat map.

[0100] To eliminate checkerboard artifacts that may arise during tile matching and feature extraction, and to simulate the continuous spatial expansion characteristics of physical defects in real overhead contact lines, a standard deviation of is introduced. Two-dimensional Gaussian smoothing kernel For coarse anomaly maps Perform spatial convolution filtering to generate a final anomaly heatmap with smooth edge transitions and suppressed discrete noise. : .

[0101] In this heatmap, the distribution of response intensity directly maps the physical and semantic span of the catenary components deviating from the normal healthy manifold.

[0102] (54) Calculate a dynamic judgment threshold based on the preset normal sample set, and perform pixel-by-pixel binarization segmentation on the abnormal heat map based on the dynamic judgment threshold to obtain a binarized judgment mask.

[0103] Based on the residual score distribution of normal samples in the manifold space when establishing a small-sample reference set, the statistical confidence interval boundaries are calculated and extracted, and a dynamic judgment threshold is automatically set accordingly. Traverse the anomaly heatmap All spatial pixel coordinates Perform pixel-by-pixel binarization segmentation to generate a binarized decision mask. The calculation formula is as follows: .

[0104] Pixels with response values ​​higher than a threshold are marked as suspected overhead contact line fault areas.

[0105] (55) Perform connected component analysis on the binarized decision mask to locate the physical coordinates of the fault and generate the minimum bounding box.

[0106] Binarization decision mask Perform connected component labeling and calculate the geometric parameters (including area, center pixel coordinates, and aspect ratio) of each independent abnormal connected region; remove tiny noise regions with an area smaller than the preset noise filtering threshold to achieve accurate coordinate positioning of various faults such as missing cotter pins, broken insulators, and loose bolts on contact network components, and automatically generate the minimum bounding rectangle surrounding the fault region.

[0107] (56) Based on the comprehensive anomaly score matrix, the severity is divided according to the extreme values ​​within the minimum bounding box to obtain a severity label; the anomaly heat map with the minimum bounding box and the severity label constitutes the graded location early warning information for the faults of the high-speed rail contact network components.

[0108] Extract the maximum and mean values ​​of abnormal scores within the fault connectivity domain, automatically classify the severity of overhead contact line faults into preset alarm levels (such as general, severe, and critical), and overlay and fuse the abnormal heat map with fault bounding box and severity label into the original inspection image, finally outputting a structured railway inspection graded location early warning report.

[0109] Based on the above, this application can be simplified to the following steps: (1) Context component clustering extraction based on contact network geometric prior enhancement and edge adaptation: high-resolution image acquisition and initial mask generation based on self-propelled intelligent inspection vehicle; physical filtering of suspension clues and edge adaptive enhancement based on contact network geometric prior; mask space alignment and target purification based on multi-scale feature clustering; image normalization resampling and linear embedding of multi-dimensional feature patches; multi-scale feature representation extraction of parameter-frozen basic visual encoder. (2) Component structure anomaly score calculation based on fusion of environmental perception dynamic prompts and frequency-space dual-domain features: construction of class semantic dynamic text prompts based on general visual recognition labels; joint extraction and representation of frequency-space dual-domain patch features; refined measurement of dual-domain patch spatial displacement under mask constraints; multimodal image-text semantic similarity evaluation based on contrastive learning; weighted fusion generation of anti-disturbance structure anomaly score matrix. (3) Calculation of component logic anomaly scores based on graph-enhanced topological association and multidimensional geometric feature constraints: component deep semantic feature pooling and graph node initialization based on mask constraints; construction of contact network component spatial topology graph and calculation of dynamic adjacency matrix; feature global evolution and deep anomaly measurement based on graph attention mechanism; multidimensional geometric feature extraction and joint geometric anomaly measurement; joint weighted fusion of component logic anomaly score matrices. (4) Global fusion of multi-level anomaly scores and fault classification and location early warning of contact network components: global weighted fusion of multi-level anomaly score matrices; spatial alignment and bilinear interpolation of anomaly score matrices; spatial smoothing and anomaly heatmap generation based on Gaussian kernel function; adaptive dynamic threshold segmentation and binarization judgment mask generation; (5) Connected component analysis and multi-target fault classification and location early warning.

[0110] To verify the validity of this application, comparative experiments were conducted in conjunction with Tables 1-3, as shown below.

[0111] (1) This application conducted extensive comparative experiments using the same “1-normal-shot” setting as most existing few-shot anomaly detection methods. In this setting, the model uses only one normal part image as a reference, i.e., zero-shot inference is required on unseen target samples.

[0112] Table 1 presents the quantitative comparison results between the proposed method and mainstream methods such as PatchCore, WinCLIP, and UniAD on eight types of overhead contact line components. The proposed method achieved the best average score across all evaluation metrics. Compared to the suboptimal WinCLIP method, the proposed method significantly outperforms the proposed method in I-AUROC, I-F1, and I-AP.

[0113] While most comparative methods performed reasonably well on the relatively simple C1 (sleeve base) structure (WinCLIP achieving 89.4%), their performance dropped sharply on two specific component classes: C6 (screw clamp) and C8 (bolt). Firstly, for C6 (screw clamp), due to its small target size and complex thread structure, PatchCore and WinCLIP achieved I-AUROCs of only 52.4% and 61.8%, respectively, almost failing. However, FC-MAD, with its "coarse-to-fine" inference strategy, achieved an I-AUROC of 78.7% on C6, demonstrating that after filtering background noise, the model can accurately capture subtle thread wear or loosening features. Failures on C8 typically involve logical changes such as "missing cotter pins" or "loose nuts," rather than simple texture differences. The benchmark methods performed the worst in this category (PatchCore only 48.5%). In contrast, this application achieved an I-AUROC of 87.6%, thanks to the GECM module's modeling of component topology, which enabled it to identify structural anomalies.

[0114] For the C7 (tube-shaped dual-ear) with extremely strong background texture, although WinCLIP achieved an accuracy of 89.4% thanks to its large-scale pre-trained knowledge, PatchCore was still limited by background interference (78.5%). This application achieves a near-perfect performance of 98.8% on C7, with an I-AP of up to 99.1%, verifying the key role of the dynamic mask filtering mechanism in suppressing complex backgrounds (such as tunnel walls and contact lines).

[0115] To meet the high-precision detection requirements of railway inspection for specific fault types (such as loose nuts or missing critical components), this application further introduces a "Few-abnormal-shot" setting. Under this setting, lightweight fine-tuning was performed using 4 normal samples and 4 abnormal samples. Table 2 shows the comparative experimental results under this setting.

[0116] Analyzing the results in Table 2, it can be concluded that compared to the 1-normal-shot setting, fine-tuning with a small number of abnormal samples improves performance across all categories, with particularly significant improvements in structurally complex components. The improvement in C6 (screw clamps) is most representative, with I-AUROC jumping from 78.7% to 89.8% and I-F1 from 76.2% to 89.3%, indicating that FC-MAD successfully maps general visual features to the specific manifold space of the contact wire components, significantly enhancing the model's ability to identify minute thread textures and fastening states. The C2 category, which often contains logical anomalies such as missing parts, saw its I-AUROC increase dramatically from 72.1% to 92.7%. This substantial improvement demonstrates that, under the constraint of Ranking Loss, the model has learned to more effectively widen the feature distance between normal structures and logical defects. PatchCore and WinCLIP can also utilize more samples to build a larger memory bank, but their performance improvements are limited. For example, PatchCore's I-AUROC on C6 only improved to 72.1%, which is still far lower than the 89.8% of this application. This shows that simply increasing the number of samples cannot solve the feature mismatch problem, while the fine-tuning mechanism of this application is the key to solving the long-tail distribution problem in specific industrial scenarios.

[0117] After fine-tuning, this application has achieved 100% I-AUROC and I-AP in categories such as C4 (positioner base), which means that for such critical components, FC-MAD has the reliability of actual engineering deployment and can achieve automated inspection with zero missed detections and zero false alarms.

[0118] Table 1. Image-level quantitative analysis results of contact wire support component inspection under a normal sample.

[0119] Table 2. Image-level quantitative analysis results of contact wire support component inspection under four abnormal samples.

[0120] To further demonstrate the intuitive qualitative effect of this application, the test results of the overhead contact line support components were visualized, as shown below. Figure 8 As shown. From Figure 8 The visualization results show that, even with a small sample size, this application can still accurately detect abnormal areas on the parts, further verifying the effectiveness of the method.

[0121] This application also evaluates the FC-MAD of this application in terms of detection accuracy (I-mAD), computational efficiency (FLOPs), number of parameters (Params), and inference latency. The comparison results are shown in Table 3. It should be noted that the comparison methods (such as SimpleNet and UniAD) are all fully supervised models trained on massive datasets, while the FC-MAD of this application is run under a strict few-shot setting (4-shot).

[0122] As shown in Table 3, methods such as UniAD and SimpleNet, benefiting from lightweight backbones and full-sample training, exhibit extremely low computational cost and high accuracy. In contrast, FC-MAD, due to its integration of a dual-stream base model (CLIP and DINOv2) to ensure generalization ability under scarce samples, has a total parameter count of 1587.77M and a total FLOPs of 381.05G. However, in-depth analysis of the data reveals the efficiency of our design: thanks to the frozen backbone strategy, the trainable parameters of the model are only 102.76M, accounting for only 6.47% of the total. Furthermore, in the computation graph, the vast majority of operations (379.68G) originate from the frozen feature extraction process, while the trainable head (adapter + dual-branch system) proposed in this application contributes only a negligible 1.38GFLOPs. This indicates that the architectural innovation of this application adds very low marginal cost to the system.

[0123] In terms of inference speed, FC-MAD achieves an inference time of approximately 0.140 seconds (7.14 FPS) on a single GPU. While this is slower than lightweight methods such as SimpleNet (0.061 seconds), it is significantly faster than generative methods such as DiAD (1.125 seconds) and DeSTSeg (0.173 seconds), making it structurally well-suited for offline intelligent analysis tasks in railway maintenance centers. Although the I-mAD (94.7%) of this application is slightly lower than state-of-the-art fully supervised methods (such as SimpleNet's 97.1%), this performance gap is reasonable considering the significant difference in training data volume. FC-MAD achieves comparable performance using only 4 outlier samples, avoiding the high cost of building large-scale labeled datasets. Overall, FC-MAD achieves a strategic balance between data efficiency and model performance, providing a robust solution for scenarios where fault samples are scarce and real-time constraints are not strong.

[0124] Table 3 Comparison of computational efficiency with the SOTA method

[0125] Wherein, I-mAD represents the average of three image-level metrics.

[0126] In summary, this application sequentially inputs images of overhead contact line components into a RAM model and a Grounded SAM large model, and combines multi-scale feature clustering and edge adaptive enhancement operators to obtain clean binary masks of the components; it inputs the images of the overhead contact line components into a basic visual encoder with frozen parameters to extract multi-scale feature representations containing local texture and global topology; it dynamically concatenates text prompts based on component category labels to generate text prompts, and imports them into a multimodal text encoder to obtain semantic text feature tokens; it performs a fast Fourier transform operation on the multi-scale feature representations to obtain high-frequency texture components, concatenates them into frequency-space dual-domain patch features, and combines multimodal semantic similarity under binary mask constraints to enhance... The system generates a structural anomaly score matrix. Multi-scale feature representations are then subjected to group average pooling (GAP) under the constraint of component binary masks to obtain deep semantic features of individual components. These deep semantic features are modeled as topological graph nodes and input into a graph attention mechanism (GAT) to obtain evolutionary features. Distance calculations based on the spatial geometric features of each component are then combined to generate a logical anomaly score matrix. The structural anomaly score matrix and the logical anomaly score matrix are then sequentially subjected to linear weighted fusion, bilinear interpolation upsampling, and Gaussian filtering smoothing operations to obtain pixel-level anomaly maps and hierarchical positioning early warning information for overhead contact line components.

[0127] Based on the same inventive concept, this application also provides a system. The solution provided by this system is similar to the solution described in the above method. Therefore, the specific limitations of one or more system embodiments provided below can be found in the limitations of the method above, and will not be repeated here.

[0128] In one exemplary embodiment, a low-sample anomaly detection system for high-speed railway overhead contact line components is provided, comprising: The data acquisition module is used to acquire a preset normal sample set and an image set of high-speed railway catenary components. Specifically, it uses a self-propelled intelligent inspection vehicle to collect images of the support and suspension devices of the high-speed railway catenary, and establishes a sample dataset of catenary components collected by the self-propelled intelligent inspection vehicle.

[0129] The feature extraction module is used to extract target content labels and masks based on the high-speed rail catenary component image set, and to optimize the mask by introducing geometric prior and adaptive edge enhancement. Then, combined with the preset normal sample set, multi-scale feature clustering is performed to perform mask space alignment and target purification to obtain component mask set and purified target image. The pure target image is then extracted using a parameter-frozen basic visual encoder to obtain multi-scale feature representation.

[0130] Specifically, the original image is input into a pre-trained object recognition model to extract target content labels, and these content labels are used as prompts to be input into a pre-trained ground segmentation model to obtain an initial target mask. Geometric features of the initial target mask are extracted, and non-target dangling cues are filtered using a cue geometry constraint operator. An adaptive edge enhancement operator is applied for morphological smoothing and edge correction to obtain a candidate mask set. A clustering algorithm is used to spatially cluster the deep features of a small number of normal samples to generate a spatial clustering mask. The intersection-union ratio (IUU) of the candidate mask set and the spatial clustering mask is calculated to perform label remapping, obtaining a clean part binary mask. The preprocessed image is input into a parameter-frozen basic visual encoder, where feature evolution is performed sequentially through a multi-head self-attention mechanism and a feedforward neural network. Multiple intermediate-level response maps are then stitched together along the channel dimension to obtain multi-scale feature representations containing local texture and global topology.

[0131] The first score calculation module is used to calculate the structural anomaly score matrix by referring to the preset normal sample set, based on the component mask set, the target content label and the multi-scale feature representation, and combining the frequency-space dual-domain spatial displacement distance and multimodal semantic similarity.

[0132] Specifically, based on the content tags extracted in the previous step, they are automatically filled into the basic semantic framework to dynamically generate text prompts, which are then imported into a multimodal text encoder to obtain semantic-like text feature tokens. A two-dimensional fast Fourier transform is applied to the multi-scale feature representation, and a high-pass filter is introduced to extract high-frequency texture components. These components are then restored through inverse transform and concatenated with spatial domain features to obtain frequency-space dual-domain patch features. Under the regional constraints of a component binary mask, the feature space distance between the frequency-space dual-domain patch features of the image under test and those of the normal reference image is calculated, and the minimum distance is selected to obtain the dual-domain spatial anomaly score. The cross-modal cosine similarity between the frequency-space dual-domain patch features and the semantic-like text feature tokens is calculated to obtain a visual-linguistic semantic anomaly score. Finally, the dual-domain spatial anomaly score and the visual-linguistic semantic anomaly score are jointly weighted to obtain a structural anomaly score matrix.

[0133] The second score calculation module is used to model the semantic features of components as graph network nodes based on the preset normal sample set, the component mask set, the multi-scale feature representation, and the high-speed rail catenary component image set, and to calculate the logical anomaly score matrix using the graph attention mechanism and geometric feature measurement.

[0134] Specifically, multi-scale feature representations are subjected to group average pooling under the constraint of component binary masks to obtain deep semantic features representing each component of the image under inspection, and these features are initialized as nodes of a spatial topological graph. The cosine similarity between the features of any two graph nodes is calculated and row-level normalization is performed to construct an adjacency matrix representing the global spatial distribution and assembly relationship of the components. The deep semantic features and the adjacency matrix are input into a graph attention mechanism for cross-node information interaction to obtain evolutionary features, and the minimum distance between the evolutionary features and the normal reference features is calculated to obtain a deep logical anomaly score. The connected component area and spatial coordinate parameters of each component are extracted and concatenated into physical geometric features, and the nonlinear distance between the physical geometric features and the normal reference geometric features is measured to obtain a geometric anomaly score. The deep logical anomaly score and the geometric anomaly score are weighted to obtain a logical anomaly score matrix.

[0135] The positioning and early warning module is used to weight the structural anomaly score matrix and the logical anomaly score matrix to obtain an anomaly heat map, and to perform dynamic threshold segmentation and connected component analysis based on the preset normal sample set on the anomaly heat map to obtain hierarchical positioning and early warning information for high-speed rail catenary component faults.

[0136] Specifically, the structural anomaly score matrix and the logical anomaly score matrix are linearly weighted and fused to obtain a comprehensive anomaly score matrix. The comprehensive anomaly score matrix is ​​then sequentially input into a bilinear interpolation operator and a Gaussian filter operator for spatial upsampling topology restoration and smoothing to generate an anomaly heatmap with coherent defect edges. A dynamic judgment threshold is calculated using the residual distribution of normal reference samples in the manifold space, and pixel-by-pixel binarization segmentation is performed on the anomaly heatmap to obtain a binarized judgment mask. Connectivity analysis is performed on the binarized judgment mask to locate the physical coordinates of the fault and generate a minimum bounding box. The severity is determined by combining the score extrema to output graded location warning information. Under training-free conditions, the method directly extracts a very small number (e.g., 1 to 4 images) of normal contact network components to construct a normal reference feature set, which is directly used for subsequent anomaly score calculation and inference.

[0137] Compared with the prior art, this application has the following beneficial technical effects: This application can be applied to the field of intelligent inspection technology for electrified railways. First, a general segmentation model combined with the geometric prior of the overhead contact system is used to filter the physical background and obtain a clean component mask. Then, a basic visual encoder with parameter freezing is used to extract multi-scale features. Second, semantic-like text prompts are dynamically generated. Combined with the frequency-space dual-domain transformation of multi-scale features, and through cross-modal semantics and spatial displacement alignment, structural anomaly scores that resist motion blur and illumination interference are calculated. Subsequently, the component features are modeled as spatial topological nodes. Using graph attention mechanism and geometric feature measurement, logical anomaly scores reflecting advanced defects such as missing or misaligned parts are calculated. Finally, the two-level scores are weighted and fused to generate an anomaly heatmap and output a hierarchical location warning.

[0138] This application overcomes the bottlenecks of traditional catenary defect detection, which relies on a single model for each class and a massive amount of abnormal samples. By introducing a parameter-freezing basic vision and multimodal text encoder, it achieves zero-cost generalization detection of cross-category components under conditions requiring minimal training and only a few normal samples. Addressing the difficulty of conventional algorithms in identifying advanced semantic defects, it models the features of independent components as spatial topological nodes and combines multidimensional geometric features with a graph attention mechanism (GAT) to achieve dual-level joint detection of physical damage to component surfaces and global assembly logic errors (such as missing or misaligned parts). Furthermore, to cope with the complex interference of high-speed rail operation and variable outdoor conditions, this application not only introduces Fast Fourier Transform (FFT) to construct frequency-space dual-domain features and combines dynamic semantic text for cross-modal alignment to resist motion blur and abrupt changes in lighting, but also deeply integrates a large segmentation model with catenary geometric priors, accurately decoupling the physical background of complex suspension lines and core components. This application fundamentally reduces the false alarm rate of minor defects, significantly improving the detection accuracy and engineering deployment efficiency of the model in complex railway scenarios.

[0139] In one exemplary embodiment, a computer device is also provided, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the above-described method embodiments.

[0140] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0141] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

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

[0143] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0144] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

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

[0146] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for detecting anomalies in a small number of components of a high-speed railway overhead contact system, characterized in that, The method includes: Acquire a preset normal sample set and an image set of high-speed rail catenary components; Based on the image set of the high-speed rail catenary components, target content labels and masks are extracted, and geometric priors and adaptive edge enhancement are introduced to optimize the mask. Then, combined with the preset normal sample set, multi-scale feature clustering is performed to perform mask space alignment and target purification to obtain component mask set and purified target image. The basic visual encoder with parameter freezing is used to extract features from the purified target image to obtain multi-scale feature representation. Using the preset normal sample set as a reference, and based on the component mask set, the target content label, and the multi-scale feature representation, combined with the frequency-space dual-domain spatial displacement distance and multimodal semantic similarity, the structural anomaly score matrix is ​​calculated. Using the preset normal sample set as a reference, based on the component mask set, the multi-scale feature representation, and the high-speed rail catenary component image set, the semantic features of the components are modeled as graph network nodes, and the logical anomaly score matrix is ​​calculated using graph attention mechanism and geometric feature measurement. The structural anomaly score matrix and the logical anomaly score matrix are weighted to obtain an anomaly heatmap. Dynamic threshold segmentation and connected component analysis based on the preset normal sample set are performed on the anomaly heatmap to obtain graded location and early warning information for high-speed rail catenary component faults.

2. The method for detecting anomalies in low-sample high-speed railway overhead contact system components according to claim 1, characterized in that, Based on the image set of high-speed rail catenary components, target content labels and masks are extracted. Geometric priors and adaptive edge enhancement are introduced to optimize the masks. Then, combined with the preset normal sample set, multi-scale feature clustering is performed to align the mask space and purify the target, resulting in a component mask set and a purified target image. A parameter-frozen basic visual encoder is used to extract features from the purified target image to obtain multi-scale feature representations, including: The images of high-speed rail catenary components in the image set are input into a pre-trained object recognition model to extract target content tags. The target content tags are used as prompts and input into the pre-trained ground segmentation large model to obtain the initial target mask set; Based on geometric prior features, the initial target mask set is filtered to obtain a filtered candidate mask set; An adaptive edge enhancement operator is applied to the candidate mask set to perform morphological smoothing and edge correction, resulting in an optimized mask set. Based on the preset normal sample set, the optimized mask set, and the high-speed rail catenary component image set, multi-scale feature clustering is performed to perform mask space alignment and target purification to obtain the component mask set and purified target image. For the clean target image, resampling and channel-level normalization are performed to map the pixels to the normal distribution range to obtain a standardized image; A tile segmentation mechanism is introduced to divide the standardized image into image blocks of a preset size. Then, a linear projection layer is used to reduce the dimensionality of each image block and map it into a multi-dimensional feature vector. Absolute spatial location encoding is superimposed to generate an initial feature token sequence representing local topological relationships in the latent space. The initial feature token sequence is input into the parameter-frozen basic visual encoder, and feature evolution is performed sequentially through a multi-head self-attention mechanism and a feedforward neural network. Multi-layer intermediate feature response maps are then stitched together in the channel dimension to obtain a multi-scale feature representation that combines local subtle textures and global topological semantics.

3. The method for detecting anomalies in low-sample high-speed railway overhead contact system components according to claim 2, characterized in that, Based on the preset normal sample set, the optimized mask set, and the high-speed rail catenary component image set, multi-scale feature clustering is performed to align the mask space and purify the target, resulting in a component mask set and a purified target image, including: For the images in the preset normal sample set, deep features are extracted and spatial clustering is performed to generate a set of spatial clustering masks; A valid set of spatial clustering masks is obtained by filtering from the set of spatial clustering masks; Calculate the intersection-union ratio (IUGR) between each optimized mask in the optimized mask set and each effective spatial clustering mask in the effective spatial clustering mask set, and use the maximum IUGR for label remapping; Perform a union operation on all optimized masks that have been remapped and assigned to the same label, and merge them to generate a component mask set; The active regions of the component mask set are logically added together and then multiplied by the Hadamard product with the image of the high-speed rail catenary component to obtain a clean target image.

4. The method for detecting anomalies in low-sample quantities of high-speed railway overhead contact system components according to claim 1, characterized in that, The preset normal sample set includes multiple preset normal samples; Using the preset normal sample set as a reference, based on the component mask set, the target content label, and the multi-scale feature representation, and combining the frequency-space dual-domain spatial displacement distance and multimodal semantic similarity, a structural anomaly score matrix is ​​calculated, including: The target content label is input into the basic semantic framework to obtain a text prompt; the text prompt is then input into a pre-trained multimodal text encoder to obtain a semantic-like text feature token. Based on two-dimensional fast Fourier transform and high-pass filter, feature extraction is performed on the multi-scale feature representation to obtain a frequency-space dual-domain patch feature set. Based on the component mask set, the region constraint is determined, and under the region constraint, the feature space distance between the frequency-space dual-domain patch features of the high-speed rail catenary component image and the frequency-space dual-domain patch features of the preset normal sample is calculated, and the minimum feature space distance is selected as the dual-domain spatial anomaly score of the frequency-space dual-domain patch features. Calculate the cross-modal cosine similarity between the frequency-space dual-domain patch features in the frequency-space dual-domain patch feature set and the semantic text feature token to obtain the visual-linguistic semantic anomaly score; The bi-domain spatial anomaly scores of each frequency-space bi-domain patch feature are weighted with the visual-linguistic semantic anomaly scores to obtain a structural anomaly score matrix.

5. The method for detecting anomalies in low-sample quantities of high-speed railway overhead contact system components according to claim 4, characterized in that, Based on two-dimensional fast Fourier transform and high-pass filter, feature extraction is performed on the multi-scale feature representation to obtain a frequency-space dual-domain patch feature set, including: Interpolation and resampling are performed on the multi-scale feature representation to obtain spatial domain patch features; A two-dimensional fast Fourier transform is performed on each channel of the spatial domain patch features to convert it to the frequency domain space, and a high-pass filter is introduced to extract high-frequency texture components. Based on the spatial domain tile features and the high-frequency texture components, the high-frequency spatial features are restored through inverse Fourier transform. The spatial domain patch features and the high-frequency spatial features are combined and linearly mapped to generate dual-domain joint patch features; multiple dual-domain joint patch features constitute a frequency-space dual-domain patch feature set.

6. The method for detecting anomalies in low-sample high-speed railway overhead contact system components according to claim 1, characterized in that, Using the preset normal sample set as a reference, and based on the component mask set, the multi-scale feature representation, and the high-speed rail catenary component image set, the semantic features of the components are modeled as graph network nodes. Using graph attention mechanisms and geometric feature calculations, a logical anomaly score matrix is ​​calculated, including: Based on the component mask set, region constraints are determined, and under the region constraints, group average pooling is performed on the multi-scale feature representation to obtain a deep semantic feature set. Each feature in the deep semantic feature set is modeled as a graph network node, and the cosine similarity between any two graph network nodes is calculated as the topological edge weight, thereby obtaining the adjacency matrix. The adjacency matrix is ​​used to perform graph attention operations on the graph network nodes to obtain evolutionary features through cross-node information interaction; The minimum distance between the evolutionary features corresponding to the multi-scale feature representation and the evolutionary features corresponding to all preset normal samples in the preset normal sample set is calculated to obtain the deep logic anomaly score. Extract the physical geometric features of each component of the high-speed rail catenary and calculate the nonlinear distance between the physical geometric features and the preset normal sample to obtain the geometric anomaly score. The deep logic anomaly score is weighted with the geometric anomaly score to obtain the logic anomaly score matrix.

7. The method for detecting anomalies in low-sample quantities of high-speed railway overhead contact system components according to claim 6, characterized in that, The physical geometric features of each component of the high-speed railway catenary are extracted, and the nonlinear distance between the physical geometric features and the preset normal samples is calculated to obtain a geometric anomaly score, including: Explicit geometric features with multiple attributes are extracted from images of high-speed rail catenary components, and physical geometric features are obtained by stitching them together. Based on the aforementioned physical geometric features, the geometric anomaly score is calculated using the following formula: ; in, Let i be the geometric anomaly score of the i-th component of the high-speed rail overhead contact system. It is a minimum value function. It is a non-linear distance function. Let be the physical and geometric characteristics of the i-th component of the high-speed railway overhead contact system. The physical geometric features corresponding to the preset normal samples are defined.

8. The method for detecting anomalies in low-sample quantities of high-speed railway overhead contact system components according to claim 1, characterized in that, The structural anomaly score matrix and the logical anomaly score matrix are weighted to obtain an anomaly heatmap. Dynamic threshold segmentation and connected component analysis based on the preset normal sample set are then performed on the anomaly heatmap to obtain graded location and early warning information for high-speed rail catenary component faults, including: The structural anomaly score matrix and the logical anomaly score matrix are linearly weighted to obtain the comprehensive anomaly score matrix. The comprehensive anomaly score matrix is ​​upsampled using a bilinear interpolation algorithm to obtain a rough anomaly map; A spatial convolution filtering operation is performed on the coarse anomaly map using a Gaussian filter operator to obtain an anomaly heatmap; A dynamic judgment threshold is calculated based on the preset normal sample set, and pixel-by-pixel binarization segmentation is performed on the abnormal heatmap based on the dynamic judgment threshold to obtain a binarization judgment mask. Perform connected component analysis on the binarized decision mask to locate the physical coordinates of the fault and generate the minimum bounding box; Based on the comprehensive anomaly score matrix, the severity is classified according to the extreme values ​​within the minimum bounding box to obtain a severity label; the anomaly heatmap with the minimum bounding box and the severity label constitutes the graded location and early warning information for high-speed rail catenary component failures.

9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the method for detecting anomalies in a small number of high-speed rail catenary components as described in any one of claims 1-8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method for detecting rare anomalies in high-speed rail catenary components as described in any one of claims 1-8.