Algorithm 1.
Training ShapeEditor using gradient descent.
|
Input:
Iattr: Image containing attribute information Iid: Image containing identity information P: Identity-attribute image pair space Functions: Encoder ShapeEditor:P Generator G Loss ← Calculate the identity loss between Iid and Iout. Loss ← Calculate the attribute loss between Iattr and Iout. Loss ← Calculate the reconstruction loss between Iid(Iattr) and Iout. Output: I: Image space Potential vector space of StyleGAN Iout: Synthesized face-swapping image |
| 1: for number of training iterations do: |
| 2: for Iid, Iattr randomly selected in training dataset do: |
| 3: Generate the space vector using [Iid, Iattr] |
| 4: ShapeEditor:P |
| 5: Generate the face-swapping image Iout using the space vector |
| 6: G |
| 7: Calculate the identity loss , the attribute loss , and the reconstruction loss |
| 8: Update ShapeEditor with loss |
| 9: end |
| 10: end. |