Giter Club home page Giter Club logo

faceswap's People

Contributors

matthewearl avatar svezina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

faceswap's Issues

Quick question if possible.

Much appreciate the code and the extensive guide. I had a simple question that hopefully will not consume too much of your time.

Is it possible to change the size of the output image? So that all faces are aligned in the same box, but they have the rest of the image extending outward (to a user defined extent)

Thanks!

TypeError: points data type = 9 is not supported

Was wondering if anyone else got this error...

Here is the full traceback:

File "./faceswap.py", line 208, in
mask = get_face_mask(im2, landmarks2)
File "./faceswap.py", line 120, in get_face_mask
color=1)
File "./faceswap.py", line 111, in draw_convex_hull
points = cv2.convexHull(points)
TypeError: points data type = 9 is not supported

How to show the keypoints?

In faceswap.py there is this chunk of code:

def annotate_landmarks(im, landmarks):
    im = im.copy()
    for idx, point in enumerate(landmarks):
        pos = (point[0, 0], point[0, 1])
        cv2.putText(im, str(idx), pos,
                    fontFace=cv2.FONT_HERSHEY_SCRIPT_SIMPLEX,
                    fontScale=0.4,
                    color=(0, 0, 255))
        cv2.circle(im, pos, 3, color=(0, 255, 255))
    return im

Which I assume was used to generate like this image. However, the code was never used and despite my attempts I can't seem to get it working. Can you show me how it worked?

correct_colours acts strangely in mouth area

I've noticed that the correct_colours routine is misbehaving in the mouth area. Here's an example with Kanye West’s body and a replacement face image:

input_sized
transformed

You will get this output, where the lips appear white:

out1

This shows just the transformed output by setting the output of get_face_mask() to all white:

out3

And here is what the faceswap looks like if the correct_color step is skipped:

out5


Here is a second example with Gwyneth Paltrow's body and a replacement face.

input_image
transformed

The colour correction this time causes a crazy bloody mouth look:

final_image

Turning off colour correction fixes this:

out2


I might look into this more and be able to offer a pull request to tweak the correct_colours() routine to fix this, but wanted to go ahead and report the issue.

Cropping the eyes

Hello, I need to extract the eyes out of the input image, my goal is to later classify if the eyes are closed or open. So far I could do that with haar eye-cascade but the results are poor, so I been searching for another method and came across your code. Great code btw!
And since your code can place the landmarks, and you even know the range list of the eyes it shouldnt be hard to crop the eyes, I tried several changes but I couldnt get it to work.
So if you are willing could you give me a hand with that?
Thank you

IndexErroe:list index out of bound

Hi,
I an new to python and I am getting error like in line no. 202 im1, landmarks1 = read_im_and_landmarks(sys.argv[1]) IndexError: list index out of range. Please can any one tell me how to fix this error.

Thanks in advance..

How to swap partial face ?

The code is perfect to swap whole face to whole face.

But who knows how to swap partial face to whole face?

a few bugs fixed!

Hi Matthew,
Great piece of code. And thanks for putting this together from the Switching Eds blog post.

And I found some wrong in the codes, its confused me a lot, then i fixed that. See below.
im1 ---
001_im1

im2 ---
002_im2

output ---
009_output_im_t

======================
that's because output_im(type is np.float64), some pixels value out of range(0~255)!!!
We only need to add two line scripts as below to before this code line output_im_t = output_im.astype(np.uint8) .

output_im = np.maximum(output_im, 0) output_im = np.minimum(output_im, 255)

that's make it! :)
008_output_im

Changing the mask shape

Hello, I was wondering how to change the shape of the mask to something like an eclipse instead of a convex polygon. Or is there a way I can fit an eclipse around the convex polygon and then have that eclipse that be polyfilled.

C++ / Replace Numpy

Hey Matthew,

Hope u are doing well !

Do u have a c++ version of your face swap demo with the camera stream ?
How would be u replace numpy ?

Cheers,
Luc Michalski

Face swap!

hello,
I'm a beginner. For the two images as input , after detecting human faces in the images I need to swap those human faces. I could do the detecting part...But need to swap the human faces. Can anyone help me how to begin and combine the code of face detection with face swap?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.