Balanced color perception enhancement method for rail transit target detection

By employing HSV spatial image enhancement and a three-stage hybrid NMS strategy in target detection in rail transit, the problems of illumination changes and target occlusion in rail transit scenarios are solved, improving the accuracy and recall rate of the detection system. This approach is suitable for rail transit safety monitoring and intelligent maintenance.

CN121392243APending Publication Date: 2026-01-23TIANJIN JINHANG INTELLIGENT CONTROL TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511491041.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-01-23

Smart Images

  • Figure CN121392243A_ABST
    Figure CN121392243A_ABST
Patent Text Reader

Abstract

The invention relates to a balanced color perception enhancement method for rail transit target detection, and belongs to the technical field of rail transit and computer vision. According to the method, brightness channel adaptive histogram equalization enhancement CLAHE-LC, a multi-segment tone channel mask mechanism MSHCM-M and a three-stage hybrid mechanism non-maximum suppression TSLSH-NMS technology are combined, so that the problems of complex illumination, multi-target shielding, color interference and the like in a rail transit scene are solved, and the accuracy and recall rate of target detection are improved. The method can be seamlessly integrated into an existing deep learning target detection framework, is compatible with multi-label, multi-category and multi-scale features, and remarkably improves the precision and recall rate of target detection in a rail transit scene. Experimental verification shows that the real-time performance is guaranteed, meanwhile, the detection performance is obviously improved compared with a traditional scheme, and the method is suitable for being applied to an actual rail transit safety monitoring and intelligent maintenance system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of rail transit and computer vision, and particularly relates to a balanced color perception enhancement method for rail transit target detection. BACKGROUND

[0002] With the rapid development of urban rail transit systems, visual-based intelligent detection technology plays an increasingly important role in train operation monitoring, passenger behavior analysis, and platform safety management, among other key applications. As a core task of visual perception, target detection aims to identify and accurately locate multiple targets to be identified from complex images, and is an important foundation for realizing the intelligentization of rail transit. However, due to the characteristics of rail transit scenes, such as varying light, frequent occlusion, dense target distribution, and similar appearance features, traditional deep learning target detection models face significant challenges in actual deployment.

[0003] In recent years, end-to-end one-stage target detection models represented by the YOLO (You Only Look Once) series have been widely applied in industrial and transportation fields due to their fast detection speed and compact structure. Although they perform well in general scenarios, they still have the following problems in rail transit environments:

[0004] On the one hand, there are strong light changes in spaces such as platforms, tunnels, and car interiors, such as strong backlight, low illumination, flickering lights, or reflective areas, which cause target edges to be blurred or have insufficient contrast, affecting feature extraction and accurate identification;

[0005] On the other hand, there is a high visual similarity and spatial overlap between multiple key targets in rail transit, such as people, doors, warning signs, and rail equipment. The traditional Non-Maximum Suppression (NMS) strategy based on fixed thresholds is prone to mis-suppressing effective candidate boxes when dealing with such overlapping targets, leading to missed or false detections in the detection results.

[0006] In addition, existing image enhancement methods mostly focus on improving overall contrast or brightness, lacking a directional enhancement mechanism for specific target features, especially being difficult to adapt to the actual problems of concentrated color information distribution and complex structure texture in rail transit scenes. At the same time, mainstream hard NMS algorithms use a fixed IoU (Intersection over Union) threshold to non-elastically suppress detection boxes in the candidate box screening stage, which cannot dynamically adjust the suppression strategy according to the scene complexity, target density, or visual context, thus showing a significant performance decline in areas with severe target occlusion or high density.

[0007] In summary, the current deployment of target detection systems in rail transit scenarios still faces many challenges. The existing technology is difficult to simultaneously consider key links such as image perceptual enhancement, color target orientation improvement, and multi-target detection post-processing flexible control, resulting in difficulty in meeting the actual needs of the rail transit field in terms of precision, recall rate and stability of the detection system.

[0008] Therefore, the present application provides a target detection method for the whole process of image enhancement to detection post-processing collaborative optimization to improve the adaptability and detection performance of the model in the complex environment of rail transit. SUMMARY

[0009] (I) Technical problems to be solved

[0010] The technical problem to be solved by the present application is to provide a balanced color perception enhancement method for rail transit target detection to solve the problem that the existing technology is difficult to simultaneously consider key links such as image perceptual enhancement, color target orientation improvement, and multi-target detection post-processing flexible control, resulting in difficulty in meeting the actual needs of the rail transit field in terms of precision, recall rate and stability of the detection system.

[0011] (II) Technical solutions

[0012] In order to solve the above technical problems, the present application provides a balanced color perception enhancement method for rail transit target detection, which comprises the following steps:

[0013] First part, HSV space image enhancement mechanism

[0014] First, the original image is color space converted, and the input RGB image is converted to HSV color space; in this space, the V channel reflects the brightness of each pixel in the image, and a CLAHE enhancement strategy is introduced to the V channel for local adaptive enhancement;

[0015] Second part, Hue channel mask guide mechanism

[0016] Based on the image enhanced by the above V channel, a multi-section Hue channel mask guide mechanism is introduced to filter out the color area of interest in a hue-oriented manner, suppress background noise and highlight target features; this mechanism divides the H channel into continuous intervals in the HSV space, extracts the pixel area corresponding to the specific color section, and constructs a semantic mask to guide the subsequent target detection model to focus on the color salient region;

[0017] The mask is applied to the enhanced image to obtain the input of the target detection model, and the target detection model performs target detection to generate a candidate box, each candidate box including class probability, box coordinates and confidence;

