Giter VIP home page Giter VIP logo

headswap-machine's Introduction

Installation and required libs

pip3 install opencv-python
sudo apt-get install libsm6 libxrender1 libfontconfig1
pip install opencv-contrib-python pip3 install -r requirements.txt \

Usage

result = headTransfer.Swap(
source_path='./tests/source_1.jpg', 
ref_path='./tests/target_img.jpg', 
headless_path='./tests/headless_template.jpg',
)
cv2.imwrite("./tests/test_result.jpg", result)

headswap-machine's People

Contributors

ramgendeploy avatar

Stargazers

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

Watchers

 avatar  avatar

headswap-machine's Issues

"test_result.jpg" is showing dark face

Hi Ramgen,
Thanks for your hard work.

I'm very new in this field.
I don't wanted to open new issue but didn't find right way to contact you. By the way I have followed you on twitter just now. I tried your code and found that "test_result.jpg" is showing dark face where as "source_1.jpg" is on fair side. Let me know if something needs to be changed. Attaching all files for your reference.

headless_template
source_1
target_img
test_result

Pretrained Model Not Found!

Hi Ramgen,
Thanks for your hard work.

I'm very new in this field.
I would like to test your code, but the pretrained model path not found:

pretrained_W = "/home/rama/legendfacesPipeline/models/bisenet_pretrained.pth"

Where can I download this model or which models can I use the same with "bisenet_pretrained.pth"?

Thanks!

[Output Image Not Correct] Problems of Landmark Detector

Hi Ramgen,

it's me again โœŒ๏ธ

I'm have been working on your project for a days, but no luck to get the perfect image result.
I can not move the source mask and the crop face into place to make the composition with the headless template.

Maybe the problems is in function : "transformation_from_points":

def transformation_from_points(points1, points2):
points1 = points1.astype(np.float32)
points2 = points2.astype(np.float32)

c1 = np.mean(points1, axis=0)
c2 = np.mean(points2, axis=0)
points1 -= c1
points2 -= c2

s1 = np.std(points1)
s2 = np.std(points2)
points1 /= s1
points2 /= s2

U, S, Vt = np.linalg.svd(points1.T * points2)
R = (U * Vt).T

return np.vstack([np.hstack(((s2 / s1) * R,
                             c2.T - (s2 / s1) * R * c1.T)),
                  np.matrix([0., 0., 1.])])

Could you please explain for me how it work and how to get the perfect result?
Thank you!

test_result

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.