Railway wagon component anomaly detection method and system
By constructing a VSSM-YOLO model and combining SS2D and FSBlock for global feature modeling and local feature capture, and replacing modules in the backbone and neck networks, the problem of insufficient global modeling capability in railway freight car anomaly detection is solved, and efficient and real-time anomaly detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- EAST CHINA JIAOTONG UNIVERSITY
- Filing Date
- 2026-05-28
- Publication Date
- 2026-06-26
AI Technical Summary
Existing railway freight car anomaly detection technologies are insufficient in terms of global modeling capabilities, location capabilities in complex backgrounds, and the balance between computational efficiency and accuracy, making it difficult to achieve automated, real-time, and high-precision detection.
An initial VSSM-YOLO model was constructed using the Mamba and YOLOv11 models. By replacing the C3k2 modules in the backbone and neck networks with VSSM modules, and combining SS2D and FSBlock for feature enhancement, global feature modeling and local feature capture were achieved. The Stem module was used to replace the Conv convolutional layers in the backbone network, and the VisionMerge module was used to replace the Conv downsampling module, thus optimizing the network structure.
It improves the detection accuracy, positioning capability, and real-time performance of abnormal components in railway freight cars, effectively solves the problem of anomaly identification in railway vehicles, and improves the performance and efficiency of the model.
Smart Images