[0018] Third part, three-stage mixed non-maximum suppression mechanism

[0019] The first stage is a confidence preliminary screening stage, which quickly excludes redundant frames and retains meaningful target candidates;

[0020] The second stage adopts a soft NMS strategy to perform confidence attenuation processing based on the IoU weight for the remaining candidate frames, and dynamically adjusts the confidence of the frame;

[0021] The third stage introduces a high IoU hard NMS combined with a depth difference weight to further remove redundant frames and retain accurate targets, and then performs geometric redundancy processing to obtain the final detection frame.

[0022] (Three) beneficial effects

[0023] The application provides an equalization color perception enhancement method for rail transit target detection, which combines a contrast limited adaptive histogram equalization for luminance channel (CLAHE-LC), a multi-segment hue channel masking mechanism (MSHCM-M) and a three-stage linear-soft-hard hybrid non-maximum suppression (TSLSH-NMS) technology, so as to solve the problems of complex illumination, multi-target occlusion and color interference in the rail transit scene, and improve the accuracy and recall rate of target detection. Specifically, first, the input image is converted to a hue-saturation-value (HSV) color space, the CLAHE algorithm is applied to the value (V) channel, the local contrast of the image is adaptively enhanced, and the saliency of the target in the low illumination and complex background is effectively improved. At the same time, according to the typical color distribution of the rail transit target, a multi-segment hue (H) channel mask is designed, the hue space is divided into several intervals, and different color segments are respectively processed, so that the feature expression ability of the key color area is enhanced, and the discrimination of the detection model for the target is improved. In the screening stage of the candidate detection frame, an innovative three-stage mixed mechanism NMS strategy is adopted: in the first stage, the confidence candidate preliminary screening stage, in the second stage, the soft-NMS strategy is adopted, and the problem of false suppression caused by multi-target occlusion and frame overlap is effectively solved; in the third stage, the high IoU hard NMS is adopted to ensure the accuracy of the candidate frame.

[0024] The method of this invention can be seamlessly integrated into existing deep learning object detection frameworks (such as You Only LookOnce, YOLO series), and is compatible with multi-label, multi-class, and multi-scale features, significantly improving the accuracy and recall rate of object detection in rail transit scenarios. Experimental verification shows that this method, while ensuring real-time performance, significantly improves detection performance compared to traditional solutions, making it suitable for practical rail transit safety monitoring and intelligent maintenance systems. Attached Figure Description

[0025] Figure 1 This is a flowchart illustrating the overall structure of the present invention, showing the integrated architecture of HSV spatial image enhancement, Hue masking mechanism and three-stage hybrid nonmaximum suppression in the target detection process;

[0026] Figure 2 This is a flowchart of the three-stage hybrid nonmaximum suppression strategy proposed in this invention;

[0027] Figure 3 The results show the detection performance of the traditional model in low-light environments of rail transit and the improved performance after introducing the image enhancement module of this invention.

[0028] Figure 4 It is a visualization of how Hue masks enhance the saliency of specific semantic targets, demonstrating the filtering effect of color channel masks on targets;

[0029] Figure 5 This is a comparison chart of the effects of each stage of the three-stage NMS, showing the comparison of candidate box retention after using only traditional NMS and the three-stage hybrid NMS of the present invention.

[0030] Figure 6 These are images showing the target detection results of the algorithm under different lighting and weather conditions;

[0031] Figure 7 It is the algorithm training iteration curve;

[0032] Figure 8 It is the confusion matrix of the detection results;

[0033] Figure 9 This is a comparison chart of PR curves for various categories of target detection in rail transit scenarios. Detailed Implementation

[0034] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0035] This invention relates to the fields of rail transit and computer vision technology, specifically to an improved method for target detection models. In particular, it relates to an optimization strategy for target detection based on color space enhancement and multi-stage nonmaximum suppression, which is used to improve the detection accuracy and recall rate under complex lighting, multi-target occlusion, and similar color conditions in rail transit environments. It is applicable to visual recognition tasks in rail transit systems such as intelligent monitoring, safety early warning, and traffic visual perception.

[0036] This invention addresses the challenges of complex lighting, multi-target occlusion, and semantic visual interference in rail transit scenarios. It proposes a balanced color perception enhancement method for target detection in rail transit, which integrates HSV (Hue, Saturation, Value) spatial image enhancement, a Hue channel masking guidance mechanism, and a three-stage hybrid nonmaximum suppression strategy for image target detection. This method can be modularly embedded into mainstream target detection frameworks (such as the YOLO series), significantly improving detection performance without altering the core structure. It is suitable for real-time detection of key targets such as people, vehicles, equipment, signs, and signals in rail transit.

[0037] This invention mainly comprises the following three parts:

[0038] Part 1: HSV Spatial Image Enhancement Mechanism

[0039] This invention first performs a color space conversion on the original image, transforming the input RGB image to the HSV color space. In this space, the V channel directly reflects the brightness of each pixel in the image, making it suitable for local contrast enhancement.

[0040] In natural image processing and object detection tasks, the choice of color space has a certain impact on feature representation capabilities. Compared to the RGB color space, which directly operates on the three primary color channels, the HSV color space provides an image representation method that is more in line with human perception by decoupling color information from luminance information. Therefore, this invention first converts the input image from RGB to HSV space and focuses on performing local adaptive enhancement on the V channel.

[0041] Step S101: RGB to HSV space conversion

