# Development of Artificial Intelligence-Based Dual-Energy Subtraction for Chest Radiography
## 2 Materials and Methods
### AI-DES Development
#### 2.1.1 AI Network  
We employed pix2 pix for our AI network to convert high-energy images into low-energy images. This is a variant of a conditional generative adversarial network (cGAN) [35]. Unlike a typical cGAN that produces images from a random noise vector, the generator of pix2 pix takes images as input and transforms them into images of a different domain by learning the relationship between the two domains [32]. The discriminator receives an image pair of two domains and attempts to determine whether the pair is real or fake. Figure 1 illustrates the pix2 pix network used in this study. The generator learns to convert high-energy images into virtual low-energy images similar to the corresponding real low-energy images. Simultaneously, the discriminator aims to distinguish between the pair of real high-energy and virtual low-energy images and the pair of real high-energy and low-energy images. The learning process is expressed as a min-max game with an adversarial loss function given by  
\[\min_{G}\max_{D}L_{cGAN}(G,D)=\mathop{\mathbb{E}}_{\mathbf{x}\sim\mathbb{P}_{high }\mathbf{y}\sim\mathbb{P}_{low}}[\log D(\mathbf{x},\mathbf{y})]+\mathop{\mathbb{E}}_\mathbf{{x}\sim\mathbb{P}_{high}}[\log(1-D(\mathbf{x},G(\mathbf{x})))], \tag{1}\]  
where \(\mathbf{x}\sim\mathbb{P}_{high}\) represents high-energy images, \(\mathbf{y}\sim\mathbb{P}_{low}\) represents low-energy images, \(G\) is the generator, and \(D\) is the discriminator [34]. \(G\) attempts to minimize Equation (1), while \(D\) attempts to maximize it. Pix2 pix also imposes a constraint on the L1 distance between the generated and real images to make the generator produce images that are closer to the ground truth, as follows:  
\[L_{1}(G)=\mathop{\mathbb{E}}_{\mathbf{x}\sim\mathbb{P}_{high}\mathbf{y}\sim\mathbb{P} _{low}}[||y-G(\mathbf{x})||_{1}]. \tag{2}\]  
Thus, the objective function of pix2 pix can be expressed as:  
\[G^{*}=\min_{G}\max_{D}L_{cGAN}(G,D)+\lambda L_{1}(G), \tag{3}\]  
where \(\lambda=100\) was used in this study. We implemented the pix2 pix network by modifying a publicly available code [36]. Specifically, we changed the resolution of each layer of the generator and discriminator to produce images with a resolution of \(1024\times 1024\). Otherwise, the same architecture as the original pix2 pix [32] was used. The details are described below and in Section 2.3. Figure 2 and Table 1 show the generator network architecture in AI-DES. The generator has a 16-layer U-Net [37] structure with symmetric encoder and decoder parts. The encoder part has eight layers, consisting of two-dimensional convolution (Conv2d: kernel size = 4, stride = 2, padding = 1), batch normalization (BN), and a LekyReLU activation function. The decoder part also has eight layers, consisting of two-dimensional deconvolution (Deconv2d: kernel size = 4, stride = 2, padding = 1), BN, and a ReLU activation function. Dropout layers were inserted between the first and second, second and third, and third and fourth layers of the decoder part. The tanh activation function was applied to the final layer to output the virtual low-energy images. Most importantly, the U-Net architecture has skip connections that concatenate the mirrored encoder and decoder layers to recover high-frequency components. The discriminator has five convolutional neural network (CNN) layers, as shown in Figure 3 and Table 2. The first layer takes six channels, since the discriminator receives a pair of two images, each with three channels. The first through third layers downsample the feature maps using Conv2d (kernel size = 4, stride = 2, padding = 1), while the fourth and final layers reduce the map resolution by one pixel using Conv2d (kernel size = 4, stride = 1, padding = 1). The discriminator employs the PatchGAN [38] approach to evaluate multiple image patches and averages the loss over the output map (126 \(\times\) 126 \(\times\) 1) to distinguish between real and virtual images. Figure 1: AI network diagram using pix2 pix.