A Smart Detection Method for Locomotive Sand Spreading Devices in Low-Light Environments
By using a low-light enhancement network and a target detection model, enhanced images are generated and the sand-spreading pipe area is predicted, solving the accuracy problem of locomotive sand-spreading device detection in low-light environments and achieving stable and efficient sand-spreading detection.
Patent Information
- Application Number
- CN202411839498.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-12-13
AI Technical Summary
Under low light conditions, the detection accuracy of locomotive sand spreading devices is low, and existing technologies are unable to effectively identify the sand spreading area.
A low-light enhancement network is used to generate enhanced images through geometric sparse representation branches and low-light enhancement branches, and combined with a target detection model, the sand-spreading pipe area is predicted.
It improves the stability and accuracy of locomotive sand spreading device detection in low-light environments, enhances image brightness, contrast and clarity, and significantly improves the accuracy and robustness of sand spreading detection.
Smart Images

Figure CN119810034B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and target detection technology, specifically to an intelligent detection method for a locomotive sand spreading device in low-light environments. Background Technology
[0002] In railway transportation, sand spreading, as a key means of improving wheel-rail adhesion coefficient, plays an irreplaceable role in ensuring locomotive traction efficiency, preventing wheel slip, and ensuring that train braking distances meet safety standards. This technical detail directly relates to the stability and safety of train operation; therefore, real-time monitoring of the locomotive's sand spreading status and ensuring the proper functioning of the sand spreading device is an indispensable part of railway maintenance. However, in practice, accurately determining whether a locomotive is undergoing sand spreading is a complex and challenging problem.
[0003] With the rapid development of computer vision technology, it has become possible to monitor the sand-spreading status of locomotives using image recognition technology. By installing cameras on the locomotive, image information from the sand-spreading device can be collected in real time, allowing for analysis and determination of whether sand-spreading has occurred. However, this approach faces significant challenges in practical applications.
[0004] In low-light conditions, images captured by cameras often exhibit low contrast, high noise, and blurred target details. These adverse factors significantly impact the performance of traditional target detection algorithms, making accurate identification of sand-spreading areas extremely difficult. Although low-light image enhancement technologies have made significant progress in recent years, most of these techniques focus on improving image quality while neglecting close integration with target detection tasks. Consequently, even with enhanced images, the detection accuracy remains unsatisfactory in practical applications. Therefore, designing an effective method to address the low detection accuracy of locomotive sand-spreading devices in low-light environments is a pressing technical challenge. Summary of the Invention
[0005] To address the shortcomings of the existing technologies, the technical problem to be solved by this invention is: how to provide an intelligent detection method for locomotive sand spreading devices in low-light environments, which generates enhanced images of locomotive sand spreading devices by using geometric sparse representation branches and low-light enhancement branches through a low-light enhancement network; and simultaneously predicts the sand spreading pipe area based on the enhanced locomotive sand spreading device image through the backbone network, neck network, and head network of the target detection model, thereby improving the stability and accuracy of sand spreading device detection.
[0006] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0007] Intelligent detection method for locomotive sand spreading device in low light environment, including:
[0008] S1: Acquire an image of the locomotive sand spreading device to be inspected;
[0009] S2: Image enhancement is performed on the image of the locomotive sand spreading device using a low-light enhancement network to obtain an enhanced image of the locomotive sand spreading device;
[0010] The processing steps of the low-light enhancement network are as follows:
[0011] S201: Geometric sparsity coefficient diagram of the computer vehicle sand spreading device image;
[0012] S202: Input the geometric sparse coefficient map into the geometric sparse representation branch and output the corresponding enhanced geometric sparse coefficient map;
[0013] S203: Input the image of the locomotive sand spreading device into the low-light enhancement branch and output the corresponding low-light enhancement feature map;
[0014] S204: The outputs of the penultimate layer of the low-light enhancement branch and the geometric sparse representation branch are fused to obtain the corresponding enhanced locomotive sand spreading device image;
[0015] S3: Input the enhanced image of the locomotive sand spreading device into the trained target detection model, and output the prediction result of the sand spreading pipe area;
[0016] S4: Output the prediction results of the sand spreading pipe area as the detection results of the locomotive sand spreading device image.
[0017] Preferably, in step S201, the geometric sparsity coefficient map is calculated using the following formula:
[0018]
[0019] In the formula: J(a) k ,∈ k ) represents the geometric sparsity coefficient of image I of the locomotive sand spreading device; ω k Represents an image block; a k The geometric sparsity coefficient of pixel k is represented by λ; k represents a pixel; D represents the dictionary image; λ represents a. k The regularization parameter on; ∈ k μ represents the coefficient. k Represents image patch ω k The mean of D in the middle; Represents image patch ω k The mean of I; Represents image patch ω k The variance of D.
[0020] Preferably, in step S202, the geometrically sparse representation branch includes a first convolutional module, a combination of four modules, a second convolutional module, a combination of convolutional modules, and a third convolutional module connected end to end in sequence.
[0021] Module combination one includes a series module connected end to end, three RRDB modules and a convolution module;
[0022] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0023] The feature maps output by the first and second convolutional modules are concatenated and used as the input to the convolutional module combination; the output of the convolutional module combination is used as the enhanced geometric sparse coefficient map of the geometric sparse representation branch output.
[0024] Preferably, in step S203, the low-light enhancement branch includes a first convolutional module, a combination of five modules, a second convolutional module, and a combination of convolutional modules connected end to end in sequence.
[0025] Module combination two includes two channel attention dense blocks and three residual dense modules connected end to end in sequence;
[0026] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0027] The feature map output by the first convolutional module and the feature map output by the convolutional module combination are concatenated to form the low-light enhancement feature map output by the low-light enhancement branch.
[0028] The feature maps output by the first to fourth module combinations are used as prior features and are respectively used as inputs to the concatenated modules in the first to fourth module combinations in the geometric sparse representation branch.
[0029] Preferably, in step S204, the outputs of the penultimate layer of the low-light enhancement branch and the geometric sparse representation branch are fused using a fusion network;
[0030] The fusion network consists of a combination of modules connected end-to-end and a combination of convolutional modules;
[0031] Module combination three includes a series module and a fusion module connected end to end in sequence;
[0032] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0033] The low-light enhancement feature map and the enhanced geometric sparse coefficient map are used as inputs to the cascaded module in module combination three; the feature map output by the convolution module combination is used as the enhanced locomotive sand spreading device image output by the fusion network.
[0034] Preferably, the channel attention dense block includes two dense modules and a channel attention module connected end to end in sequence;
[0035] Dense modules consist of four modules connected end-to-end and a convolutional module; module combination four consists of convolutional modules connected end-to-end and a ReLU activation function layer.
[0036] The channel attention module consists of a global pooling layer, a fully connected layer, a ReLU activation function layer, a fully connected layer, and a Sigmoid activation function layer, which are connected sequentially from end to end.
[0037] The original feature map input to the channel attention dense block is concatenated with the feature map output from the first dense module and used as the input to the second dense module; the feature maps input and output from the second dense module are concatenated and used as the input to the channel attention module; the feature maps input and output from the channel attention module are concatenated and then concatenated with the original feature map to obtain the feature map output from the channel attention dense block.
[0038] Preferably, in step S202, the geometric sparse representation branch is trained based on the generative adversarial network, and the specific training steps are as follows:
[0039] S2021: Acquiring Low-Light Images I Low and real images And geometric sparse coefficient plots of low-light images and real images;
[0040] S2022: Generator Training: Fix the discriminator parameters; use the geometric sparse coefficient map of the low-light image as input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Based on enhanced geometric sparsity coefficient graph Calculate the generator loss function using the geometric sparse coefficient graph of the real image. and pixel loss function And further calculate the total loss function The generator parameters are updated using the backpropagation algorithm to minimize its total loss function.
[0041] The formula is expressed as:
[0042]
[0043] Where: β GSR and γ GSR These represent the enhanced geometric sparsity coefficient diagrams. Pixel loss weights and adversarial loss weights; GSR(I Low ) and A Low All represent the geometric sparsity coefficients of low-light images; G represents the expected value; GSR D GSR G represents the generator and discriminator, respectively; GSR (GSR(ILow )) and G(A Low Both represent enhanced geometric sparse coefficient maps generated by the generator based on the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image;
[0044] S2023: Training the discriminator: Fix the generator parameters; use the geometric sparse coefficient map of the low-light image as the input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Enhanced geometric sparsity coefficient plot Image reconstruction is performed to obtain the restored image. Restore image and real images Input the discriminator and calculate the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function.
[0045] The discriminator loss function is expressed as follows:
[0046]
[0047] In the formula: Both represent the expected value; This indicates that the discriminator is effective in reconstructing the image. The output probability, i.e., the probability that the discriminator considers the recovered image to be correct. The probability that it is a real image; This indicates that the discriminator recognizes the real image. The output probability, i.e., the probability that the discriminator considers the image to be real. The probability that it is a real image;
[0048] Restore image The calculation formula is expressed as:
[0049]
[0050] In the formula: This represents the value of the enhanced geometric sparsity coefficient map at pixel k. This represents the value of the recovered image at pixel k; This represents the value of the actual image at pixel k; This represents the representation error at pixel k, used to indicate residuals or uncertainties present during image reconstruction.
[0051] S2023: Repeat steps S2021 to S2022 to train the generator and discriminator alternately;
[0052] S2024: Use the completed generator as a branch of the trained geometric sparse representation.
[0053] Preferably, in step S203, the low-light enhancement branch is trained based on a generative adversarial network, and the specific training steps are as follows:
[0054] S2031: Acquire low-light image I Low and real images and the geometric sparse representation branch based on low-light image I Low Enhanced geometric sparse coefficient map generated from geometric sparse coefficient map
[0055] S2032: Training the discriminator: Fix the generator parameters; enhance the geometric sparse coefficient map generated by the low-light image and the geometric sparse representation branch. As input to the generator, a low-light enhancement feature map is generated. Low-light enhancement feature map and real images The input discriminator distinguishes whether the input image is a low-light enhancement feature map generated by the generator or a real image, and calculates the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function.
[0056] The discriminator loss function is expressed as follows:
[0057]
[0058] In the formula: Both represent the expected value; This indicates the probability that the discriminator considers the low-light enhancement feature map generated by the generator to be a real image; This represents the probability that the discriminator considers a real image to be a real image;
[0059] S2033: Training the generator: Fix the parameters of the discriminator; enhance the geometric sparse coefficient map generated by the low-light image and the geometric sparse representation branch. As input to the generator, a low-light enhancement feature map is generated. The generated low-light enhancement feature map With real images The input is fed into the discriminator, and the discriminator's judgment result is obtained; based on the discriminator's judgment result and the low-light enhancement feature map... Compared with the true feature map Calculate the generator loss function for each difference. Perceptual loss function Pixel loss function and the pixel loss function after introducing geometric sparse coefficient map And further calculate the total loss function The generator's parameters are updated using the backpropagation algorithm to minimize its total loss function.
[0060] The formula is expressed as:
[0061]
[0062] In the formula: γ I These represent low-light enhancement feature maps. The pixel loss weight, the pixel loss weight after introducing the geometric sparse coefficient map, and the adversarial loss weight; G(I) represents the expected value; Low ) indicates that the generator is based on the low-light image I LLow Generated low-light enhancement feature map; GSR(G(I) Low )) represents the root geometric sparse representation of the branch, which is an enhanced geometric sparse coefficient map generated from the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image; C j W represents the number of feature maps in the j-th layer of the generator; j H represents the width of the feature map of the j-th layer of the generator; j φ represents the height of the feature map of the j-th layer of the generator; J G represents the output of the j-th layer of the generator; G represents the generator; D represents the output of the j-th layer of the generator. I Indicates the discriminator;
[0063] S2034: Repeat steps S2021 to S2022 to train the generator and discriminator alternately;
[0064] S2035: Use the completed generator as the trained low-light enhancement branch.
[0065] Preferably, in step S301, the backbone network includes a combination of three feature extraction modules connected end-to-end, a pyramid pooling module, and an attention module; the feature extraction module combination includes a convolutional module and a C2F module connected end-to-end; the attention module includes two sub-modules: channel attention and spatial attention; in the channel attention module: the input features are max pooled and average pooled to obtain two different features, which are then fed into a multilayer perceptron, and then the two feature maps are merged. The merged feature map is then fed into the spatial attention module, where the input feature map is max pooled and average pooled along the channel axis to obtain two feature maps. These two feature maps are then concatenated, and a convolutional layer with a kernel size of 7 is applied to generate a spatial attention map;
[0066] In step S302, the neck module includes an upsampling module, a first cross-layer connection, a first C2F module, a convolution module, a second cross-layer connection, and a second C2F module connected sequentially from end to end; the cross-layer connection can splice the feature information between different layers and merge the features of different layers;
[0067] In step S303, the head network generates feature maps for predicting categories and bounding boxes, producing the final detection results.
[0068] Preferably, the classification loss function used when training the object detection model is as follows:
[0069]
[0070] In the formula: L i Let represent the loss for the i-th sample; N represents the total number of samples; y i p represents the true label of the i-th sample; i This represents the probability that the model predicts the i-th sample belongs to the positive class;
[0071] Bounding box regression loss function when training object detection model as follows:
[0072]
[0073] In the formula: Indicates the weighting coefficient; Indicates IOU loss; W g H represents the actual frame width. g W represents the actual bounding box height. i H represents the width of the overlapping region. i Indicates the height of the overlapping region; S u This represents the area of the predicted bounding box and the ground truth bounding box; * indicates W. g H g Separate from the computation graph; x represents the x-coordinate of the center point of the predicted bounding box; y represents the y-coordinate of the center point of the predicted bounding box; x gt The x-coordinate of the center point of the true bounding box; y gt The vertical coordinate of the center point of the true bounding box.
[0074] Compared with existing technologies, the intelligent detection method for locomotive sand spreading devices in low-light environments proposed in this invention has the following advantages:
[0075] In this invention, a low-light enhancement network generates enhanced images of locomotive sand-spreading devices through a geometric sparse representation branch and a low-light enhancement branch. First, the geometric sparse representation branch extracts and enhances geometric structural information in the image by analyzing its geometric sparse coefficient map. This structural information is crucial for identifying objects with specific shapes and locations, such as sand-spreading pipes, and helps to stably locate the sand-spreading pipe area under low-light conditions, improving the stability of locomotive sand-spreading device detection. Second, the low-light enhancement branch focuses on improving the image's brightness, contrast, and clarity, effectively suppressing noise and restoring image details that were previously blurred in low-light environments. This helps subsequent target detection tasks more accurately identify the sand-spreading pipe area. Simultaneously, the image processed by the low-light enhancement network exhibits significantly improved quality and features, thereby enhancing the accuracy and robustness of locomotive sand-spreading device detection in low-light environments. Finally, the output before the low-light enhancement branch fusion layer and the output of the penultimate layer of the geometric sparse representation branch are fused together. This fully utilizes the complementary features extracted by the two branches, enhances the overall image quality, and preserves key geometric structural information. This significantly improves the image quality, including brightness, contrast, and detail information, making targets that were originally difficult to identify under low light conditions clearly visible. This greatly improves the accuracy of sand spreading detection by the locomotive sand spreading device.
[0076] This invention, based on generating enhanced images of a locomotive sand-spreading device using a low-light enhancement network, further predicts the sand-spreading pipe region using a target detection model. First, the backbone network of the target detection model, through a combination of convolutional modules, C2F modules, spatial pyramid pooling modules, and attention modules, efficiently extracts multi-level features from the image. These features not only contain rich detailed information but also encompass global contextual information, providing a solid foundation for subsequent feature fusion and target detection. Simultaneously, the introduction of an attention module into the backbone network allows the model to pay more attention to multi-scale information, which is particularly important for detecting targets of different sizes and shapes, as the size and shape of targets are often diverse in practical applications. By enhancing the processing capability of multi-scale information, targets in the image can be identified more accurately. Second, the neck network, through the cooperation of convolutional modules, cross-layer connection modules, upsampling modules, and C2F modules, achieves effective fusion and stitching of features at different scales. This not only improves the robustness and expressive power of the features but also helps the model better adapt to sand-spreading pipe regions of different scales and shapes. Finally, the head network, based on fused features, uses advanced detection algorithms (such as YOLO, Faster R-CNN, etc.) to achieve precise localization of the sand-spreading pipe area. Through regression prediction and classification judgment, the model can accurately identify the location and shape of the sand-spreading pipe, providing a reliable basis for subsequent decision-making and control. Attached Figure Description
[0077] To make the objectives, technical solutions, and advantages of the invention clearer, the invention will now be described in further detail with reference to the accompanying drawings, wherein:
[0078] Figure 1 A logic block diagram for an intelligent detection method for locomotive sand spreading devices in low-light environments;
[0079] Figure 2 This is a network structure diagram of a low-light enhancement network;
[0080] Figure 3 For channel attention, consider the network structure diagram of dense blocks;
[0081] Figure 4 This is a network structure diagram of the attention module in the backbone network.
[0082] Figure 5 This is a network structure diagram of the C2F module;
[0083] Figure 6 This is a network structure diagram of the pyramid pooling module. Detailed Implementation
[0084] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but only to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0085] The following detailed explanation illustrates the specific implementation methods:
[0086] Example:
[0087] This embodiment discloses an intelligent detection method for locomotive sand spreading devices in low-light environments.
[0088] like Figure 1 As shown, the intelligent detection method for locomotive sand spreading devices in low-light environments includes:
[0089] S1: Acquire an image of the locomotive sand spreading device to be inspected;
[0090] S2: Image enhancement is performed on the image of the locomotive sand spreading device using a low-light enhancement network to obtain an enhanced image of the locomotive sand spreading device;
[0091] The processing steps of the low-light enhancement network are as follows:
[0092] S201: Geometric sparsity coefficient diagram of the computer vehicle sand spreading device image;
[0093] S202: Input the geometric sparse coefficient map into the geometric sparse representation branch and output the corresponding enhanced geometric sparse coefficient map;
[0094] S203: Input the image of the locomotive sand spreading device into the low-light enhancement branch and output the corresponding low-light enhancement feature map;
[0095] S204: The outputs of the penultimate layer of the low-light enhancement branch and the geometric sparse representation branch are fused to obtain the corresponding enhanced locomotive sand spreading device image;
[0096] S3: Input the enhanced image of the locomotive sand spreading device into the trained target detection model, and output the prediction result of the sand spreading pipe area;
[0097] The processing steps of the object detection model are as follows:
[0098] S301: The backbone network extracts features from the image of the enhanced locomotive sand spreading device through convolutional modules, C2F modules, spatial pyramid pooling modules, and attention modules to obtain image features;
[0099] S302: The neck network uses a convolutional module, a cross-layer connection module, an upsampling module, and a C2F module to fuse and stitch together image features to obtain fused features;
[0100] S303: The head network outputs the prediction results of the sand-spraying pipe region based on the fusion features;
[0101] S4: Output the prediction results of the sand spreading pipe area as the detection results of the locomotive sand spreading device image.
[0102] In this embodiment, after obtaining the prediction result of the sand-spreading pipe area, it can be used to determine whether sand spreading is being carried out through the image.
[0103] In this invention, a low-light enhancement network generates enhanced images of locomotive sand-spreading devices through a geometric sparse representation branch and a low-light enhancement branch. First, the geometric sparse representation branch extracts and enhances geometric structural information in the image by analyzing its geometric sparse coefficient map. This structural information is crucial for identifying objects with specific shapes and locations, such as sand-spreading pipes, and helps to stably locate the sand-spreading pipe area under low-light conditions, improving the stability of locomotive sand-spreading device detection. Second, the low-light enhancement branch focuses on improving the image's brightness, contrast, and clarity, effectively suppressing noise and restoring image details that were previously blurred in low-light environments. This helps subsequent target detection tasks more accurately identify the sand-spreading pipe area. Simultaneously, the image processed by the low-light enhancement network exhibits significantly improved quality and features, thereby enhancing the accuracy and robustness of locomotive sand-spreading device detection in low-light environments. Finally, the output before the low-light enhancement branch fusion layer and the output of the penultimate layer of the geometric sparse representation branch are fused together. This fully utilizes the complementary features extracted by the two branches, enhances the overall image quality, and preserves key geometric structural information. This significantly improves the image quality, including brightness, contrast, and detail information, making targets that were originally difficult to identify under low light conditions clearly visible. This greatly improves the accuracy of sand spreading detection by the locomotive sand spreading device.
[0104] This invention, based on generating enhanced images of a locomotive sand-spreading device using a low-light enhancement network, further predicts the sand-spreading pipe region using a target detection model. First, the backbone network of the target detection model, through a combination of convolutional modules, C2F modules, spatial pyramid pooling modules, and attention modules, efficiently extracts multi-level features from the image. These features not only contain rich detailed information but also encompass global contextual information, providing a solid foundation for subsequent feature fusion and target detection. Simultaneously, the introduction of an attention module into the backbone network allows the model to pay more attention to multi-scale information, which is particularly important for detecting targets of different sizes and shapes, as the size and shape of targets are often diverse in practical applications. By enhancing the processing capability of multi-scale information, targets in the image can be identified more accurately. Second, the neck network, through the cooperation of convolutional modules, cross-layer connection modules, upsampling modules, and C2F modules, achieves effective fusion and stitching of features at different scales. This not only improves the robustness and expressive power of the features but also helps the model better adapt to sand-spreading pipe regions of different scales and shapes. Finally, the head network, based on fused features, uses advanced detection algorithms (such as YOLO, Faster R-CNN, etc.) to achieve precise localization of the sand-spreading pipe area. Through regression prediction and classification judgment, the model can accurately identify the location and shape of the sand-spreading pipe, providing a reliable basis for subsequent decision-making and control.
[0105] To better illustrate the technical solution of the present invention, this embodiment is described in the following parts.
[0106] I. Geometric Sparsity Coefficient Diagram
[0107] In this embodiment, the geometric sparsity coefficient map is calculated using the following formula:
[0108]
[0109] In the formula: J(a) k ,∈ k ) represents the geometric sparsity coefficient of image I of the locomotive sand spreading device; ω k Represents an image block; a k λ represents the geometric sparse coefficients of pixel k; k represents a pixel; D represents the dictionary image (in geometric sparse representation, the dictionary image is a set of basic elements used to represent signals or data; these dictionary elements can be regarded as building blocks of an image, and the target image can be efficiently reconstructed or approximated by linearly combining these elements); λ represents a k The regularization parameter on; ∈ k μ represents the coefficient. k Represents image patch ω k The mean of D in the middle; Represents image patch ω k The mean of I; Represents image patch ω k The variance of D.
[0110] II. Low-light enhancement network
[0111] Combination Figure 2 As shown, the low-light enhancement network includes a geometrically sparse representation branch and a low-light enhancement branch.
[0112] 1. Geometric sparse representation branching
[0113] The geometric sparse representation branch includes the first convolutional module, the four-module combination I, the second convolutional module, the convolutional module combination, and the third convolutional module, which are connected end to end in sequence;
[0114] Module combination one includes a series module connected end to end, three RRDB modules and a convolution module;
[0115] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0116] The feature maps output by the first and second convolutional modules are concatenated and used as the input to the convolutional module combination; the output of the convolutional module combination is used as the enhanced geometric sparse coefficient map of the geometric sparse representation branch output.
[0117] 2. Low-light enhancement branch
[0118] The low-light enhancement branch includes a first convolutional module connected end to end, a combination of five modules, a second convolutional module, and a combination of convolutional modules connected end to end.
[0119] Module combination two includes two channel attention dense blocks and three residual dense modules connected end to end in sequence;
[0120] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0121] The feature map output by the first convolutional module and the feature map output by the convolutional module combination are concatenated to form the low-light enhancement feature map output by the low-light enhancement branch.
[0122] The feature maps output by the first to fourth module combinations are used as prior features and are respectively used as inputs to the concatenated modules in the first to fourth module combinations in the geometric sparse representation branch.
[0123] In this embodiment, the Residual Dense Module (RRDB module) enhances information flow and gradient propagation through multi-level feature extraction and residual connections. Logically, RRDB nests multiple dense blocks together, with each block directly connecting its input and output to enhance feature reuse, while residual learning reduces training difficulty. This effectively improves image quality, especially in terms of detail and texture.
[0124] 3. The fusion of the two branches
[0125] The outputs of the penultimate layer of the low-light enhancement branch and the geometric sparse representation branch are fused using a fusion network.
[0126] The fusion network consists of a combination of modules connected end-to-end and a combination of convolutional modules;
[0127] Module combination three includes a series module and a fusion module connected end to end in sequence;
[0128] A convolutional module combination consists of two convolutional modules connected end-to-end in sequence;
[0129] The low-light enhancement feature map and the enhanced geometric sparse coefficient map are used as inputs to the cascaded module in module combination three; the feature map output by the convolution module combination is used as the enhanced locomotive sand spreading device image output by the fusion network.
[0130] 4. Pay attention to densely packed blocks in the passageway.
[0131] Combination Figure 3 As shown, the channel attention dense block includes two dense modules connected end to end and a channel attention module;
[0132] Dense modules consist of four modules connected end-to-end and a convolutional module; module combination four consists of convolutional modules connected end-to-end and a ReLU activation function layer.
[0133] The channel attention module consists of a global pooling layer, a fully connected layer (FC layer), a ReLU activation function layer, an FC layer, and a Sigmoid activation function layer, which are connected end to end in sequence.
[0134] The original feature map input to the channel attention dense block is concatenated with the feature map output from the first dense module and used as the input to the second dense module; the feature maps input and output from the second dense module are concatenated and used as the input to the channel attention module; the feature maps input and output from the channel attention module are concatenated and then concatenated with the original feature map to obtain the feature map output from the channel attention dense block.
[0135] III. Training the sparse representation branch of geometry
[0136] The specific training steps for training the geometric sparse representation branch based on generative adversarial networks are as follows:
[0137] S2021: Acquiring Low-Light Images I Low and real images And geometric sparse coefficient plots of low-light images and real images;
[0138] S2022: Generator Training: Fix the discriminator parameters; use the geometric sparse coefficient map of the low-light image as input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Based on enhanced geometric sparsity coefficient graph Calculate the generator loss function using the geometric sparse coefficient graph of the real image. and pixel loss function And further calculate the total loss function The generator parameters are updated using the backpropagation algorithm to minimize its total loss function.
[0139] The formula is expressed as:
[0140]
[0141] Where: β GSR and γ GSR These represent the enhanced geometric sparsity coefficient diagrams. Pixel loss weights and adversarial loss weights; GSR(I Low ) and A Low All represent the geometric sparsity coefficients of low-light images; G represents the expected value; GSR D GSRG represents the generator and discriminator, respectively; GSR (GSR(I Low )) and G(A Low Both represent enhanced geometric sparse coefficient maps generated by the generator based on the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image;
[0142] S2023: Training the discriminator: Fix the generator parameters; use the geometric sparse coefficient map of the low-light image as the input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Enhanced geometric sparsity coefficient plot Image reconstruction is performed to obtain the restored image. Restore image and real images Input the discriminator and calculate the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function.
[0143] The discriminator loss function is expressed as follows:
[0144]
[0145] In the formula: Both represent the expected value; This indicates that the discriminator is effective in reconstructing the image. The output probability, i.e., the probability that the discriminator considers the recovered image to be correct. The probability that it is a real image; This indicates that the discriminator recognizes the real image. The output probability, i.e., the probability that the discriminator considers the image to be real. The probability that it is a real image;
[0146] Restore image The calculation formula is expressed as:
[0147]
[0148] In the formula: This represents the value of the enhanced geometric sparsity coefficient map at pixel k. This represents the value of the recovered image at pixel k; This represents the value of the actual image at pixel k; This represents the representation error at pixel k, used to indicate residuals or uncertainties present during image reconstruction.
[0149] S2023: Repeat steps S2021 to S2022 to train the generator and discriminator alternately;
[0150] S2024: Use the completed generator as a branch of the trained geometric sparse representation.
[0151] IV. Training the Low-Light Enhancement Branch
[0152] The low-light enhancement branch is trained using a generative adversarial network. The specific training steps are as follows:
[0153] S2031: Acquire low-light image I Low and real images and the geometric sparse representation branch based on low-light image I Low Enhanced geometric sparse coefficient map generated from geometric sparse coefficient map
[0154] S2032: Training the discriminator: Fix the generator parameters; enhance the geometric sparse coefficient map generated by the low-light image and the geometric sparse representation branch. As input to the generator, a low-light enhancement feature map is generated. Low-light enhancement feature map and real images The input discriminator distinguishes whether the input image is a low-light enhancement feature map generated by the generator or a real image, and calculates the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function.
[0155] The discriminator loss function is expressed as follows:
[0156]
[0157] In the formula: Both represent the expected value; This indicates the probability that the discriminator considers the low-light enhancement feature map generated by the generator to be a real image; This represents the probability that the discriminator considers a real image to be a real image;
[0158] S2033: Training the generator: Fix the parameters of the discriminator; enhance the geometric sparse coefficient map generated from the low-light image and the geometric sparse representation branch. As input to the generator, a low-light enhancement feature map is generated. The generated low-light enhancement feature map With real images The input is fed into the discriminator, and the discriminator's judgment result is obtained; based on the discriminator's judgment result and the low-light enhancement feature map... Compared with the true feature map Calculate the generator loss function for each difference. Perceptual loss function Pixel loss function and the pixel loss function after introducing geometric sparse coefficient map And further calculate the total loss function The generator's parameters are updated using the backpropagation algorithm to minimize its total loss function.
[0159] The formula is expressed as:
[0160]
[0161] In the formula: γ I These represent low-light enhancement feature maps. The pixel loss weight, the pixel loss weight after introducing the geometric sparse coefficient map, and the adversarial loss weight; G(I) represents the expected value; Low ) indicates that the generator is based on the low-light image I Low Generated low-light enhancement feature map; GSR(G(I) Low )) represents the root geometric sparse representation of the branch, which is an enhanced geometric sparse coefficient map generated from the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image; C j W represents the number of feature maps in the j-th layer of the generator; j H represents the width of the feature map of the j-th layer of the generator; j φ represents the height of the feature map of the j-th layer of the generator; J G represents the output of the j-th layer of the generator; G represents the generator; D represents the output of the j-th layer of the generator. I Indicates the discriminator;
[0162] S2034: Repeat steps S2021 to S2022 to train the generator and discriminator alternately;
[0163] S2035: Use the completed generator as the trained low-light enhancement branch.
[0164] V. Target Detection Model
[0165] Combination Figure 4As shown, the backbone network consists of three feature extraction modules connected end-to-end, a pyramid pooling module, and an attention module. The feature extraction module combination consists of a convolutional module and a C2F module connected end-to-end. The attention module consists of two sub-modules: channel attention and spatial attention. In the channel attention module, the input features are max-pooled and average-pooled to obtain two different features, which are then fed into a multilayer perceptron. The two feature maps are then merged, and the merged feature map is fed into the spatial attention module. In this module, the input feature map is max-pooled and average-pooled along the channel axis to obtain two feature maps. These two feature maps are then concatenated, and a convolutional layer with a kernel size of 7 is applied to generate the spatial attention map.
[0166] In this embodiment, both the C2F module and the pyramid pooling module are existing network modules, and their network structure diagrams are as follows: Figure 5 and Figure 6 As shown.
[0167] The neck module consists of an upsampling module, a first cross-layer connection, a first C2F module, a convolution module, a second cross-layer connection, and a second C2F module, which are connected end to end in sequence. The cross-layer connection can concatenate the feature information between different layers, merge the features of different layers, and prevent information loss.
[0168] The head network generates feature maps for predicting categories and bounding boxes, producing the final detection results.
[0169] VI. Training the Target Detection Model
[0170] The classification loss function used when training the object detection model is as follows:
[0171]
[0172] In the formula: L i Let represent the loss for the i-th sample; N represents the total number of samples; y i p represents the true label of the i-th sample; i This represents the probability that the i-th sample, as predicted by the model, belongs to the positive class (the target exists).
[0173] Bounding box regression loss function when training object detection model as follows:
[0174]
[0175]
[0176] In the formula: Indicates the weighting coefficient; Indicates IOU loss; W g H represents the actual frame width.g W represents the actual bounding box height. i H represents the width of the overlapping region. i Indicates the height of the overlapping region; S u This represents the area of the predicted bounding box and the ground truth bounding box; * indicates W. g H g Separate from the computation graph; x represents the x-coordinate of the center point of the predicted bounding box; y represents the y-coordinate of the center point of the predicted bounding box; x gt The x-coordinate of the center point of the true bounding box; y gt The vertical coordinate of the center point of the true bounding box.
[0177] After training, the object detection model is obtained, and its performance is tested using a test dataset. The evaluation metrics are as follows:
[0178] Accuracy: The ratio of the number of correctly detected targets to the total number of detected targets;
[0179] Precision: The ratio of positive samples to samples that are detected as positive out of all positive samples.
[0180] Recall: The ratio of all positive detections to actual positive samples.
[0181] Where TP represents the number of correctly predicted positive samples;
[0182] FP represents the number of positive samples that were incorrectly predicted;
[0183] FN represents the number of incorrectly predicted negative samples;
[0184] F1 score: the harmonic mean of precision and recall.
[0185] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit the technical solutions. Those skilled in the art should understand that any modifications or equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention should be covered within the scope of the claims of the present invention.
Claims
1. An intelligent detection method for locomotive sand-spreading devices under low-light conditions, characterized in that, include: S1: Acquire an image of the locomotive sand spreading device to be inspected; S2: Image enhancement is performed on the image of the locomotive sand spreading device using a low-light enhancement network to obtain an enhanced image of the locomotive sand spreading device; The processing steps of the low-light enhancement network are as follows: S201: Geometric sparsity coefficient diagram of the computer vehicle sand spreading device image; S202: Input the geometric sparse coefficient map into the geometric sparse representation branch and output the corresponding enhanced geometric sparse coefficient map; In step S202, the geometric sparse representation branch includes a first convolutional module connected end to end in sequence, a combination of four modules, a second convolutional module, a combination of convolutional modules, and a third convolutional module; Module combination one includes a series module connected end to end, three RRDB modules and a convolution module; A convolutional module combination consists of two convolutional modules connected end-to-end in sequence; The feature maps output by the first and second convolutional modules are concatenated and used as the input to the convolutional module combination; the output of the convolutional module combination is used as the enhanced geometric sparse coefficient map of the geometric sparse representation branch output. S203: Input the image of the locomotive sand spreading device into the low-light enhancement branch and output the corresponding low-light enhancement feature map; S204: The output of the low-light enhancement branch and the output of the penultimate layer of the geometric sparse representation branch are fused to obtain the corresponding enhanced locomotive sand spreading device image; S3: Input the enhanced image of the locomotive sand spreading device into the trained target detection model, and output the prediction result of the sand spreading pipe area; S4: Output the prediction results of the sand spreading pipe area as the detection results of the locomotive sand spreading device image.
2. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 1, characterized in that: In step S201, the geometric sparsity coefficient map is calculated using the following formula: In the formula: J(a) k ,∈ k ) represents the geometric sparsity coefficient of image I of the locomotive sand spreading device; ω k Represents an image block; a k The geometric sparsity coefficient of pixel k is represented by λ; k represents a pixel; D represents the dictionary image; λ represents a. k The regularization parameter on; ∈ k μ represents the coefficient. k Represents image patch ω k The mean of D in the middle; Represents image patch ω k The mean of I; Represents image patch ω k The variance of D.
3. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 1, characterized in that: In step S203, the low-light enhancement branch includes a first convolutional module, a combination of five modules, a second convolutional module, and a combination of convolutional modules connected end to end in sequence; Module combination two includes two channel attention dense blocks and three residual dense modules connected end to end in sequence; A convolutional module combination consists of two convolutional modules connected end-to-end in sequence; The feature map output by the first convolutional module and the feature map output by the convolutional module combination are concatenated to form the low-light enhancement feature map output by the low-light enhancement branch. The feature maps output by the first to fourth module combinations are used as prior features and are respectively used as inputs to the concatenated modules in the first to fourth module combinations in the geometric sparse representation branch.
4. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 3, characterized in that: In step S204, the outputs of the penultimate layer of the low-light enhancement branch and the geometric sparse representation branch are fused using a fusion network; The fusion network consists of a combination of modules connected end-to-end and a combination of convolutional modules; Module combination three includes a series module and a fusion module connected end to end in sequence; A convolutional module combination consists of two convolutional modules connected end-to-end in sequence; The low-light enhancement feature map and the enhanced geometric sparse coefficient map are used as inputs to the cascaded module in module combination three; the feature map output by the convolution module combination is used as the enhanced locomotive sand spreading device image output by the fusion network.
5. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 3, characterized in that: The channel attention dense block consists of two dense modules connected end-to-end and a channel attention module; Dense modules consist of four modules connected end-to-end and a convolutional module; module combination four consists of convolutional modules connected end-to-end and a ReLU activation function layer. The channel attention module consists of a global pooling layer, a fully connected layer, a ReLU activation function layer, a fully connected layer, and a Sigmoid activation function layer, which are connected sequentially from end to end. The original feature map input to the channel attention dense block is concatenated with the feature map output from the first dense module and used as the input to the second dense module; the feature maps input and output from the second dense module are concatenated and used as the input to the channel attention module; the feature maps input and output from the channel attention module are concatenated and then concatenated with the original feature map to obtain the feature map output from the channel attention dense block.
6. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 3, characterized in that: In step S202, the geometric sparse representation branch is trained based on the generative adversarial network. The specific training steps are as follows: S2021: Acquiring Low-Light Images I Low and real images And geometric sparse coefficient plots of low-light images and real images; S2022: Generator Training: Fix the discriminator parameters; use the geometric sparse coefficient map of the low-light image as input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Based on enhanced geometric sparsity coefficient graph Calculate the generator loss function using the geometric sparse coefficient graph of the real image. and pixel loss function And further calculate the total loss function The generator parameters are updated using the backpropagation algorithm to minimize its total loss function. The formula is expressed as: Where: β GSR and γ GSR These represent the enhanced geometric sparsity coefficient diagrams. Pixel loss weights and adversarial loss weights; GSR(I Low ) and A Low All represent the geometric sparsity coefficients of low-light images; G represents the expected value; GSR D GSR G represents the generator and discriminator, respectively; GSR (GSR(I Low )) and G(A Low Both represent enhanced geometric sparse coefficient maps generated by the generator based on the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image; S2023: Training the discriminator: Fix the generator parameters; use the geometric sparse coefficient map of the low-light image as the input to the generator, and combine it with the prior features of the low-light enhancement branch to generate the enhanced geometric sparse coefficient map. Enhanced geometric sparsity coefficient plot Image reconstruction is performed to obtain the restored image. Restore image and real images Input the discriminator and calculate the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function. The discriminator loss function is expressed as follows: In the formula: Both represent the expected value; This indicates that the discriminator is effective in reconstructing the image. The output probability, i.e., the probability that the discriminator considers the recovered image to be correct. The probability that it is a real image; This indicates that the discriminator recognizes the real image. The output probability, i.e., the probability that the discriminator considers the image to be real. The probability that it is a real image; Restore image The calculation formula is expressed as: In the formula: This represents the value of the enhanced geometric sparsity coefficient map at pixel k. I represents the value of the recovered image at pixel k; Gt (k) represents the value of the real image at pixel k; This represents the representation error at pixel k, used to indicate residuals or uncertainties present during image reconstruction. S2023: Repeat steps S2021 to S2022 to train the generator and discriminator alternately; S2024: Use the completed generator as a branch of the trained geometric sparse representation.
7. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 3, characterized in that: In step S203, the low-light enhancement branch is trained based on a generative adversarial network. The specific training steps are as follows: S2031: Acquire low-light image I Low and real images and the geometric sparse representation branch based on low-light image I Low Enhanced geometric sparse coefficient map generated from geometric sparse coefficient map S2032: Training the discriminator: Fix the generator parameters; enhance the geometric sparse coefficient map generated by the low-light image and the geometric sparse representation branch. As input to the generator, a low-light enhancement feature map is generated. Low-light enhancement feature map and real images The input discriminator distinguishes whether the input image is a low-light enhancement feature map generated by the generator or a real image, and calculates the discriminator loss function. The discriminator parameters are updated using the backpropagation algorithm to minimize the discriminator loss function. The discriminator loss function is expressed as follows: In the formula: Both represent the expected value; This indicates the probability that the discriminator considers the low-light enhancement feature map generated by the generator to be a real image; This represents the probability that the discriminator considers a real image to be a real image; S2033: Training the generator: Fix the parameters of the discriminator; use the low-light image and the geometrically sparse representation branch to generate an enhanced geometrically sparse coefficient map A. En As input to the generator, a low-light enhancement feature map is generated. The generated low-light enhancement feature map With real image I Gt The input is fed into the discriminator, and the discriminator's judgment result is obtained; based on the discriminator's judgment result and the low-light enhancement feature map... Compared with the true feature map Calculate the generator loss function for each difference. Perceptual loss function Pixel loss function and the pixel loss function after introducing geometric sparse coefficient map And further calculate the total loss function The generator's parameters are updated using the backpropagation algorithm to minimize its total loss function. The formula is expressed as: In the formula: γ I These represent low-light enhancement feature maps. The pixel loss weight, the pixel loss weight after introducing the geometric sparse coefficient map, and the adversarial loss weight; G(I) represents the expected value; Low ) indicates that the generator is based on the low-light image I Low Generated low-light enhancement feature map; GSR(G(I) Low )) represents the root geometric sparse representation of the branch, which is an enhanced geometric sparse coefficient map generated from the geometric sparse coefficient map of the low-light image; A graph representing the geometric sparse coefficients of a real image; C j W represents the number of feature maps in the j-th layer of the generator; j H represents the width of the feature map of the j-th layer of the generator; j φ represents the height of the feature map of the j-th layer of the generator; J G represents the output of the j-th layer of the generator; G represents the generator; D represents the output of the j-th layer of the generator. I Indicates the discriminator; S2034: Repeat steps S2021 to S2022 to train the generator and discriminator alternately; S2035: Use the completed generator as the trained low-light enhancement branch.
8. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 1, characterized in that: In step S301, the backbone network includes a combination of three feature extraction modules connected end-to-end, a pyramid pooling module, and an attention module; the feature extraction module combination includes a convolutional module and a C2F module connected end-to-end; the attention module includes two sub-modules: channel attention and spatial attention; in the channel attention module: the input features are max pooled and average pooled to obtain two different features, which are then fed into a multilayer perceptron, and then the two feature maps are merged. The merged feature map is then fed into the spatial attention module, where the input feature map is max pooled and average pooled along the channel axis to obtain two feature maps. These two feature maps are then concatenated, and a convolutional layer with a kernel size of 7 is applied to generate a spatial attention map; In step S302, the neck module includes an upsampling module, a first cross-layer connection, a first C2F module, a convolution module, a second cross-layer connection, and a second C2F module connected sequentially from end to end; the cross-layer connection can splice the feature information between different layers and merge the features of different layers; In step S303, the head network generates feature maps for predicting categories and bounding boxes, producing the final detection results.
9. The intelligent detection method for locomotive sand spreading device in low-light environment as described in claim 8, characterized in that: The classification loss function used when training the object detection model is as follows: In the formula: L i Let represent the loss for the i-th sample; N represents the total number of samples; y i p represents the true label of the i-th sample; i This represents the probability that the model predicts the i-th sample belongs to the positive class; Bounding box regression loss function when training object detection model as follows: In the formula: Indicates the weighting coefficient; Indicates IOU loss; W g Indicates the actual frame width; H g Indicates the actual height of the bounding box; W i H represents the width of the overlapping region. i Indicates the height of the overlapping region; S u This represents the area of the predicted bounding box and the ground truth bounding box; * indicates W. g H g Separate from the computation graph; x represents the x-coordinate of the center point of the predicted bounding box; y represents the y-coordinate of the center point of the predicted bounding box; x gt The x-coordinate of the center point of the true bounding box; y gt The vertical coordinate of the center point of the true bounding box.
Citation Information
Patent Citations
Low-light image enhancement method based on depth Retinex
CN116012260A
Low-light image enhancement method capable of balancing details and brightness of different regions simultaneously
CN117611467A