Rail intrusion detection method and system based on computer vision
By using computer vision methods to extract features and detect targets in track monitoring images, filtering from a whitelist of channels, setting channel suppression coefficients and random diffusion iterative calculations, the problem of trains and track equipment being misidentified as foreign object intrusions is solved, improving the accuracy and adaptability of track intrusion detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING FIVESHIELD TECH CO LTD
- Filing Date
- 2026-04-08
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies struggle to simultaneously achieve low false alarms and high detection rates. Legitimate targets such as trains and track equipment are easily misidentified as foreign object intrusions, and small or low-contrast track foreign objects are difficult to detect in a timely manner.
By performing feature extraction and target detection on track monitoring images, image feature maps and target category scores are generated. Channel importance values are calculated and filtered from a whitelist of channels. Channel suppression coefficients are set to construct image residual feature maps. Random diffusion iterative calculations are performed using track masks and potential field maps to generate track intrusion detection results.
It significantly reduces the probability of trains and track equipment being mistaken for intrusion targets, enhances the ability to detect small-volume, low-contrast foreign objects in dangerous track areas, and adapts to equipment changes and changes in vehicle body paint.
Smart Images

Figure CN121999448B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and more particularly to a method and system for detecting track intrusion based on computer vision. Background Technology
[0002] In recent years, with the increasing application of fixed cameras and intelligent video analytics in railway scenarios, utilizing computer vision for track intrusion detection has become an important means to improve traffic safety. Existing methods mostly employ target detection models to directly detect pedestrians, vehicles, or foreign objects in the monitored image and trigger alarms within a predefined track area of interest (ROI); or they use background modeling or image differencing to treat changes in the track area as intrusions. However, track scenarios have significant characteristics: train bodies occupy a large area of the image as legitimate targets; track equipment has complex shapes and colors and a fixed distribution; different train models, paint schemes, and equipment modifications frequently change its appearance; and real foreign objects such as small stones, tools, and detached parts are often small in size and have low contrast. This leads to traditional methods relying heavily on category labels or static whitelists, resulting in a sharp increase in false alarm rates when the appearance of trains or equipment changes. Pixel-level or raw feature-level thresholds are insufficient to establish a stable distinction between legitimate and foreign objects, making it difficult to prevent trains or equipment from being treated as intrusions and to reliably detect small foreign objects within dangerous track areas. Therefore, a detection scheme optimized from both the feature space and track physical constraints is urgently needed.
[0003] Currently, Chinese invention patent application number CN202011496298.1 discloses a method and apparatus for detecting foreign object intrusion into railway tracks based on computer vision. The method includes: reading an input image; performing grayscale processing; extracting gradient features; performing binarization processing; applying a mask to the binarized image to retain effective information within the region of interest; extracting contour features from the binarized image of interest; filtering closed contours to obtain all contours most strongly correlated with the track; obtaining the central axis of all contours; distinguishing left and right track regions based on the central axis, and clustering and filtering the contours within each region to obtain track line contours; feeding the track contours back to the binarized region of interest; determining occlusion if the endpoints of the track contours do not intersect the boundary of the binarized region of interest; formatting the results and outputting them. This invention has low operating costs, high efficiency, and is not limited to straight tracks, having a wide range of applications. However, the relevant technologies have difficulty in achieving both low false alarms and high detection rates. When conducting track intrusion detection, there are problems such as legitimate targets such as trains and track equipment being frequently misjudged as foreign object intrusions, and small or low-contrast track foreign objects being difficult to detect in a timely manner. Summary of the Invention
[0004] The technical problem solved by this invention is that related technologies have difficulty in simultaneously achieving low false alarms and high detection rates. When performing track intrusion detection, legitimate targets such as trains and track equipment are frequently misjudged as foreign object intrusions, and small-volume or low-contrast track foreign objects are difficult to detect in a timely manner.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0006] A computer vision-based method for detecting track intrusion includes the following steps:
[0007] Step S1: Perform feature extraction and target detection on the non-intrusive track monitoring image to generate image feature map and target category score. Calculate the channel importance value of each feature channel based on the target category score. Filter the channel importance value to obtain a whitelist channel set.
[0008] Step S2: Set the channel suppression coefficient according to the whitelist channel set, perform suppression operation on the image feature map through the channel suppression coefficient to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map;
[0009] Step S3: Obtain the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map.
[0010] Step S4: Construct a potential field map using an orbital mask. Under the constraints of the potential field map, perform random diffusion iteration on the initial activation map generated based on the spatial residual abnormal heat map. Obtain the activation energy map based on the changes in activation values during the iteration process, and output the orbital intrusion detection results based on the activation energy map.
[0011] Preferably, step S1 specifically includes:
[0012] Step S11: Obtain non-intrusive track monitoring images, geometric structure information of track scenes and scene configuration, perform target detection on each frame of non-intrusive track monitoring images, and obtain a set of detection boxes for each frame of non-intrusive track monitoring images;
[0013] The geometric information of the track scene includes the track centerline, track surface height, and track gauge;
[0014] The scenario configuration includes the fixed installation location of the track equipment and the boundary of the area that the track vehicle is allowed to occupy.
[0015] The detection frame set includes rail vehicles and rail equipment;
[0016] Step S12: Extract the feature map corresponding to each frame of non-intrusive track monitoring image to obtain the image feature map. Take the region corresponding to the detection box of each frame of non-intrusive track monitoring image in the image feature map as the detection box feature map.
[0017] The image feature map includes feature channels and spatial locations;
[0018] Step S13: Select the target category score of rail vehicle or rail equipment from the detection box set, and calculate the channel contribution based on the target category score. The calculation expression is as follows:
[0019] ;
[0020] in, Let k be the channel contribution of the k-th detection box in the c-th feature channel, where k is the detection box index and c is the feature channel index. To detect the spatial location covered by the detection frame, Let be the feature value of the c-th feature channel at spatial location (u,v). Score the target category. The partial derivative of the target category score with respect to the feature value;
[0021] Step S14: Calculate the average value of the channel contribution of all detection boxes in the feature channels to obtain the channel importance value, and form an importance value sequence from the channel importance values of all feature channels;
[0022] Step S15: Sort all feature channels in descending order of channel importance value according to the importance value sequence, select feature channels with channel importance values greater than the preset importance threshold from the sorting results, and form a whitelist channel set.
[0023] Preferably, step S2 specifically includes:
[0024] Step S21: Set the channel suppression coefficient for each feature channel;
[0025] Among them, the channel suppression coefficient of feature channels that do not belong to the whitelist channel set is set to 1;
[0026] Set the channel suppression coefficient of the feature channels belonging to the whitelist channel set to a constant greater than 0 and less than 1;
[0027] Step S22: Calculate the product of the feature value of each feature channel in the feature map of each frame image and the channel suppression coefficient of that feature channel to obtain the residual feature value. Combine the residual feature values to obtain the image residual feature map.
[0028] Step S23: Combine the residual feature values in all image residual feature maps to obtain the residual feature vector, and obtain the normal residual sample set;
[0029] Step S24: Calculate the mean vector and covariance matrix of all residual eigenvectors in the normal residual sample set, and construct a normal residual distribution model using the mean vector and covariance matrix.
[0030] Preferably, the process of constructing a normal residual distribution model specifically includes:
[0031] Using the mean vector as the center position of the normal residual distribution model and the covariance matrix as the covariance structure of the normal residual distribution model, the outlier measure of the residual eigenvectors under the normal residual distribution model is calculated. The calculation expression is as follows:
[0032] ;
[0033] in, These are abnormal metrics. For residual eigenvectors, It is the mean vector. It is the inverse of the covariance matrix. The square of the Mahalanobis distance. These are the normalization coefficients;
[0034] The expression for calculating the normalization coefficient is:
[0035] ;
[0036] in, Let covariance matrix be the variance matrix. For feature dimensions.
[0037] Preferably, step S3 specifically includes:
[0038] Step S31: Obtain the current frame track monitoring image to be detected, extract the current frame feature map corresponding to the current frame track monitoring image, calculate the product of the feature value of each feature channel in the current frame feature map and the channel suppression coefficient of that feature channel to obtain the current frame residual feature value, obtain the current residual feature vector by combining the current frame residual feature values, input the current residual feature vector into the normal residual distribution model, calculate the anomaly measurement value of the current residual feature vector, and obtain the feature domain residual anomaly heat map;
[0039] Step S32: Based on the spatial correspondence between the current frame feature map and the track monitoring image to be detected in the current frame, the feature domain residual abnormal heat map is mapped to the pixel space of the track monitoring image to obtain the spatial residual abnormal heat map in the pixel space of the track monitoring image.
[0040] Preferably, step S4 specifically includes:
[0041] Step S41: In the pixel space of the track monitoring image, obtain the track mask according to the geometric structure information and scene configuration of the track scene. The track mask includes the track danger area mask, the track equipment allowed area mask, and the track vehicle allowed area mask.
[0042] Set the pixel positions corresponding to the track equipment occupancy area mask and the track vehicle occupancy area mask to the first potential value, set the pixel positions corresponding to the track danger area mask to the second potential value, and set the pixel positions not belonging to the track mask to the third potential value to construct a potential field map;
[0043] Among them, the third potential value is greater than the first potential value, and the first potential value is greater than the second potential value;
[0044] Step S42: Set the abnormal measurement values of the pixel positions that do not belong to the track hazard area mask in the spatial residual abnormal heat map to zero, and retain the abnormal measurement values of the pixel positions that are within the track hazard area mask to form the initial activation map.
[0045] Step S43: Starting with the initial activation map, perform random diffusion iteration on the initial activation map under the constraint of the potential field map. In each round of random diffusion iteration, take the iteration activation map of the previous round as input to generate the corresponding iteration activation map of the next round. In each round of iteration, record the changes in activation values at each pixel position of the iteration activation map at the beginning of the round and the iteration activation map at the end of the round to obtain the activation energy map.
[0046] Preferably, the random diffusion iterative operation specifically includes:
[0047] For the iterative activation map of the previous iteration, a preset random perturbation value is added to each pixel position to obtain a perturbation activation map. By the amplitude of the preset random perturbation value, the potential value of the first pixel position is greater than the potential value of the second pixel position, and the amplitude of the preset random perturbation value corresponding to the first pixel position is less than the amplitude of the preset random perturbation value corresponding to the second pixel position.
[0048] Based on the potential value of each pixel position in the potential field map, the suppression value of the corresponding pixel position is determined, and the activation value of each pixel position in the perturbation activation map is suppressed by the suppression value, so that the potential value of the first pixel position is greater than the potential value of the second pixel position, and the reduction of the activation value of the first pixel position is not less than the reduction of the activation value of the second pixel position, thus obtaining the suppressed activation map.
[0049] The enhancement value for each pixel position is determined based on the initial activation value of the initial activation map at each pixel position. The activation value of each pixel position in the suppressed activation map is then enhanced using the enhancement value, so that the initial activation value of the first pixel position is greater than the initial activation value of the second pixel position, and the increase in the activation value of the first pixel position is not less than the increase in the activation value of the second pixel position, thus obtaining the enhanced activation map.
[0050] The activation values of each pixel in the enhanced activation map are attenuated according to a preset attenuation ratio to obtain the current iteration activation map of this round of iteration, and this current iteration activation map is used as the iteration activation map of the previous round of iteration in the next round of random diffusion iteration operation.
[0051] Wherein, the first pixel position and the second pixel position are arbitrary pixel positions in the pixel space of the track monitoring image.
[0052] Preferably, the process of obtaining the activation energy map specifically includes:
[0053] During each round of random diffusion iteration, the activation value of the pixel position in the previous iteration's activation map at the start of the current iteration is calculated as the difference between the activation value of the corresponding pixel position in the current iteration's activation map at the end of the current iteration. The absolute value of the activation value difference is taken as the activation change value of the pixel position in the current iteration.
[0054] In all rounds of random diffusion iteration, the activation change value corresponding to each pixel position is accumulated to obtain the cumulative activation change, and the cumulative activation changes of all pixel positions are combined to form an activation energy map.
[0055] Preferably, step S4 further includes:
[0056] Step S44: In the activation energy map, the pixel positions where the activation change is greater than the activation energy threshold are marked as intrusion candidate pixels to obtain the intrusion target mask.
[0057] Step S45: Perform connected component analysis on the intrusion target mask to obtain adjacent intrusion candidate pixels, and use the adjacent intrusion candidate pixels as the intrusion target region to obtain the intrusion target region set;
[0058] Step S46: Select the intersection of the pixel set corresponding to the track hazard area mask from the intrusion target area set as the overlapping intrusion target area, and use the overlapping intrusion target area as the track intrusion detection output result of the track monitoring image of the current frame.
[0059] A computer vision-based track intrusion detection system includes a feature recognition module, a construction module, an anomaly measurement module, and an analysis module.
[0060] The feature recognition module is used to extract features and detect targets in non-intrusive track monitoring images, generate image feature maps and target category scores, calculate the channel importance value of each feature channel based on the target category score, and obtain a whitelist channel set based on the channel importance value.
[0061] The construction module is used to set channel suppression coefficients according to the whitelist channel set, perform suppression operations on the image feature map through the channel suppression coefficients to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map;
[0062] The anomaly measurement module is used to acquire the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map.
[0063] The analysis module is used to construct a potential field map through an orbital mask, perform random diffusion iterative calculations on the initial activation map generated based on the spatial residual abnormal heat map under the constraints of the potential field map, obtain the activation energy map based on the changes in activation values during the iteration process, and output the orbital intrusion detection results based on the activation energy map.
[0064] The beneficial effects of this invention are as follows: By performing gradient attribution on the feature maps of detection boxes for rail vehicles and equipment in non-intrusive track monitoring images, calculating channel contribution and obtaining a sequence of channel importance values, a whitelist of channels is automatically selected. Then, channel-by-channel suppression is performed on the image feature map and the current frame feature map using channel suppression coefficients to obtain the image residual feature map and the current residual feature vector. Anomaly metrics are calculated only within the residual subspace using a multivariate Gaussian normal residual distribution model, and a spatial residual anomaly heatmap is generated. Unlike methods that rely solely on detection categories or manually delineated whitelist regions, this invention concentrates the representation of rail vehicles and equipment in the suppressed whitelist channels, while leaving more intruder representations in the unsuppressed channels. This naturally amplifies the statistical difference between legitimate occupants and foreign objects in the residual space, enabling periodic reassessment of channel importance as the scene changes, adapting to equipment changes and vehicle paint changes, thereby steadily reducing the probability of trains and track equipment being misjudged as intrusion targets. Furthermore, by utilizing the potential field diagram and the iterative process of random diffusion, the track geometry and equipment are allowed to occupy high potential regions, which naturally suppresses the false activation of trains and equipment. At the same time, energy amplification is performed on low-contrast small foreign objects in dangerous areas of the track to achieve enhanced detection. Attached Figure Description
[0065] Figure 1 A schematic diagram of the basic process of a computer vision-based track intrusion detection method provided in one embodiment of the present invention;
[0066] Figure 2 The following is a basic flowchart of a computer vision-based track intrusion detection system provided as an embodiment of the present invention. Detailed Implementation
[0067] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0068] Example 1, referring to Figure 1 As an embodiment of the present invention, a computer vision-based method for detecting track intrusion is provided, comprising the following steps:
[0069] Step S1: Perform feature extraction and target detection on the non-intrusive track monitoring image to generate image feature map and target category score. Calculate the channel importance value of each feature channel based on the target category score. Filter the channel importance value to obtain a whitelist channel set.
[0070] Step S2: Set the channel suppression coefficient according to the whitelist channel set, perform suppression operation on the image feature map through the channel suppression coefficient to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map;
[0071] Step S3: Obtain the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map.
[0072] Step S4: Construct a potential field map using an orbital mask. Under the constraints of the potential field map, perform random diffusion iteration on the initial activation map generated based on the spatial residual abnormal heat map. Obtain the activation energy map based on the changes in activation values during the iteration process, and output the orbital intrusion detection results based on the activation energy map.
[0073] This invention extracts features and detects targets in non-intrusive track monitoring images. It calculates the channel importance value of each feature channel using target category scores and uses this to obtain a whitelist of channels. It automatically learns the most critical feature channels for identifying track vehicles and equipment, laying the foundation for subsequent anomaly detection only in the residual subspace composed of non-whitelisted channels. Based on the whitelisted channel set, a channel suppression coefficient is set, and the image feature map is suppressed to obtain an image residual feature map. A normal residual distribution model is then constructed on the residual features, compressing normal features into the suppressed channels while retaining more intrusive features in the residual space. This allows anomaly detection to focus more on small foreign objects deviating from the normal residual pattern. For the current frame to be detected, the current frame feature map is extracted and combined with the channel suppression coefficient to calculate the current residual feature vector. This current residual feature vector is input into the normal residual distribution model to obtain an anomaly metric, which is then mapped to a spatial residual anomaly heatmap. This achieves fine quantification of the anomaly degree at each pixel position in the current frame within the residual subspace. By constructing a potential field map using a track mask, and performing a random diffusion iterative operation on the initial activation map generated based on the spatial residual anomaly heatmap under the constraints of the potential field map, an activation energy map is constructed based on the changes in activation values during the iteration process, and the track intrusion detection results are output accordingly. This allows the track intrusion determination to consider not only the residual anomaly intensity, but also the constraints of the track hazard area and the stability of multiple iterations, thereby significantly suppressing false alarms of trains and track equipment while enhancing the detection capability of small-volume, low-contrast intruders in the track hazard area.
[0074] In a specific embodiment, step S1 specifically includes:
[0075] Step S11: Obtain non-intrusive track monitoring images, geometric structure information of track scenes and scene configuration, perform target detection on each frame of non-intrusive track monitoring images, and obtain the set of detection boxes for each frame of non-intrusive track monitoring images;
[0076] The geometric information of the track scene includes the track centerline, track height, and track gauge;
[0077] Scene configuration includes the fixed installation locations of track equipment and the boundaries of the areas that track vehicles are allowed to occupy;
[0078] The detection frame set includes rail vehicles and rail equipment;
[0079] Step S12: Extract the feature map corresponding to each frame of non-intrusive track monitoring image to obtain the image feature map. Take the region corresponding to the detection box of each frame of non-intrusive track monitoring image in the image feature map as the detection box feature map.
[0080] Image feature maps include feature channels and spatial locations;
[0081] Specifically, target detection for each frame of non-intrusive track monitoring image involves using the YOLO model to perform forward inference to obtain the class probability of candidate targets and detection box parameters. Then, the set of detection boxes is obtained through confidence filtering and non-maximum suppression. Finally, image feature maps are obtained from the backbone network in the YOLO model, where each unit in the image feature map is a corresponding feature value.
[0082] Step S13: Select the target category score of rail vehicle or rail equipment from the detection box set, and calculate the channel contribution based on the target category score. The calculation expression is as follows:
[0083] ;
[0084] in, Let k be the channel contribution of the k-th detection box in the c-th feature channel, where k is the detection box index and c is the feature channel index. To detect the spatial location covered by the detection frame, Let be the feature value of the c-th feature channel at spatial location (u,v). Score the target category. The partial derivative of the target category score with respect to the feature value;
[0085] Step S14: Calculate the average value of the channel contribution of all detection boxes in the feature channels to obtain the channel importance value, and form an importance value sequence from the channel importance values of all feature channels;
[0086] Step S15: Sort all feature channels in descending order of channel importance value according to the importance value sequence, select feature channels with channel importance values greater than the preset importance threshold from the sorting results, and form a whitelist channel set.
[0087] Specifically, the preset importance threshold is preferably the cutoff value of the top N most important channels, which can adaptively focus on feature channels related to normal scene targets and filter out channels that contribute little or no to the recognition of normal targets.
[0088] The value of N is the cumulative contribution of all feature channels after they are sorted in descending order of importance, and the number of feature channels that first reach 85% of the total contribution.
[0089] By utilizing the geometric structure information and scene configuration of the track scene on non-intrusive track monitoring images to define the detection area, and combining the target detection results with the detection box feature map, gradient attribution is performed on the detection boxes identified as track vehicles or track equipment. The channel contribution and channel importance values of each feature channel are calculated, and a whitelist channel set is selected accordingly. This achieves automatic extraction of the feature subspace of trains or equipment without the need for manually writing category whitelists or manually specifying equipment regions. It provides accurate channel-level priors for subsequent channel suppression and improves the separability of normal and abnormal roles in the subsequent residual space.
[0090] In a specific embodiment, step S2 specifically includes:
[0091] Step S21: Set the channel suppression coefficient for each feature channel;
[0092] Among them, the channel suppression coefficient of feature channels that do not belong to the whitelist channel set is set to 1;
[0093] Set the channel suppression coefficient of the feature channels belonging to the whitelist channel set to a constant greater than 0 and less than 1;
[0094] Step S22: Calculate the product of the feature value of each feature channel in the feature map of each frame image and the channel suppression coefficient of that feature channel to obtain the residual feature value. Combine the residual feature values to obtain the image residual feature map.
[0095] Step S23: Combine the residual feature values in all image residual feature maps to obtain the residual feature vector, and obtain the normal residual sample set;
[0096] Step S24: Calculate the mean vector and covariance matrix of all residual eigenvectors in the normal residual sample set, and construct a normal residual distribution model using the mean vector and covariance matrix.
[0097] Specifically, the channel suppression coefficients of feature channels belonging to the whitelist channel set are set to constants greater than 0 and less than 1. The greater than 0 value ensures that the residual feature values of the corresponding channels are not zero, thus guaranteeing the smooth calculation of anomaly metrics when constructing the normal residual distribution model. The less than 1 value suppresses features highly correlated with normal targets. When generating the image residual feature map, the feature responses corresponding to normal targets are weakened, while features corresponding to anomalous intrusive targets or background noise are relatively preserved or enhanced. This makes the residual feature map more effective in highlighting patterns deviating from the normal distribution, providing clearer signals for subsequent anomaly detection.
[0098] The residual feature map corresponding to each frame of non-intrusive track monitoring image is used to combine the residual feature values in all the image residual feature maps to obtain the residual feature vector. These residual feature vectors of all non-intrusive track monitoring images are gathered together to form the normal residual sample set.
[0099] The calculation of the mean vector and covariance matrix of all residual eigenvectors in the normal residual sample set specifically includes: summing the residual eigenvectors of all samples and dividing by the total number of samples to obtain the mean vector; then calculating the difference between each sample vector and the mean vector; and calculating the covariance matrix based on these difference matrices.
[0100] In a specific embodiment, the process of constructing a normal residual distribution model includes:
[0101] Using the mean vector as the center position of the normal residual distribution model and the covariance matrix as the covariance structure of the normal residual distribution model, the outlier measure of the residual eigenvectors under the normal residual distribution model is calculated. The calculation expression is as follows:
[0102] ;
[0103] in, These are abnormal metrics. For residual eigenvectors, It is the mean vector. It is the inverse of the covariance matrix. The square of the Mahalanobis distance. These are the normalization coefficients;
[0104] The expression for calculating the normalization coefficient is:
[0105] ;
[0106] in, Let covariance matrix be the variance matrix. For feature dimensions.
[0107] Specifically, the square of the Mahalanobis distance is the weighted squared distance of the current residual feature from the center of the normal distribution, taking into account the variance differences and correlations of each dimension.
[0108] The feature dimension is the number of feature channels. Each residual feature vector is obtained by combining the residual eigenvalues of all feature channels at a certain spatial location in the image residual feature map along the channel dimension. Therefore, the dimension of the residual feature vector is equal to the number of feature channels, i.e., the number of channels output by the feature extraction network. Due to the limitation of the number of samples and the existence of collinearity between features, the covariance matrix actually calculated may have singularity or ill-conditioned phenomena, resulting in the inverse matrix being unable to be solved directly and being numerically unstable. Therefore, Tikhonov regularization is used to uniformly add a very small positive constant to the main diagonal elements of the covariance matrix, and the inverse matrix is obtained from the matrix after the addition.
[0109] By constructing a normal residual distribution model, statistical modeling of non-intrusion scenarios is achieved in the residual subspace after the whitelist channel is suppressed. This enables subsequent anomaly measurement to be based on the degree of deviation from the normal residual pattern rather than the original feature difference, thereby improving the statistical discrimination capability against foreign object intrusion.
[0110] In a specific embodiment, step S3 specifically includes:
[0111] Step S31: Obtain the current frame track monitoring image to be detected, extract the current frame feature map corresponding to the current frame track monitoring image, calculate the product of the feature value of each feature channel in the current frame feature map and the channel suppression coefficient of that feature channel to obtain the current frame residual feature value, obtain the current residual feature vector by combining the current frame residual feature values, input the current residual feature vector into the normal residual distribution model, calculate the anomaly measurement value of the current residual feature vector, and obtain the feature domain residual anomaly heat map;
[0112] Step S32: Based on the spatial correspondence between the current frame feature map and the track monitoring image to be detected in the current frame, the feature domain residual abnormal heat map is mapped to the pixel space of the track monitoring image to obtain the spatial residual abnormal heat map in the pixel space of the track monitoring image.
[0113] Specifically, calculating the anomaly metric of the current residual feature vector to obtain the feature domain residual anomaly heatmap involves taking the negative logarithm of the anomaly metric at each spatial location of the current frame feature map to obtain a positive anomaly score, and arranging and combining the anomaly scores at each spatial location according to their corresponding original spatial locations to obtain the feature domain residual anomaly heatmap.
[0114] The pixel space of a track monitoring image refers to a two-dimensional pixel grid with the row and column numbers of the track monitoring image itself as coordinates. For example, a monitoring image can be seen as composed of several rows and columns of pixels, and each pixel has a unique row index and column index in this space.
[0115] When using the YOLO model's feature extraction network to perform forward computation on track monitoring images, operations such as convolution, stride, and downsampling are used to compress the original image into a smaller feature map. Each position on the feature map actually corresponds to a larger pixel block in the original track monitoring image. This relationship between the feature map grid position and a pixel region in the original image is the spatial correspondence between the current frame's feature map and the current frame's track monitoring image. Based on this spatial correspondence, the residual abnormal heatmap of the feature domain is treated as a low-resolution grayscale image. Bilinear interpolation scaling is then used to directly scale the grayscale image to the same height and width as the current frame's track monitoring image. Each scaled position corresponds one-to-one with a pixel in the original track monitoring image, completing the mapping from the feature map space to the track monitoring image pixel space.
[0116] It should be noted that, on non-intrusive track monitoring images, gradient attribution is first used to automatically calculate the channel contribution and importance value of each feature channel to the determination of track vehicles or track equipment, forming a whitelist of channels. Then, channel suppression coefficients are used to uniformly suppress only these whitelisted channels, concentrating the dominant features of trains and equipment into the weakened subspace, retaining the residual subspace formed by the remaining channels, and constructing a normal residual distribution model only on the residual subspace to calculate the anomaly metric of the current frame's residual feature vector. Compared with existing methods that directly perform binary classification in the pixel domain or original feature map, or simply filter by detection category and track ROI, this scheme does not require explicit enumeration of all train or equipment categories, nor does it rely on manually written whitelists. Instead, it automatically learns the train or equipment feature subspace from within the network and uniformly weakens this subspace during the detection stage, so that track vehicles and track equipment almost no longer generate high anomaly responses in the residual space. At the same time, the features of various foreign objects, especially small-volume, low-contrast foreign objects, are more retained in the unsuppressed channels, naturally exhibiting high anomaly under the residual distribution model. Without altering the existing target detection model structure, it significantly reduces the probability of trains and track equipment being misidentified as intruders. It also has adaptive capabilities for new equipment forms or changes in vehicle body paint that are not explicitly defined in the whitelist. At the same time, it maintains or even improves the ability to detect small and low-contrast foreign objects in dangerous track areas. This mechanism of distinguishing legitimate large occupants from abnormal intruders at the feature channel level is something that traditional category-label-based and fixed ROI-based filtering methods do not possess.
[0117] In a specific embodiment, step S4 specifically includes:
[0118] Step S41: In the pixel space of the track monitoring image, obtain the track mask according to the geometric structure information and scene configuration of the track scene. The track mask includes the track danger area mask, the track equipment allowed area mask, and the track vehicle allowed area mask.
[0119] Specifically, obtaining the track mask based on the geometric structure information and scene configuration of the track scene includes: using the track centerline and gauge from the geometric structure information, drawing the centerline on the track monitoring image according to the direction of the track centerline; translating along the normal direction on both sides of the centerline by half the gauge to obtain the projection lines of the left and right rails; using the area between the two rails as the basic danger zone; and appropriately extending outwards on both sides along the gauge direction according to the rail surface height and safety clearance requirements to delineate a long, rectangular polygonal area extending along the track direction on the image; using polygon filling, setting the internal pixels of the polygon to 1 and the external pixels to 0 to obtain the track danger zone mask; and using the track equipment fixed installation recorded in the scene configuration... For location, mark the fixed points of each device on the track monitoring image. Based on the actual shape or design outline of the device, draw a polygonal occupancy outline around each fixed point. Merge all device occupancy outline areas, fill the polygon with internal pixels set to 1 and the rest to 0, to obtain the track equipment allowed occupancy area mask. Based on the track vehicle allowed occupancy area boundary given in the scene configuration, draw a boundary polygon on the image representing the range where the train body is allowed to appear. This polygon can cover the entire projection area from the wheels to the outer outline of the vehicle body. Similarly, use the polygon filling method to set its internal pixels to 1 and its external pixels to 0 to form the track vehicle allowed occupancy area mask. All three masks are defined in the pixel space of the track monitoring image.
[0120] Set the pixel positions corresponding to the track equipment occupancy area mask and the track vehicle occupancy area mask to the first potential value, set the pixel positions corresponding to the track danger area mask to the second potential value, and set the pixel positions not belonging to the track mask to the third potential value to construct a potential field map;
[0121] Among them, the third potential value is greater than the first potential value, and the first potential value is greater than the second potential value;
[0122] Step S42: Set the abnormal measurement values of the pixel positions that do not belong to the track hazard area mask in the spatial residual abnormal heat map to zero, and retain the abnormal measurement values of the pixel positions that are within the track hazard area mask to form the initial activation map.
[0123] Step S43: Starting with the initial activation map, perform random diffusion iteration on the initial activation map under the constraint of the potential field map. In each round of random diffusion iteration, take the iteration activation map of the previous round as input to generate the corresponding iteration activation map of the next round. In each round of iteration, record the changes in activation values at each pixel position of the iteration activation map at the beginning of the round and the iteration activation map at the end of the round to obtain the activation energy map.
[0124] Specifically, the third potential value is greater than 10 times the first potential value, and the first potential value is greater than the second potential value. To form an absolute energy barrier in the potential field diagram and effectively eliminate extra-orbital interference and false alarms from legitimate targets, a 10-fold difference is set between the third and first potential values. For example, the second potential value, representing a dangerous area on the orbit, can be set to 0, the first potential value, representing a legally occupied area, can be set to 1, and the third potential value, representing areas not belonging to the orbital mask, can be set to 10, thereby suppressing abnormal responses in high-potential areas.
[0125] In the pixel space of track monitoring images, a track mask is obtained based on the geometric structure information and scene configuration of the track scene. Based on this, a potential field map is constructed according to three types of potential values. The spatial residual abnormal heat map is cropped into an initial activation map within the track hazard area mask. Under the constraint of the potential field map, a random diffusion iterative operation is performed on the initial activation map to obtain an activation energy map. This realizes the unified transformation of the three types of engineering priors—track hazard area, equipment or vehicle permitted occupation area, and outside track area—into a continuous potential field. This naturally suppresses the abnormal response in high potential value areas and gives greater evolutionary freedom to the residual abnormal response in the track hazard area.
[0126] In a specific embodiment, the random diffusion iteration operation specifically includes:
[0127] For the iterative activation map of the previous iteration, a preset random perturbation value is added to each pixel position to obtain a perturbation activation map. By the amplitude of the preset random perturbation value, the potential value of the first pixel position is greater than the potential value of the second pixel position, and the amplitude of the preset random perturbation value corresponding to the first pixel position is less than the amplitude of the preset random perturbation value corresponding to the second pixel position.
[0128] Based on the potential value of each pixel position in the potential field map, the suppression value of the corresponding pixel position is determined, and the activation value of each pixel position in the perturbation activation map is suppressed by the suppression value, so that the potential value of the first pixel position is greater than the potential value of the second pixel position, and the reduction of the activation value of the first pixel position is not less than the reduction of the activation value of the second pixel position, thus obtaining the suppressed activation map.
[0129] The enhancement value for each pixel position is determined based on the initial activation value of the initial activation map at each pixel position. The activation value of each pixel position in the suppressed activation map is then enhanced by the enhancement value, so that the initial activation value of the first pixel position is greater than the initial activation value of the second pixel position, and the increase in the activation value of the first pixel position is not less than the increase in the activation value of the second pixel position, thus obtaining the enhanced activation map.
[0130] The activation values of each pixel in the enhanced activation map are attenuated according to a preset attenuation ratio to obtain the current iteration activation map of this round of iteration, and this current iteration activation map is used as the iteration activation map of the previous round of iteration in the next round of random diffusion iteration operation.
[0131] Wherein, the first pixel position and the second pixel position are arbitrary pixel positions in the pixel space of the track monitoring image.
[0132] Specifically, the preset random disturbance value is Gaussian noise with a mean of zero and an adjustable standard deviation. This Gaussian noise is generated independently in each iteration and superimposed on each pixel position of the activation image. Its standard deviation parameter can be adjusted inversely according to the potential value of the corresponding pixel. Inverse adjustment means that the specific value of the standard deviation is negatively correlated with the potential value. For example, by using an inverse proportional function mapping, the value of the standard deviation decreases monotonically as the corresponding potential value increases, so that the disturbance amplitude in the low potential value region is larger and the disturbance amplitude in the high potential value region is suppressed.
[0133] Determining the suppression value for each pixel position based on the potential value of the potential field map specifically includes:
[0134] The potential value is converted into a suppression coefficient through a first monotonically increasing mapping function. This suppression coefficient is positively correlated with the potential value. During the suppression process, the activation value is multiplied by a compensation coefficient, which is 1 minus the suppression coefficient, to achieve the effect that the higher the potential value, the greater the attenuation of the activation value. The first monotonically increasing mapping function uses the potential value of the pixel position in the potential field map as the only input variable. The design of the first monotonically increasing mapping function ensures that the suppression coefficient increases monotonically with the increase of the input potential value, transforming the potential gradient into a resistance gradient to the diffusion of activation energy. Regions with higher potential values correspond to larger suppression coefficients.
[0135] Determining the enhancement value for the corresponding pixel position based on the initial activation value at each pixel position in the initial activation map specifically includes:
[0136] Determining the enhancement value for each pixel location based on the initial activation value in the initial activation map involves converting the initial activation value into an enhancement amount using a second monotonically increasing mapping function. This enhancement amount is positively correlated with the initial activation value. During the enhancement processing stage, the activation value is directly superimposed with this enhancement amount to ensure that regions with stronger initial anomalous responses receive more sustained energy replenishment. The second monotonically increasing mapping function uses the initial activation value of the pixel location in the initial activation map as the sole input variable. The design of this function ensures that the enhancement amount monotonically increases with the increase of the input initial activation value, establishing a positive feedback reinforcement mechanism for the initial anomalous response. Pixel locations identified as highly anomalous in the initial stage will receive greater energy replenishment in each iteration.
[0137] The preset attenuation ratio is a coefficient used to globally attenuate the activation values of the enhanced activation map in each iteration, preferably 0.95. This setting is to simulate energy dissipation during the diffusion process, preventing activation values from growing or accumulating indefinitely during iterations, ensuring the stability and convergence of the iteration process. It encourages the diffusion process to eventually stabilize or attenuate to a negligible level, avoiding infinite loops. The attenuation ratio, along with potential field constraints, random perturbations, and the enhancement mechanism, allows activation energy to compete and select spatially under conditions that conform to the scenario's prior knowledge. Ultimately, this ensures that the activation energy of the truly intrusive regions is relatively preserved and highlighted, while random perturbations or noise in non-intrusive regions are gradually attenuated and suppressed.
[0138] The first monotonically increasing mapping function converts the potential value into a suppression coefficient, which is positively correlated with the potential value. Using the Sigmoid function (activation function) as the first monotonically increasing mapping function, the potential value is mapped to the (0,1) interval. In the suppression process, the activation value is multiplied by a compensation coefficient, which is 1 minus the suppression coefficient. This ensures that the compensation coefficient is also in the (0,1) interval, which conforms to the physical meaning of energy decay and achieves the effect that the higher the potential value, the greater the degree of activation value decay.
[0139] The initial activation value is converted into an enhancement value through a second monotonically increasing mapping function. This enhancement value is positively correlated with the initial activation value. The sigmoid function is used as the second monotonically increasing mapping function to map the initial activation value into an enhancement value greater than zero. In the enhancement processing stage, the activation value is directly superimposed with the enhancement value so that the region with the stronger initial abnormal response can obtain a more sustained energy replenishment effect.
[0140] It should be noted that the random diffusion iteration process set in this invention is a key step in performing secondary dynamic screening of residual abnormal information based on the initial activation map and potential field map. Its role is to use multi-round, potential field-constrained activation dynamics evolution to distinguish between real and stable intrusion activation in the dangerous area of the track and pseudo activation generated by one-time noise or legitimate occupation by track vehicles, track equipment, etc.
[0141] The initial activation map obtained from the residual abnormal heatmap within the track hazard area mask is used as the initial state of the iterative activation map. In each iteration, the previous iteration activation map is used as input. By adding a random perturbation with the same preset random distribution but modulated by the potential field map to each pixel position in the track monitoring image pixel space, a perturbed activation map is obtained. This makes activation fluctuations more likely to occur in the track hazard area with lower potential values, while activation fluctuations in the track vehicle and track equipment occupancy areas with higher potential values are suppressed. A potential field suppression operation is performed on the perturbed activation map based on the potential field map. According to the potential value and its spatial variation at each pixel position, the activation value of the perturbed activation map is targeted and suppressed, so that the activation value in the high potential area is rapidly decayed in each round, while the activation value in the low potential hazard area decays more slowly. This spatially restricts the activation evolution to the physically permissible intrusion area. An external force enhancement operation is performed using the initial activation map, with the initial activation value as an external force source to enhance the potential field suppression. The corresponding pixel positions in the active image are enhanced differently according to the initial activation value. This ensures that pixels with higher initial activation values are continuously driven in each iteration, and their activation values are constantly re-energized in multiple rounds of evolution. Meanwhile, pixels with lower or near-zero initial activation values are difficult to amplify even when subjected to random perturbations. Damping attenuation is uniformly applied to the enhanced activation image to keep the overall activation level within a controllable range and prevent local anomalies in a single iteration from being amplified indefinitely. After the above perturbation, suppression, enhancement, and damping complete update, the current iteration activation image is formed and used as the input state for the next iteration. This process is repeated multiple times. In each iteration, for each pixel position, the absolute value of the difference between the activation value at that position and the activation value at the end of the iteration is taken as the activation change for that round. This is accumulated over all iterations to obtain the cumulative activation change for that pixel position, ultimately forming an activation energy map across the entire image.
[0142] In this way, the random diffusion iteration process does not rely solely on the activation value of a single frame. Instead, it comprehensively considers the cumulative change behavior of each pixel's activation value during multiple rounds of evolution under given potential field constraints and external force driving. This results in significant cumulative changes in the activation energy map for pixel positions located in the orbital danger zone with unusually significant initial residuals that can be continuously reactivated by external forces after multiple rounds of perturbation and suppression. Meanwhile, the activation of one-time noise points or those in high-potential legally occupied areas is rapidly suppressed in multiple rounds of iteration and is unlikely to form high cumulative changes. This provides a stable activation metric basis that has undergone time evolution and potential field screening for subsequent threshold segmentation and intrusion target region extraction based on the activation energy map.
[0143] In a specific embodiment, the process of obtaining the activation energy map includes:
[0144] During each round of random diffusion iteration, the activation value of the pixel position in the previous iteration's activation map at the start of the current iteration is calculated as the difference between the activation value of the corresponding pixel position in the current iteration's activation map at the end of the current iteration. The absolute value of the activation value difference is taken as the activation change value of the pixel position in the current iteration.
[0145] In all rounds of random diffusion iteration, the activation change value corresponding to each pixel position is accumulated to obtain the cumulative activation change, and the cumulative activation changes of all pixel positions are combined to form an activation energy map.
[0146] In a specific embodiment, step S4 further includes:
[0147] Step S44: In the activation energy map, the pixel positions where the activation change is greater than the activation energy threshold are marked as intrusion candidate pixels to obtain the intrusion target mask.
[0148] Step S45: Perform connected component analysis on the intrusion target mask to obtain adjacent intrusion candidate pixels, and use the adjacent intrusion candidate pixels as the intrusion target region to obtain the intrusion target region set;
[0149] Specifically, the activation energy threshold is used to filter out significantly abnormal pixel locations from the activation energy map and mark them as intrusion candidate pixels. Preferably, it is the mean activation energy of normal samples plus a certain multiple of the standard deviation. For example, based on the Laida criterion, this multiple is specifically set to 3 times, providing a binary decision mechanism that converts the continuous activation energy map into a discrete intrusion target mask, facilitating subsequent connected component analysis and region extraction.
[0150] Performing connected component analysis on the intrusion target mask specifically includes:
[0151] A two-dimensional pixel grid with row and column indices as coordinates is established in the pixel space of the track monitoring image. Each pixel position in the intrusion target mask is traversed in sequence according to the preset scanning order. For the current pixel marked as an intrusion candidate pixel, all pixel positions of the current pixel in the preset pixel neighborhood are determined. The preset pixel neighborhood is the set of pixels whose row index and column index differ from the current pixel by one pixel unit in the row direction.
[0152] In the pixel neighborhood, other pixels that are also marked as intrusion candidate pixels are searched. When any other intrusion candidate pixel is located in the pixel neighborhood of the current pixel, the current pixel and the other intrusion candidate pixel are determined as a pair of adjacent intrusion candidate pixels. All intrusion candidate pixels that can be connected to each other through the relationship of adjacent intrusion candidate pixels are merged into the same connected pixel set, and a unified region label is assigned to the connected pixel set. After completing the traversal of all pixel positions and completing the region labeling of all intrusion candidate pixels, all intrusion candidate pixels with the same region label constitute an intrusion target region, and all intrusion target regions corresponding to different region labels constitute an intrusion target region set.
[0153] Step S46: Select the intersection of the pixel set corresponding to the track hazard area mask from the intrusion target area set as the overlapping intrusion target area, and use the overlapping intrusion target area as the track intrusion detection output result of the track monitoring image of the current frame.
[0154] Specifically, by setting an activation change threshold for the activation energy map, pixels with activation changes greater than the threshold are marked as intrusion candidate pixels, thus obtaining an intrusion target mask. Then, connected component analysis is performed on the intrusion target mask to aggregate adjacent intrusion candidate pixels into an intrusion target region set. From the intrusion target region set, overlapping intrusion target regions that intersect with the pixel set corresponding to the track hazard area mask are selected as the detection output. This realizes the transformation from energy-significant pixels to connected structured target regions. Through pixel-level intersection constraints with the track hazard area mask, it is ensured that the final alarm only points to the target that actually intrudes into the track hazard area, filtering out high-energy noise areas outside the hazard area, thereby improving the accuracy of track intrusion detection results in spatial positioning and their effectiveness in terms of safety.
[0155] Example 2, refer to Figure 2 This is another embodiment of the present invention, which differs from the first embodiment in that it provides a computer vision-based track intrusion detection method, including a feature recognition module, a construction module, an anomaly measurement module, and an analysis module;
[0156] The feature recognition module is used to extract features and detect targets in non-intrusive track monitoring images, generate image feature maps and target category scores, calculate the channel importance value of each feature channel based on the target category score, and obtain a whitelist channel set based on the channel importance value.
[0157] The construction module is used to set the channel suppression coefficient according to the whitelist channel set, perform suppression operation on the image feature map through the channel suppression coefficient to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map;
[0158] The anomaly measurement module is used to acquire the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map.
[0159] The analysis module is used to construct a potential field map through the orbital mask. Under the constraint of the potential field map, it performs random diffusion iterative calculation on the initial activation map generated based on the spatial residual abnormal heat map. It obtains the activation energy map based on the change of activation value during the iteration process and outputs the orbital intrusion detection results based on the activation energy map.
[0160] This invention performs gradient attribution on the feature maps of detection boxes for rail vehicles and equipment in non-intrusive track monitoring images, calculates channel contribution, and obtains a sequence of channel importance values. It automatically filters out a whitelist of channels and then performs channel-by-channel suppression on the image feature map and the current frame feature map using channel suppression coefficients, resulting in an image residual feature map and a current residual feature vector. Anomaly metrics are calculated only within the residual subspace using a multivariate Gaussian normal residual distribution model, generating a spatial residual anomaly heatmap. Unlike existing methods that rely solely on detection categories or manually defined whitelist regions, this invention concentrates the representation of rail vehicles and equipment in the suppressed whitelisted channels, while leaving more intruder representations in the unsuppressed channels. This naturally amplifies the statistical difference between legitimate occupants and foreign objects in the residual space, enabling periodic reassessment of channel importance as the scene changes, adapting to equipment changes and vehicle paint variations, thereby steadily reducing the probability of trains and track equipment being misjudged as intrusion targets. Furthermore, by utilizing the potential field diagram and the iterative process of random diffusion, the track geometry and equipment are allowed to occupy high potential regions, which naturally suppresses the false activation of trains and equipment. At the same time, energy amplification is performed on low-contrast small foreign objects in dangerous areas of the track to achieve enhanced detection.
[0161] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0162] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the protection scope of the present invention.
Claims
1. A computer vision-based method for detecting track intrusion, characterized in that, Includes the following steps: Step S1: Perform feature extraction and target detection on the non-intrusive track monitoring image to generate image feature map and target category score. Calculate the channel importance value of each feature channel based on the target category score. Filter the channel importance value to obtain a whitelist channel set. All feature channels are sorted from largest to smallest according to their channel importance value. Feature channels with a channel importance value greater than a preset importance threshold are selected from the sorting results and formed into a whitelist channel set. Step S2: Set the channel suppression coefficient according to the whitelist channel set, perform suppression operation on the image feature map through the channel suppression coefficient to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map; Step S2 specifically includes: Step S21: Set the channel suppression coefficient for each feature channel; Among them, the channel suppression coefficient of feature channels that do not belong to the whitelist channel set is set to 1; Set the channel suppression coefficient of the feature channels belonging to the whitelist channel set to a constant greater than 0 and less than 1; Step S22: Calculate the product of the feature value of each feature channel in the feature map of each frame image and the channel suppression coefficient of that feature channel to obtain the residual feature value. Combine the residual feature values to obtain the image residual feature map. Step S23: Combine the residual feature values in all image residual feature maps to obtain the residual feature vector, and obtain the normal residual sample set; Step S24: Calculate the mean vector and covariance matrix of all residual eigenvectors in the normal residual sample set, and construct a normal residual distribution model using the mean vector and covariance matrix; Step S3: Obtain the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map. Step S3 specifically includes: Step S31: Obtain the current frame track monitoring image to be detected, extract the current frame feature map corresponding to the current frame track monitoring image, calculate the product of the feature value of each feature channel in the current frame feature map and the channel suppression coefficient of that feature channel to obtain the current frame residual feature value, obtain the current residual feature vector by combining the current frame residual feature values, input the current residual feature vector into the normal residual distribution model, calculate the anomaly measurement value of the current residual feature vector, and obtain the feature domain residual anomaly heat map; Step S32: Based on the spatial correspondence between the current frame feature map and the track monitoring image to be detected in the current frame, the feature domain residual abnormal heat map is mapped to the pixel space of the track monitoring image to obtain the spatial residual abnormal heat map in the pixel space of the track monitoring image. Step S4: Construct a potential field map using the orbital mask, retain the abnormal metric values of the corresponding pixel positions within the orbital danger zone mask to form an initial activation map, perform random diffusion iteration on the initial activation map generated based on the spatial residual abnormal heat map under the constraint of the potential field map, obtain the activation energy map based on the changes in activation values during the iteration process, and output the orbital intrusion detection result based on the activation energy map. Starting with the initial activation map as the initial state, random diffusion iteration is performed on the initial activation map under the constraint of the potential field map. In each round of random diffusion iteration, the iterative activation map of the previous round is used as input to generate the corresponding iterative activation map of the next round. In each round of iteration, the activation value changes of the iterative activation map at the beginning of the round and the iterative activation map at the end of the round are recorded to obtain the activation energy map. The random diffusion iterative operation specifically includes: For the iterative activation map of the previous iteration, a preset random perturbation value is added to each pixel position to obtain a perturbation activation map. By the amplitude of the preset random perturbation value, the potential value of the first pixel position is greater than the potential value of the second pixel position, and the amplitude of the preset random perturbation value corresponding to the first pixel position is less than the amplitude of the preset random perturbation value corresponding to the second pixel position. Based on the potential value of each pixel position in the potential field map, the suppression value of the corresponding pixel position is determined, and the activation value of each pixel position in the perturbation activation map is suppressed by the suppression value, so that the potential value of the first pixel position is greater than the potential value of the second pixel position, and the reduction of the activation value of the first pixel position is not less than the reduction of the activation value of the second pixel position, thus obtaining the suppressed activation map. The enhancement value for each pixel position is determined based on the initial activation value of the initial activation map at each pixel position. The activation value of each pixel position in the suppressed activation map is then enhanced using the enhancement value, so that the initial activation value of the first pixel position is greater than the initial activation value of the second pixel position, and the increase in the activation value of the first pixel position is not less than the increase in the activation value of the second pixel position, thus obtaining the enhanced activation map. The activation values of each pixel in the enhanced activation map are attenuated according to a preset attenuation ratio to obtain the current iteration activation map of this round of iteration, and this current iteration activation map is used as the iteration activation map of the previous round of iteration in the next round of random diffusion iteration operation. Wherein, the first pixel position and the second pixel position are arbitrary pixel positions in the pixel space of the track monitoring image.
2. The computer vision-based track intrusion detection method as described in claim 1, characterized in that, Step S1 specifically includes: Step S11: Obtain non-intrusive track monitoring images, geometric structure information of track scenes and scene configuration, perform target detection on each frame of non-intrusive track monitoring images, and obtain the set of detection boxes for each frame of non-intrusive track monitoring images; The geometric information of the track scene includes the track centerline, track surface height, and track gauge; The scenario configuration includes the fixed installation location of the track equipment and the boundary of the area that the track vehicle is allowed to occupy. The detection frame set includes rail vehicles and rail equipment; Step S12: Extract the feature map corresponding to each frame of non-intrusive track monitoring image to obtain the image feature map. Take the region corresponding to the detection box of each frame of non-intrusive track monitoring image in the image feature map as the detection box feature map. The image feature map includes feature channels and spatial locations; Step S13: Select the target category score of rail vehicle or rail equipment from the detection box set, and calculate the channel contribution based on the target category score. The calculation expression is as follows: ; in, Let k be the channel contribution of the k-th detection box in the c-th feature channel, where k is the detection box index and c is the feature channel index. To detect the spatial location covered by the detection frame, Let be the feature value of the c-th feature channel at spatial location (u,v). Score the target category. The partial derivative of the target category score with respect to the feature value; Step S14: Calculate the average value of the channel contribution of all detection boxes in the feature channels to obtain the channel importance value, and form an importance value sequence from the channel importance values of all feature channels; Step S15: Sort all feature channels in descending order of channel importance value according to the importance value sequence, select feature channels with channel importance values greater than the preset importance threshold from the sorting results, and form a whitelist channel set.
3. The computer vision-based track intrusion detection method as described in claim 2, characterized in that, The process of constructing a normal residual distribution model specifically includes: Using the mean vector as the center position of the normal residual distribution model and the covariance matrix as the covariance structure of the normal residual distribution model, the outlier measure of the residual eigenvectors under the normal residual distribution model is calculated. The calculation expression is as follows: ; in, These are abnormal metrics. For residual eigenvectors, It is the mean vector. It is the inverse of the covariance matrix. The square of the Mahalanobis distance. These are the normalization coefficients; The expression for calculating the normalization coefficient is: ; in, Let covariance matrix be the variance matrix. For feature dimensions.
4. The computer vision-based track intrusion detection method as described in claim 3, characterized in that, Step S4 specifically includes: Step S41: In the pixel space of the track monitoring image, obtain the track mask according to the geometric structure information and scene configuration of the track scene. The track mask includes the track danger area mask, the track equipment allowed area mask, and the track vehicle allowed area mask. Set the pixel positions corresponding to the track equipment occupancy area mask and the track vehicle occupancy area mask to the first potential value, set the pixel positions corresponding to the track danger area mask to the second potential value, and set the pixel positions not belonging to the track mask to the third potential value to construct a potential field map; Among them, the third potential value is greater than the first potential value, and the first potential value is greater than the second potential value; Step S42: Set the abnormal metric values of the corresponding pixel positions in the spatial residual abnormal heat map that do not belong to the track hazard area mask to zero, and retain the abnormal metric values of the corresponding pixel positions within the track hazard area mask to form the initial activation map.
5. The computer vision-based track intrusion detection method as described in claim 4, characterized in that, The process of obtaining the activation energy map specifically includes: During each round of random diffusion iteration, the activation value of the pixel position in the previous iteration's activation map at the start of the current iteration is calculated as the difference between the activation value of the corresponding pixel position in the current iteration's activation map at the end of the current iteration. The absolute value of the activation value difference is taken as the activation change value of the pixel position in the current iteration. In all rounds of random diffusion iteration, the activation change value corresponding to each pixel position is accumulated to obtain the cumulative activation change, and the cumulative activation changes of all pixel positions are combined to form an activation energy map.
6. The computer vision-based track intrusion detection method as described in claim 5, characterized in that, Step S4 also includes: Step S44: In the activation energy map, the pixel positions where the activation change is greater than the activation energy threshold are marked as intrusion candidate pixels to obtain the intrusion target mask. Step S45: Perform connected component analysis on the intrusion target mask to obtain adjacent intrusion candidate pixels, and use the adjacent intrusion candidate pixels as the intrusion target region to obtain the intrusion target region set; Step S46: Select the intersection of the pixel set corresponding to the track hazard area mask from the intrusion target area set as the overlapping intrusion target area, and use the overlapping intrusion target area as the track intrusion detection output result of the track monitoring image of the current frame.
7. A computer vision-based track intrusion detection system, applied in any one of the computer vision-based track intrusion detection methods as described in claims 1-6, characterized in that, It includes a feature recognition module, a construction module, an anomaly measurement module, and an analysis module; The feature recognition module is used to extract features and detect targets in non-intrusive track monitoring images, generate image feature maps and target category scores, calculate the channel importance value of each feature channel based on the target category score, and obtain a whitelist channel set based on the channel importance value. The construction module is used to set channel suppression coefficients according to the whitelist channel set, perform suppression operations on the image feature map through the channel suppression coefficients to obtain the image residual feature map, and construct a normal residual distribution model based on the image residual feature map; The anomaly measurement module is used to acquire the current frame track monitoring image to be detected, extract the current frame feature map and calculate the current residual feature vector by combining the channel suppression coefficient, input the current residual feature vector into the normal residual distribution model to obtain the anomaly measurement value, and map it to obtain the spatial residual anomaly heat map. The analysis module is used to construct a potential field map through an orbital mask, perform random diffusion iterative calculations on the initial activation map generated based on the spatial residual abnormal heat map under the constraints of the potential field map, obtain the activation energy map based on the changes in activation values during the iteration process, and output the orbital intrusion detection results based on the activation energy map.