Skip to main content
. 2021 Nov 8;21(21):7405. doi: 10.3390/s21217405
Algorithm 1: Modified Algorithm Training Loop Pseudocode
1: Draw a minibatch of samples {XAB(1),..., xAB(m)} from domain X
2: Draw a minibatch of samples {Y(1),..., y(m)} from domain Y
3: Compute the discriminator loss on real images:
IrealD=1mi=1mDAAi12 + 1ni=1nDBBj12
4: Compute the discriminator loss on fake images:
    IfakeD=1mi=1mDBGABAi 2 + 1nj=1nDAGBABj 2
5: Update the PatchGAN discriminator
6: Apply Attention to the Generator
        qattl=ψTσ1WxTxil+WgTgi+bg+bψ)
            αil=σ2qattlxil,gi; Θatt
7: Compute the B → A generator loss:
         JGBA=1nj=1nDAGBABj1)2+JBA
8: Compute the A → B generator loss:
         JGAB=1mi=1mDBGABAi1)2+JAB
9: Update the generator