deepfakes / faceswap-model

Tweaking the generative model
147 stars 133 forks source link

Survey of Model Improvements Proposals #22

Open kvrooman opened 6 years ago

kvrooman commented 6 years ago

Creating a list to organize my own thoughts but I would love to hear everyone else's ideas and suggestions as well as what they're looking at

Ways to improve the faceswap mode( accuracy, speed, robustness to outliers, model convergence )

  1. Improved face detection options ( Current code: dlib/CNN+mmod )

    • MTCNN
    • Mask R-CNN ( would also provide a pixel-by-pixel semantic mask for the face )
    • YOLOv2
  2. Improved face recognition ( Current code: ageitgey/face_recognition )

  3. Improved face alignment ( Current code: 1adrianb/face-alignment )

  4. Add Batch Normalization after Conv and Dense Layers in the autoencoder ( Current code: No norm )

  5. Replace rectifier in the conv layer with more robust alternatives ( Current code: Leaky RELU )

    • PRELU
    • ELU
    • PELU
  6. Adjust learning rate when user changes batch size ( Current code: no LR scaling with batch size )

  7. Explore using other optimizers in autoencoder ( Current code: Adam )

    • SGD with momentum
    • Cyclical Learning Rate
    • L4adam
    • Yellow Fin
  8. Effective learning rate schedule ( Current code: no adjustment of LR after start or at stagnation )

    • best practice is to modify(lower) the learning rate or (raise) the batch size either at set intervals or after the loss has stagnated ( Note: for a constant mini-batch size of say 16 which is limited by GPU memory, you can still increase batch size, i.e. running on multiple GPUs or sequential GPU runs )
    • https://openreview.net/pdf?id=B1Yy1BxCZ
    • also related: model restarting at set intervals with higher LR to kick out of local minimum
    • https://arxiv.org/pdf/1608.03983.pdf
  9. Initial learning rate ( Current code: 5e-5 )

    • Dependent on model architecture ( normalization, batch size, regularization, better rectifiers, optimizers allow you to increase LR with same stability/accuracy
    • Suspect it is too low but current model has few of the tweaks which promote training stability
    • Also highly dependent on default batch size
  10. Use keras.preprocessing.image.ImageDataGenerator ( Current code: random_transform and other )

Threw in a lot, but can add more if anyone ever looks at this. PS - I was looking at 4/5/7/9 with a re-write of the Original_Model

Clorr commented 6 years ago

Very nice info, thanks