This is an unofficial implementation of Lingzhi Li, Jianmin Bao, Ting Zhang, Hao Yang, Dong Chen, Fang Wen, Baining Guo: Face X-Ray for More General Face Forgery Detection. CVPR 2020: 5000-5009.
Users can use following command to install Dependancies:
pip install -r requirements.txt
Users can use the following command to get usage:
>> python main.py -h
usage: main.py [-h] --background_img_path BACKGROUND_IMG_PATH --img_db_path IMG_DB_PATH
--output_img_path OUTPUT_IMG_PATH --output_xray_path OUTPUT_XRAY_PATH
optional arguments:
-h, --help show this help message and exit
--background_img_path BACKGROUND_IMG_PATH, -b BACKGROUND_IMG_PATH
background images floder path
--img_db_path IMG_DB_PATH, -i IMG_DB_PATH
image database for key-points-nearest-search
--output_img_path OUTPUT_IMG_PATH, -oi OUTPUT_IMG_PATH
output blended image folder path to store output
--output_xray_path OUTPUT_XRAY_PATH, -ox OUTPUT_XRAY_PATH
output x-ray folder path to store output
- --background_img_path: the background images database searched by our algorithm.
- --img_db_path: target face images.
- --output_img_path: output path of the generated face image.
- --output_xray_path: output path of the generated face x-ray.
An example can be as follows:
python main.py --background_img_path=./background_img --img_db_path=./img_db --output_img_path=./output --output_xray_path=./output_xray
Background images to search the nearest target face to swap.
Images to be swapped.
Caculate the convex hull of people face.
Add Gaussian blur to face X-ray image as the paper described.
Get the face landmarks of people images.
Use nearest search of face landmarks to get the target image face.
The main class to generate face X-ray.
Some function used by above.