Skip to main content
. 2022 Dec 8;22(24):9628. doi: 10.3390/s22249628
Algorithm 1. Ad CycleGAN Optimization
1: for number of epochs do
2:      for number of batches do
3:          Sample minibatch ←xii=1m∈X
4: Sample minibatch ←yjj=1m∈Y
5:          Generate m synthetic samples of Gxand Fy
6:                    synthetic X: X →Gx
7:                    synthetic Y: Y →Fy
8:          Compute the Adversarial loss
9:         LGANG,DY, X,Y=Ey~pymlogDYy+Ex~pxmlog1−DYGx
10:         LGANF,DX, Y,X=Ex~pdataxlogDXx+Ey~pdataylog1−DXFy
11:          Generate m cycle sample of FGxand GFy
12:                    Cycle X: Gx→FGx
13:                    Cycle Y: Fy→GFy
14:          Compute the Cycle loss
15:       LcycG,F=Ex~pxmFGx−x1+Ey~pymGFy−y1
16:           Generate m identical sample of Fxand Gy
17:                    identical X:X →Fx
18:                    identical Y:Y →Gy
19:          Compute the identity loss
20:       LidenG,F=Ex~pxmFx−x1+Ey~pymGy−y1
21:          Compute the criterion loss for cycle sample: Lc−cycle
22:          Compute the criterion loss for identical sample: Lc−identity
23:          Compute the total generator loss
24:      Ltotal=[LGANG,DY, X,Y+LGANF,DX, Y,X]+λLcycleG,F+λLidenG,F+κ(φLc)
25          Update the Discriminator DX and DY
26:                    maxDXLGANF, DX, X, Y
27:                    maxDYLGANG, Dy,X, Y
28:           Update the Generators G, F
29:                    minG,FLG,F,DX, DY
30:    end do
31:  end do