ondyari / FaceForensics

Github of the FaceForensics dataset
http://niessnerlab.org/projects/roessler2018faceforensics.html
Other
2.34k stars 529 forks source link

faceswap.py doesn't work #32

Open balokume opened 4 years ago

balokume commented 4 years ago

I'm using the dataset\FaceSwapKowalski\faceswap.py to recreate some face swapping results. However, the "utils.getShapeTextureCoords" function doesn't exist in the original https://github.com/MarekKowalski/FaceSwap repo. I think the following code needs to be added to FaceSwap/utils.py

def getShapeTextureCoords(keypoints, mean3DShape, blendshapes, idxs2D, idxs3D):
    projectionModel = models.OrthographicProjectionBlendshapes(blendshapes.shape[0])
    modelParams = projectionModel.getInitialParameters(mean3DShape[:, idxs3D], keypoints[:, idxs2D])
    modelParams = NonLinearLeastSquares.GaussNewton(modelParams, projectionModel.residual, projectionModel.jacobian, ([mean3DShape[:, idxs3D], blendshapes[:, :, idxs3D]], keypoints[:, idxs2D]), verbose=0)
    textureCoords = projectionModel.fun([mean3DShape, blendshapes], modelParams)
    return textureCoords 
fiona-lxd commented 4 years ago

def getShapeTextureCoords(keypoints, mean3DShape, blendshapes, idxs2D, idxs3D): projectionModel = models.OrthographicProjectionBlendshapes(blendshapes.shape[0]) modelParams = projectionModel.getInitialParameters(mean3DShape[:, idxs3D], keypoints[:, idxs2D]) modelParams = NonLinearLeastSquares.GaussNewton(modelParams, projectionModel.residual, projectionModel.jacobian, ([mean3DShape[:, idxs3D], blendshapes[:, :, idxs3D]], keypoints[:, idxs2D]), verbose=0) textureCoords = projectionModel.fun([mean3DShape, blendshapes], modelParams) return textureCoords

Hi, have you find out how to make eyes blinking with faceswap? This repo can't swap the face with opened eyes to pics with eyes closed, but the example gif can.

balokume commented 4 years ago

Have you tried some more examples? I think that's because the landmark detector isn't very accurate sometimes.

fiona-lxd commented 4 years ago

Have you tried some more examples? I think that's because the landmark detector isn't very accurate sometimes.

Yes, I have tried lots of cases. But no one changed eyes.

balokume commented 4 years ago

Have you tried some more examples? I think that's because the landmark detector isn't very accurate sometimes.

Yes, I have tried lots of cases. But no one changed eyes.

I think this is the limitation of the method. The eyes are copied without warping.