Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Face Swapping Inference

Yuval Nirkin edited this pageNov 20, 2022 ·3 revisions

First make sure you have all the latest version models infsgan/weights directory. Fill outthis form, placedownload_fsgan_models.py in the root directory of the fsgan repository, and run:

python download_fsgan_models.py

Simple usage

The swap inference script can be called using the following template:

python swap.py SOURCE -t TARGET -o OUTPUT [FLAGS]

Forbest quality follow this example:

# From FSGAN's root directorypython fsgan/inference/swap.py docs/examples/shinzo_abe.mp4 -t docs/examples/conan_obrien.mp4 -o. --finetune --finetune_save --seg_remove_mouth

Example
finetune: enable an initial finetuning stage of the reenactment generator
finetune_save: save the finetuning weights to the cache directory
seg_remove_mouth: remove the inner part of the mouth from the segmentation mask

Forbest performance follow this example:

# From FSGAN's root directorypython fsgan/inference/swap.py docs/examples/shinzo_abe.mp4 -t docs/examples/conan obrien.mp4 -o . --seg_remove_mouth

Additional output options

Output cropped video:

# From FSGAN's root directorypython swap.py docs/examples/shinzo_abe.mp4 -t docs/examples/conan_obrien.mp4 -o. --output_crop -f -fs -srm

Example

Output cropped video with together with the queried source frames from the appearance map and the target frame:

# From FSGAN's root directorypython fsgan/inference/swap.py docs/examples/shinzo_abe.mp4 -t docs/examples/conan_obrien.mp4 -o. --verbose 1 -f -fs -srm

Example
First three columns are the queried source frames, the 4th column is the result, and the last column is the target frame.

Output all available information including intermediate stages (useful for debugging):

# From FSGAN's root directorypython fsgan/inference/swap.py docs/examples/shinzo_abe.mp4 -t docs/examples/conan_obrien.mp4 -o. --verbose 2 -f -fs -srm

ExampleLeft: the appearance map. The green dots represent the source views (after filtering close views),the blue lines represent the the Delaunay triangulation, the yellow dots represent the current queried views,and the red X represent the current target pose. Right: The first column is the same as the above output. Thesecond column includes: reenactment result after barycentric coordinates interpolation, completion result,the completed face transferred onto the target image, soft mask used for combining the blending result with thetarget frame, and finally the target segmentation.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp