Skip to main content
. 2020 Oct 2;20(19):5647. doi: 10.3390/s20195647
Algorithm 1: Unsupervised Virtual Try-on (UVIRT)
Require: The weight of latent L1 loss λlatent, the weight of pixel L1 loss λpixel, the weight of whitening regularization loss λw, the weight of coloring regularization loss λc, the batchsize m, Adam hyperparameters αβ1,β2
Require: Initial style and content encoder parameters in domain A and B ϕsA,ϕsB,ϕcA,ϕcB, initial decoder parameters in domain A and BθA,θB, initial discriminator parameters in domain A and B ψA,ψB
 whileϕ,θ has not converged do
  for i=1,…,m do
   Sample each domain real data xA∼pdataA(x),xB∼pdataB(x)
    sA,sB=StyleEncoderϕsA(xA),StyleEncoderϕsB(xB)
    cA,cB=ContentEncoderϕcA(xA),ContentEncoderϕcB(xB)
    cBA,cAB=GDWCTθA(cB,sA),GDWCTθB(cA,sB)
    xBA,xAB=DecoderθA(cBA),DecoderθB(cAB)
    LDadvA,LGadvA←12DψAxA−12+12DψAxBA2,12DψAxBA−12
    LDadvB,LGadvB←12DψBxB−12+12DψBxAB2,12DψBxAB−12
    ψ←Adam∇ψA,ψB1m∑i=1mLDadvA+LDadvB,ψA+ψB,α,β1β2
    sBA,sAB=StyleEncoderϕsA(xBA),StyleEncoderϕsB(xAB)
    cBA,cAB=ContentEncoderϕcA(xBA),ContentEncoderϕcB(xAB)
    cABA,cBAB=GDWCTθA(cAB,sBA),GDWCTθB(cBA,sAB)
    xABA,xBAB=DecoderθA(cABA),DecoderθB(cBAB)
    cAA,cBB=GDWCTθA(cA,sA),GDWCTθB(cB,sB)
    xAA,xBB=DecoderθA(cAA),DecoderθB(cBB)
    LsBA,LsAB←sBA−sA1,sAB−sB1
    LcBA,LcAB←cBA−cB1,cAB−cA1
    LcycABA,LcycBAB←xABA−xA1,xBAB−xB1
    LiAA,LiBB←xAA−xA1,xBB−xB1
    ΣcB,ΣcA=ComputeCovariance(cB),ComputeCovariance(cA)
    RwB,RwA←ΣcB−I1,ΣcA−I1
    UDA,UDB=sACT,sBCT
    DA,DB=ComputeL2Norm(sACT),ComputeL2Norm(sBCT)
    UA,UB=UDADA,UDBDB
    RcA,RcB←UATUA−I1,UBTUB−I1
    ϕ,θ←Adam(∇ϕsA,ϕsB,ϕcA,ϕcB,θA,θB1m∑i=1mλlantentLsBA+LsAB+LcBA+LcAB+
    λpixelLcycABA+LcycBAB+LiAA+LiBB+λwRwB+RwA+λcRcB+RcA+LDadvB+LGadvB,
    ϕsA+ϕsB+ϕcA+ϕcB+θA+θB,α,β1β2)
   end for
 end while