# Cycle Consistent Generative Motion Artifact Correction in Coronary Computed Tomography Angiography
## 3 Methodology
### Training and Applying the Cycle Consistent Generative Motion Artifact Correction Network  
The proposed CycleGAN model is designed for image-to-image translation. It learns the pixel mapping and color distributions of the source and target patches for subsequent data synthesis. Typically, the GAN model comprises of two deep learning models--a generator model and a discriminator model. The learning process alternates between updating the generator to trick the discriminator more effectively and updating the discriminator to better identify generated images as real or fake, such that at the end the generator synthesizes realistic images.  
As depicted in Figure 4, the training process of the CycleGAN aims to map features from source images X, and target images Y to accurately synthesize realistic RCA. In our study, source domain X images are the motion-perturbed patches, while the SynGT, from the previous step, are the target domain Y images. This method involves two cyclic image mapping functions (generators), denoted as \(G:X\to Y\) and \(F:Y\to X\), and two discriminators, denoted as \(D_{x}\) and \(D_{y}\). In the CycleGAN architecture, the mapping functions \(G\) and \(F\) exhibit cycle consistency, signifying that the image translation cycle can restore an image \(x\) from domain \(X\) back to the original image (\(F(G(x))\to x\)), and similarly, it can restore an image \(y\) from domain \(Y\) back to the original image (\(G(F(y))\to y\)).  
Our proposed CycleGAN framework utilizes a ResNet6-based generator that features six residual blocks. Each block comprises convolutional layers with skip connections, allowing for efficient gradient flow during training. The generator utilizes a series of deconvolutional layers for upsampling, progressively refining the translated images. The number of filters in the first convolutional layer is set to 64. The cycle-consistency loss \(\mathcal{L}_{\text{cyc}}\) for the generator is mathematically defined as:  
\[\mathcal{L}_{\text{cyc}}(G,F,X,Y) =\mathbb{E}_{x\sim p_{\text{data}}(x)}[\|F(G(x))-x\|_{1}]\] \[\quad+\mathbb{E}_{y\sim p_{\text{data}}(y)}[\|G(F(y))-y\|_{1}]\]  
For the discriminator, we have adopted a 70\(\times\)70 PatchGAN model. This divides the input image into non-overlapping patches of 70\(\times\)70 pixels, evaluating each independently. Mathematically, the adversarial loss \(\mathcal{L}_{\text{GAN}}\) for the discriminator is defined as:  
\[\mathcal{L}_{\text{GAN}}(D,X,Y) =\mathbb{E}_{y\sim p_{\text{data}}(y)}[\log D_{Y}(y)]\] \[\quad+\mathbb{E}_{x\sim p_{\text{data}}(x)}[\log(1-D_{Y}(G(x)))]\]  
This approach provides fine-grained feedback, enabling the generator to focus on localized details and reducing computational complexity. The model undergoes training for a total of 100 epochs with an initial learning rate set at 0.0002. Following this initial training phase, the learning rate is linearly decayed to zero over the next 200 epochs. Figure 5 provides a detailed illustration of the layers within the described generator and discriminator architecture.  
We chose CycleGAN because of (1) its cycle consistency, which means that after translating patches to correct motion artifacts, the reverse translation should bring them back to their original state, helping in maintaining relevant anatomical details while mitigating artifacts, and (2) PatchGAN's ability to handle patch-wise translations, which aligns well with the need to correct artifacts in only specific regions of the image.  
Figure 4: A schematic of our proposed method based on CycleGAN [20].