# Multi-Target Detection Algorithm for Fusion Images Based on an Attention Mechanism
## 3 Dataset Creation
### Fusion Network Training  
It is important to clarify that while the Pix2 Pix model introduced earlier is used solely for data augmentation by generating synthetic infrared images, the following GAN architecture is independently designed to perform the core image fusion task, as described in this section.  
This fusion network learns to integrate complementary features from paired visible and infrared images into a single, perceptually informative fused output. The architecture consists of a generator \(G\), responsible for producing the fused images, and two discriminators \(D_{v}\) and \(D_{i}\), which evaluate whether the fused image preserves the semantic characteristics of the visible and infrared modalities, respectively.  
The training process of this GAN follows the two-timescale update rule (TTUR) [25]. Specifically, the learning rate of the discriminator is set to 0.002, and the generator's learning rate is set to 0.001. The Adam optimizer is used for both components, and the batch size is set to 16 based on available memory resources.  
The training process of GAN are as follows: the training steps for \(G\), \(D_{v}\), and \(D_{i}\) are \(I_{G}\), \(I_{D_{v}}\), and \(I_{D_{i}}\), respectively; \(I_{\text{max}}\) is the maximum number of training steps; \(I_{\text{max}}\) and \(L_{G_{\text{max}}}\) are the stopping criteria.  
1. Initialize the parameters of \(G\), \(D_{v}\), \(D_{i}\);
2. For each training iteration: * Train the discriminators \(D_{v}\) and \(D_{i}\): Randomly select a batch of infrared images \(\{i^{(1)},\dots,i^{(m)}\}\) and their corresponding visible images \(\{v^{(1)},\dots,v^{(m)}\}\). Generate fake data using the generator: \[\{G(v^{(1)},i^{(1)}),\dots,G(v^{(m)},i^{(m)})\}\] Minimize the loss \(L_{D_{v}}\) to update the parameters of \(D_{v}\).  
Figure 3: Partial pictures.  
Minimize the loss \(L_{D_{i}}\) to update the parameters of \(D_{i}\). If \(L_{D_{v}}>L_{\text{max}}\) and \(I_{D_{v}}<I_{\text{max}}\), repeat the update step and increment \(I_{D_{v}}\). If \(L_{D_{i}}>L_{\text{max}}\) and \(I_{D_{i}}<I_{\text{max}}\), repeat the update step and increment \(I_{D_{i}}\).
* Train the generator \(G\): Randomly select a batch of infrared images \(\{i^{(1)},\dots,i^{(m)}\}\) and their corresponding visible images \(\{v^{(1)},\dots,v^{(m)}\}\). Generate fake data using the generator: \[\{G(v^{(1)},i^{(1)}),\dots,G(v^{(m)},i^{(m)})\}\] Minimize the loss \(L_{G}\) to update the parameters of \(G\). If \(L_{G}>L_{c_{\text{max}}}\) and \(I_{G}<I_{\text{max}}\), repeat the update step and increment \(I_{G}\).
* End the training when the maximum number of iterations or stopping criteria is met.  
After 100 rounds of training, the loss change curve in the training process after smoothing is shown in Figure 4.  
It can be observed from the figure that the loss of the generator gradually decreases with the increase in the number of training rounds and eventually stabilizes. This shows that the generator gradually learns the ability to generate more realistic samples during the training process, and the training process has achieved good results.