[0042] Assume the input image is an RGB image with the following dimensions: W, the pixel range is:

[0043]

[0044] The image channels are transformed into HVS space using a transformation function:

[0045]

[0046] Where H (Hue) represents hue in degrees, ranging from [0, 179], and represents the color type (e.g., red, green, blue), which is normalized to an integer in the conversion function. [0,179]. S (Saturation) represents saturation, ranging from [0,255], and represents the purity of the color. V (Value) represents the brightness or darkness of the color, ranging from [0,255].

[0047] Traditional histogram equalization is effective in improving overall image contrast, but it can easily lead to noise amplification or over-enhancement in scenes with large lighting variations or small target areas. Therefore, Contrast-Limited Adaptive Histogram Equalization (CLAHE) is used to enhance the V channel. The V channel is divided into a fixed number of sub-blocks, and histogram equalization is performed on each sub-block to enhance local contrast. To avoid over-enhancing noise, parameters are introduced to limit the maximum height of the local histogram. Finally, bilinear interpolation is used to smoothly stitch the enhanced sub-blocks into a complete image. The specific steps are as follows:

[0048] Step S102 Channel segmentation

[0049] Will The channel is divided into Sub-block :

[0050]

[0051] in, , ;

[0052] Step S103: Limit the histogram height

[0053] For each sub-block Calculate its grayscale histogram:

[0054]

[0055] Indicates the current sub-block The grayscale value of a single pixel in the image is used. When a grayscale level exceeds a certain limit L, it is truncated, and the excess portion is evenly distributed to other sub-blocks to avoid excessive local contrast enhancement.

[0056] Step S104: Equalization of Cumulative Distribution Function (CDF)

[0057] Normalize the cumulative histogram for each sub-block:

[0058]

[0059] Represents grayscale levels, and is an integer with a range of values. . This represents the total number of pixels in the current sub-block. If the sub-block size is... That is, the width is , Gao Wei ,but:

[0060]

[0061] The enhancement value is obtained using the cumulative histogram corresponding to the current grayscale value:

[0062] .

[0063] Step S105: Interpolation fusion and channel reconstruction

[0064] For all enhanced sub-blocks Bilinear interpolation is used for smooth stitching to obtain the enhanced luminance channel. . No. The coordinates of the top left corner of each sub-block are The center coordinates are:

[0065]

[0066]

[0067] For any pixel Find the centers of its four adjacent sub-blocks and calculate the weight coefficients in the horizontal and vertical directions. and Assuming Located at the center of the four sub-blocks , , , Within the enclosed area.

[0068]

[0069]

[0070] For pixels Enhancement value Perform horizontal and vertical interpolation, with the horizontal interpolation performed at the center of the top two sub-blocks. and Between and the center of the two bottom sub-blocks and between:

[0071]

[0072]

[0073] After horizontal interpolation, perform vertical interpolation at the top and bottom:

[0074]

[0075] Then reconstruct it with the original hue and saturation channels to create a new HSV image:

[0076]

[0077] Finally, it is converted back to RGB space for model input:

[0078]

[0079] in This represents the number of pixels with a grayscale value of k. Let k be the normalized cumulative probability distribution function corresponding to gray level k. These are the pixel values ​​of the sub-blocks after CLAHE enhancement. The enhanced HSV image.

[0080] To address common visual obstacles in rail transit scenarios such as strong backlighting, low illumination, and reflective occlusion, this invention introduces a CLAHE enhancement strategy for the V channel. This method performs restricted histogram equalization within a local window and sets a contrast limiting factor to prevent noise amplification caused by over-enhancement. After CLAHE processing, the structure of targets in dark areas of the image is highlighted, edge sharpness is significantly improved, and the model's ability to perceive targets in low-brightness areas is enhanced, alleviating the problem of decreased target extraction capability of the traditional YOLO model under extreme lighting conditions such as nighttime and tunnels.

[0081] Part Two: Hue Channel Mask Bootstrapping Mechanism

[0082] After completing the local enhancement of the luminance channel, to further utilize color semantics for precise target region localization, a multi-segment Hue masking mechanism is introduced based on the enhanced V channel image. This mechanism filters out the truly interesting color regions in a hue-guided manner, thereby maximizing the suppression of background noise and highlighting target features. Considering that key semantic targets in rail transit images (such as red warning lights, yellow warning signs, green traffic signals, and blue markings) have high separation in the hue dimension, this invention further proposes a segmented masking mechanism based on the Hue channel. This mechanism divides the H channel into continuous intervals in the HSV space, extracts the pixel regions corresponding to specific color segments, and constructs a semantic mask to guide subsequent detection models to focus on color-salient regions.

[0083] Step S201: Specifically, the Hue channel is divided into multiple segments according to the color wheel interval, such as the red segment (H∈[0°,20°]∪[340°,360°]), the yellow segment (H∈[20°,40°]), the green segment (H∈[90°,150°]), and the blue segment (H∈[200°,250°]). For each segment, a multi-dimensional weighted mask image is constructed by combining its joint distribution in the saturation and brightness dimensions, and then channel-level weighted fusion is performed with the original image. This mechanism can improve color synesthesia in salient color areas on the one hand, and suppress interference from areas with the same hue as the background but no semantic association on the other. The steps are as follows:

[0084] Step S2011, Target Tone Distribution Analysis

[0085] Given an enhanced HSV image:

[0086]

[0087] First, we calculate the full image histogram for the tone channels:

[0088]