Figure CN122290091A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of railway freight car component anomaly detection technology, and in particular to a method and system for railway freight car component anomaly detection. Background Technology
[0002] With the rapid development of railway transportation, ensuring the safety of train operation has become increasingly important.
[0003] As a primary mode of transportation, railway freight cars are complex systems comprised of several key components, including bogies, wheelsets, braking systems, and suspension systems. Their operational safety depends on the long-term stable operation of these components. Under prolonged high-load operation and the influence of complex environments, key components of freight cars commonly exhibit abnormal risks such as wear, loss, and misalignment. Failure to detect and address these issues promptly will seriously threaten the safe operation of the railway freight car system.
[0004] Current methods for detecting anomalies in railway freight cars still have several shortcomings, as detailed below: First, railway bureaus still rely on the Trouble of Freight Detection System (TFDS) for manual visual inspection, which is inefficient, has a high false detection rate, and is offline, making it impossible to achieve automated anomaly detection. Secondly, early computer vision-based railway freight car anomaly detection technologies were mostly based on two-stage models such as Faster R-CNN to develop railway freight car anomaly detection algorithms. Such methods have complex network structures and slow inference speeds, making it difficult to meet the real-time detection requirements in railway scenarios. Third, existing detection methods mainly rely on convolutional neural networks for local feature modeling, lacking the ability to globally model the semantic structure of railway freight car images. Railway freight car images contain very complex cross-structure and component relationships; relying solely on local features cannot fully capture the relationships between components, affecting the accuracy of anomaly detection. Fourth, while the introduction of Transformer technology demonstrates strong global feature modeling capabilities, its computational complexity increases quadratically with the input image resolution. In railway freight car image acquisition systems, multi-view, high-resolution trackside images are typically acquired, which leads to high computational demands and storage overhead for Transformer-based models in practical applications.
[0005] In summary, existing railway freight car anomaly detection technologies still have significant shortcomings in terms of global modeling capabilities, location capabilities in complex backgrounds, and the balance between computational efficiency and accuracy, and breakthroughs urgently need to be achieved through technological innovation. Summary of the Invention
[0006] Based on this, the purpose of this invention is to provide a method and system for detecting abnormalities in railway freight car components, in order to solve the problems of low detection accuracy, insufficient positioning capability, and difficulty in balancing efficiency and performance in existing industrial inspections in complex scenarios.
[0007] This invention provides a method for detecting abnormalities in railway freight car components, comprising: Historical images of freight cars on various railway sections were acquired and identified to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of freight cars. An initial VSSM-YOLO model was constructed based on the Mamba model and the YOLOv11 model. The initial VSSM-YOLO model was then trained using a dataset of abnormal components of railway freight cars to obtain the target VSSM-YOLO model. The current images of railway freight cars on each section are acquired, and the current images of railway freight cars are input into the target VSSM-YOLO model to identify the current images of railway freight cars. Based on the identification results, abnormal parts of the freight cars are located to realize the detection of abnormal parts of railway freight cars. The Mamba model includes a VSSM module, a Stem module, and a VisionMerge downsampling module; the YOLOv11 model includes a backbone network and a neck network, both of which include a C3k2 module. The backbone network also includes Conv convolutional layers and a Conv downsampling module. In the step of constructing the initial VSSM-YOLO model based on the Mamba and YOLOv11 models, the initial VSSM-YOLO model construction method includes: The VSSM module is used to replace the C3k2 module in the backbone network and the neck network, respectively. Replace the Conv convolutional layer in the backbone network with the Stem module; Replace the Conv downsampling module in the backbone network with the VisionMerge downsampling module.
[0008] In addition, the railway freight car component anomaly detection method of the present invention described above may also have the following additional technical features: Furthermore, in the process of replacing the C3k2 module in the backbone network and the neck network with the VSSM module respectively, the method of replacing the C3k2 module in the backbone network with the VSSM module includes: Locate the C3k2 module and extract its input interface parameters and output interface parameters, wherein the input interface parameters include input features and the output interface parameters include output features; A VSSM module is constructed, the C3k2 module is removed from the backbone network architecture and a VSSM module is inserted in the same position, and multi-level adaptation is performed on the C3k2 module so that the VSSM module can be replaced without changing the input interface parameters and output interface parameters. In the step of multi-level adaptation for the C3k2 module, the adaptation method includes: the VSSM module directly receives the input features of the C3k2 module at the input end and generates consistent output features at the output end. The number of output channels of the VSSM module is the same as the number of output channels of the C3k2 module, and the spatial resolution of the VSSM module remains unchanged with the spatial resolution of the C3k2 module, so as to ensure that the features before and after the replacement are completely consistent.
[0009] Furthermore, the neck network includes upsampling and feature concatenation operations. In replacing the C3k2 module in the backbone network and the neck network with the VSSM module, the method for replacing the C3k2 module in the neck network with the VSSM module includes: The C3k2 module after feature concatenation is located, and the output features of the C3k2 module after multi-source input feature fusion in different levels of backbone network are obtained; A VSSM module is constructed, and its input interface is adapted for the input features after multi-branch fusion. This allows the VSSM module to directly process the high-dimensional channel features after feature concatenation. At the same time, channel mapping is achieved through convolution operations to adjust the number of output channels of the VSSM module to be consistent with the number of output channels of the C3k2 module, while ensuring that the input interfaces of subsequent convolutional layers and detection heads remain unchanged.
[0010] Furthermore, in the step of replacing the Stem module with the Conv convolutional layer in the backbone network, the replacement method includes: Obtain the output interface parameters of the original convolutional module, including the number of output channels and spatial resolution, and construct the Stem module so that the output features of the Stem module are consistent with those of the original convolutional module in terms of channel dimension and spatial resolution, so as to meet the input requirements of subsequent network layers. Remove two convolutional operations from the backbone network in the network graph and insert a Stem module at the same position after removal. At the same time, keep the output features of the Stem module directly input to the subsequent downsampling layer or feature extraction module to ensure that the data flow path remains unchanged. The Stem module receives the original image input at its input end, and generates a feature map of the same dimension as the original convolutional module at its output end through feature integration, so as to ensure that the structure of each layer in the subsequent backbone network does not need to be adjusted.
[0011] Furthermore, in the step of replacing the Conv downsampling module in the backbone network with the VisionMerge downsampling module, the replacement method includes: Obtain the output interface parameters of the Conv downsampling module, including the number of output channels and the spatial resolution scaling relationship. Construct the VisionMerge downsampling module based on the number of output channels and the spatial resolution scaling relationship, so that the output features of the VisionMerge downsampling module are consistent with those of the Conv downsampling module in terms of the number of channels and spatial resolution while performing feature downsampling. Remove the Conv downsampling module from the backbone network and replace it with the VisionMerge module at the same position after removal, ensuring that the data flow between the VisionMerge module and the modules before and after it remains unchanged; The steps of removing the Conv downsampling module from the backbone network and replacing it with the VisionMerge module in the same position after removal include: In terms of interface adaptation, the input end of the VisionMerge module directly receives the output features from the previous module, and the output end of the VisionMerge module is connected to the subsequent feature extraction module to ensure that the input and output relationships between the layers of the network remain unchanged.
[0012] Furthermore, the VSSM module includes SS2D and FSBlock, where SS2D is a two-dimensional selective state-space scanning module and FSBlock is a frequency-domain and spatial-domain adaptive residual gating architecture; a feature enhancement mechanism for state-space modeling and multi-domain information modulation is constructed through SS2D and FSBlock, wherein the state-space modeling method includes: The input features are modeled in two-dimensional state space using the SS2D method; wherein the input features of the SS2D are derived from the output features of the preceding network, and the processing method includes: The input features are serialized and rearranged, and the two-dimensional spatial features are expanded into a sequence form according to different scanning paths. The state space scanning operation is performed according to different methods. During the scanning process, the current features and historical features are recursively fused through the state update equation to realize the propagation and accumulation of information in the spatial dimension. The feature results obtained from scanning in different directions are fused and restored to a two-dimensional feature map structure. This allows for the modeling of global dependencies while maintaining the original spatial resolution, thereby improving the model's ability to capture long-distance contextual information. Feature enhancement methods include: introducing an FSBlock inside the VSSM module to perform multi-domain information fusion and adaptive modulation on the output features of SS2D; The multi-domain information fusion method includes: the FSBlock receives the output features of SS2D and decomposes the output features of SS2D into a frequency domain branch and a spatial domain branch. The frequency domain branch obtains global frequency response information of the input features through fast Fourier transform, which is used to characterize the periodic structure and global pattern in the image; the spatial domain branch retains the spatial distribution information of the original features, which is used to maintain local structural details. Adaptive modulation methods include: The frequency domain features and spatial domain features are weighted and fused through a gating mechanism to obtain fused features. The gating weights of the weighted fusion are learnable parameters that can adaptively adjust the contribution ratio of frequency domain information and spatial domain information according to the input features, thereby achieving a dynamic balance between different information representations. After fusion, the fused features are superimposed on the input features through residual connection to obtain the final output features, so as to ensure the stability of feature transmission and avoid information degradation.
[0013] Furthermore, the VSSM module's methods for processing image feature maps include: An image feature map is obtained, which is a two-dimensional feature map. The two-dimensional feature map is normalized to stabilize the training. Local spatial features are extracted through depthwise separable convolution. Then, nonlinearity is introduced through activation function to achieve lightweight spatial feature processing. The features after lightweight spatial feature processing are fed into SS2D to expand the two-dimensional feature map into a one-dimensional input sequence through scan expansion. SS2D includes scan expansion, S6 selective state space computation, and scan merging. The S6 selective state-space computation applies a structured state-space sequence equation to the one-dimensional input sequence for recursive computation to obtain a one-dimensional output sequence for global modeling; the one-dimensional output sequence is scanned and merged in the order opposite to the scan expansion to obtain a two-dimensional spatial feature map; The two-dimensional spatial feature map is fed into FSBlock so that it undergoes frequency domain branching and spatial domain branching. It is then multiplied by a gating mechanism to obtain the frequency domain branch output and the spatial domain branch output. A lightweight adaptive fusion network is then used to fuse the frequency domain branch output and the spatial domain branch output to obtain the output after FSBlock processing. The two-dimensional spatial feature map and the output of FSBlock are fused through residual connection, and the fused features are layer normalized to obtain the final output of the VSSM module.
[0014] Another aspect of the present invention provides a railway freight car component anomaly detection system for implementing the above-described railway freight car component anomaly detection method, the system comprising: The acquisition module is used to acquire and identify historical images of railway freight cars on various sections to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of railway freight cars. The training module is used to construct an initial VSSM-YOLO model based on the Mamba model and the YOLOv11 model, and to train the initial VSSM-YOLO model using a railway freight car abnormal component dataset to obtain the target VSSM-YOLO model. The detection module is used to acquire current images of railway freight cars on each section, input the current images of railway freight cars into the target VSSM-YOLO model to identify the current images of railway freight cars, and locate abnormal parts of freight cars based on the identification results to achieve abnormal detection of railway freight car parts.
[0015] In another aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the railway freight car component anomaly detection method as described above.
[0016] In another aspect, the present invention provides a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the railway freight car component anomaly detection method as described above.
[0017] The aforementioned method and system for detecting anomalies in railway freight car components, on the one hand, improves the detection accuracy, localization capability, real-time performance, and robustness of anomaly detection in railway freight car components by replacing the C3k2 module in the backbone network and neck network with the VSSM module, effectively solving the problem of anomaly identification in railway vehicles. Specifically, the VSSM module includes SS2D and FSBlock. SS2D processes global feature modeling of the image, while FSBlock captures local features. The combination of the two provides a more comprehensive understanding of the input image, thereby improving the model's ability to detect anomalies in different components. Local features help capture detailed information such as the edges and textures of the target, while global features provide contextual information about the target, such as the relationship between the background and the target. Through information interaction and feature fusion in the VSSM module, the network's ability to express details and complex information in the image is effectively improved. On the other hand, the Stem module replaces the Conv convolutional layer in the backbone network, and the VisionMerge downsampling module replaces the Conv downsampling module in the backbone network, effectively balancing the model's performance and efficiency, and preserving more visual cues beneficial to model training for SSM, thus improving the performance and efficiency of anomaly detection in railway freight car components. Attached Figure Description
[0018] Figure 1 This is a flowchart of the railway freight car component anomaly detection method in the first embodiment of the present invention.
[0019] Figure 2 This is an example image of a railway freight car acquired by the TFDS system in the first embodiment of the present invention.
[0020] Figure 3 This is a schematic diagram of the VSSM-YOLO model in the first embodiment of the present invention.
[0021] Figure 4 This is a schematic diagram of the SS2D structure of the present invention.
[0022] Figure 5 This is a schematic diagram of the structure of the FSBlock of the present invention.
[0023] Figure 6 This is a schematic diagram of the VSSM module in the first embodiment of the present invention.
[0024] Figure 7 This is a schematic diagram of the Stem module in the first embodiment of the present invention.
[0025] Figure 8 This is a schematic diagram of the VisionMerge module in the first embodiment of the present invention.
[0026] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0027] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0029] To facilitate understanding of the present invention, several embodiments are given below. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of the present invention will be more thorough and complete.
[0030] Example 1 Please see Figure 1 The figure shows a method for detecting abnormalities in railway freight car components according to the first embodiment of the present invention, the method comprising steps S101 to S104: S101. Obtain and identify historical images of railway freight cars for each section to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of railway freight cars.
[0031] like Figure 2 As shown in the illustration, as a specific example, industrial high-definition cameras at the trackside of the TFDS (Trouble of Freight Detection System) are used to photograph and store images of passing freight cars, thus obtaining the original dataset through TFDS. The original dataset is then filtered to obtain a set of freight car images containing multiple scales and anomaly types. The main anomaly types detected include seven categories: wheel damage, missing key, misaligned saddle, misaligned locking plate, bearing oil spillage, protruding outer spring of the bolster spring, and broken bolster spring. The original dataset is divided into training, validation, and test sets in an 8:1:1 ratio. Furthermore, to enrich the anomaly samples, the training and validation sets are augmented using geometric transformations, color transformations, noise addition, blurring, and weather effect simulations to obtain sample data.
[0032] The data augmentation methods specifically include: First, utilizing the `albumentations` library, a Python library for image augmentation, which provides a rich set of data augmentation methods. Different functions are used to blur the training images to varying degrees, including `MedianBlur`, `Blur`, `GaussNoise`, and `MotionBlur`. Second, the `HueSaturationValue` function is used to adjust the image's hue, saturation, and brightness. Third, the `RandomBrightnessContrast` function is used to randomly adjust the image's brightness and contrast. Finally, the `RandomRain` and `RandomSnow` functions are used to simulate random rain and snow. This expands the dataset size, improves the model's generalization ability, enhances anomaly detection robustness, and reduces the risk of overfitting.
[0033] Furthermore, abnormal components in the images are labeled, and the anomaly type and location are recorded for each abnormal region in the image; the labeling results are then reviewed to ensure accuracy. During dataset processing, LabelStudio is used to perform detailed labeling of the acquired railway freight car images to indicate anomaly categories and locations.
[0034] S102. The initial VSSM-YOLO model is constructed based on the Mamba model and the YOLOv11 model.
[0035] In this embodiment, the Mamba model includes a VSSM (Vision State Space Model) module, a Stem module, and a VisionMerge downsampling module; the YOLOv11 model includes a backbone network and a neck network, both of which include a C3k2 module. The backbone network also includes Conv convolutional layers and a Conv downsampling module.
[0036] like Figure 3 The diagram shown illustrates the structure of the VSSM-YOLO model. As a specific example, in the step of constructing the initial VSSM-YOLO model based on the Mamba model and the YOLOv11 model, the construction method of the initial VSSM-YOLO model includes steps S1021 to S1023: S1021. Replace the C3k2 modules in the backbone network and neck network with VSSM modules respectively.
[0037] In step S1021, regarding the replacement of the C3k2 module in the backbone network by the VSSM module, the replacement method is specifically explained as follows: For the backbone network of the YOLOv11 model, the C3k2 modules used for feature extraction in each stage are structurally replaced. The original backbone network consists of multiple progressively downsampled feature extraction stages, with convolutional operations used between stages to reduce spatial resolution. At each scale, the C3k2 modules perform depth-based feature extraction. Specifically, the C3k2 modules are located, and their input and output interface parameters are extracted. The input interface parameters include input features, and the output interface parameters include output features.
[0038] Furthermore, a VSSM module is built on this basis, the C3k2 module is removed from the backbone network architecture and the VSSM module is inserted in the same position, and multi-level adaptation is performed for the C3k2 module so that the VSSM module can be replaced without changing the input interface parameters and output interface parameters.
[0039] In the multi-level adaptation step for the C3k2 module, the adaptation method includes: the VSSM module directly receives the input features of the C3k2 module at the input end and generates consistent output features at the output end. The number of output channels of the VSSM module is the same as that of the C3k2 module, and the spatial resolution of the VSSM module remains unchanged with that of the C3k2 module, so as to ensure that the features before and after the replacement are completely consistent, thereby making the network before and after the replacement equivalent in terms of topology.
[0040] In some alternative embodiments, when the number of input channels of the C3k2 module does not match the internal processing dimension of the VSSM module, the input features are linearly transformed by setting a channel mapping unit to achieve input interface alignment, but this mapping does not change the overall output interface.
[0041] Furthermore, since the backbone network adopts a single-path layer-by-layer feature transmission method and does not involve multi-branch feature fusion, it is only necessary to ensure that the input and output dimensions between adjacent modules are consistent during data flow transmission, without the need to adjust the additional branch structure.
[0042] Through the above replacement, the VSSM module can update the feature extraction unit without changing the overall structure of the backbone network and the data flow path, thus providing a foundation for the subsequent feature fusion of the neck network.
[0043] In this embodiment, the neck network includes upsampling and feature concatenation operations. Further, in step S1021, the method for replacing the C3k2 module in the neck network with the VSSM module is explained as follows: For the neck network portion of the YOLOv11 model, the C3k2 module involved in multi-scale feature fusion is structurally replaced. The neck network employs a top-down and bottom-up feature fusion structure, including upsampling and feature concatenation operations, to fuse feature maps from different scales in the backbone network. In this structure, the C3k2 module is located after the feature concatenation operation and is used to further extract and enhance the fused features.
[0044] During the replacement process, firstly, the C3k2 module after feature concatenation is located, and the output features of the C3k2 module after multi-source input feature fusion in different layers of the backbone network are obtained. Then, a VSSM module is constructed, and its input interface is adapted for the multi-branch fused input features, enabling the VSSM module to directly process the high-dimensional channel features after feature concatenation. Simultaneously, channel mapping is achieved through convolution operations, adjusting the number of output channels of the VSSM module to match that of the C3k2 module, while ensuring that the input interfaces of subsequent convolutional layers and the detection head remain unchanged.
[0045] During the replacement, the original C3k2 module was removed from its position after feature concatenation and a VSSM module was inserted. Simultaneously, the data flow connections between upsampling, feature concatenation, and subsequent convolutional layers were kept consistent to ensure the multi-scale feature fusion path was not disrupted. It should be further noted that, unlike the backbone network, the feature flow in the neck network exhibits significant multi-branch fusion characteristics. Therefore, during the replacement process, it is necessary to additionally ensure the VSSM module's ability to model cross-scale fused features; that is, to achieve global dependency modeling of fused features without altering the feature concatenation structure.
[0046] Through the above replacement, the neck network is upgraded from the original local convolution processing method to a global modeling method in the information processing stage after multi-scale feature fusion, thereby improving the collaborative expression ability between features of different scales and enhancing the model's ability to detect different targets and cross-scale targets.
[0047] As a concrete example, the VSSM module includes SS2D (2D Selective State Space Scan Module, SS2D) and FSBlock (Feature Selection Block, FSBlock). SS2D is a two-dimensional selective state space scanning module, and FSBlock is an adaptive residual gating architecture in the frequency and spatial domains. A feature enhancement mechanism for state space modeling and multi-domain information modulation is constructed using SS2D and FSBlock, where: The state-space modeling method includes: performing two-dimensional state-space modeling processing on the input features using SS2D; where the input features of SS2D come from the output features of the previous network, the specific processing method for two-dimensional state-space modeling includes: serializing and rearranging the input features, expanding the two-dimensional spatial features into a sequence form according to different scanning paths, and performing state-space scanning operations along different methods respectively. During the scanning process, the current features and historical features are recursively fused through the state update equation to realize the propagation and accumulation of information in the spatial dimension; the feature results obtained from scanning in different directions are fused and restored to a two-dimensional feature map structure, so as to realize the modeling of global dependencies while maintaining the original spatial resolution, thereby improving the model's ability to capture long-distance contextual information.
[0048] Furthermore, the feature enhancement method includes introducing an FSBlock within the VSSM module for multi-domain information fusion and adaptive modulation of the SS2D output features. The multi-domain information fusion method involves the FSBlock receiving the SS2D output features and decomposing them into a frequency domain branch and a spatial domain branch. The frequency domain branch uses a Fast Fourier Transform (FFT) to obtain global frequency response information from the input features, representing periodic structures and global patterns in the image. The spatial domain branch retains the spatial distribution information of the original features to maintain local structural details. Further, the adaptive modulation method involves weighted fusion of the frequency and spatial domain features using a gating mechanism to obtain fused features. The gating weights are learnable parameters that adaptively adjust the contribution ratio of frequency and spatial domain information based on the input features, achieving a dynamic balance between different information representations. After fusion, the fused features are superimposed on the input features using a residual connection to obtain the final output features, ensuring the stability of feature transfer and avoiding information degradation.
[0049] This invention embeds SS2D and FSBlock into the feature processing flow of the VSSM module, enabling the VSSM module to not only have global state space modeling capabilities but also further integrate frequency domain and spatial domain information to achieve multi-dimensional modeling of complex visual features. Thus, without changing the overall network structure, it effectively improves the feature representation capability and detection performance of the target VSSM-YOLO model in the task of detecting abnormal targets in railway freight cars.
[0050] SS2D introduces a State Space Model (SSM) computation method to significantly improve the model's understanding of the relationships between cross structures and components in railway freight cars. Specifically, the SSM computation method models two-dimensional image information through one-dimensional sequences, effectively capturing long-range dependency information of the image and enhancing the global modeling capability of the target VSSM-YOLO model. This effectively overcomes the shortcomings of convolutional neural networks in global modeling and, with its linear complexity advantage, overcomes the quadratic growth in complexity of Transformer technology, which can perform global modeling. This achieves the target VSSM-YOLO model's ability to model the relationships between cross structures and components in railway freight cars, improves the target VSSM-YOLO model's understanding of the relationships between different components, and thus enhances the target VSSM-YOLO model's anomaly detection capability for railway freight car components.
[0051] Specifically, SS2D mainly includes three parts: scan extension, S6 selective state space calculation, and scan merging, such as... Figure 4As shown, the input feature map is first expanded by scanning in four symmetrical directions into a one-dimensional sequence: top-down, bottom-up, left-to-right, and right-to-left. Then, the one-dimensional sequence is processed using the S6 selective state-space computation of the SSM (Selective State-Solving Method). The SSM-processed sequence is then fused by scanning in reverse direction to reconstruct a two-dimensional image. These different scanning directions provide rich multidimensional information for subsequent feature extraction, improving the efficiency and comprehensiveness of multidimensional image feature capture.
[0052] Furthermore, such as Figure 5 As shown, FSBlock effectively models image information in both the frequency and spatial domains, improves performance in both domains through a simple gating mechanism, and adaptively allocates channel weights between the frequency and spatial domains using a simple adaptive fusion network. This results in comprehensive image feature information, effectively improving anomaly detection and localization capabilities in complex backgrounds and grayscale imaging of railway freight cars. Specifically, in FSBlock, given an input tensor Z, the input features are first split into three parts using a 1×1 convolution, serving as inputs for the frequency, gating, and spatial domain branches, respectively.
[0053] In the formula, F freq Indicates frequency domain branching; F gate Indicates a gated branch; F space Represents spatial domain branching; Split() represents channel dimension splitting; Conv 1×1 (﹒) represents a 1×1 convolution operation.
[0054] The frequency domain branch aims to explicitly model the global contextual information of the features. Firstly, for... F freq A two-dimensional real-number Fast Fourier Transform (FFT) is performed to obtain the complex frequency spectrum of the frequency domain branch. Then, the complex frequency spectrum is decomposed into an amplitude spectrum and a phase spectrum, where the amplitude spectrum carries the intensity information and the phase spectrum carries the structural information of the image, respectively. To obtain a compact, channel-independent global frequency domain representation, the average values of amplitude and phase across all channels are calculated to obtain A and P, where A represents amplitude features and P represents phase features. Finally, the merged [A, P] is passed through a module consisting of a 1×1 convolution and an activation function, projected onto C channels, and upsampled to a spatial dimension (H, W) to obtain the output of the frequency domain branch. O freq .
[0055] Furthermore, the spatial domain branch is responsible for capturing local spatial features and details. First, local features are extracted using a 3×3 depthwise separable convolution (DWConv). Then, residual connections are used to stabilize the training. Finally, batch normalization and activation functions are applied for a nonlinear transformation to obtain the output of the spatial domain branch. O space .
[0056] Furthermore, gated branches are used to modulate the characteristics of frequency domain branches and spatial domain branches to highlight important regions. F gate The gated signal G is obtained through a 1×1 convolution and a sigmoid function. Modulation is achieved by performing element-wise multiplication with the gated signal G in both the frequency and spatial domains. The specific calculation formula is as follows: ; ; In the formula, This represents the result of multiplying the gate control by the spatial domain feature; This represents the result after multiplying the gated data with the frequency domain features; O space This indicates the output of the spatial domain branch; O freq The frequency domain branch output is represented; G represents the gate signal. This indicates element-wise multiplication.
[0057] Depending on the different feature channels, such as texture, edge, and color, the degree of dependence on spatial and frequency domain information varies. Furthermore, a feature channel fusion method is designed to learn an independent pair of fusion weights for each channel, effectively modeling the differentiated preferences of different feature channels for spatial and frequency domain information. Specifically, the feature channel fusion process includes: first, concatenating the spatial domain features with the frequency domain features... F in Global average pooling is performed to compress the data into two feature vectors along the channel dimension. These two compressed feature vectors are then input into a dynamic fusion network to fuse the compressed spatial and frequency domain features. The dynamic fusion network is a lightweight, bottlenecked multilayer perceptron (MLP) consisting of two 1×1 convolutional layers and a non-linear activation function. The output dimension of the dynamic fusion network is set to 2C, generating two values W for each channel of the sample. Specifically, the above feature channel fusion process can be represented as follows: ; ; in: F in The feature is the result of concatenating spatial domain features and frequency domain features; DFIndicates a dynamic fusion network; * indicates a 1×1 convolution operation; W 1 is the weight matrix of the first convolutional layer; W 2 is the weight matrix of the second convolutional layer; B represents the set of real numbers; C represents the batch size; H represents the number of channels; W represents the height; δ ReLU This represents the activation function.
[0058] As a concrete example, the output of the above formula is... W 1 and W 2. Mapping to the (0,1) interval using the Sigmoid function to form a whole, and then dividing this whole into channels along the channel dimension. W space and W freq Then it is broadcast to the corresponding spatial location of the channel, and then W space and W freq The fused features are obtained by multiplying each channel of the features from its respective branch and then summing the results. Specifically, the formula for calculating the fused features is:
[0059] In the formula, W space The weight matrix representing the spatial domain; W freq Represents the weight matrix in the frequency domain; Indicates the characteristics after fusion; This represents the result of multiplying the gate control by the spatial domain feature; This represents the result after multiplying the gated data with the frequency domain features; This indicates element-wise multiplication.
[0060] The fused features are then subjected to a Dropout operation and a 1×1 convolutional projection layer; a learnable scaling parameter is used to establish a residual connection with Shortcut(·) to obtain the final output of the entire VSSM module. Specifically, the formula for calculating the final output of the VSSM module is as follows:
[0061] In the formula, γ represents the learnable scaling parameter; Shortcut(·) represents the projection mapping, which is accomplished through a convolution operation; output This indicates the final output of the VSSM module; Conv 1×1 This represents a 1×1 convolution operation.
[0062] As a concrete example, the VSSM module, composed of SS2D and FSBlock, replaces the C3k2 module in the backbone and neck network of the YOLOv11 model. The VSSM module, by simultaneously capturing both global and local features of the image, enables a more comprehensive understanding of the input image. In object detection tasks, this helps the model identify and correctly locate targets in the image. SS2D within the VSSM module comprehensively captures the global dependencies of the image, thus better understanding the contextual information of the target. FSBlock within the VSSM module effectively locates anomalous components in railway freight car images with complex backgrounds and grayscale imaging. Therefore, the VSSM module effectively improves the network's ability to represent details and complex patterns in images.
[0063] like Figure 6 As shown, from a macroscopic perspective, the VSSM module starts with the input features. First, it undergoes preliminary processing through a standard feature extraction block consisting of convolution, batch normalization, and activation functions. Then, it sequentially passes through layer normalization, linear mapping, depthwise separable convolution, and activation functions for feature transformation and refinement. Finally, it is fed into the core SS2D module, where the two-dimensional spatial features are scanned into a sequence and efficient global context modeling is performed using SSM. Simultaneously, another skip connection path connects the earlier preliminary features X... l-2 This is directly added to the features output from SS2D to achieve cross-layer information fusion and obtain the intermediate feature X. l-1 The intermediate feature X l-1 The data is then fed into the FSBlock architecture for feature enhancement of both frequency and spatial domain information. Finally, SS2D and FSBlock are added together to output the final feature X of this layer. l .
[0064] In this embodiment, the VSSM module employs multiple strategies to enhance the network's feature extraction capabilities, combining local feature extraction, global feature extraction, and feature fusion to improve object detection capabilities. Specifically: Local feature extraction: The VSSM module mainly extracts local features through the FSBlock architecture. By leveraging the complementarity of frequency domain information and spatial domain information, it fully extracts local features from railway freight car images.
[0065] Global Feature Extraction: The VSSM module mainly extracts global features through SS2D. It uses 2D image feature serialization, performs efficient global context modeling through SSM, and then restores the 2D image to finally obtain global features.
[0066] Feature fusion: Global and local features are combined. This VSSM module fuses global and local features through residual connections to form the final output.
[0067] Specifically, the main formulas of the VSSM module are as follows: Preliminary feature extraction:
[0068] Global feature extraction:
[0069] Local feature extraction:
[0070] Among them, X l-3 The original features are the input; X l-2 These are preliminary characteristics; σ Indicates the activation function; BatchNorm (﹒) indicates batch normalization processing; Conv 2 d (﹒) represents a two-dimensional convolution operation; LayerNorm (﹒) indicates layer normalization processing; FSBlock (﹒) represents the adaptive residual gating architecture in the frequency and spatial domains; SS2D (﹒) represents the two-dimensional selective state space scanning module.
[0071] S1022, Replace the Conv convolutional layer in the backbone network with the Stem module.
[0072] As a specific example, the replacement method in step S1022 is explained as follows: For the initial feature extraction structure at the input of the YOLOv11 model backbone network, the original convolutional operations are replaced with a simplified Stem module. Specifically, the original convolutional operations are used for preliminary feature extraction of the input image. During the replacement process: First, the output interface parameters of the original convolutional module are obtained, including the number of output channels and spatial resolution. A Stem module is then constructed to ensure that its output features maintain the same channel dimension and spatial resolution as the original convolutional module, thus meeting the input requirements of subsequent network layers. Next, two convolutional layers in the backbone network are removed from the network graph, and the Stem module is inserted at the same location after removal. Simultaneously, the output features of the Stem module are directly input to subsequent downsampling layers or feature extraction modules to ensure the data flow path remains unchanged. The Stem module receives the original image input at its input end, and its output end generates a feature map of the same dimension as the original convolutional module through feature integration, ensuring that the structure of subsequent layers in the backbone network does not require adjustment.
[0073] like Figure 7 As shown, Figure 7This is a schematic diagram of the Stem module. In the Stem module, only two convolutions are used for downsampling, achieving a balance between performance and efficiency. Furthermore, to avoid convolutional downsampling interfering with the selective operations of the SSM and to preserve more visual cues for the SSM, the VisionMerge module replaces the Conv convolutional downsampling, thereby effectively improving the accuracy and efficiency of railway freight car anomaly detection.
[0074] During the replacement process, the original two convolutional layers in the backbone network are removed from the network graph and replaced with the Stem module. At the same time, the output features of the Stem module are directly input to the subsequent downsampling layer or feature extraction module to ensure that the data flow path remains unchanged.
[0075] The above replacements enable the input feature extraction unit to be upgraded without changing the overall network structure and interface definition, thereby providing a more efficient initial feature representation for subsequent feature extraction, while improving feature expression efficiency and reducing redundant computation.
[0076] S1023. Replace the Conv downsampling module in the backbone network with the VisionMerge downsampling module.
[0077] Regarding the replacement method in step S1023, the specific explanation is as follows: The Conv downsampling module used for spatial resolution reduction in the YOLOv11 model backbone network was replaced with the VisionMerge downsampling module. Specifically, the original Conv downsampling module consisted of convolutional layers with a stride greater than 1, used to convert input features into low-resolution features, and the downsampling ratio was determined by the convolutional stride. During the replacement process: First, obtain the output interface parameters of the Conv downsampling module, including the number of output channels and the spatial resolution scaling relationship. Then, construct the VisionMerge downsampling module based on the number of output channels and the spatial resolution scaling relationship, so that the output features of the VisionMerge downsampling module are consistent with those of the Conv downsampling module in terms of the number of channels and spatial resolution while performing feature downsampling.
[0078] Furthermore, the Conv downsampling module is removed from the backbone network and replaced with the VisionMerge module at the same location after removal, ensuring that the data flow between the VisionMerge module and its preceding and following modules remains unchanged.
[0079] The step of removing the Conv downsampling module from the backbone network and replacing it with the VisionMerge module in the same position includes: in terms of interface adaptation, the input of the VisionMerge module directly receives the output features from the previous module, and the output of the VisionMerge module is connected to the subsequent feature extraction module to ensure that the input and output relationships between the network layers remain unchanged. Specifically, as follows... Figure 8 As shown.
[0080] In the VisionMerge module, spatial recombination is performed by splitting the dimensional map and appending redundant feature maps to the channel dimension, and downsampling is performed using standard convolutional layers.
[0081] Through the above replacements, the structure of the downsampling module is updated without changing the overall network structure and multi-scale feature generation process, providing more effective information for subsequent feature fusion and target detection tasks.
[0082] The VSSM module's structure mainly includes SS2D and FSBlock. The VSSM module processes the spatial dimension of an image through sequences. Specifically, the VSSM module's processing methods for image feature maps include: acquiring image feature maps (which are two-dimensional), normalizing the two-dimensional feature maps for stable training, extracting local spatial features through depthwise separable convolution, and introducing nonlinearity through an activation function to achieve lightweight spatial feature processing; inputting the lightweight spatial feature processed features into SS2D to expand the two-dimensional feature map into a one-dimensional input sequence through scan expansion. SS2D includes scan expansion, S6 selective state space computation, and scan merging; S6 selective state space computation recursively calculates the one-dimensional input sequence using structured state space sequence equations to obtain the one-dimensional... The output sequence is used for global modeling; the one-dimensional output sequence is scanned and merged in the opposite order to the scan expansion to obtain a two-dimensional spatial feature map; the two-dimensional spatial feature map is fed into FSBlock so that it undergoes frequency domain branching and spatial domain branching, and is multiplied by the gating mechanism to obtain the frequency domain branch output and spatial domain branch output. Then, a lightweight adaptive fusion network is used to fuse the frequency domain branch output and spatial domain branch output to obtain the output after FSBlock processing; the two-dimensional spatial feature map and the output after FSBlock processing are fused through residual connections, and the fused features are layer normalized to obtain the final output of the VSSM module.
[0083] S103. Train the initial VSSM-YOLO model using the abnormal components dataset of railway freight cars, and then obtain the target VSSM-YOLO model.
[0084] As a concrete example, an initial VSSM-YOLO model is trained using a dataset of abnormal components from railway freight cars, resulting in a trained VSSM-YOLO model. This trained model is then evaluated, and the VSSM-YOLO model is adjusted based on the evaluation results to obtain the target VSSM-YOLO model. Specifically: An anomaly test set of railway freight car components was input into the trained VSSM-YOLO model, and evaluation results were obtained based on the set key metrics. These key metrics included mAP, precision, and recall, where mAP represents the mean average precision for each object category; precision represents accuracy; and recall represents recall. When evaluating model performance on the validation set, the mean of detection precision, recall, and average precision were used as evaluation metrics.
[0085] Among them, detection accuracy measures the proportion of targets that are actually abnormal out of all targets predicted as abnormal by the model. It reflects the accuracy of the model in identifying anomalies. The formula for calculating detection accuracy is as follows:
[0086] Furthermore, recall represents the proportion of anomalous targets successfully detected by the model among all actual anomalous targets. It measures the model's coverage of real targets. The formula for recall is as follows:
[0087] In the formula, TP This represents the number of samples that were correctly classified as positive (in reality, these are anomalies, and the model detects them as anomalies). FP This indicates the number of samples that were misclassified as positive (in reality, they are normal, but the model detects them as abnormal). FN This indicates the number of samples that were misclassified as negative (in reality, they are anomalies, but the model detects them as normal).
[0088] Furthermore, the mean precision comprehensively considers the model's precision and recall performance under different IoU thresholds. It is usually calculated by the area under the precision-recall curve and is an important indicator for evaluating the overall performance of the model. The formula for calculating the mean precision is as follows:
[0089] In the formula, n Indicates the number of categories. i Indicates category index, P ( R The precision-recall curve is represented by a function. P Represents precision, R Represents recall rate.
[0090] As a concrete example, these evaluation metrics can be used to comprehensively assess the actual performance of the improved YOLOv11 model in detecting anomalies in railway freight car components, ensuring its optimization in terms of accuracy and recall.
[0091] The hyperparameters of the VSSM-YOLO model are adjusted based on the evaluation results to obtain the adjusted VSSM-YOLO model.
[0092] S104. Obtain the current images of railway freight cars on each section, input the current images of railway freight cars into the target VSSM-YOLO model to identify the current images of railway freight cars, and locate abnormal parts of freight cars based on the identification results to realize abnormal detection of railway freight car parts.
[0093] In summary, the railway freight car component anomaly detection method in the above embodiments of the present invention, on the one hand, improves the detection accuracy, localization capability, real-time performance, and robustness of abnormal railway freight car components by replacing the C3k2 module in the backbone network and neck network with the VSSM module, effectively solving the problem of anomaly identification in railway vehicles. Specifically, the VSSM module includes SS2D and FSBlock. SS2D processes the global feature model of the image, and FSBlock captures the local feature of the image. The combination of the two provides a more comprehensive understanding of the input image, thereby improving the model's ability to detect anomalies in different components. Among them, local features help to capture detailed information such as the edge and texture of the target, while global features provide contextual information of the target, such as the relationship between the background and the target. Through information interaction and feature fusion in the VSSM module, the network's ability to express details and complex information in the image is effectively improved. On the other hand, the Stem module replaces the Conv convolutional layer in the backbone network, and the VisionMerge downsampling module replaces the Conv downsampling module in the backbone network, effectively balancing the model's performance and efficiency, and retaining more visual cues that are beneficial to model training for SSM, thereby improving the performance and efficiency of railway freight car component anomaly detection.
[0094] Example 2 The second embodiment of the present invention provides a railway freight car component anomaly detection system for implementing the railway freight car component anomaly detection method in the above embodiments. The system includes: The acquisition module is used to acquire and identify historical images of railway freight cars on various sections to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of railway freight cars. The training module is used to construct an initial VSSM-YOLO model based on the Mamba model and the YOLOv11 model, and to train the initial VSSM-YOLO model using a railway freight car abnormal component dataset to obtain the target VSSM-YOLO model. The detection module is used to acquire current images of railway freight cars on each section, input the current images of railway freight cars into the target VSSM-YOLO model to identify the current images of railway freight cars, and locate abnormal parts of freight cars based on the identification results to achieve abnormal detection of railway freight car parts.
[0095] In summary, the railway freight car component anomaly detection system in the above embodiments of the present invention, on the one hand, improves the detection accuracy, localization capability, real-time performance, and robustness of abnormal railway freight car components by replacing the C3k2 module in the backbone network and neck network with the VSSM module, effectively solving the problem of anomaly identification in railway vehicles. Specifically, the VSSM module includes SS2D and FSBlock. SS2D processes global feature modeling of the image, while FSBlock captures local features of the image. The combination of the two provides a more comprehensive understanding of the input image, thereby improving the model's ability to detect anomalies in different components. Local features help capture detailed information such as the edges and textures of the target, while global features provide contextual information about the target, such as the relationship between the background and the target. Through information interaction and feature fusion in the VSSM module, the network's ability to express details and complex information in the image is effectively improved. On the other hand, the Stem module replaces the Conv convolutional layer in the backbone network, and the VisionMerge downsampling module replaces the Conv downsampling module in the backbone network, effectively balancing the model's performance and efficiency, and preserving more visual cues beneficial to model training for SSM, thus improving the performance and efficiency of railway freight car component anomaly detection.
[0096] Furthermore, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the methods described above.
[0097] Furthermore, embodiments of the present invention also propose a data processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the methods described above.
[0098] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0099] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0100] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0101] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0102] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
Claims
1. A method for detecting abnormalities in railway freight car components, characterized in that, include: Historical images of freight cars on various railway sections were acquired and identified to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of freight cars. An initial VSSM-YOLO model was constructed based on the Mamba model and the YOLOv11 model. The initial VSSM-YOLO model was then trained using a dataset of abnormal components of railway freight cars to obtain the target VSSM-YOLO model. The current images of railway freight cars on each section are acquired, and the current images of railway freight cars are input into the target VSSM-YOLO model to identify the current images of railway freight cars. Based on the identification results, abnormal parts of the freight cars are located to realize the detection of abnormal parts of railway freight cars. The Mamba model includes a VSSM module, a Stem module, and a VisionMerge downsampling module; the YOLOv11 model includes a backbone network and a neck network, both of which include a C3k2 module. The backbone network also includes Conv convolutional layers and a Conv downsampling module. In the step of constructing the initial VSSM-YOLO model based on the Mamba and YOLOv11 models, the initial VSSM-YOLO model construction method includes: The VSSM module is used to replace the C3k2 module in the backbone network and the neck network, respectively. Replace the Conv convolutional layer in the backbone network with the Stem module; Replace the Conv downsampling module in the backbone network with the VisionMerge downsampling module.
2. The method for detecting abnormalities in railway freight car components according to claim 1, characterized in that, The method for replacing the C3k2 module in the backbone network with the VSSM module in the neck network includes: Locate the C3k2 module and extract its input interface parameters and output interface parameters, wherein the input interface parameters include input features and the output interface parameters include output features; A VSSM module is constructed, the C3k2 module is removed from the backbone network architecture and a VSSM module is inserted in the same position, and multi-level adaptation is performed on the C3k2 module so that the VSSM module can be replaced without changing the input interface parameters and output interface parameters. In the step of multi-level adaptation for the C3k2 module, the adaptation method includes: the VSSM module directly receives the input features of the C3k2 module at the input end and generates consistent output features at the output end. The number of output channels of the VSSM module is the same as the number of output channels of the C3k2 module, and the spatial resolution of the VSSM module remains unchanged with the spatial resolution of the C3k2 module, so as to ensure that the features before and after the replacement are completely consistent.
3. The method for detecting abnormalities in railway freight car components according to claim 1, characterized in that, The neck network includes upsampling and feature concatenation operations. In replacing the C3k2 module in the backbone network and the neck network with the VSSM module, the method for replacing the C3k2 module in the neck network with the VSSM module includes: The C3k2 module after feature concatenation is located, and the output features of the C3k2 module after multi-source input feature fusion in different levels of backbone network are obtained; A VSSM module is constructed, and its input interface is adapted for the input features after multi-branch fusion. This allows the VSSM module to directly process the high-dimensional channel features after feature concatenation. At the same time, channel mapping is achieved through convolution operations to adjust the number of output channels of the VSSM module to be consistent with the number of output channels of the C3k2 module, while ensuring that the input interfaces of subsequent convolutional layers and detection heads remain unchanged.
4. The method for detecting abnormalities in railway freight car components according to claim 1, characterized in that, In the step of replacing the Stem module with the Conv convolutional layer in the backbone network, the replacement method includes: Obtain the output interface parameters of the original convolutional module, including the number of output channels and spatial resolution, and construct the Stem module so that the output features of the Stem module are consistent with those of the original convolutional module in terms of channel dimension and spatial resolution, so as to meet the input requirements of subsequent network layers. Remove two convolutional operations from the backbone network in the network graph and insert a Stem module at the same position after removal. At the same time, keep the output features of the Stem module directly input to the subsequent downsampling layer or feature extraction module to ensure that the data flow path remains unchanged. The Stem module receives the original image input at its input end, and generates a feature map of the same dimension as the original convolutional module at its output end through feature integration, so as to ensure that the structure of each layer in the subsequent backbone network does not need to be adjusted.
5. The method for detecting abnormalities in railway freight car components according to claim 1, characterized in that, In the step of replacing the Conv downsampling module in the backbone network with the VisionMerge downsampling module, the replacement method includes: Obtain the output interface parameters of the Conv downsampling module, including the number of output channels and the spatial resolution scaling relationship. Construct the VisionMerge downsampling module based on the number of output channels and the spatial resolution scaling relationship, so that the output features of the VisionMerge downsampling module are consistent with those of the Conv downsampling module in terms of the number of channels and spatial resolution while performing feature downsampling. Remove the Conv downsampling module from the backbone network and replace it with the VisionMerge module at the same position after removal, ensuring that the data flow between the VisionMerge module and the modules before and after it remains unchanged; The steps of removing the Conv downsampling module from the backbone network and replacing it with the VisionMerge module in the same position after removal include: In terms of interface adaptation, the input end of the VisionMerge module directly receives the output features from the previous module, and the output end of the VisionMerge module is connected to the subsequent feature extraction module to ensure that the input and output relationships between the layers of the network remain unchanged.
6. The method for detecting abnormalities in railway freight car components according to claim 1, characterized in that, The VSSM module includes SS2D and FSBlock. SS2D is a two-dimensional selective state space scanning module, and FSBlock is a frequency domain and spatial domain adaptive residual gating architecture. A feature enhancement mechanism for state-space modeling and multi-domain information modulation is constructed using the SS2D and FSBlock, wherein the state-space modeling method includes: The input features are modeled in two-dimensional state space using the SS2D method; wherein the input features of the SS2D are derived from the output features of the preceding network, and the processing method includes: The input features are serialized and rearranged, and the two-dimensional spatial features are expanded into a sequence form according to different scanning paths. The state space scanning operation is performed according to different methods. During the scanning process, the current features and historical features are recursively fused through the state update equation to realize the propagation and accumulation of information in the spatial dimension. The feature results obtained from scanning in different directions are fused and restored to a two-dimensional feature map structure. This allows for the modeling of global dependencies while maintaining the original spatial resolution, thereby improving the model's ability to capture long-distance contextual information. Feature enhancement methods include: introducing an FSBlock inside the VSSM module to perform multi-domain information fusion and adaptive modulation on the output features of SS2D; The multi-domain information fusion method includes: the FSBlock receives the output features of SS2D and decomposes the output features of SS2D into a frequency domain branch and a spatial domain branch. The frequency domain branch obtains global frequency response information of the input features through fast Fourier transform, which is used to characterize the periodic structure and global pattern in the image; the spatial domain branch retains the spatial distribution information of the original features, which is used to maintain local structural details. Adaptive modulation methods include: The frequency domain features and spatial domain features are weighted and fused through a gating mechanism to obtain fused features. The gating weights of the weighted fusion are learnable parameters that can adaptively adjust the contribution ratio of frequency domain information and spatial domain information according to the input features, thereby achieving a dynamic balance between different information representations. After fusion, the fused features are superimposed on the input features through residual connection to obtain the final output features, so as to ensure the stability of feature transmission and avoid information degradation.
7. The method for detecting abnormalities in railway freight car components according to claim 6, characterized in that, The VSSM module's methods for processing image feature maps include: An image feature map is obtained, which is a two-dimensional feature map. The two-dimensional feature map is normalized to stabilize the training. Local spatial features are extracted through depthwise separable convolution. Then, nonlinearity is introduced through activation function to achieve lightweight spatial feature processing. The features after lightweight spatial feature processing are fed into SS2D to expand the two-dimensional feature map into a one-dimensional input sequence through scan expansion. SS2D includes scan expansion, S6 selective state space computation, and scan merging. The S6 selective state-space computation applies a structured state-space sequence equation to the one-dimensional input sequence for recursive computation to obtain a one-dimensional output sequence for global modeling; the one-dimensional output sequence is scanned and merged in the order opposite to the scan expansion to obtain a two-dimensional spatial feature map; The two-dimensional spatial feature map is fed into FSBlock so that it undergoes frequency domain branching and spatial domain branching. It is then multiplied by a gating mechanism to obtain the frequency domain branch output and the spatial domain branch output. A lightweight adaptive fusion network is then used to fuse the frequency domain branch output and the spatial domain branch output to obtain the output after FSBlock processing. The two-dimensional spatial feature map and the output of FSBlock are fused through residual connection, and the fused features are layer normalized to obtain the final output of the VSSM module.
8. A railway freight car component anomaly detection system, characterized in that, The system for implementing the railway freight car component anomaly detection method according to any one of claims 1-7 comprises: The acquisition module is used to acquire and identify historical images of railway freight cars on various sections to label abnormal parts of the freight cars, thereby obtaining a dataset of abnormal parts of railway freight cars. The training module is used to construct an initial VSSM-YOLO model based on the Mamba model and the YOLOv11 model, and to train the initial VSSM-YOLO model using a railway freight car abnormal component dataset to obtain the target VSSM-YOLO model. The detection module is used to acquire current images of railway freight cars on each section, input the current images of railway freight cars into the target VSSM-YOLO model to identify the current images of railway freight cars, and locate abnormal parts of freight cars based on the identification results to achieve abnormal detection of railway freight car parts.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the railway freight car component anomaly detection method as described in any one of claims 1-7.
10. A data processing apparatus, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the railway freight car component anomaly detection method as described in any one of claims 1-7.