Machine Learning for Cybersecurity Cookbook by Emmanuel Tsukerman

Machine Learning for Cybersecurity Cookbook by Emmanuel Tsukerman

Author:Emmanuel Tsukerman
Language: eng
Format: epub
Tags: COM043050 - COMPUTERS / Security / Networking, COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM025000 - COMPUTERS / Expert Systems
Publisher: Packt Publishing
Published: 2019-11-22T13:33:43+00:00


In the following steps, we provide a recipe for replacing the face of one individual in an image with that of another. The code is structured in five parts: Deepfake.ipynb (main), the deepfake_config configuration file, deepfake_face_detection, deepfake_face_points_detection, and deepfake_face_swap. Also, a models folder is included.

The following code can be found in Deepfake.ipynb:

Import opencv for image operations and the methods needed to swap faces from the associated code:

import os

import cv2

import numpy as np

from deepfake_face_detection import select_face

from deepfake_face_swap import (

warp_image_2d,

warp_image_3d,

mask_from_points,

apply_mask,

correct_colours,

transformation_from_points,

ProcessFace,

)

Specify the image containing the face we wish to use in content_image and the image where we want the face to be transferred to in target_image. Finally, specify where you'd like the result created:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.