[0089] By analyzing the hue histogram distribution of typical targets (such as traffic lights, vehicle markings, and warning signs) on the training or validation set, several discrete hue intervals can be determined:

[0090]

[0091] For example, a red traffic light corresponds to approximately the range [0°, 20°] ∪ [340°, 360°] in the Hue of HSV, while a yellow warning sign corresponds to approximately the range [20°, 40°].

[0092] Step S2012: Multi-segment mask generation

[0093] For each tone range Construct a binary mask:

[0094]

[0095] All submasks are combined using a bitwise OR operation to obtain the overall verification mask:

[0096]

[0097] This represents the final overall verification mask for the H channel, which is obtained by performing a bitwise OR operation on all sub-masks. Therefore, the size of the mask matrix should be the same as the size of the original image. This represents the height and width of the image. The size of the mask is the same as the image size, and each pixel in the image has a corresponding mask value.

[0098] Step S2013: Spatial Smoothing and Morphological Post-processing

[0099] To eliminate the impact of noise and isolated small areas, The above applies morphological opening and closing operations. The opening operation (opening) involves erosion followed by dilation to remove small-area noise. The closing operation (closing) involves dilation followed by erosion to fill tiny holes in the mask. Let the structuring element be... (Square kernel), then:

[0100]

[0101] in It indicates corrosion (Erosion). It indicates dilation.

[0102] Step S2014: Joint Mask (H∩S∩V)

[0103] If the target color also differs from the background in saturation or brightness, such as reflective metal and non-reflective surfaces, S and V channel masks can be further introduced:

[0104]

[0105]

[0106] The final composite mask is the intersection of the bitwise AND operations on the three channels:

[0107]

[0108]

[0109] The mask takes into account the target features in three dimensions: hue, saturation, and brightness, further enhancing robustness.

[0110] Step S2015: Integration with network input

[0111] Composite mask Apply to image enhancement:

[0112]

[0113] remember For the final network input, regions conforming to color semantics are preserved and passed to the backbone of the object detection model, reducing the interference of background-irrelevant features on the network gradient. The multi-segment Hue channel masking mechanism, through fine segmentation and fusion of the hue channels, supplemented by morphological smoothing and optional S / V channel filtering, provides image regions with higher signal-to-noise ratios for the network input. Combined with the aforementioned V-channel CLAHE enhancement, it can effectively improve the detection rate of YOLOv5 for multiple and small targets in complex environments, while maintaining lightweight inference performance. By introducing the Hue masking guidance mechanism, the model obtains color-conscious priors for semantically salient targets during training and inference, avoiding false positives or false negatives caused by the model's insensitivity to color differences. This is suitable for distinguishing track targets with similar colors but different functions, such as emergency markers.

[0114] Step S202: After image processing and feature extraction, the next step is neural network processing, which typically includes the forward propagation phase of an object detection model (such as YOLO). A mask is applied to the enhanced image to obtain the input to the object detection model. The object detection model performs object detection to generate candidate boxes, each of which includes class probability, box coordinates, and confidence score.

[0115] The specific steps are as follows:

[0116] Step S2021: Input image

[0117] The enhanced image (such as an image fused with CLAHE enhancement and tone mask) is fed into the object detection network (such as YOLOv5).

[0118] Step S2022, Feature Extraction

[0119] The network extracts multi-level features from images using convolutional neural networks (CNNs) to generate feature maps. These feature maps contain visual information about various regions in the image, helping the network to classify and locate objects.

[0120] Step S2023, Bounding Box Prediction

[0121] The network generates a bounding box candidate at each location and predicts its associated attributes, including the object category, bounding box coordinates, and confidence score. YOLO series networks typically employ a single-stage detection method, generating candidate boxes directly from the feature map, rather than generating candidate regions first and then classifying them.

[0122] Step S2024, Category Prediction and Regression:

[0123] The network outputs class probability and bounding box regression value for each candidate box. Specifically, the model predicts whether each candidate box contains the target and outputs the class distribution (such as classification probability) and precise box coordinates.

[0124] For example, the model might output the following information:

[0125]

[0126] in, For category prediction, Here are the coordinates and dimensions of the bounding box, and confidence is the confidence that the bounding box contains the target.

[0127] Step S2025: Generate candidate boxes

[0128] After processing by the neural network, each candidate box obtained includes class probability, box coordinates, and confidence score, which serve as input for the next post-processing step.

[0129] Part Three: Three-Stage Hybrid Nonmaximum Suppression Mechanism

[0130] To address the issues of redundant detection and missed detection caused by dense overlap of target candidate boxes, this invention designs a hierarchical candidate box suppression mechanism that combines traditional hard NMS with soft confidence decay strategies to form a three-stage hybrid nonmaximum suppression process.

[0131] This three-stage hybrid mechanism balances the sparsity of detection results with the target retention rate. While ensuring real-time performance, it significantly improves the model's ability to detect small targets, occluded targets, and dense regions, effectively reducing false suppression and bounding box drift. The designed non-maximum suppression process consists of three sequentially executed stages, each with the following objectives and mechanisms:

[0132] Definition 1: The first stage, the initial screening stage based on confidence level, aims to quickly eliminate candidate boxes with obviously low confidence levels that are almost invalid, thereby reducing the burden on subsequent NIMS processing and ensuring that weak targets (such as distant targets) are not prematurely deleted. Traditionally, a confidence threshold is often used. (like We would use a filtering method, but here we introduce a milder initial screening threshold. :

[0133]

[0134] in Scaling factor

[0135] Step S301: Under the initial screening threshold, retain all candidate boxes that meet the following conditions:

[0136]

[0137] in, It is the set of all candidate boxes. It is the i-th candidate box. Candidate boxes Maximum confidence across all categories This is the initial screening threshold. This strategy can retain most of the target candidates with acceptable confidence, especially those boxes with slightly lower confidence due to occlusion, blurring, or distance, but which are of practical significance, thus preserving opportunities for subsequent fine-grained judgment.

[0138] The collection after hard NMS processing In the process, there may still be some partially overlapping candidate boxes with different targets. If hard thresholding is continued for suppression, some true targets close to the main box will inevitably be deleted. To address this, the second-stage Soft-NMS Gaussian confidence suppression adopts the Soft-NMS strategy, which uses a confidence-decreasing approach to penalize overlap.

[0139] Step S302: For the candidate box with the highest current confidence score For all remaining boxes After calculating its IoU, its confidence level is updated as follows:

[0140]

[0141] in Candidate boxes and The degree of overlap between them; It is the standard deviation of the Gaussian kernel, which controls the degree of decay; Used to attenuate those that are related to the main frame The confidence score of heavily overlapping boxes. This strategy avoids false deletions due to excessive overlap and does not directly reduce the confidence score to zero, thus offering greater flexibility in candidate box selection. The attenuated boxes, if they still meet the following criteria... , will be retained middle.

[0142] Definition 2: After the second stage of processing, some slightly overlapping bounding boxes may still exist, especially in dense target areas. To further optimize the box selection, a high IoU hard NMS is introduced in the third stage to ensure the accuracy of candidate boxes. Considering the horizontal variation in image information caused by the target's shooting distance, we introduce a... As a distance weight, it is used to reduce overlap misjudgments caused by distance.

[0143] Step S303: Considering that the target's shooting distance may introduce horizontal changes in the image, we introduce a depth difference weight. This is used to adjust the confidence level of candidate boxes and reduce false positives due to overlap caused by differences in target depth. The confidence level of candidate boxes is adjusted using the following formula:

[0144]

[0145] in This represents the weighting of the depth difference. and These are candidate boxes and Depth information, It is the weight of the influence of depth difference. Based on candidate boxes and Gaussian decay of IOU and depth information, if candidate box and candidate boxes If there is overlap, then the candidate boxes will be... The confidence level is decayed.

[0146] Definition 3: To further eliminate redundant bounding boxes, preliminary geometric deduplication is performed. However, unlike conventional settings, this paper introduces a relatively more lenient IoU threshold. The definition is as follows:

[0147]

[0148] in It is the main NMS threshold (e.g.) ), usually located Interval. It is an added bias that allows for a certain degree of overlap, thereby avoiding the accidental deletion of side-by-side targets.

[0149] The processing procedure is as follows:

[0150] Step S304, from Select the box with the highest confidence level For each After updating the confidence level in step S303, if the following conditions are met:

[0151]

[0152] Will Remove from the set, Add to output set Repeat the above steps until the set is empty. This strategy reduces input load by quickly removing overlapping and redundant boxes, and leaves room for retaining slightly overlapping but real targets.

[0153] Step S305: Repeat the above process until all detection boxes have been processed, and output the final set. .

[0154] The first stage uses confidence-based initial screening to quickly eliminate redundant boxes and retain meaningful target candidates. The second stage employs a soft Non-Maximum Suppression (NMS) strategy to dynamically adjust the confidence of the boxes, effectively avoiding missed detections, especially in occluded and densely populated areas. The third stage uses high IoU hard NMS combined with depth difference weighting to further remove redundant boxes and retain accurate targets, followed by geometric deduplication. This continuously decaying confidence adjustment mechanism is more flexible than hard pruning, and is particularly suitable for retaining occluded targets, adjacent targets, or distant small targets, achieving a good balance between recall and precision. Through a three-stage depth-aware hybrid non-maximum suppression, a layer-by-layer screening approach is introduced on the basis of traditional NMS, integrating initial screening, hard suppression, and soft suppression mechanisms to differentiate the processing of detection boxes; a dynamic threshold and context-aware model are designed to improve recall and suppress false alarms; and computational complexity is optimized to meet the real-time requirements of embedded platforms.

[0155] Example 1:

[0156] In object detection ensembles, this three-stage nonmaximum suppression replaces the original nonmaximum suppression function, or is called experimentally in the validation and training functions. The specific call depends on the different code encapsulation of object detection, different object detection models, or different versions of the algorithm.

[0157] The integrated system mainly consists of the following five core modules:

[0158] (1) HSV spatial image enhancement module

[0159] This module is executed during the image preprocessing stage. It integrates CLAHE brightness enhancement, Hue channel mask fusion, and Soft fusion strategies. By jointly optimizing the hue and brightness of the target area, it improves the contrast and edge sharpness of the target area, significantly enhancing the perception capabilities of subsequent networks.

[0160] (2) Multi-stage nonmaximum suppression module

[0161] This module structurally replaces the default NMS in the YOLO series, constructing a three-stage structure: the initial screening stage removes redundant boxes with extremely low confidence, then Soft-NMS is used to exponentially decay the remaining candidate boxes to retain dense targets, and finally a high IoU hard NMS and geometric deduplication process is performed to output the final prediction result, effectively solving the problem of missed detection of occluded and overlapping targets.

[0162] (3) Training loader enhancement module

