3.2. Light-Aware Module (LAM)
A key advantage of fusing visible light with infrared thermal images is the ability to maintain detection capabilities even under poor lighting conditions. Generally, when lighting is sufficient, visible light images alone are adequate for recognizing and distinguishing pedestrians or other objects. However, in low-light conditions or when there is no external light source, infrared thermal images become the primary source for detecting pedestrians. It is evident that lighting conditions determine the modality dependency. However, pedestrian detection models cannot adaptively adjust the degree of reliance on different modalities based on lighting conditions. Therefore, we introduce a light-aware module, the structure of which is shown in
Figure 2. The key innovation of the proposed LMB-Net lies in constructing a light-aware modality balancing framework that adaptively adjusts the contributions of visible and thermal infrared modalities under varying illumination conditions, which is fundamentally different from the fixed or equal-weight fusion strategies widely adopted in previous works. This module captures differences in lighting conditions based on the visible light image, thereby outputting corresponding light-aware balance parameters. These parameters are utilized within the module to adjust the weights of features derived from visible light and infrared thermal modalities.
The preprocessing stage in
Figure 2 is responsible for uniformly resizing all images input to the light-sensing module to a fixed dimension. Since assessing the overall brightness of an image does not depend on image details, this preprocessing step effectively reduces the number of network parameters and improves computational speed. The images are then fed into convolutional blocks, which consist of convolutional layers, batch normalization layers and activation layers; each convolutional block is followed by a max-pooling layer to further reduce the spatial dimensions of the feature maps.
Pday and
Pnight represent the predicted values for daytime and night-time, respectively. As public datasets lack labels regarding light intensity, and since light intensity is a relatively subjective perception with a high degree of uncertainty in manual labeling, this module uses the time at which the image was captured as the standard for corresponding light intensity. Specifically, if the capture time is during the day, this indicates sufficient light, meaning that
Pday should output a relatively higher score; conversely, at night,
Pnight should have a higher value. The output of this branch will be compared with the actual value, thereby updating the module’s parameters. Since
Pday and
Pnight are intended to reflect actual light intensity, their output ranges tend to be close to 1 or 0, making them unsuitable for use directly in the model’s internal adjustment parameters. To address this, the light-aware module utilizes the output from the second branch to adjust the light balance parameters within the pedestrian detection model. The post-processing at the end of this branch adjusts the predicted scores based on a benchmark of 0.5, ensuring the results do not deviate excessively. The adjustment formula is shown below.
where
f refers to the features input into the post-processing module;
θ and
β are two learnable parameters within the post-processing module, initialized to 1 and 0, respectively. The final output, the daytime confidence score
Wd, provides the light balance parameter for the model’s internal detection head.
3.3. Alignment Complementary Fusion Module (ACF)
To optimize the integration of information from the visible light and infrared thermal image modalities, we design an alignment complementary fusion module (ACF), which aims to efficiently fuse the features of two image types. Given the potential spatial misalignment between visible light and infrared thermal images, ACF specifically introduces a deformable convolution operation, aiming to adaptively learn spatial deformations without the need for additional supervision, thereby addressing potential spatial misalignment challenges. Furthermore, to ensure the quality of the fused features and maintain the network’s overall performance, we adopt the concept of a residual structure, ensuring that the fused features can be seamlessly integrated into the encoder branch.
Figure 3 provides a visual representation of the module’s architecture and working principle.
In
Figure 3, we demonstrate how to fuse features from the two modal branches (visible light and infrared thermal) using the feature outputs from each stage of
fRGB and
fT by DConv operation. Taking the visible light features as an example, we first calculate the difference between
fRGB and
fT, aiming to emphasize the complementarity between the two modalities. We apply mixed pooling (Mix-P) [
22] and the tanh activation function (
θ) to this difference, thereby obtaining a complementary weight
WRT. For the infrared thermal branch, the corresponding complementary weight is denoted as
WTR. We then multiply
WRT by the original visible light feature
fRGB and add the result to the infrared thermal feature
fT to generate a fused feature
. For the infrared thermal feature branch, we follow exactly the same procedure, except that the roles of the weights and features are swapped.
Figure 4 illustrates the key components of the deformable convolution operation, in which the size and shape of the kernel are variable. The figure clearly demonstrates how offsets are computed on the input feature map via a convolution layer. Specifically, this additional convolution layer generates an offset feature map with the same spatial dimensions as the input feature map, but with double the number of channels. The additional channels are used to predict offsets in the X and Y directions. These offsets are not fixed but are learned alongside the main task. In this way, deformable convolution can dynamically adjust its sampling positions to better accommodate the deformations and diversity of object shapes within an image. This plug-and-play nature enables deformable convolution to be easily integrated into various existing convolutional neural network architectures, thereby enhancing the network’s ability to process complex image features.
Deformable convolution is used to enhance the deformation modeling capabilities of convolutional neural networks. When discussing the role of convolution in image processing, traditional methods tend to sample at fixed grid points on the feature map. The consequence of this strategy is that, within each convolutional layer of a CNN, the internal activation units (neurons) possess receptive fields of identical size. They cover and influence regions of the same size within the input image. However, as the sizes and shapes of objects in the real world vary greatly, this rigidity inherent in traditional convolution limits its ability to effectively handle spatial deformations. To overcome this limitation, researchers have introduced the concept of deformable convolution, an improvement that incorporates the flexibility of two-dimensional spatial displacement into the sampling framework of traditional convolution. In this way, deformable convolution can better adapt to the diversity of objects within an image, enhancing the model’s ability to handle spatial deformations.
Figure 4 illustrates the styles of traditional convolution kernels alongside various styles of deformable convolution. In convolutional neural networks, traditional convolution operations are constrained by their fixed sampling positions, resulting in a fixed receptive field for the convolution kernel. However, objects in real-world scenarios often vary in shape and size, requiring convolution operations to possess greater flexibility. Consequently, deformable convolution was developed, with its key feature being the introduction of dynamically adjustable displacements. These displacements are not predefined but are learned by the network during training. This means that deformable convolution kernels can adaptively adjust their shape and size according to the requirements of the actual task, thereby better capturing features within images. This adaptability enables deformable convolution, in theory, to handle deformations of arbitrary shapes, thereby enhancing the model’s ability to process complex image features.
3.4. Detection Head
The pedestrian detection model described in this study outputs the location and class information of pedestrians in an image via detection heads. Localization predictions are used to precisely localize the position of pedestrians within the image, while classification predictions are used to identify the class of the target, such as pedestrians or vehicles. This model design incorporates four independent detection heads, each responsible for generating detection boxes of specific scales and aspect ratios. Through this design, the model can effectively capture the location and category information of pedestrian targets at different scales, thereby improving the accuracy and robustness of detection.
Each detection head focuses on multimodal feature detection at a specific scale, and the results from the four stages are merged to form the final detection output. This design allows the model to perform more aggressive weight reduction. Through the modal balance weights of the light-sensing module, it automatically adjusts the ratio of the two modal features and generates two sets of category-position outputs. In
Figure 5,
Wd represents the parameter obtained by the light-aware module from the visible light image. This can be understood as the degree of confidence we can place in the visible light image under the current lighting conditions. The confidence level of the infrared thermal image is calculated as
Wn = 1 −
Wd. These are weighted with the visible light and infrared thermal features respectively, yielding the weighted visible light feature
and the weighted infrared thermal feature
. Concatenating these two features and feeding them into the convolutional block yields
. We can see that a single detection head ultimately generates two sets of location-type results: one set is derived from the concatenated modal features, whilst the other is obtained by concatenating the unmerged modal information and then applying a convolutional operation.
3.5. Loss Function
In the final detection model, we define a total loss
Ltotal, which consists of three key components: the light-aware loss
L1, the classification loss
Lcls, and the localization loss
Lreg. Together, these form the optimization objective during model training, and their mathematical expressions are as follows:
where hyperparameter
λ is set to 1. Within the detection model’s loss function, the light-aware loss plays a crucial role and is expressed as
which is based on the daytime prediction and night-time prediction
Pnight output by the light-aware module, as well as the corresponding ground-truth time-slot labels
Yday and
Ynight. Specifically, when an image is actually captured during the day, the true label
Yday is 1, while
Ynight is 0. Conversely, when an image is captured at night,
Yday is 0, while
Ynight is 1. The calculation of the light-aware loss
L1 takes into account the differences between true labels and the predicted values, thereby ensuring that the model can accurately determine whether an image was captured during the day or at night.
In the loss function of the detection model, the classification loss
Lcls and the localization loss
Lreg each comprise two sets, reflecting the two distinct sets of outputs from the alignment detection module.
The first set of classification loss Lcls1 is calculated based on the first set of outputs from the detection head. The second set of classification loss Lcls2 is calculated based on the second set of outputs from the detection head. Similarly, for the localization loss, there are also two sets, including Lreg1 and Lreg2, which correspond to the localization losses of the two sets of detection results from the detection head, respectively. This design enables the model to evaluate the performance of the two sets of outputs more comprehensively and to optimize them simultaneously during training, thereby improving overall detection accuracy.
When discussing classification loss, as the calculation formulas for the two sets of classification loss (
Lcls1 and
Lcls2) are identical, we will present the definition and calculation process for classification loss collectively to simplify the explanation. Classification loss typically employs focal loss [
23] as a metric, which is used to quantify the discrepancy between the model’s predicted classification results and the true labels.
By minimizing this loss function, we can optimize the model parameters and improve the performance of the classification task. We define as the predicted classification probability for the i-th detection box. To balance the contribution of positive and negative samples to the loss, we introduce a balancing factor α. To modulate the weight of hard-to-classify samples, we use a modulation coefficient γ. These two factors play a crucial role in the loss function, helping the model to better handle samples of different classes. The optimal values of α and γ in the unite loss function can be deduced as 0.1 and 1, respectively.
Localization loss is typically used to measure the discrepancy between the model’s predicted detection box position and the ground-truth detection box position.
We define
as the parametric coordinate offset of the model’s output for the
i-th detection box. This represents the relative positional difference between the model’s predicted detection box and the predefined anchor box. Correspondingly,
denotes the true parametric coordinate offset of the
i-th detection box, i.e., the relative positional difference between the true detection box and the corresponding anchor box.
For any given detection box in the detection model, the predicted parametric coordinate offsets are typically calculated based on the model output and the predefined anchor box. These parametric coordinate offsets are calculated as follows:
The parametric coordinate offsets typically involve the center x-coordinate, center y-coordinate, width, and height of the detection box. These coordinates and dimensions are usually compared with a predefined anchor box. Specifically, let denote the center x-coordinate, center y-coordinate, width, and height of the detection box, respectively, while the subscript a represents the anchor box, i.e., denote the center x-coordinate, center y-coordinate, width, and height of the anchor box, respectively.
In the calculation of the localization loss, to avoid the shortcomings of both
L1 and
L2 losses, we typically employ the
loss.
It smoothly combines the characteristics of L1 and L2 losses, namely, it exhibits the behavior of L2 loss (small gradient) where the error is close to zero, and the behavior of L1 loss (constant gradient) where the error is large, thereby avoiding the vanishing gradient problem.