Skip to content

Latest commit

 

History

History
96 lines (74 loc) · 4.54 KB

README.md

File metadata and controls

96 lines (74 loc) · 4.54 KB

SwapID by PiktID logo

SwapID by PiktID

SwapID - v3.2.0

Official Website Discord Follow

Face Swap implementation by PiktID (Beta version).

Getting Started

Open In Colab

The following instructions suppose you have already installed a recent version of Python. For a general overview, please visit the API documentation. To use any PiktID API, an access token is required. Moreover, PiktID is currently manually granting access to users.

Step 0 - Register here. 10 credits are given for free to all new users.

Step 1 - Clone the SwapID library

# Installation commands
$ git clone https://github.com/piktid/swapid.git
$ cd swapid

Step 2 - Export the email and password as environmental variables

$ export SWAPID_EMAIL={Your email here}
$ export SWAPID_PASSWORD={Your password here}

Step 3 - You can provide both the absolute path of the target and face image (containing a person). Add the arguments

...
--target_path 'mydir/mytarget.jpg'
or
--face_path 'mydir/mysource.jpg'
...

Alternatively, you can provide the url of the target and face image, as in the default example with the Einstein face on the Monalisa image.

...
--target_url 'https://images.piktid.com/frontend/studio/swapid/target/monalisa.jpg'
or
--face_url 'https://images.piktid.com/frontend/studio/swapid/face/einstein.jpg'
...

Step 4 - Select the endpoint

  • For quick tests on portrait photos, we recommend using the default endpoint argument "swap". A demo of such endpoint is available at swap.piktid.com
  • For robust test on images with multiple persons, we recommend using the endpoint argument "consistent_identities". Such endpoint utilizes the EraseID infrastructure and APIs and it is appropriate for production environments. To try it out, we suggest using the EraseID web-application and click on the consistent identity mode.

Step 5 - Run the main function with the selected endpoint

$ python3 main_swap.py --target_path 'mydir/mytarget.jpg' --face_path 'mydir/mysource.jpg' --endpoint 'swap'

Without any additional argument, SwapID will upload both images into PiktID's servers and provide (read the logs) the codes for both images, which you can reuse for further re-generations (as long as you use the same endpoint), one for the target 'abc' and one for the face 'xyz'. The swap asynchronously elaborates your images. It reads the notifications, and once the swap process is over, it extracts the link of the swapped image.

Step 6 - Rerun the main function with PiktID's codes

$ python3 main_swap.py --target_name 'abc' --face_name 'xyz'

Step 7 - Play with the parameters

If the result is not satisfactory enough, we recommend either using the "consistent_identities" endpoint or changing the seed or strength of the source image (lower strength results in low influence of the source on the output)

$ python3 main_swap.py --target_name 'abc' --face_name 'xyz' --seed 1234 --strength '0.6'

Step 8 - Multiple faces

If you have a target image with multiple subjects, you can use the "consistent_identities" endpoint and tell the system, via the idx_face integer argument, which face to swap. As an example:

$ python3 main_swap.py --target_path 'mydir/mytarget.jpg' --face_path 'mydir/mysource.jpg' --endpoint 'consistent_identities' --idx_face 0

Head Swap

It is also possible to include the hair in the swapping process. To do that, you need to use the "consistent_identities" endpoint and run the command

$ python3 main_swap.py --target_path 'mydir/mytarget.jpg' --face_path 'mydir/mysource.jpg' --endpoint 'consistent_identities' --hair

Skin Swap (Coming soon)

Please contact us for more details.

Contact

[email protected]