[0163] This module makes a minor modification to the YOLO image loading process by embedding the enhancement function into the getitem interface. HSV enhancement and masking can be applied during the training phase to ensure that the images received by the backbone network are consistent before and after enhancement processing, thereby improving the detector's generalization robustness to enhanced samples.

[0164] (4) Parameter configuration module

[0165] The training interface of Ultralytics YOLO has been updated with a unified management interface for enhancement parameters (such as hsv_clip, hsv_mix_ratio, soft_nms_sigma, etc.), which avoids the problem of manually injecting incompatible configuration items and improves the stability and flexibility of the overall project.

[0166] (5) Model export and deployment module

[0167] The system is compatible with the official Ultralytics export API, and can automatically export to ONNX, TensorRT, CoreML, and other formats after training, eliminating the need for manual script writing. It is adaptable to various deployment platforms and cloud AI servers, meeting the multi-terminal deployment requirements of industrial-grade track inspection systems. System deployment consists of four steps, as follows:

[0168] Step 1: Training, Integration, and Deployment

[0169] Place the enhancement module file in the data loading directory and replace the default loading logic; replace the Ultralytics default non_max_suppression function with the three-stage NMS function; set appropriate parameters in train.py, such as hsv_clip and soft_nms_sigma; train using the YOLO.train() interface provided by Ultralytics, which automatically calls the enhancement and suppression modules during the process; after training, save the optimal weights and configuration file, and record the P / R / mAP change trends of each round.

[0170] Step 2: Inference Deployment Optimization

[0171] Load the saved best.pt or last.pt model; during the inference phase, process the input image using the same image augmentation pipeline to maintain training-test consistency; the non-maximum suppression module still runs in a three-stage manner; the output results are saved as JSON, TXT, or visualization image formats for subsequent application analysis.

[0172] Step 3: Model Export and Compression. Use the Ultralytics YOLO export interface to directly export to ONNX format; TensorRT can be used to further quantize the ONNX model to improve inference speed; optional model compression optimization strategies such as channel pruning and sparse-aware training can be performed.

[0173] Step 4: End-side deployment and integration

[0174] Deploy inference code on an embedded platform; utilize API calls to optimize the model; deploy a hybrid Python and C++ calling method on the platform to achieve concurrent detection of multi-channel images; and synchronously upload post-processing and results to a server or database to form a complete closed loop.

[0175] This invention strictly adheres to the YOLO series training and inference interface standards during deployment, requiring no modification to the YOLO backbone structure and maximizing compatibility with different YOLO versions (such as v5, v8, v9, and v11). Furthermore, all enhancement and suppression modules possess fault-tolerant mechanisms, such as handling missing mask regions or no candidate boxes, ensuring stable model operation and preventing abnormal interruptions during inference. In addition, the system configuration file supports both dynamic configuration via command line and configuration file reading, facilitating batch deployment and version control. During deployment, the system automatically records the output results at each stage, supporting log tracking and visual comparison.

[0176] Example 2:

[0177] This method has been deployed in the pre- and post-processing workflows of YOLOv5, YOLOv8, and YOLOv9 models, specifically integrating HSV enhancement and Hue mask set image processing. The Soft-NMS mechanism replaces the original target detection function, maintaining the same structure and output. All modules support batch inference and are compatible with ONNX and TensorRT deployments. The modules of this invention can be seamlessly integrated into the YOLO backbone network, significantly improving detection accuracy and recall, and possessing strong versatility and deployability. Experimental results show that the enhancement and suppression modules proposed in this invention exhibit significant advantages in rail transit scenarios. The metrics on the test set based on the YOLO network are as follows:

[0178] Table 1. Results of the integrated experiment

[0179]

[0180] The results show that, without significantly increasing inference latency, the system achieves simultaneous improvements in multiple accuracy metrics, particularly demonstrating stronger detection capabilities for small targets in densely occluded and low-light environments within rail transit scenarios. The deployment and integration strategy proposed in this invention fully considers the compatibility, engineering practicality, and inference performance of the target detection model, effectively supporting the requirements of intelligent rail transit detection systems for accuracy, recall, and stability.

[0181] This invention discloses a target detection method suitable for rail transit environments. This method combines Contrast Limited Adaptive Histogram Equalization for Luminance Channel (CLAHE-LC), Multi-Segment Hue Channel Masking Mechanism (MSHCM-M), and Three-Stage Linear-Soft-Hard Hybrid Non-Maximum Suppression (TSLSH-NMS) techniques to address issues such as complex lighting, multiple target occlusion, and color interference in rail transit scenarios, thereby improving the accuracy and recall of target detection. Specifically, the input image is first converted to a Hue-Saturation-Value (HSV) color space. By applying the CLAHE algorithm to the luminance channel (Value, V), adaptive enhancement of local image contrast is achieved, effectively improving the salience of targets in low-light and complex backgrounds. Simultaneously, considering the typical color distribution of rail transit targets, a multi-segment hue channel (Hue, H) mask is designed to divide the hue space into several intervals. Different color segments are processed separately to enhance the feature representation ability of key color regions, thereby improving the detection model's ability to distinguish targets. In the candidate detection box screening stage, an innovative three-stage hybrid mechanism NMS strategy is adopted: the first stage is the initial screening stage based on confidence; the second stage uses a soft-NMS strategy to effectively alleviate the false suppression problem caused by multiple target occlusion and box overlap; the third stage is a high IoU hard NMS to ensure the accuracy of candidate boxes.

