deepfakes / faceswap
Deepfakes / FaceSwap
deepfakes_faceswap Important information for Patreon and PayPal supporters. Please see this forum post: https://forum.faceswap.dev/viewtopic.php?f=14&t=3120 关于 Patreon 和 PayPal 支持者的重要信息,请查看此论坛帖子:https://forum.faceswap.dev/viewtopic.php?f=14&t=3120
FaceSwap is a tool that utilizes deep learning to recognize and swap faces in pictures and videos. Emma Stone/Scarlett Johansson FaceSwap using the Phaze-A model. Jennifer Lawrence/Steve Buscemi FaceSwap using the Villain model. Make sure you check out INSTALL.md before getting started. FaceSwap 是一款利用深度学习来识别并替换图片和视频中人脸的工具。例如使用 Phaze-A 模型进行的艾玛·斯通/斯嘉丽·约翰逊换脸,以及使用 Villain 模型进行的詹妮弗·劳伦斯/史蒂夫·布西密换脸。在开始之前,请务必查阅 INSTALL.md 文件。
Manifesto: FaceSwap has ethical uses.
宣言:FaceSwap 具有合乎道德的用途。
When faceswapping was first developed and published, the technology was groundbreaking, it was a huge step in AI development. It was also completely ignored outside of academia because the code was confusing and fragmentary. It required a thorough understanding of complicated AI techniques and took a lot of effort to figure it out. Until one individual brought it together into a single, cohesive collection. 当换脸技术首次被开发并发布时,这是一项开创性的技术,也是人工智能发展的一大步。然而,由于代码混乱且零散,它在学术界之外完全被忽视了。它需要对复杂的人工智能技术有透彻的理解,并需要付出巨大的努力才能弄明白。直到后来,有人将其整合为一个单一、连贯的集合。
It ran, it worked, and as is so often the way with new technology emerging on the internet, it was immediately used to create inappropriate content. Despite the inappropriate uses the software was given originally, it was the first AI code that anyone could download, run and learn by experimentation without having a Ph.D. in math, computer theory, psychology, and more. 它运行起来了,也生效了。正如互联网上新兴技术的常见情况一样,它立即被用于制作不当内容。尽管该软件最初被用于不当用途,但它是第一个任何人都可以下载、运行并通过实验学习的人工智能代码,而无需拥有数学、计算机理论、心理学等领域的博士学位。
Before “deepfakes” these techniques were like black magic, only practiced by those who could understand all of the inner workings as described in esoteric and endlessly complicated books and papers. “Deepfakes” changed all that and anyone could participate in AI development. To us, developers, the release of this code opened up a fantastic learning opportunity. 在“Deepfakes”出现之前,这些技术就像黑魔法一样,只有那些能够理解深奥且极其复杂的书籍和论文中所描述的内部运作机制的人才能掌握。“Deepfakes”改变了这一切,任何人都可以参与到人工智能的开发中来。对于我们开发者而言,这段代码的发布开启了一个绝佳的学习机会。
It allowed us to build on ideas developed by others, collaborate with a variety of skilled coders, experiment with AI whilst learning new skills and ultimately contribute towards an emerging technology which will only see more mainstream use as it progresses. Are there some out there doing horrible things with similar software? Yes. And because of this, the developers have been following strict ethical standards. 它使我们能够在他人开发的理念基础上进行构建,与各种技术娴熟的程序员合作,在学习新技能的同时进行人工智能实验,并最终为一项随着发展将获得更多主流应用的新兴技术做出贡献。是否有人在利用类似软件做可怕的事情?是的。正因如此,开发者们一直遵循着严格的道德标准。
Many of us don’t even use it to create videos, we just tinker with the code to see what it does. Sadly, the media concentrates only on the unethical uses of this software. That is, unfortunately, the nature of how it was first exposed to the public, but it is not representative of why it was created, how we use it now, or what we see in its future. 我们中的许多人甚至不使用它来制作视频,我们只是摆弄代码来看看它能做什么。遗憾的是,媒体只关注该软件不道德的用途。不幸的是,这就是它最初向公众展示的方式,但这并不能代表它被创造的初衷、我们现在的使用方式,或者我们对它未来的展望。
Like any technology, it can be used for good or it can be abused. It is our intention to develop FaceSwap in a way that its potential for abuse is minimized whilst maximizing its potential as a tool for learning, experimenting and, yes, for legitimate faceswapping. We are not trying to denigrate celebrities or to demean anyone. We are programmers, we are engineers, we are Hollywood VFX artists, we are activists, we are hobbyists, we are human beings. 像任何技术一样,它可以被善用,也可能被滥用。我们的初衷是以一种最小化滥用可能性的方式开发 FaceSwap,同时最大化其作为学习、实验工具的潜力,当然,也包括合法的换脸用途。我们并非试图诋毁名人或贬低任何人。我们是程序员、工程师、好莱坞视觉特效师、活动家、业余爱好者,我们是人类。
To this end, we feel that it’s time to come out with a standard statement of what this software is and isn’t as far as us developers are concerned. FaceSwap is not for creating inappropriate content. FaceSwap is not for changing faces without consent or with the intent of hiding its use. FaceSwap is not for any illicit, unethical, or questionable purposes. 为此,我们认为现在是时候就我们开发者而言,对该软件的定位发表一份标准声明了。FaceSwap 不用于制作不当内容。FaceSwap 不用于在未经同意的情况下更改人脸,也不用于隐瞒其使用意图。FaceSwap 不用于任何非法、不道德或可疑的目的。
FaceSwap exists to experiment and discover AI techniques, for social or political commentary, for movies, and for any number of ethical and reasonable uses. We are very troubled by the fact that FaceSwap can be used for unethical and disreputable things. However, we support the development of tools and techniques that can be used ethically as well as provide education and experience in AI for anyone who wants to learn it hands-on. We will take a zero tolerance approach to anyone using this software for any unethical purposes and will actively discourage any such uses. FaceSwap 的存在是为了实验和探索人工智能技术,用于社会或政治评论、电影制作,以及任何合乎道德和合理的用途。我们对 FaceSwap 可能被用于不道德和名誉扫地的事情感到非常困扰。然而,我们支持开发可以合乎道德使用的工具和技术,并为任何想要亲身学习的人提供人工智能方面的教育和经验。对于任何将此软件用于不道德目的的人,我们将采取零容忍态度,并积极抵制任何此类用途。
How To setup and run the project
如何设置并运行该项目
FaceSwap is a Python program that will run on multiple Operating Systems including Windows, Linux, and MacOS. See INSTALL.md for full installation instructions. You will need a modern GPU with CUDA support for best performance. Many AMD GPUs are supported through ROCm (Linux). FaceSwap 是一个可以在包括 Windows、Linux 和 MacOS 在内的多种操作系统上运行的 Python 程序。请参阅 INSTALL.md 获取完整的安装说明。为了获得最佳性能,你需要一个支持 CUDA 的现代 GPU。许多 AMD GPU 通过 ROCm(Linux)提供支持。
Overview: The project has multiple entry points. You will have to: Gather photos and/or videos, Extract faces from your raw photos, Train a model on the faces extracted from the photos/videos, Convert your sources with the model. Check out USAGE.md for more detailed instructions. 概述:该项目有多个入口点。你需要:收集照片和/或视频,从原始照片中提取人脸,利用从照片/视频中提取的人脸训练模型,使用模型转换你的源素材。请查看 USAGE.md 获取更详细的说明。
Extract: From your setup folder, run python faceswap.py extract. This will take photos from src folder and extract faces into extract folder.
提取:在你的设置文件夹中,运行 python faceswap.py extract。这将从 src 文件夹中获取照片,并将提取的人脸存入 extract 文件夹。
Train: From your setup folder, run python faceswap.py train. This will take photos from two folders containing pictures of both faces and train a model that will be saved inside the models folder.
训练:在你的设置文件夹中,运行 python faceswap.py train。这将从包含两张人脸图片的文件夹中获取照片,并训练一个保存在 models 文件夹中的模型。
Convert: From your setup folder, run python faceswap.py convert. This will take photos from original folder and apply new faces into modified folder.
转换:在你的设置文件夹中,运行 python faceswap.py convert。这将从 original 文件夹中获取照片,并将新的人脸应用到 modified 文件夹中。
GUI: Alternatively, you can run the GUI by running python faceswap.py gui.
图形界面:或者,你可以通过运行 python faceswap.py gui 来启动图形界面。
General notes: All of the scripts mentioned have -h/—help options with arguments that they will accept. You’re smart, you can figure out how this works, right?! NB: there is a conversion tool for video. This can be accessed by running python tools.py effmpeg -h. Alternatively, you can use ffmpeg to convert video into photos, process images, and convert images back to the video. Some tips: Reusing existing models will train much faster.
通用说明:上述所有脚本都有 -h/—help 选项,可以查看它们接受的参数。你很聪明,能弄明白它是怎么运作的,对吧?!注意:有一个用于视频的转换工具。可以通过运行 python tools.py effmpeg -h 来访问。或者,你可以使用 ffmpeg 将视频转换为照片,处理图像,然后再将图像转换回视频。一些提示:重用现有模型会使训练速度快得多。