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 xApdataA(x),xBpdataB(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,LGadvA12DψAxA12+12DψAxBA2,12DψAxBA12
    LDadvB,LGadvB12DψBxB12+12DψBxAB2,12DψBxAB12
    ψAdamψA,ψB1mi=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,LsABsBAsA1,sABsB1
    LcBA,LcABcBAcB1,cABcA1
    LcycABA,LcycBABxABAxA1,xBABxB1
    LiAA,LiBBxAAxA1,xBBxB1
    ΣcB,ΣcA=ComputeCovariance(cB),ComputeCovariance(cA)
    RwB,RwAΣcBI1,ΣcAI1
    UDA,UDB=sACT,sBCT
    DA,DB=ComputeL2Norm(sACT),ComputeL2Norm(sBCT)
    UA,UB=UDADA,UDBDB
    RcA,RcBUATUAI1,UBTUBI1
    ϕ,θAdam(ϕsA,ϕsB,ϕcA,ϕcB,θA,θB1mi=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