[0182] The method of this invention can be seamlessly integrated into existing deep learning object detection frameworks (such as You Only LookOnce, YOLO series), and is compatible with multi-label, multi-class, and multi-scale features, significantly improving the accuracy and recall rate of object detection in rail transit scenarios. Experimental verification shows that this method, while ensuring real-time performance, significantly improves detection performance compared to traditional solutions, making it suitable for practical rail transit safety monitoring and intelligent maintenance systems.

[0183] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for enhancing color perception in rail transit target detection, characterized in that, The method includes the following steps: Part 1: HSV Spatial Image Enhancement Mechanism First, the original image is converted to the HSV color space. In this space, the V channel reflects the brightness of each pixel in the image. The CLAHE enhancement strategy is introduced to the V channel for local adaptive enhancement. Part Two: Hue Channel Masking Mechanism Based on the image enhanced by the V channel, a multi-segment Hue channel masking mechanism is introduced to filter out the color regions of real interest in a hue-guided manner, thereby suppressing background noise and highlighting target features. This mechanism divides the H channel into continuous intervals in the HSV space, extracts the pixel regions corresponding to specific color segments, and constructs semantic masks to guide subsequent object detection models to focus on color-salient regions. The mask is applied to the enhanced image to obtain the input of the object detection model. The object detection model performs object detection to generate candidate boxes. Each candidate box includes the class probability, box coordinates and confidence score. Part Three: Three-Stage Hybrid Nonmaximum Suppression Mechanism The first stage is the initial confidence screening stage, which quickly eliminates redundant boxes and retains meaningful target candidates. The second stage employs a soft NMS strategy to perform confidence decay processing on the remaining candidate boxes based on IoU weights, dynamically adjusting the confidence of the boxes. The third stage introduces high IoU hard NMS, combined with depth difference weights, to further remove redundant boxes and retain accurate targets. Then, geometric deduplication is performed to obtain the final detection boxes.

2. The balanced color perception enhancement method for target detection in rail transit as described in claim 1, characterized in that, The first part includes: Step S101: RGB to HSV space conversion Assume the input image is an RGB image with the following dimensions: W, the pixel range is: The image channels are transformed into HVS space using a transformation function: Where H represents hue in degrees, ranging from [0, 179], and represents color type, which is normalized to an integer in the conversion function. [0,179]; S represents saturation, ranging from [0,255], and represents the purity of the color; V represents the brightness of the color, ranging from [0,255]. Step S102: Enhance the V channel using contrast-limited adaptive histogram equalization (CLAHE): Divide the V channel into a fixed number of sub-blocks, perform histogram equalization on each sub-block to enhance local contrast; To avoid over-amplifying noise, introduce parameters to limit the maximum height of the local histogram; Finally, use bilinear interpolation to smoothly stitch the enhanced sub-blocks into a complete image.

3. The balanced color perception enhancement method for target detection in rail transit as described in claim 2, characterized in that, Step S102 includes: Step S1021 Channel segmentation Will The channel is divided into Sub-block : in, , ; Step S1022: Limit the histogram height For each sub-block Calculate its grayscale histogram: Indicates the current sub-block The grayscale value of a single pixel in the image; when a certain grayscale level exceeds the limit value L, it is truncated and the excess part is evenly distributed to other sub-blocks to avoid local excessive contrast enhancement; Step S1023: Equilibrium of Cumulative Distribution Function (CDF) Normalize the cumulative histogram for each sub-block: Represents grayscale levels, and is an integer with a range of values. ; This represents the total number of pixels in the current sub-block; if the sub-block size is... That is, the width is , Gao Wei ,but: The enhancement value is obtained using the cumulative histogram corresponding to the current grayscale value: ; Step S1024, Interpolation fusion and channel reconstruction For all enhanced sub-blocks Bilinear interpolation is used for smooth stitching to obtain the enhanced luminance channel. ;No. The coordinates of the top left corner of each sub-block are The center coordinates are: For any pixel Find the centers of its four adjacent sub-blocks and calculate the weight coefficients in the horizontal and vertical directions. and Assuming Located at the center of the four sub-blocks , , , Within the enclosed area; For pixels Enhancement value Perform horizontal and vertical interpolation, with the horizontal interpolation performed at the center of the top two sub-blocks. and Between and the center of the two bottom sub-blocks and between: After horizontal interpolation, perform vertical interpolation at the top and bottom: Then reconstruct it with the original hue and saturation channels to create a new HSV image: Finally, it is converted back to RGB space for model input: in This represents the number of pixels with a grayscale value of k. Let k be the normalized cumulative probability distribution function corresponding to gray level k. These are the pixel values ​​of the sub-blocks after CLAHE enhancement. The enhanced HSV image.

4. The balanced color perception enhancement method for target detection in rail transit as described in claim 1, characterized in that, The second part includes: Step S201: The Hue channel is divided into multiple segments according to the color wheel interval. The red segment is H∈[0°,20°]∪[340°,360°], the yellow segment is H∈[20°,40°], the green segment is H∈[90°,150°], and the blue segment is H∈[200°,250°]. For each segment, a multidimensional weighted mask image is constructed by combining its joint distribution in the saturation and brightness dimensions, and then channel-level weighted fusion is performed with the original image. Step S202: Apply the mask to the enhanced image to obtain the input of the object detection model. The object detection model performs object detection to generate candidate boxes. Each candidate box includes the class probability, box coordinates and confidence score.

5. The balanced color perception enhancement method for target detection in rail transit as described in claim 4, characterized in that, Step S201 includes: Step S2011, Target Tone Distribution Analysis Given an enhanced HSV image: First, we calculate the full image histogram for the tone channels: By analyzing the hue histogram distribution of typical targets on the training or validation set, several discrete hue intervals are determined: Step S2012: Multi-segment mask generation For each tone range Construct a binary mask: All submasks are combined using a bitwise OR operation to obtain the overall verification mask: This represents the final overall verification mask for the H channel, obtained by performing a bitwise OR operation on all sub-masks; the size of the mask matrix should be consistent with the size of the original image. It represents the height and width of the image; the size of the mask is consistent with the size of the image, and each pixel in the image will have a corresponding mask value; Step S2013: Spatial Smoothing and Morphological Post-processing To eliminate the impact of noise and isolated small areas, The above applies morphological opening and closing operations. Opening involves erosion followed by dilation to remove small-area noise; closing involves dilation followed by erosion to fill tiny holes in the mask. Let the structuring element be... ,but: in Indicates corrosion. Indicates expansion; Step S2014, Joint Mask If the target color also differs from the background in saturation or brightness, further S and V channel masks can be introduced: The final composite mask is the intersection of the bitwise AND operations on the three channels: The mask takes into account the target features in three dimensions: hue, saturation, and brightness, further enhancing robustness; Step S2015: Integration with network input Composite mask Apply to image enhancement: remember As the final network input, regions that conform to color semantics are preserved and passed to the backbone of the object detection model, reducing the interference of background-irrelevant features on the network gradient.

6. The balanced color perception enhancement method for target detection in rail transit as described in claim 5, characterized in that, Step S202 includes: Step S2021: Input image Will Input the target detection model network; Step S2022, Feature Extraction The network extracts multi-level features from images through convolutional neural networks to generate feature maps; these feature maps contain visual information of various regions in the image, which helps the network to classify and locate objects. Step S2023, Bounding Box Prediction The network generates a bounding box candidate at each location and predicts its associated attributes, including object category, bounding box coordinates, and confidence score. Step S2024, Category Prediction and Regression: The network outputs the class probability and bounding box regression value for each candidate box; the model predicts whether each candidate box contains the target, and simultaneously outputs the class distribution of the box and the precise box coordinates; Step S2025: Generate candidate boxes After processing by the neural network, each candidate box obtained includes class probability, box coordinates, and confidence score, which serve as input for the next post-processing step.

7. The balanced color perception enhancement method for target detection in rail transit as described in claim 6, characterized in that, In step S2024, the model will output the following information: in, For category prediction, Here are the coordinates and dimensions of the bounding box, and confidence is the confidence that the bounding box contains the target.

8. The balanced color perception enhancement method for target detection in rail transit as described in claim 7, characterized in that, The first stage, the initial screening stage based on confidence level, aims to quickly eliminate candidate boxes with significantly low confidence levels that are almost invalid, thereby reducing the burden on subsequent NIMS processing and ensuring that weak targets are not prematurely deleted. A more lenient initial screening threshold is introduced. : in This is the scaling factor; The confidence threshold; Step S301: Under the initial screening threshold, retain all candidate boxes that meet the following conditions: in, It is the set of all candidate boxes. It is the i-th candidate box. Candidate boxes Maximum confidence across all categories This is the initial screening threshold.

9. The balanced color perception enhancement method for target detection in rail transit as described in claim 8, characterized in that, The second stage employs a Soft-NMS strategy, using a confidence-decreasing approach to apply overlap penalties; specifically, it includes: Step S302: For the candidate box with the highest current confidence score For all remaining boxes After calculating its IoU, its confidence level is updated as follows: in Candidate boxes and The degree of overlap between them; It is the standard deviation of the Gaussian kernel, which controls the degree of decay; Used to attenuate those that are related to the main frame The confidence score of heavily overlapping boxes; this strategy avoids false deletions due to excessive overlap by attenuating the confidence score of overlapping boxes and does not directly reduce the confidence score to zero, thus providing greater flexibility in candidate box selection; the attenuated boxes, if they still meet the following criteria... , will be retained middle.

10. The balanced color perception enhancement method for target detection in rail transit as described in claim 9, characterized in that, The third stage introduces a high IoU hard NMS to ensure the accuracy of the candidate boxes; considering the horizontal variation in image information caused by the target's shooting distance, a... As a distance weight to reduce overlap misjudgments caused by distance; Step S303: Considering that the target's shooting distance may introduce horizontal changes in the image, a depth difference weight is introduced. This is used to adjust the confidence level of candidate boxes and reduce false positives due to differences in target depth. Adjust the confidence level of the candidate boxes using the following formula: in The influence weight of depth difference; where and These are candidate boxes and Depth information, Based on candidate boxes and Gaussian decay of IOU and depth information, if candidate box and candidate boxes If there is overlap, then the candidate boxes will be... The confidence level is decayed; To further eliminate redundant bounding boxes, preliminary geometric deduplication is performed; a relatively more lenient IoU threshold is introduced. The definition is as follows: in It is the main NMS threshold; It is an added deviation that allows for a certain degree of overlap, thereby avoiding the accidental deletion of side-by-side targets; The processing procedure is as follows: Step S304, from Select the box with the highest confidence level For each After updating the confidence level in step S303, if the following conditions are met: Will Remove from the set, Add to output set Repeat the above steps until the set is empty; Step S305: Repeat the above process until all detection boxes have been processed, and output the final set. .

Citation Information

Cited By

  • Mine image enhancement method and device

    CN121616511A

  • A method and apparatus for enhancing mine images

    CN121616511B