Upload 204 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +81 -0
- SimSwap/.gitattributes +2 -0
- SimSwap/.gitignore +145 -0
- SimSwap/LICENSE +399 -0
- SimSwap/MultiSpecific.ipynb +1 -0
- SimSwap/README.md +247 -0
- SimSwap/SimSwap colab.ipynb +579 -0
- SimSwap/arcface_model/arcface_checkpoint.tar +3 -0
- SimSwap/checkpoints/people/iter.txt +2 -0
- SimSwap/checkpoints/people/latest_net_D1.pth +3 -0
- SimSwap/checkpoints/people/latest_net_D2.pth +3 -0
- SimSwap/checkpoints/people/latest_net_G.pth +3 -0
- SimSwap/checkpoints/people/loss_log.txt +0 -0
- SimSwap/checkpoints/people/opt.txt +72 -0
- SimSwap/cog.yaml +20 -0
- SimSwap/data/data_loader_Swapping.py +125 -0
- SimSwap/docs/css/bootstrap-theme.min.css +6 -0
- SimSwap/docs/css/bootstrap.min.css +0 -0
- SimSwap/docs/css/ie10-viewport-bug-workaround.css +13 -0
- SimSwap/docs/css/jumbotron.css +5 -0
- SimSwap/docs/css/page.css +49 -0
- SimSwap/docs/favicon.ico +0 -0
- SimSwap/docs/fonts/glyphicons-halflings-regular.eot +0 -0
- SimSwap/docs/fonts/glyphicons-halflings-regular.svg +0 -0
- SimSwap/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
- SimSwap/docs/fonts/glyphicons-halflings-regular.woff +0 -0
- SimSwap/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
- SimSwap/docs/guidance/preparation.md +37 -0
- SimSwap/docs/guidance/usage.md +115 -0
- SimSwap/docs/img/LRGT_201110059_201110091.webp +3 -0
- SimSwap/docs/img/anni.webp +3 -0
- SimSwap/docs/img/chenglong.webp +3 -0
- SimSwap/docs/img/girl2-RGB.png +3 -0
- SimSwap/docs/img/girl2.gif +3 -0
- SimSwap/docs/img/id/Iron_man.jpg +0 -0
- SimSwap/docs/img/id/anni.jpg +0 -0
- SimSwap/docs/img/id/chenglong.jpg +0 -0
- SimSwap/docs/img/id/wuyifan.png +3 -0
- SimSwap/docs/img/id/zhoujielun.jpg +0 -0
- SimSwap/docs/img/id/zhuyin.jpg +3 -0
- SimSwap/docs/img/logo.png +0 -0
- SimSwap/docs/img/logo1.png +0 -0
- SimSwap/docs/img/logo2.png +0 -0
- SimSwap/docs/img/mama_mask_short.webp +3 -0
- SimSwap/docs/img/mama_mask_wuyifan_short.webp +3 -0
- SimSwap/docs/img/multi_face_comparison.png +3 -0
- SimSwap/docs/img/new.gif +0 -0
- SimSwap/docs/img/nrsig.png +3 -0
- SimSwap/docs/img/result_whole_swap_multispecific_512.jpg +3 -0
- SimSwap/docs/img/results1.PNG +3 -0
.gitattributes
CHANGED
|
@@ -106,3 +106,84 @@ Wav2Lip-HD/Real-ESRGAN/results/tree_alpha_16bit_out.png filter=lfs diff=lfs merg
|
|
| 106 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt.lmdb/data.mdb filter=lfs diff=lfs merge=lfs -text
|
| 107 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt/baboon.png filter=lfs diff=lfs merge=lfs -text
|
| 108 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt/comic.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt.lmdb/data.mdb filter=lfs diff=lfs merge=lfs -text
|
| 107 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt/baboon.png filter=lfs diff=lfs merge=lfs -text
|
| 108 |
Wav2Lip-HD/Real-ESRGAN/tests/data/gt/comic.png filter=lfs diff=lfs merge=lfs -text
|
| 109 |
+
SimSwap/docs/img/anni.webp filter=lfs diff=lfs merge=lfs -text
|
| 110 |
+
SimSwap/docs/img/chenglong.webp filter=lfs diff=lfs merge=lfs -text
|
| 111 |
+
SimSwap/docs/img/girl2-RGB.png filter=lfs diff=lfs merge=lfs -text
|
| 112 |
+
SimSwap/docs/img/girl2.gif filter=lfs diff=lfs merge=lfs -text
|
| 113 |
+
SimSwap/docs/img/id/wuyifan.png filter=lfs diff=lfs merge=lfs -text
|
| 114 |
+
SimSwap/docs/img/id/zhuyin.jpg filter=lfs diff=lfs merge=lfs -text
|
| 115 |
+
SimSwap/docs/img/LRGT_201110059_201110091.webp filter=lfs diff=lfs merge=lfs -text
|
| 116 |
+
SimSwap/docs/img/mama_mask_short.webp filter=lfs diff=lfs merge=lfs -text
|
| 117 |
+
SimSwap/docs/img/mama_mask_wuyifan_short.webp filter=lfs diff=lfs merge=lfs -text
|
| 118 |
+
SimSwap/docs/img/multi_face_comparison.png filter=lfs diff=lfs merge=lfs -text
|
| 119 |
+
SimSwap/docs/img/nrsig.png filter=lfs diff=lfs merge=lfs -text
|
| 120 |
+
SimSwap/docs/img/result_whole_swap_multispecific_512.jpg filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
SimSwap/docs/img/results1.PNG filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
SimSwap/docs/img/title.png filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
SimSwap/docs/img/total.PNG filter=lfs diff=lfs merge=lfs -text
|
| 124 |
+
SimSwap/docs/img/vggface2_hq_compare.png filter=lfs diff=lfs merge=lfs -text
|
| 125 |
+
SimSwap/docs/img/video.webp filter=lfs diff=lfs merge=lfs -text
|
| 126 |
+
SimSwap/docs/img/zhoujielun.webp filter=lfs diff=lfs merge=lfs -text
|
| 127 |
+
SimSwap/docs/img/zhuyin.webp filter=lfs diff=lfs merge=lfs -text
|
| 128 |
+
SimSwap/temp_results/frame_0000000.jpg filter=lfs diff=lfs merge=lfs -text
|
| 129 |
+
SimSwap/temp_results/frame_0000001.jpg filter=lfs diff=lfs merge=lfs -text
|
| 130 |
+
SimSwap/temp_results/frame_0000002.jpg filter=lfs diff=lfs merge=lfs -text
|
| 131 |
+
SimSwap/temp_results/frame_0000003.jpg filter=lfs diff=lfs merge=lfs -text
|
| 132 |
+
SimSwap/temp_results/frame_0000004.jpg filter=lfs diff=lfs merge=lfs -text
|
| 133 |
+
SimSwap/temp_results/frame_0000005.jpg filter=lfs diff=lfs merge=lfs -text
|
| 134 |
+
SimSwap/temp_results/frame_0000006.jpg filter=lfs diff=lfs merge=lfs -text
|
| 135 |
+
SimSwap/temp_results/frame_0000007.jpg filter=lfs diff=lfs merge=lfs -text
|
| 136 |
+
SimSwap/temp_results/frame_0000008.jpg filter=lfs diff=lfs merge=lfs -text
|
| 137 |
+
SimSwap/temp_results/frame_0000009.jpg filter=lfs diff=lfs merge=lfs -text
|
| 138 |
+
SimSwap/temp_results/frame_0000010.jpg filter=lfs diff=lfs merge=lfs -text
|
| 139 |
+
SimSwap/temp_results/frame_0000011.jpg filter=lfs diff=lfs merge=lfs -text
|
| 140 |
+
SimSwap/temp_results/frame_0000012.jpg filter=lfs diff=lfs merge=lfs -text
|
| 141 |
+
SimSwap/temp_results/frame_0000013.jpg filter=lfs diff=lfs merge=lfs -text
|
| 142 |
+
SimSwap/temp_results/frame_0000014.jpg filter=lfs diff=lfs merge=lfs -text
|
| 143 |
+
SimSwap/temp_results/frame_0000015.jpg filter=lfs diff=lfs merge=lfs -text
|
| 144 |
+
SimSwap/temp_results/frame_0000016.jpg filter=lfs diff=lfs merge=lfs -text
|
| 145 |
+
SimSwap/temp_results/frame_0000017.jpg filter=lfs diff=lfs merge=lfs -text
|
| 146 |
+
SimSwap/temp_results/frame_0000018.jpg filter=lfs diff=lfs merge=lfs -text
|
| 147 |
+
SimSwap/temp_results/frame_0000019.jpg filter=lfs diff=lfs merge=lfs -text
|
| 148 |
+
SimSwap/temp_results/frame_0000020.jpg filter=lfs diff=lfs merge=lfs -text
|
| 149 |
+
SimSwap/temp_results/frame_0000021.jpg filter=lfs diff=lfs merge=lfs -text
|
| 150 |
+
SimSwap/temp_results/frame_0000022.jpg filter=lfs diff=lfs merge=lfs -text
|
| 151 |
+
SimSwap/temp_results/frame_0000023.jpg filter=lfs diff=lfs merge=lfs -text
|
| 152 |
+
SimSwap/temp_results/frame_0000024.jpg filter=lfs diff=lfs merge=lfs -text
|
| 153 |
+
SimSwap/temp_results/frame_0000025.jpg filter=lfs diff=lfs merge=lfs -text
|
| 154 |
+
SimSwap/temp_results/frame_0000026.jpg filter=lfs diff=lfs merge=lfs -text
|
| 155 |
+
SimSwap/temp_results/frame_0000027.jpg filter=lfs diff=lfs merge=lfs -text
|
| 156 |
+
SimSwap/temp_results/frame_0000028.jpg filter=lfs diff=lfs merge=lfs -text
|
| 157 |
+
SimSwap/temp_results/frame_0000029.jpg filter=lfs diff=lfs merge=lfs -text
|
| 158 |
+
SimSwap/temp_results/frame_0000030.jpg filter=lfs diff=lfs merge=lfs -text
|
| 159 |
+
SimSwap/temp_results/frame_0000031.jpg filter=lfs diff=lfs merge=lfs -text
|
| 160 |
+
SimSwap/temp_results/frame_0000032.jpg filter=lfs diff=lfs merge=lfs -text
|
| 161 |
+
SimSwap/temp_results/frame_0000033.jpg filter=lfs diff=lfs merge=lfs -text
|
| 162 |
+
SimSwap/temp_results/frame_0000034.jpg filter=lfs diff=lfs merge=lfs -text
|
| 163 |
+
SimSwap/temp_results/frame_0000035.jpg filter=lfs diff=lfs merge=lfs -text
|
| 164 |
+
SimSwap/temp_results/frame_0000036.jpg filter=lfs diff=lfs merge=lfs -text
|
| 165 |
+
SimSwap/temp_results/frame_0000037.jpg filter=lfs diff=lfs merge=lfs -text
|
| 166 |
+
SimSwap/temp_results/frame_0000038.jpg filter=lfs diff=lfs merge=lfs -text
|
| 167 |
+
SimSwap/temp_results/frame_0000039.jpg filter=lfs diff=lfs merge=lfs -text
|
| 168 |
+
SimSwap/temp_results/frame_0000040.jpg filter=lfs diff=lfs merge=lfs -text
|
| 169 |
+
SimSwap/temp_results/frame_0000041.jpg filter=lfs diff=lfs merge=lfs -text
|
| 170 |
+
SimSwap/temp_results/frame_0000042.jpg filter=lfs diff=lfs merge=lfs -text
|
| 171 |
+
SimSwap/temp_results/frame_0000043.jpg filter=lfs diff=lfs merge=lfs -text
|
| 172 |
+
SimSwap/temp_results/frame_0000044.jpg filter=lfs diff=lfs merge=lfs -text
|
| 173 |
+
SimSwap/temp_results/frame_0000045.jpg filter=lfs diff=lfs merge=lfs -text
|
| 174 |
+
SimSwap/temp_results/frame_0000046.jpg filter=lfs diff=lfs merge=lfs -text
|
| 175 |
+
SimSwap/temp_results/frame_0000047.jpg filter=lfs diff=lfs merge=lfs -text
|
| 176 |
+
SimSwap/temp_results/frame_0000048.jpg filter=lfs diff=lfs merge=lfs -text
|
| 177 |
+
SimSwap/temp_results/frame_0000049.jpg filter=lfs diff=lfs merge=lfs -text
|
| 178 |
+
SimSwap/temp_results/frame_0000050.jpg filter=lfs diff=lfs merge=lfs -text
|
| 179 |
+
SimSwap/temp_results/frame_0000051.jpg filter=lfs diff=lfs merge=lfs -text
|
| 180 |
+
SimSwap/temp_results/frame_0000052.jpg filter=lfs diff=lfs merge=lfs -text
|
| 181 |
+
SimSwap/temp_results/frame_0000053.jpg filter=lfs diff=lfs merge=lfs -text
|
| 182 |
+
SimSwap/temp_results/frame_0000054.jpg filter=lfs diff=lfs merge=lfs -text
|
| 183 |
+
SimSwap/temp_results/frame_0000055.jpg filter=lfs diff=lfs merge=lfs -text
|
| 184 |
+
SimSwap/temp_results/frame_0000056.jpg filter=lfs diff=lfs merge=lfs -text
|
| 185 |
+
SimSwap/temp_results/frame_0000057.jpg filter=lfs diff=lfs merge=lfs -text
|
| 186 |
+
SimSwap/temp_results/frame_0000058.jpg filter=lfs diff=lfs merge=lfs -text
|
| 187 |
+
SimSwap/temp_results/frame_0000059.jpg filter=lfs diff=lfs merge=lfs -text
|
| 188 |
+
SimSwap/temp_results/frame_0000060.jpg filter=lfs diff=lfs merge=lfs -text
|
| 189 |
+
SimSwap/temp_results/frame_0000061.jpg filter=lfs diff=lfs merge=lfs -text
|
SimSwap/.gitattributes
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto detect text files and perform LF normalization
|
| 2 |
+
* text=auto
|
SimSwap/.gitignore
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
pip-wheel-metadata/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# PyInstaller
|
| 31 |
+
# Usually these files are written by a python script from a template
|
| 32 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 33 |
+
*.manifest
|
| 34 |
+
*.spec
|
| 35 |
+
|
| 36 |
+
# Installer logs
|
| 37 |
+
pip-log.txt
|
| 38 |
+
pip-delete-this-directory.txt
|
| 39 |
+
|
| 40 |
+
# Unit test / coverage reports
|
| 41 |
+
htmlcov/
|
| 42 |
+
.tox/
|
| 43 |
+
.nox/
|
| 44 |
+
.coverage
|
| 45 |
+
.coverage.*
|
| 46 |
+
.cache
|
| 47 |
+
nosetests.xml
|
| 48 |
+
coverage.xml
|
| 49 |
+
*.cover
|
| 50 |
+
*.py,cover
|
| 51 |
+
.hypothesis/
|
| 52 |
+
.pytest_cache/
|
| 53 |
+
|
| 54 |
+
# Translations
|
| 55 |
+
*.mo
|
| 56 |
+
*.pot
|
| 57 |
+
|
| 58 |
+
# Django stuff:
|
| 59 |
+
*.log
|
| 60 |
+
local_settings.py
|
| 61 |
+
db.sqlite3
|
| 62 |
+
db.sqlite3-journal
|
| 63 |
+
|
| 64 |
+
# Flask stuff:
|
| 65 |
+
instance/
|
| 66 |
+
.webassets-cache
|
| 67 |
+
|
| 68 |
+
# Scrapy stuff:
|
| 69 |
+
.scrapy
|
| 70 |
+
|
| 71 |
+
# Sphinx documentation
|
| 72 |
+
docs/_build/
|
| 73 |
+
|
| 74 |
+
# PyBuilder
|
| 75 |
+
target/
|
| 76 |
+
|
| 77 |
+
# Jupyter Notebook
|
| 78 |
+
.ipynb_checkpoints
|
| 79 |
+
|
| 80 |
+
# IPython
|
| 81 |
+
profile_default/
|
| 82 |
+
ipython_config.py
|
| 83 |
+
|
| 84 |
+
# pyenv
|
| 85 |
+
.python-version
|
| 86 |
+
|
| 87 |
+
# pipenv
|
| 88 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 89 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 90 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 91 |
+
# install all needed dependencies.
|
| 92 |
+
#Pipfile.lock
|
| 93 |
+
|
| 94 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
| 95 |
+
__pypackages__/
|
| 96 |
+
|
| 97 |
+
# Celery stuff
|
| 98 |
+
celerybeat-schedule
|
| 99 |
+
celerybeat.pid
|
| 100 |
+
|
| 101 |
+
# SageMath parsed files
|
| 102 |
+
*.sage.py
|
| 103 |
+
|
| 104 |
+
# Environments
|
| 105 |
+
.env
|
| 106 |
+
.venv
|
| 107 |
+
env/
|
| 108 |
+
venv/
|
| 109 |
+
ENV/
|
| 110 |
+
env.bak/
|
| 111 |
+
venv.bak/
|
| 112 |
+
|
| 113 |
+
# Spyder project settings
|
| 114 |
+
.spyderproject
|
| 115 |
+
.spyproject
|
| 116 |
+
|
| 117 |
+
# Rope project settings
|
| 118 |
+
.ropeproject
|
| 119 |
+
|
| 120 |
+
# mkdocs documentation
|
| 121 |
+
/site
|
| 122 |
+
|
| 123 |
+
# mypy
|
| 124 |
+
.mypy_cache/
|
| 125 |
+
.dmypy.json
|
| 126 |
+
dmypy.json
|
| 127 |
+
|
| 128 |
+
# Pyre type checker
|
| 129 |
+
.pyre/
|
| 130 |
+
|
| 131 |
+
docs/ppt/
|
| 132 |
+
checkpoints/
|
| 133 |
+
*.tar
|
| 134 |
+
*.patch
|
| 135 |
+
*.zip
|
| 136 |
+
*.avi
|
| 137 |
+
*.pdf
|
| 138 |
+
*.pptx
|
| 139 |
+
|
| 140 |
+
*.pth
|
| 141 |
+
*.onnx
|
| 142 |
+
wandb/
|
| 143 |
+
temp_results/
|
| 144 |
+
output/*.*
|
| 145 |
+
/cr
|
SimSwap/LICENSE
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Attribution-NonCommercial 4.0 International
|
| 2 |
+
|
| 3 |
+
=======================================================================
|
| 4 |
+
|
| 5 |
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
| 6 |
+
does not provide legal services or legal advice. Distribution of
|
| 7 |
+
Creative Commons public licenses does not create a lawyer-client or
|
| 8 |
+
other relationship. Creative Commons makes its licenses and related
|
| 9 |
+
information available on an "as-is" basis. Creative Commons gives no
|
| 10 |
+
warranties regarding its licenses, any material licensed under their
|
| 11 |
+
terms and conditions, or any related information. Creative Commons
|
| 12 |
+
disclaims all liability for damages resulting from their use to the
|
| 13 |
+
fullest extent possible.
|
| 14 |
+
|
| 15 |
+
Using Creative Commons Public Licenses
|
| 16 |
+
|
| 17 |
+
Creative Commons public licenses provide a standard set of terms and
|
| 18 |
+
conditions that creators and other rights holders may use to share
|
| 19 |
+
original works of authorship and other material subject to copyright
|
| 20 |
+
and certain other rights specified in the public license below. The
|
| 21 |
+
following considerations are for informational purposes only, are not
|
| 22 |
+
exhaustive, and do not form part of our licenses.
|
| 23 |
+
|
| 24 |
+
Considerations for licensors: Our public licenses are
|
| 25 |
+
intended for use by those authorized to give the public
|
| 26 |
+
permission to use material in ways otherwise restricted by
|
| 27 |
+
copyright and certain other rights. Our licenses are
|
| 28 |
+
irrevocable. Licensors should read and understand the terms
|
| 29 |
+
and conditions of the license they choose before applying it.
|
| 30 |
+
Licensors should also secure all rights necessary before
|
| 31 |
+
applying our licenses so that the public can reuse the
|
| 32 |
+
material as expected. Licensors should clearly mark any
|
| 33 |
+
material not subject to the license. This includes other CC-
|
| 34 |
+
licensed material, or material used under an exception or
|
| 35 |
+
limitation to copyright. More considerations for licensors:
|
| 36 |
+
wiki.creativecommons.org/Considerations_for_licensors
|
| 37 |
+
|
| 38 |
+
Considerations for the public: By using one of our public
|
| 39 |
+
licenses, a licensor grants the public permission to use the
|
| 40 |
+
licensed material under specified terms and conditions. If
|
| 41 |
+
the licensor's permission is not necessary for any reason--for
|
| 42 |
+
example, because of any applicable exception or limitation to
|
| 43 |
+
copyright--then that use is not regulated by the license. Our
|
| 44 |
+
licenses grant only permissions under copyright and certain
|
| 45 |
+
other rights that a licensor has authority to grant. Use of
|
| 46 |
+
the licensed material may still be restricted for other
|
| 47 |
+
reasons, including because others have copyright or other
|
| 48 |
+
rights in the material. A licensor may make special requests,
|
| 49 |
+
such as asking that all changes be marked or described.
|
| 50 |
+
Although not required by our licenses, you are encouraged to
|
| 51 |
+
respect those requests where reasonable. More_considerations
|
| 52 |
+
for the public:
|
| 53 |
+
wiki.creativecommons.org/Considerations_for_licensees
|
| 54 |
+
|
| 55 |
+
=======================================================================
|
| 56 |
+
|
| 57 |
+
Creative Commons Attribution-NonCommercial 4.0 International Public
|
| 58 |
+
License
|
| 59 |
+
|
| 60 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
| 61 |
+
to be bound by the terms and conditions of this Creative Commons
|
| 62 |
+
Attribution-NonCommercial 4.0 International Public License ("Public
|
| 63 |
+
License"). To the extent this Public License may be interpreted as a
|
| 64 |
+
contract, You are granted the Licensed Rights in consideration of Your
|
| 65 |
+
acceptance of these terms and conditions, and the Licensor grants You
|
| 66 |
+
such rights in consideration of benefits the Licensor receives from
|
| 67 |
+
making the Licensed Material available under these terms and
|
| 68 |
+
conditions.
|
| 69 |
+
|
| 70 |
+
Section 1 -- Definitions.
|
| 71 |
+
|
| 72 |
+
a. Adapted Material means material subject to Copyright and Similar
|
| 73 |
+
Rights that is derived from or based upon the Licensed Material
|
| 74 |
+
and in which the Licensed Material is translated, altered,
|
| 75 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
| 76 |
+
permission under the Copyright and Similar Rights held by the
|
| 77 |
+
Licensor. For purposes of this Public License, where the Licensed
|
| 78 |
+
Material is a musical work, performance, or sound recording,
|
| 79 |
+
Adapted Material is always produced where the Licensed Material is
|
| 80 |
+
synched in timed relation with a moving image.
|
| 81 |
+
|
| 82 |
+
b. Adapter's License means the license You apply to Your Copyright
|
| 83 |
+
and Similar Rights in Your contributions to Adapted Material in
|
| 84 |
+
accordance with the terms and conditions of this Public License.
|
| 85 |
+
|
| 86 |
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
| 87 |
+
closely related to copyright including, without limitation,
|
| 88 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
| 89 |
+
Rights, without regard to how the rights are labeled or
|
| 90 |
+
categorized. For purposes of this Public License, the rights
|
| 91 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
| 92 |
+
Rights.
|
| 93 |
+
d. Effective Technological Measures means those measures that, in the
|
| 94 |
+
absence of proper authority, may not be circumvented under laws
|
| 95 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
| 96 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
| 97 |
+
agreements.
|
| 98 |
+
|
| 99 |
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
| 100 |
+
any other exception or limitation to Copyright and Similar Rights
|
| 101 |
+
that applies to Your use of the Licensed Material.
|
| 102 |
+
|
| 103 |
+
f. Licensed Material means the artistic or literary work, database,
|
| 104 |
+
or other material to which the Licensor applied this Public
|
| 105 |
+
License.
|
| 106 |
+
|
| 107 |
+
g. Licensed Rights means the rights granted to You subject to the
|
| 108 |
+
terms and conditions of this Public License, which are limited to
|
| 109 |
+
all Copyright and Similar Rights that apply to Your use of the
|
| 110 |
+
Licensed Material and that the Licensor has authority to license.
|
| 111 |
+
|
| 112 |
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
| 113 |
+
under this Public License.
|
| 114 |
+
|
| 115 |
+
i. NonCommercial means not primarily intended for or directed towards
|
| 116 |
+
commercial advantage or monetary compensation. For purposes of
|
| 117 |
+
this Public License, the exchange of the Licensed Material for
|
| 118 |
+
other material subject to Copyright and Similar Rights by digital
|
| 119 |
+
file-sharing or similar means is NonCommercial provided there is
|
| 120 |
+
no payment of monetary compensation in connection with the
|
| 121 |
+
exchange.
|
| 122 |
+
|
| 123 |
+
j. Share means to provide material to the public by any means or
|
| 124 |
+
process that requires permission under the Licensed Rights, such
|
| 125 |
+
as reproduction, public display, public performance, distribution,
|
| 126 |
+
dissemination, communication, or importation, and to make material
|
| 127 |
+
available to the public including in ways that members of the
|
| 128 |
+
public may access the material from a place and at a time
|
| 129 |
+
individually chosen by them.
|
| 130 |
+
|
| 131 |
+
k. Sui Generis Database Rights means rights other than copyright
|
| 132 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
| 133 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
| 134 |
+
as amended and/or succeeded, as well as other essentially
|
| 135 |
+
equivalent rights anywhere in the world.
|
| 136 |
+
|
| 137 |
+
l. You means the individual or entity exercising the Licensed Rights
|
| 138 |
+
under this Public License. Your has a corresponding meaning.
|
| 139 |
+
|
| 140 |
+
Section 2 -- Scope.
|
| 141 |
+
|
| 142 |
+
a. License grant.
|
| 143 |
+
|
| 144 |
+
1. Subject to the terms and conditions of this Public License,
|
| 145 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
| 146 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
| 147 |
+
exercise the Licensed Rights in the Licensed Material to:
|
| 148 |
+
|
| 149 |
+
a. reproduce and Share the Licensed Material, in whole or
|
| 150 |
+
in part, for NonCommercial purposes only; and
|
| 151 |
+
|
| 152 |
+
b. produce, reproduce, and Share Adapted Material for
|
| 153 |
+
NonCommercial purposes only.
|
| 154 |
+
|
| 155 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
| 156 |
+
Exceptions and Limitations apply to Your use, this Public
|
| 157 |
+
License does not apply, and You do not need to comply with
|
| 158 |
+
its terms and conditions.
|
| 159 |
+
|
| 160 |
+
3. Term. The term of this Public License is specified in Section
|
| 161 |
+
6(a).
|
| 162 |
+
|
| 163 |
+
4. Media and formats; technical modifications allowed. The
|
| 164 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
| 165 |
+
all media and formats whether now known or hereafter created,
|
| 166 |
+
and to make technical modifications necessary to do so. The
|
| 167 |
+
Licensor waives and/or agrees not to assert any right or
|
| 168 |
+
authority to forbid You from making technical modifications
|
| 169 |
+
necessary to exercise the Licensed Rights, including
|
| 170 |
+
technical modifications necessary to circumvent Effective
|
| 171 |
+
Technological Measures. For purposes of this Public License,
|
| 172 |
+
simply making modifications authorized by this Section 2(a)
|
| 173 |
+
(4) never produces Adapted Material.
|
| 174 |
+
|
| 175 |
+
5. Downstream recipients.
|
| 176 |
+
|
| 177 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
| 178 |
+
recipient of the Licensed Material automatically
|
| 179 |
+
receives an offer from the Licensor to exercise the
|
| 180 |
+
Licensed Rights under the terms and conditions of this
|
| 181 |
+
Public License.
|
| 182 |
+
|
| 183 |
+
b. No downstream restrictions. You may not offer or impose
|
| 184 |
+
any additional or different terms or conditions on, or
|
| 185 |
+
apply any Effective Technological Measures to, the
|
| 186 |
+
Licensed Material if doing so restricts exercise of the
|
| 187 |
+
Licensed Rights by any recipient of the Licensed
|
| 188 |
+
Material.
|
| 189 |
+
|
| 190 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
| 191 |
+
may be construed as permission to assert or imply that You
|
| 192 |
+
are, or that Your use of the Licensed Material is, connected
|
| 193 |
+
with, or sponsored, endorsed, or granted official status by,
|
| 194 |
+
the Licensor or others designated to receive attribution as
|
| 195 |
+
provided in Section 3(a)(1)(A)(i).
|
| 196 |
+
|
| 197 |
+
b. Other rights.
|
| 198 |
+
|
| 199 |
+
1. Moral rights, such as the right of integrity, are not
|
| 200 |
+
licensed under this Public License, nor are publicity,
|
| 201 |
+
privacy, and/or other similar personality rights; however, to
|
| 202 |
+
the extent possible, the Licensor waives and/or agrees not to
|
| 203 |
+
assert any such rights held by the Licensor to the limited
|
| 204 |
+
extent necessary to allow You to exercise the Licensed
|
| 205 |
+
Rights, but not otherwise.
|
| 206 |
+
|
| 207 |
+
2. Patent and trademark rights are not licensed under this
|
| 208 |
+
Public License.
|
| 209 |
+
|
| 210 |
+
3. To the extent possible, the Licensor waives any right to
|
| 211 |
+
collect royalties from You for the exercise of the Licensed
|
| 212 |
+
Rights, whether directly or through a collecting society
|
| 213 |
+
under any voluntary or waivable statutory or compulsory
|
| 214 |
+
licensing scheme. In all other cases the Licensor expressly
|
| 215 |
+
reserves any right to collect such royalties, including when
|
| 216 |
+
the Licensed Material is used other than for NonCommercial
|
| 217 |
+
purposes.
|
| 218 |
+
|
| 219 |
+
Section 3 -- License Conditions.
|
| 220 |
+
|
| 221 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
| 222 |
+
following conditions.
|
| 223 |
+
|
| 224 |
+
a. Attribution.
|
| 225 |
+
|
| 226 |
+
1. If You Share the Licensed Material (including in modified
|
| 227 |
+
form), You must:
|
| 228 |
+
|
| 229 |
+
a. retain the following if it is supplied by the Licensor
|
| 230 |
+
with the Licensed Material:
|
| 231 |
+
|
| 232 |
+
i. identification of the creator(s) of the Licensed
|
| 233 |
+
Material and any others designated to receive
|
| 234 |
+
attribution, in any reasonable manner requested by
|
| 235 |
+
the Licensor (including by pseudonym if
|
| 236 |
+
designated);
|
| 237 |
+
|
| 238 |
+
ii. a copyright notice;
|
| 239 |
+
|
| 240 |
+
iii. a notice that refers to this Public License;
|
| 241 |
+
|
| 242 |
+
iv. a notice that refers to the disclaimer of
|
| 243 |
+
warranties;
|
| 244 |
+
|
| 245 |
+
v. a URI or hyperlink to the Licensed Material to the
|
| 246 |
+
extent reasonably practicable;
|
| 247 |
+
|
| 248 |
+
b. indicate if You modified the Licensed Material and
|
| 249 |
+
retain an indication of any previous modifications; and
|
| 250 |
+
|
| 251 |
+
c. indicate the Licensed Material is licensed under this
|
| 252 |
+
Public License, and include the text of, or the URI or
|
| 253 |
+
hyperlink to, this Public License.
|
| 254 |
+
|
| 255 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
| 256 |
+
reasonable manner based on the medium, means, and context in
|
| 257 |
+
which You Share the Licensed Material. For example, it may be
|
| 258 |
+
reasonable to satisfy the conditions by providing a URI or
|
| 259 |
+
hyperlink to a resource that includes the required
|
| 260 |
+
information.
|
| 261 |
+
|
| 262 |
+
3. If requested by the Licensor, You must remove any of the
|
| 263 |
+
information required by Section 3(a)(1)(A) to the extent
|
| 264 |
+
reasonably practicable.
|
| 265 |
+
|
| 266 |
+
4. If You Share Adapted Material You produce, the Adapter's
|
| 267 |
+
License You apply must not prevent recipients of the Adapted
|
| 268 |
+
Material from complying with this Public License.
|
| 269 |
+
|
| 270 |
+
Section 4 -- Sui Generis Database Rights.
|
| 271 |
+
|
| 272 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
| 273 |
+
apply to Your use of the Licensed Material:
|
| 274 |
+
|
| 275 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
| 276 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
| 277 |
+
portion of the contents of the database for NonCommercial purposes
|
| 278 |
+
only;
|
| 279 |
+
|
| 280 |
+
b. if You include all or a substantial portion of the database
|
| 281 |
+
contents in a database in which You have Sui Generis Database
|
| 282 |
+
Rights, then the database in which You have Sui Generis Database
|
| 283 |
+
Rights (but not its individual contents) is Adapted Material; and
|
| 284 |
+
|
| 285 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
| 286 |
+
all or a substantial portion of the contents of the database.
|
| 287 |
+
|
| 288 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
| 289 |
+
replace Your obligations under this Public License where the Licensed
|
| 290 |
+
Rights include other Copyright and Similar Rights.
|
| 291 |
+
|
| 292 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
| 293 |
+
|
| 294 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
| 295 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
| 296 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
| 297 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
| 298 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
| 299 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
| 300 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
| 301 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
| 302 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
| 303 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
| 304 |
+
|
| 305 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
| 306 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
| 307 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
| 308 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
| 309 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
| 310 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
| 311 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
| 312 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
| 313 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
| 314 |
+
|
| 315 |
+
c. The disclaimer of warranties and limitation of liability provided
|
| 316 |
+
above shall be interpreted in a manner that, to the extent
|
| 317 |
+
possible, most closely approximates an absolute disclaimer and
|
| 318 |
+
waiver of all liability.
|
| 319 |
+
|
| 320 |
+
Section 6 -- Term and Termination.
|
| 321 |
+
|
| 322 |
+
a. This Public License applies for the term of the Copyright and
|
| 323 |
+
Similar Rights licensed here. However, if You fail to comply with
|
| 324 |
+
this Public License, then Your rights under this Public License
|
| 325 |
+
terminate automatically.
|
| 326 |
+
|
| 327 |
+
b. Where Your right to use the Licensed Material has terminated under
|
| 328 |
+
Section 6(a), it reinstates:
|
| 329 |
+
|
| 330 |
+
1. automatically as of the date the violation is cured, provided
|
| 331 |
+
it is cured within 30 days of Your discovery of the
|
| 332 |
+
violation; or
|
| 333 |
+
|
| 334 |
+
2. upon express reinstatement by the Licensor.
|
| 335 |
+
|
| 336 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
| 337 |
+
right the Licensor may have to seek remedies for Your violations
|
| 338 |
+
of this Public License.
|
| 339 |
+
|
| 340 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
| 341 |
+
Licensed Material under separate terms or conditions or stop
|
| 342 |
+
distributing the Licensed Material at any time; however, doing so
|
| 343 |
+
will not terminate this Public License.
|
| 344 |
+
|
| 345 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
| 346 |
+
License.
|
| 347 |
+
|
| 348 |
+
Section 7 -- Other Terms and Conditions.
|
| 349 |
+
|
| 350 |
+
a. The Licensor shall not be bound by any additional or different
|
| 351 |
+
terms or conditions communicated by You unless expressly agreed.
|
| 352 |
+
|
| 353 |
+
b. Any arrangements, understandings, or agreements regarding the
|
| 354 |
+
Licensed Material not stated herein are separate from and
|
| 355 |
+
independent of the terms and conditions of this Public License.
|
| 356 |
+
|
| 357 |
+
Section 8 -- Interpretation.
|
| 358 |
+
|
| 359 |
+
a. For the avoidance of doubt, this Public License does not, and
|
| 360 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
| 361 |
+
conditions on any use of the Licensed Material that could lawfully
|
| 362 |
+
be made without permission under this Public License.
|
| 363 |
+
|
| 364 |
+
b. To the extent possible, if any provision of this Public License is
|
| 365 |
+
deemed unenforceable, it shall be automatically reformed to the
|
| 366 |
+
minimum extent necessary to make it enforceable. If the provision
|
| 367 |
+
cannot be reformed, it shall be severed from this Public License
|
| 368 |
+
without affecting the enforceability of the remaining terms and
|
| 369 |
+
conditions.
|
| 370 |
+
|
| 371 |
+
c. No term or condition of this Public License will be waived and no
|
| 372 |
+
failure to comply consented to unless expressly agreed to by the
|
| 373 |
+
Licensor.
|
| 374 |
+
|
| 375 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
| 376 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
| 377 |
+
that apply to the Licensor or You, including from the legal
|
| 378 |
+
processes of any jurisdiction or authority.
|
| 379 |
+
|
| 380 |
+
=======================================================================
|
| 381 |
+
|
| 382 |
+
Creative Commons is not a party to its public
|
| 383 |
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
| 384 |
+
its public licenses to material it publishes and in those instances
|
| 385 |
+
will be considered the “Licensor.” The text of the Creative Commons
|
| 386 |
+
public licenses is dedicated to the public domain under the CC0 Public
|
| 387 |
+
Domain Dedication. Except for the limited purpose of indicating that
|
| 388 |
+
material is shared under a Creative Commons public license or as
|
| 389 |
+
otherwise permitted by the Creative Commons policies published at
|
| 390 |
+
creativecommons.org/policies, Creative Commons does not authorize the
|
| 391 |
+
use of the trademark "Creative Commons" or any other trademark or logo
|
| 392 |
+
of Creative Commons without its prior written consent including,
|
| 393 |
+
without limitation, in connection with any unauthorized modifications
|
| 394 |
+
to any of its public licenses or any other arrangements,
|
| 395 |
+
understandings, or agreements concerning use of licensed material. For
|
| 396 |
+
the avoidance of doubt, this paragraph does not form part of the
|
| 397 |
+
public licenses.
|
| 398 |
+
|
| 399 |
+
Creative Commons may be contacted at creativecommons.org.
|
SimSwap/MultiSpecific.ipynb
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"MultiSpecific.ipynb","provenance":[],"collapsed_sections":[],"authorship_tag":"ABX9TyNw8SfPWhG77cf/e7YZd178"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"accelerator":"GPU"},"cells":[{"cell_type":"markdown","metadata":{"id":"7_gtFoV8BuRx"},"source":["This is an example of SimSwap on processing video with multiple faces with designated sources.\n","\n","Code path: https://github.com/neuralchen/SimSwap\n","Paper path: https://arxiv.org/pdf/2106.06340v1.pdf."]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"0Y1RfpzsCAl9","executionInfo":{"status":"ok","timestamp":1625380781426,"user_tz":-480,"elapsed":586,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"2a897b34-72f1-4515-ac6f-2f0e2d4ea4f7"},"source":["## make sure you are using a runtime with GPU\n","## you can check at Runtime/Change runtime type in the top bar.\n","!nvidia-smi"],"execution_count":1,"outputs":[{"output_type":"stream","text":["Sun Jul 4 06:39:39 2021 \n","+-----------------------------------------------------------------------------+\n","| NVIDIA-SMI 465.27 Driver Version: 460.32.03 CUDA Version: 11.2 |\n","|-------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|===============================+======================+======================|\n","| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n","| N/A 45C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |\n","| | | N/A |\n","+-------------------------------+----------------------+----------------------+\n"," \n","+-----------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=============================================================================|\n","| No running processes found |\n","+-----------------------------------------------------------------------------+\n"],"name":"stdout"}]},{"cell_type":"markdown","metadata":{"id":"0Qzzx2UpDkqw"},"source":["All file changes make by this notebook are temporary. \n","You can try to mount your own google drive to store files if you wang.\n"]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"VA_4CeWZCHLP","executionInfo":{"status":"ok","timestamp":1625380786661,"user_tz":-480,"elapsed":4693,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"d0665552-be92-45b0-aab2-f84c619a51fb"},"source":["!git clone https://github.com/neuralchen/SimSwap\n","!cd SimSwap && git pull"],"execution_count":2,"outputs":[{"output_type":"stream","text":["Cloning into 'SimSwap'...\n","remote: Enumerating objects: 667, done.\u001b[K\n","remote: Counting objects: 100% (48/48), done.\u001b[K\n","remote: Compressing objects: 100% (35/35), done.\u001b[K\n","remote: Total 667 (delta 19), reused 28 (delta 13), pack-reused 619\u001b[K\n","Receiving objects: 100% (667/667), 132.14 MiB | 44.44 MiB/s, done.\n","Resolving deltas: 100% (292/292), done.\n","Already up to date.\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"Y5K4au_UCkKn","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1625380797906,"user_tz":-480,"elapsed":11253,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"7429f153-bc6d-48c2-eb3c-21f1f02fede9"},"source":["!pip install insightface==0.2.1 onnxruntime moviepy\n","!pip install googledrivedownloader\n","!pip install imageio==2.4.1"],"execution_count":3,"outputs":[{"output_type":"stream","text":["Collecting insightface==0.2.1\n"," Downloading https://files.pythonhosted.org/packages/ee/1e/6395bbe0db665f187c8e49266cda54fcf661f182192370d409423e4943e4/insightface-0.2.1-py2.py3-none-any.whl\n","Collecting onnxruntime\n","\u001b[?25l Downloading https://files.pythonhosted.org/packages/f9/76/3d0f8bb2776961c7335693df06eccf8d099e48fa6fb552c7546867192603/onnxruntime-1.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5MB)\n","\u001b[K |████████████████████████████████| 4.5MB 37.5MB/s \n","\u001b[?25hRequirement already satisfied: moviepy in /usr/local/lib/python3.7/dist-packages (0.2.3.5)\n","Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (0.22.2.post1)\n","Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (2.23.0)\n","Collecting onnx\n","\u001b[?25l Downloading https://files.pythonhosted.org/packages/3f/9b/54c950d3256e27f970a83cd0504efb183a24312702deed0179453316dbd0/onnx-1.9.0-cp37-cp37m-manylinux2010_x86_64.whl (12.2MB)\n","\u001b[K |████████████████████████████████| 12.2MB 32.2MB/s \n","\u001b[?25hRequirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (3.2.2)\n","Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (7.1.2)\n","Requirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (0.16.2)\n","Requirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (4.1.2.30)\n","Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (4.41.1)\n","Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.4.1)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.19.5)\n","Requirement already satisfied: easydict in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.9)\n","Requirement already satisfied: flatbuffers in /usr/local/lib/python3.7/dist-packages (from onnxruntime) (1.12)\n","Requirement already satisfied: protobuf in /usr/local/lib/python3.7/dist-packages (from onnxruntime) (3.12.4)\n","Requirement already satisfied: imageio<3.0,>=2.1.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (2.4.1)\n","Requirement already satisfied: decorator<5.0,>=4.0.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (4.4.2)\n","Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->insightface==0.2.1) (1.0.1)\n","Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (3.0.4)\n","Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (1.24.3)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (2021.5.30)\n","Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (2.10)\n","Requirement already satisfied: typing-extensions>=3.6.2.1 in /usr/local/lib/python3.7/dist-packages (from onnx->insightface==0.2.1) (3.7.4.3)\n","Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from onnx->insightface==0.2.1) (1.15.0)\n","Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (2.8.1)\n","Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (0.10.0)\n","Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (2.4.7)\n","Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (1.3.1)\n","Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->insightface==0.2.1) (2.5.1)\n","Requirement already satisfied: PyWavelets>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->insightface==0.2.1) (1.1.1)\n","Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from protobuf->onnxruntime) (57.0.0)\n","Installing collected packages: onnx, insightface, onnxruntime\n","Successfully installed insightface-0.2.1 onnx-1.9.0 onnxruntime-1.8.0\n","Requirement already satisfied: googledrivedownloader in /usr/local/lib/python3.7/dist-packages (0.4)\n","Requirement already satisfied: imageio==2.4.1 in /usr/local/lib/python3.7/dist-packages (2.4.1)\n","Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from imageio==2.4.1) (1.19.5)\n","Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio==2.4.1) (7.1.2)\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"gQ7ZoIbLFCye","executionInfo":{"status":"ok","timestamp":1625380798405,"user_tz":-480,"elapsed":533,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"8448a0a3-a19e-44c2-a044-f4d3f9152e91"},"source":["import os\n","os.chdir(\"SimSwap\")\n","!ls"],"execution_count":4,"outputs":[{"output_type":"stream","text":[" crop_224\t simswaplogo\n"," data\t\t test_one_image.py\n"," demo_file\t test_video_swapmulti.py\n"," docs\t\t test_video_swap_multispecific.py\n"," insightface_func test_video_swapsingle.py\n"," LICENSE\t test_video_swapspecific.py\n"," models\t\t test_wholeimage_swapmulti.py\n"," options\t test_wholeimage_swap_multispecific.py\n"," output\t\t test_wholeimage_swapsingle.py\n"," README.md\t test_wholeimage_swapspecific.py\n","'SimSwap colab.ipynb' util\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"ZvGp-p0nOmKE","executionInfo":{"status":"ok","timestamp":1625380798407,"user_tz":-480,"elapsed":17,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}}},"source":["## You can upload filed manually\n","# from google.colab import drive\n","# drive.mount('/content/gdrive')"],"execution_count":5,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"gLti1J0pEFjJ","executionInfo":{"status":"ok","timestamp":1625380813268,"user_tz":-480,"elapsed":14876,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"99dc9306-9b9a-475d-cc7d-a3f423bd1e81"},"source":["from google_drive_downloader import GoogleDriveDownloader\n","\n","### it seems that google drive link may not be permenant, you can find this ID from our open url.\n","# GoogleDriveDownloader.download_file_from_google_drive(file_id='1TLNdIufzwesDbyr_nVTR7Zrx9oRHLM_N',\n","# dest_path='./arcface_model/arcface_checkpoint.tar')\n","# GoogleDriveDownloader.download_file_from_google_drive(file_id='1PXkRiBUYbu1xWpQyDEJvGKeqqUFthJcI',\n","# dest_path='./checkpoints.zip')\n","\n","!wget -P ./arcface_model https://github.com/neuralchen/SimSwap/releases/download/1.0/arcface_checkpoint.tar\n","!wget https://github.com/neuralchen/SimSwap/releases/download/1.0/checkpoints.zip\n","!unzip ./checkpoints.zip -d ./checkpoints\n","!wget -P ./parsing_model/checkpoint https://github.com/neuralchen/SimSwap/releases/download/1.0/79999_iter.pth"],"execution_count":6,"outputs":[{"output_type":"stream","text":["--2021-07-04 06:39:56-- https://github.com/neuralchen/SimSwap/releases/download/1.0/arcface_checkpoint.tar\n","Resolving github.com (github.com)... 140.82.114.3\n","Connecting to github.com (github.com)|140.82.114.3|:443... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://github-releases.githubusercontent.com/374891081/e17b9d00-dcb8-11eb-8c4f-1412bcea78a6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210704%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210704T063956Z&X-Amz-Expires=300&X-Amz-Signature=b6d431c65405e894ddc994061c5fe8fe87db4e71e702513aec01f398a1004825&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=374891081&response-content-disposition=attachment%3B%20filename%3Darcface_checkpoint.tar&response-content-type=application%2Foctet-stream [following]\n","--2021-07-04 06:39:56-- https://github-releases.githubusercontent.com/374891081/e17b9d00-dcb8-11eb-8c4f-1412bcea78a6?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210704%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210704T063956Z&X-Amz-Expires=300&X-Amz-Signature=b6d431c65405e894ddc994061c5fe8fe87db4e71e702513aec01f398a1004825&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=374891081&response-content-disposition=attachment%3B%20filename%3Darcface_checkpoint.tar&response-content-type=application%2Foctet-stream\n","Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.108.154, 185.199.109.154, 185.199.110.154, ...\n","Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.108.154|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 766871429 (731M) [application/octet-stream]\n","Saving to: ‘./arcface_model/arcface_checkpoint.tar’\n","\n","arcface_checkpoint. 100%[===================>] 731.34M 64.4MB/s in 11s \n","\n","2021-07-04 06:40:07 (68.4 MB/s) - ‘./arcface_model/arcface_checkpoint.tar’ saved [766871429/766871429]\n","\n","--2021-07-04 06:40:07-- https://github.com/neuralchen/SimSwap/releases/download/1.0/checkpoints.zip\n","Resolving github.com (github.com)... 140.82.113.3\n","Connecting to github.com (github.com)|140.82.113.3|:443... connected.\n","HTTP request sent, awaiting response... 302 Found\n","Location: https://github-releases.githubusercontent.com/374891081/a8dac400-dcb6-11eb-933f-977cd7f5f554?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210704%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210704T063831Z&X-Amz-Expires=300&X-Amz-Signature=3fd2850d03abb9301bf5ba5969d82eb73cb0b940b85e45de2e1e34f1ba2eaf09&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=374891081&response-content-disposition=attachment%3B%20filename%3Dcheckpoints.zip&response-content-type=application%2Foctet-stream [following]\n","--2021-07-04 06:40:07-- https://github-releases.githubusercontent.com/374891081/a8dac400-dcb6-11eb-933f-977cd7f5f554?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210704%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210704T063831Z&X-Amz-Expires=300&X-Amz-Signature=3fd2850d03abb9301bf5ba5969d82eb73cb0b940b85e45de2e1e34f1ba2eaf09&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=374891081&response-content-disposition=attachment%3B%20filename%3Dcheckpoints.zip&response-content-type=application%2Foctet-stream\n","Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.108.154, 185.199.109.154, 185.199.110.154, ...\n","Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.108.154|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 256461775 (245M) [application/octet-stream]\n","Saving to: ‘checkpoints.zip’\n","\n","checkpoints.zip 100%[===================>] 244.58M 219MB/s in 1.1s \n","\n","2021-07-04 06:40:08 (219 MB/s) - ‘checkpoints.zip’ saved [256461775/256461775]\n","\n","Archive: ./checkpoints.zip\n"," creating: ./checkpoints/people/\n"," inflating: ./checkpoints/people/iter.txt \n"," inflating: ./checkpoints/people/latest_net_D1.pth \n"," inflating: ./checkpoints/people/latest_net_D2.pth \n"," inflating: ./checkpoints/people/latest_net_G.pth \n"," inflating: ./checkpoints/people/loss_log.txt \n"," inflating: ./checkpoints/people/opt.txt \n"," creating: ./checkpoints/people/web/\n"," creating: ./checkpoints/people/web/images/\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"fJ9DYRrCPIUL","executionInfo":{"status":"ok","timestamp":1625380821122,"user_tz":-480,"elapsed":7869,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"a3d1d841-440c-4244-8045-cb0ce3cc81fd"},"source":["!wget --no-check-certificate \"https://sh23tw.dm.files.1drv.com/y4mmGiIkNVigkSwOKDcV3nwMJulRGhbtHdkheehR5TArc52UjudUYNXAEvKCii2O5LAmzGCGK6IfleocxuDeoKxDZkNzDRSt4ZUlEt8GlSOpCXAFEkBwaZimtWGDRbpIGpb_pz9Nq5jATBQpezBS6G_UtspWTkgrXHHxhviV2nWy8APPx134zOZrUIbkSF6xnsqzs3uZ_SEX_m9Rey0ykpx9w\" -O antelope.zip\n","!unzip ./antelope.zip -d ./insightface_func/models/"],"execution_count":7,"outputs":[{"output_type":"stream","text":["--2021-07-04 06:40:11-- https://sh23tw.dm.files.1drv.com/y4mmGiIkNVigkSwOKDcV3nwMJulRGhbtHdkheehR5TArc52UjudUYNXAEvKCii2O5LAmzGCGK6IfleocxuDeoKxDZkNzDRSt4ZUlEt8GlSOpCXAFEkBwaZimtWGDRbpIGpb_pz9Nq5jATBQpezBS6G_UtspWTkgrXHHxhviV2nWy8APPx134zOZrUIbkSF6xnsqzs3uZ_SEX_m9Rey0ykpx9w\n","Resolving sh23tw.dm.files.1drv.com (sh23tw.dm.files.1drv.com)... 13.107.42.12\n","Connecting to sh23tw.dm.files.1drv.com (sh23tw.dm.files.1drv.com)|13.107.42.12|:443... connected.\n","HTTP request sent, awaiting response... 200 OK\n","Length: 248024513 (237M) [application/zip]\n","Saving to: ‘antelope.zip’\n","\n","antelope.zip 100%[===================>] 236.53M 52.4MB/s in 4.7s \n","\n","2021-07-04 06:40:16 (49.9 MB/s) - ‘antelope.zip’ saved [248024513/248024513]\n","\n","Archive: ./antelope.zip\n"," creating: ./insightface_func/models/antelope/\n"," inflating: ./insightface_func/models/antelope/glintr100.onnx \n"," inflating: ./insightface_func/models/antelope/scrfd_10g_bnkps.onnx \n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"PfSsND36EMvn","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1625380827902,"user_tz":-480,"elapsed":6811,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"8130e97d-b4a0-4988-85fb-e2bc3e755259"},"source":["import cv2\n","import torch\n","import fractions\n","import numpy as np\n","from PIL import Image\n","import torch.nn.functional as F\n","from torchvision import transforms\n","from models.models import create_model\n","from options.test_options import TestOptions\n","from insightface_func.face_detect_crop_multi import Face_detect_crop\n","from util.videoswap_multispecific import video_swap\n","import os\n","import glob"],"execution_count":8,"outputs":[{"output_type":"stream","text":["Imageio: 'ffmpeg-linux64-v3.3.1' was not found on your computer; downloading it now.\n","Try 1. Download from https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-linux64-v3.3.1 (43.8 MB)\n","Downloading: 8192/45929032 bytes (0.0%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b3432448/45929032 bytes (7.5%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b7036928/45929032 bytes (15.3%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b10641408/45929032 bytes (23.2%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b14278656/45929032 bytes (31.1%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b18104320/45929032 bytes (39.4%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b21954560/45929032 bytes (47.8%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b25780224/45929032 bytes (56.1%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b29736960/45929032 bytes (64.7%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b33488896/45929032 bytes (72.9%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b37093376/45929032 bytes (80.8%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b40689664/45929032 bytes (88.6%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b44392448/45929032 bytes (96.7%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b45929032/45929032 bytes (100.0%)\n"," Done\n","File saved as /root/.imageio/ffmpeg/ffmpeg-linux64-v3.3.1.\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"rxSbZ2EDNDlf","executionInfo":{"status":"ok","timestamp":1625380827903,"user_tz":-480,"elapsed":12,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}}},"source":["def lcm(a, b): return abs(a * b) / fractions.gcd(a, b) if a and b else 0\n","\n","transformer = transforms.Compose([\n"," transforms.ToTensor(),\n"," #transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])\n"," ])\n","\n","transformer_Arcface = transforms.Compose([\n"," transforms.ToTensor(),\n"," transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])\n"," ])\n"],"execution_count":9,"outputs":[]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ye8iS0UVPMRg","executionInfo":{"status":"ok","timestamp":1625380828574,"user_tz":-480,"elapsed":680,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"cb5a4b02-b1d0-4ff8-f542-5c1b3c9703d9"},"source":["!ls ./checkpoints"],"execution_count":10,"outputs":[{"output_type":"stream","text":["people\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"wwJOwR9LNKRz","colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"status":"ok","timestamp":1625380828576,"user_tz":-480,"elapsed":13,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"0f92f785-4d9c-4130-b24d-76871b2dafba"},"source":["opt = TestOptions()\n","opt.initialize()\n","opt.parser.add_argument('-f') ## dummy arg to avoid bug\n","opt = opt.parse()\n","opt.multisepcific_dir = './demo_file/multispecific' ## or replace it with folder from your own google drive\n"," ## and remember to follow the dir structure in usage.md\n","opt.video_path = './demo_file/multi_people_1080p.mp4' ## or replace it with video from your own google drive\n","opt.output_path = './output/multi_test_multispecific.mp4'\n","opt.temp_path = './tmp'\n","opt.Arc_path = './arcface_model/arcface_checkpoint.tar'\n","opt.name = 'people'\n","opt.isTrain = False\n","opt.use_mask = True ## new feature up-to-date\n","\n","crop_size = opt.crop_size\n"],"execution_count":11,"outputs":[{"output_type":"stream","text":["------------ Options -------------\n","Arc_path: models/BEST_checkpoint.tar\n","aspect_ratio: 1.0\n","batchSize: 8\n","checkpoints_dir: ./checkpoints\n","cluster_path: features_clustered_010.npy\n","data_type: 32\n","dataroot: ./datasets/cityscapes/\n","display_winsize: 512\n","engine: None\n","export_onnx: None\n","f: /root/.local/share/jupyter/runtime/kernel-19937219-895d-4d02-9a72-5cfa0e889adf.json\n","feat_num: 3\n","fineSize: 512\n","fp16: False\n","gpu_ids: [0]\n","how_many: 50\n","id_thres: 0.03\n","image_size: 224\n","input_nc: 3\n","instance_feat: False\n","isTrain: False\n","label_feat: False\n","label_nc: 0\n","latent_size: 512\n","loadSize: 1024\n","load_features: False\n","local_rank: 0\n","max_dataset_size: inf\n","model: pix2pixHD\n","multisepcific_dir: ./demo_file/multispecific\n","nThreads: 2\n","n_blocks_global: 6\n","n_blocks_local: 3\n","n_clusters: 10\n","n_downsample_E: 4\n","n_downsample_global: 3\n","n_local_enhancers: 1\n","name: people\n","nef: 16\n","netG: global\n","ngf: 64\n","niter_fix_global: 0\n","no_flip: False\n","no_instance: False\n","no_simswaplogo: False\n","norm: batch\n","norm_G: spectralspadesyncbatch3x3\n","ntest: inf\n","onnx: None\n","output_nc: 3\n","output_path: ./output/\n","phase: test\n","pic_a_path: ./crop_224/gdg.jpg\n","pic_b_path: ./crop_224/zrf.jpg\n","pic_specific_path: ./crop_224/zrf.jpg\n","resize_or_crop: scale_width\n","results_dir: ./results/\n","semantic_nc: 3\n","serial_batches: False\n","temp_path: ./temp_results\n","tf_log: False\n","use_dropout: False\n","use_encoded_image: False\n","verbose: False\n","video_path: ./demo_file/multi_people_1080p.mp4\n","which_epoch: latest\n","-------------- End ----------------\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"UFt8zQrAMq9F","executionInfo":{"status":"ok","timestamp":1625381428564,"user_tz":-480,"elapsed":599996,"user":{"displayName":"José Lampreia","photoUrl":"","userId":"16015278604201270582"}},"outputId":"46188013-3f6d-4174-9959-d1fd203dcc0d"},"source":["pic_specific = opt.pic_specific_path\n","crop_size = opt.crop_size\n","multisepcific_dir = opt.multisepcific_dir\n","\n","torch.nn.Module.dump_patches = True\n","model = create_model(opt)\n","model.eval()\n","\n","app = Face_detect_crop(name='antelope', root='./insightface_func/models')\n","app.prepare(ctx_id= 0, det_thresh=0.6, det_size=(640,640))\n","# The specific person to be swapped(source)\n","source_specific_id_nonorm_list = []\n","source_path = os.path.join(multisepcific_dir,'SRC_*')\n","source_specific_images_path = sorted(glob.glob(source_path))\n","\n","with torch.no_grad():\n"," for source_specific_image_path in source_specific_images_path:\n"," specific_person_whole = cv2.imread(source_specific_image_path)\n"," specific_person_align_crop, _ = app.get(specific_person_whole,crop_size)\n"," specific_person_align_crop_pil = Image.fromarray(cv2.cvtColor(specific_person_align_crop[0],cv2.COLOR_BGR2RGB)) \n"," specific_person = transformer_Arcface(specific_person_align_crop_pil)\n"," specific_person = specific_person.view(-1, specific_person.shape[0], specific_person.shape[1], specific_person.shape [2])\n"," # convert numpy to tensor\n"," specific_person = specific_person.cuda()\n"," #create latent id\n"," specific_person_downsample = F.interpolate(specific_person, size=(112,112))\n"," specific_person_id_nonorm = model.netArc(specific_person_downsample)\n"," source_specific_id_nonorm_list.append(specific_person_id_nonorm.clone())\n","\n"," # The person who provides id information (list)\n"," target_id_norm_list = []\n"," target_path = os.path.join(multisepcific_dir,'DST_*')\n"," target_images_path = sorted(glob.glob(target_path))\n","\n"," for target_image_path in target_images_path:\n"," img_a_whole = cv2.imread(target_image_path)\n"," img_a_align_crop, _ = app.get(img_a_whole,crop_size)\n"," img_a_align_crop_pil = Image.fromarray(cv2.cvtColor(img_a_align_crop[0],cv2.COLOR_BGR2RGB)) \n"," img_a = transformer_Arcface(img_a_align_crop_pil)\n"," img_id = img_a.view(-1, img_a.shape[0], img_a.shape[1], img_a.shape[2])\n"," # convert numpy to tensor\n"," img_id = img_id.cuda()\n"," #create latent id\n"," img_id_downsample = F.interpolate(img_id, size=(112,112))\n"," latend_id = model.netArc(img_id_downsample)\n"," latend_id = F.normalize(latend_id, p=2, dim=1)\n"," target_id_norm_list.append(latend_id.clone())\n"," \n"," assert len(target_id_norm_list) == len(source_specific_id_nonorm_list), \"The number of images in source and target directory must be same !!!\"\n"," video_swap(opt.video_path, target_id_norm_list,source_specific_id_nonorm_list, opt.id_thres, \\\n"," model, app, opt.output_path,temp_results_dir=opt.temp_path,no_simswaplogo=opt.no_simswaplogo,use_mask=opt.use_mask)"],"execution_count":12,"outputs":[{"output_type":"stream","text":["input mean and std: 127.5 127.5\n","find model: ./insightface_func/models/antelope/glintr100.onnx recognition\n","find model: ./insightface_func/models/antelope/scrfd_10g_bnkps.onnx detection\n","set det-size: (640, 640)\n"],"name":"stdout"},{"output_type":"stream","text":["\r 0%| | 0/594 [00:00<?, ?it/s]"],"name":"stderr"},{"output_type":"stream","text":["(142, 366, 4)\n"],"name":"stdout"},{"output_type":"stream","text":["100%|██████████| 594/594 [08:28<00:00, 1.17it/s]\n"],"name":"stderr"},{"output_type":"stream","text":["[MoviePy] >>>> Building video ./output/multi_test_multispecific.mp4\n","[MoviePy] Writing audio in multi_test_multispecificTEMP_MPY_wvf_snd.mp3\n"],"name":"stdout"},{"output_type":"stream","text":["100%|██████████| 438/438 [00:00<00:00, 832.16it/s]"],"name":"stderr"},{"output_type":"stream","text":["[MoviePy] Done.\n","[MoviePy] Writing video ./output/multi_test_multispecific.mp4\n"],"name":"stdout"},{"output_type":"stream","text":["\n","100%|██████████| 595/595 [00:53<00:00, 11.11it/s]\n"],"name":"stderr"},{"output_type":"stream","text":["[MoviePy] Done.\n","[MoviePy] >>>> Video ready: ./output/multi_test_multispecific.mp4 \n","\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"Rty2GsyZZrI6"},"source":[],"execution_count":null,"outputs":[]}]}
|
SimSwap/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SimSwap: An Efficient Framework For High Fidelity Face Swapping
|
| 2 |
+
## Proceedings of the 28th ACM International Conference on Multimedia
|
| 3 |
+
**The official repository with Pytorch**
|
| 4 |
+
|
| 5 |
+
**Our method can realize **arbitrary face swapping** on images and videos with **one single trained model**.**
|
| 6 |
+
|
| 7 |
+
***We are recruiting full-time engineers. If you are interested, please send an [email](mailto:chen19910528@sjtu.edu.cn?subject=[GitHub]%20Source%20Han%20Sans) to my team. Please refer to the website for specific recruitment conditions: [Requirements](https://join.sjtu.edu.cn/Admin/QsPreview.aspx?qsid=44f5413a90974114b8f5e643177ef32d)***
|
| 8 |
+
|
| 9 |
+
Training and test code are now available!
|
| 10 |
+
[ <a href="https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/train.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"></a>](https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/train.ipynb)
|
| 11 |
+
|
| 12 |
+
We are working with our incoming paper SimSwap++, keeping expecting!
|
| 13 |
+
|
| 14 |
+
The high resolution version of ***SimSwap-HQ*** is supported!
|
| 15 |
+
|
| 16 |
+
[](https://github.com/neuralchen/SimSwap)
|
| 17 |
+
|
| 18 |
+
Our paper can be downloaded from [[Arxiv]](https://arxiv.org/pdf/2106.06340v1.pdf) [[ACM DOI]](https://dl.acm.org/doi/10.1145/3394171.3413630)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
### This project also received support from [SocialBook](https://socialbook.io).
|
| 22 |
+
<!-- [](https://socialbook.io) -->
|
| 23 |
+
<img width=30% src="./simswaplogo/socialbook_logo.2020.357eed90add7705e54a8.svg"/>
|
| 24 |
+
|
| 25 |
+
<!-- [[Google Drive]](https://drive.google.com/file/d/1fcfWOGt1mkBo7F0gXVKitf8GJMAXQxZD/view?usp=sharing)
|
| 26 |
+
[[Baidu Drive ]](https://pan.baidu.com/s/1-TKFuycRNUKut8hn4IimvA) Password: ```ummt``` -->
|
| 27 |
+
|
| 28 |
+
## Attention
|
| 29 |
+
***This project is for technical and academic use only. Please do not apply it to illegal and unethical scenarios.***
|
| 30 |
+
|
| 31 |
+
***In the event of violation of the legal and ethical requirements of the user's country or region, this code repository is exempt from liability***
|
| 32 |
+
|
| 33 |
+
***Please do not ignore the content at the end of this README!***
|
| 34 |
+
|
| 35 |
+
If you find this project useful, please star it. It is the greatest appreciation of our work.
|
| 36 |
+
|
| 37 |
+
## Top News <img width=8% src="./docs/img/new.gif"/>
|
| 38 |
+
|
| 39 |
+
**`2023-09-26`**: We fixed bugs in colab!
|
| 40 |
+
|
| 41 |
+
**`2023-04-25`**: We fixed the "AttributeError: 'SGD' object has no attribute 'defaults' now" bug. If you have already downloaded **arcface_checkpoint.tar**, please **download it again**. Also, you also need to update the scripts in ```./models/```.
|
| 42 |
+
|
| 43 |
+
**`2022-04-21`**: For resource limited users, we provide the cropped VGGFace2-224 dataset [[Google Driver] VGGFace2-224 (10.8G)](https://drive.google.com/file/d/19pWvdEHS-CEG6tW3PdxdtZ5QEymVjImc/view?usp=sharing) [[Baidu Driver]](https://pan.baidu.com/s/1OiwLJHVBSYB4AY2vEcfN0A) [Password: lrod].
|
| 44 |
+
|
| 45 |
+
**`2022-04-20`**: Training scripts are now available. We highly recommend that you guys train the simswap model with our released high quality dataset [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ).
|
| 46 |
+
|
| 47 |
+
**`2021-11-24`**: We have trained a beta version of ***SimSwap-HQ*** on [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) and open sourced the checkpoint of this model (if you think the Simswap 512 is cool, please star our [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) repo). Please don’t forget to go to [Preparation](./docs/guidance/preparation.md) and [Inference for image or video face swapping](./docs/guidance/usage.md) to check the latest set up.
|
| 48 |
+
|
| 49 |
+
**`2021-11-23`**: The google drive link of [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) is released.
|
| 50 |
+
|
| 51 |
+
**`2021-11-17`**: We released a high resolution face dataset [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) and the method to generate this dataset. This dataset is for research purpose.
|
| 52 |
+
|
| 53 |
+
**`2021-08-30`**: Docker has been supported, please refer [here](https://replicate.ai/neuralchen/simswap-image) for details.
|
| 54 |
+
|
| 55 |
+
**`2021-08-17`**: We have updated the [Preparation](./docs/guidance/preparation.md), The main change is that the gpu version of onnx is now installed by default, Now the time to process a video is greatly reduced.
|
| 56 |
+
|
| 57 |
+
**`2021-07-19`**: ***Obvious border abruptness has been resolved***. We add the ability to using mask and upgrade the old algorithm for better visual effect, please go to [Inference for image or video face swapping](./docs/guidance/usage.md) for details. Please don’t forget to go to [Preparation](./docs/guidance/preparation.md) to check the latest set up. (Thanks for the help from [@woctezuma](https://github.com/woctezuma) and [@instant-high](https://github.com/instant-high))
|
| 58 |
+
|
| 59 |
+
## The first open source high resolution dataset for face swapping!!!
|
| 60 |
+
## High Resolution Dataset [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ)
|
| 61 |
+
|
| 62 |
+
[](https://github.com/NNNNAI/VGGFace2-HQ)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
## Dependencies
|
| 68 |
+
- python3.6+
|
| 69 |
+
- pytorch1.5+
|
| 70 |
+
- torchvision
|
| 71 |
+
- opencv
|
| 72 |
+
- pillow
|
| 73 |
+
- numpy
|
| 74 |
+
- imageio
|
| 75 |
+
- moviepy
|
| 76 |
+
- insightface
|
| 77 |
+
- ***timm==0.5.4***
|
| 78 |
+
|
| 79 |
+
## Training
|
| 80 |
+
|
| 81 |
+
[Preparation](./docs/guidance/preparation.md)
|
| 82 |
+
|
| 83 |
+
The training script is slightly different from the original version, e.g., we replace the patch discriminator with the projected discriminator, which saves a lot of hardware overhead and achieves slightly better results.
|
| 84 |
+
|
| 85 |
+
In order to ensure the normal training, the batch size must be greater than 1.
|
| 86 |
+
|
| 87 |
+
Friendly reminder, due to the difference in training settings, the user-trained model will have subtle differences in visual effects from the pre-trained model we provide.
|
| 88 |
+
|
| 89 |
+
- Train 224 models with VGGFace2 224*224 [[Google Driver] VGGFace2-224 (10.8G)](https://drive.google.com/file/d/19pWvdEHS-CEG6tW3PdxdtZ5QEymVjImc/view?usp=sharing) [[Baidu Driver] ](https://pan.baidu.com/s/1OiwLJHVBSYB4AY2vEcfN0A) [Password: lrod]
|
| 90 |
+
|
| 91 |
+
For faster convergence and better results, a large batch size (more than 16) is recommended!
|
| 92 |
+
|
| 93 |
+
***We recommend training more than 400K iterations (batch size is 16), 600K~800K will be better, more iterations will not be recommended.***
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
```
|
| 97 |
+
python train.py --name simswap224_test --batchSize 8 --gpu_ids 0 --dataset /path/to/VGGFace2HQ --Gdeep False
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
[Colab demo for training 224 model][ <a href="https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/train.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"></a>](https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/train.ipynb)
|
| 101 |
+
|
| 102 |
+
For faster convergence and better results, a large batch size (more than 16) is recommended!
|
| 103 |
+
|
| 104 |
+
- Train 512 models with VGGFace2-HQ 512*512 [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ).
|
| 105 |
+
```
|
| 106 |
+
python train.py --name simswap512_test --batchSize 16 --gpu_ids 0 --dataset /path/to/VGGFace2HQ --Gdeep True
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
## Inference with a pretrained SimSwap model
|
| 112 |
+
[Preparation](./docs/guidance/preparation.md)
|
| 113 |
+
|
| 114 |
+
[Inference for image or video face swapping](./docs/guidance/usage.md)
|
| 115 |
+
|
| 116 |
+
[Colab demo](https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/SimSwap%20colab.ipynb)
|
| 117 |
+
|
| 118 |
+
<div style="background: yellow; width:140px; font-weight:bold;font-family: sans-serif;">Stronger feature</div>
|
| 119 |
+
|
| 120 |
+
[Colab for switching specific faces in multi-face videos][ <a href="https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/MultiSpecific.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"></a>](https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/MultiSpecific.ipynb)
|
| 121 |
+
|
| 122 |
+
[Image face swapping demo & Docker image on Replicate](https://replicate.ai/neuralchen/simswap-image)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
## Video
|
| 127 |
+
<img src="./docs/img/video.webp"/>
|
| 128 |
+
<div>
|
| 129 |
+
<img width=24% src="./docs/img/anni.webp"/>
|
| 130 |
+
<img width=24% src="./docs/img/chenglong.webp"/>
|
| 131 |
+
<img width=24% src="./docs/img/zhoujielun.webp"/>
|
| 132 |
+
<img width=24% src="./docs/img/zhuyin.webp"/>
|
| 133 |
+
</div>
|
| 134 |
+
<div>
|
| 135 |
+
<img width=49% src="./docs/img/mama_mask_short.webp"/>
|
| 136 |
+
<img width=49% src="./docs/img/mama_mask_wuyifan_short.webp"/>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
## Results
|
| 140 |
+

|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
<!-- 
|
| 146 |
+

|
| 147 |
+

|
| 148 |
+
 -->
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
**High-quality videos can be found in the link below:**
|
| 152 |
+
|
| 153 |
+
[[Mama(video) 1080p]](https://drive.google.com/file/d/1mnSlwzz7f4H2O7UwApAHo64mgK4xSNyK/view?usp=sharing)
|
| 154 |
+
|
| 155 |
+
[[Google Drive link for video 1]](https://drive.google.com/file/d/1hdne7Gw39d34zt3w1NYV3Ln5cT8PfCNm/view?usp=sharing)
|
| 156 |
+
|
| 157 |
+
[[Google Drive link for video 2]](https://drive.google.com/file/d/1bDEg_pVeFYLnf9QLSMuG8bsjbRPk0X5_/view?usp=sharing)
|
| 158 |
+
|
| 159 |
+
[[Google Drive link for video 3]](https://drive.google.com/file/d/1oftHAnLmgFis4XURcHTccGSWbWSXYKK1/view?usp=sharing)
|
| 160 |
+
|
| 161 |
+
[[Baidu Drive link for video]](https://pan.baidu.com/s/1WTS6jm2TY17bYJurw57LUg ) Password: ```b26n```
|
| 162 |
+
|
| 163 |
+
[[Online Video]](https://www.bilibili.com/video/BV12v411p7j5/)
|
| 164 |
+
|
| 165 |
+
## User case
|
| 166 |
+
If you have some interesting results after using our project and are willing to share, you can contact us by email or share directly on the issue. Later, we may make a separate section to show these results, which should be cool.
|
| 167 |
+
|
| 168 |
+
At the same time, if you have suggestions for our project, please feel free to ask questions in the issue, or contact us directly via email: [email1](mailto:chenxuanhongzju@outlook.com), [email2](mailto:nicklau26@foxmail.com), [email3](mailto:ziangliu824@gmail.com). (All three can be contacted, just choose any one)
|
| 169 |
+
|
| 170 |
+
## License
|
| 171 |
+
For academic and non-commercial use only.The whole project is under the CC-BY-NC 4.0 license. See [LICENSE](https://github.com/neuralchen/SimSwap/blob/main/LICENSE) for additional details.
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
## To cite our papers
|
| 175 |
+
```
|
| 176 |
+
@inproceedings{DBLP:conf/mm/ChenCNG20,
|
| 177 |
+
author = {Renwang Chen and
|
| 178 |
+
Xuanhong Chen and
|
| 179 |
+
Bingbing Ni and
|
| 180 |
+
Yanhao Ge},
|
| 181 |
+
title = {SimSwap: An Efficient Framework For High Fidelity Face Swapping},
|
| 182 |
+
booktitle = {{MM} '20: The 28th {ACM} International Conference on Multimedia},
|
| 183 |
+
year = {2020}
|
| 184 |
+
}
|
| 185 |
+
```
|
| 186 |
+
```
|
| 187 |
+
@Article{simswapplusplus,
|
| 188 |
+
author = {Xuanhong Chen and
|
| 189 |
+
Bingbing Ni and
|
| 190 |
+
Yutian Liu and
|
| 191 |
+
Naiyuan Liu and
|
| 192 |
+
Zhilin Zeng and
|
| 193 |
+
Hang Wang},
|
| 194 |
+
title = {SimSwap++: Towards Faster and High-Quality Identity Swapping},
|
| 195 |
+
journal = {{IEEE} Trans. Pattern Anal. Mach. Intell.},
|
| 196 |
+
volume = {46},
|
| 197 |
+
number = {1},
|
| 198 |
+
pages = {576--592},
|
| 199 |
+
year = {2024}
|
| 200 |
+
}
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
## Related Projects
|
| 204 |
+
|
| 205 |
+
**Please visit our another ACMMM2020 high-quality style transfer project**
|
| 206 |
+
|
| 207 |
+
[](https://github.com/neuralchen/ASMAGAN)
|
| 208 |
+
|
| 209 |
+
[](https://github.com/neuralchen/ASMAGAN)
|
| 210 |
+
|
| 211 |
+
**Please visit our AAAI2021 sketch based rendering project**
|
| 212 |
+
|
| 213 |
+
[](https://github.com/TZYSJTU/Sketch-Generation-with-Drawing-Process-Guided-by-Vector-Flow-and-Grayscale)
|
| 214 |
+
[](https://github.com/TZYSJTU/Sketch-Generation-with-Drawing-Process-Guided-by-Vector-Flow-and-Grayscale)
|
| 215 |
+
|
| 216 |
+
**Please visit our high resolution face dataset VGGFace2-HQ**
|
| 217 |
+
|
| 218 |
+
[](https://github.com/NNNNAI/VGGFace2-HQ)
|
| 219 |
+
|
| 220 |
+
Learn about our other projects
|
| 221 |
+
|
| 222 |
+
[[VGGFace2-HQ]](https://github.com/NNNNAI/VGGFace2-HQ);
|
| 223 |
+
|
| 224 |
+
[[RainNet]](https://neuralchen.github.io/RainNet);
|
| 225 |
+
|
| 226 |
+
[[Sketch Generation]](https://github.com/TZYSJTU/Sketch-Generation-with-Drawing-Process-Guided-by-Vector-Flow-and-Grayscale);
|
| 227 |
+
|
| 228 |
+
[[CooGAN]](https://github.com/neuralchen/CooGAN);
|
| 229 |
+
|
| 230 |
+
[[Knowledge Style Transfer]](https://github.com/AceSix/Knowledge_Transfer);
|
| 231 |
+
|
| 232 |
+
[[SimSwap]](https://github.com/neuralchen/SimSwap);
|
| 233 |
+
|
| 234 |
+
[[ASMA-GAN]](https://github.com/neuralchen/ASMAGAN);
|
| 235 |
+
|
| 236 |
+
[[SNGAN-Projection-pytorch]](https://github.com/neuralchen/SNGAN_Projection)
|
| 237 |
+
|
| 238 |
+
[[Pretrained_VGG19]](https://github.com/neuralchen/Pretrained_VGG19).
|
| 239 |
+
|
| 240 |
+
## Acknowledgements
|
| 241 |
+
|
| 242 |
+
<!--ts-->
|
| 243 |
+
* [Deepfacelab](https://github.com/iperov/DeepFaceLab)
|
| 244 |
+
* [Insightface](https://github.com/deepinsight/insightface)
|
| 245 |
+
* [Face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch)
|
| 246 |
+
* [BiSeNet](https://github.com/CoinCheung/BiSeNet)
|
| 247 |
+
<!--te-->
|
SimSwap/SimSwap colab.ipynb
ADDED
|
@@ -0,0 +1,579 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"nbformat": 4,
|
| 3 |
+
"nbformat_minor": 0,
|
| 4 |
+
"metadata": {
|
| 5 |
+
"colab": {
|
| 6 |
+
"name": "SimSwap colab.ipynb",
|
| 7 |
+
"provenance": [],
|
| 8 |
+
"collapsed_sections": []
|
| 9 |
+
},
|
| 10 |
+
"kernelspec": {
|
| 11 |
+
"name": "python3",
|
| 12 |
+
"display_name": "Python 3"
|
| 13 |
+
},
|
| 14 |
+
"language_info": {
|
| 15 |
+
"name": "python"
|
| 16 |
+
},
|
| 17 |
+
"accelerator": "GPU"
|
| 18 |
+
},
|
| 19 |
+
"cells": [
|
| 20 |
+
{
|
| 21 |
+
"cell_type": "markdown",
|
| 22 |
+
"metadata": {
|
| 23 |
+
"id": "7_gtFoV8BuRx"
|
| 24 |
+
},
|
| 25 |
+
"source": [
|
| 26 |
+
"This is a simple example of SimSwap on processing video with multiple faces. You can change the codes for inference based on our other scripts for image or single face swapping.\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"Code path: https://github.com/neuralchen/SimSwap\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"Paper path: https://arxiv.org/pdf/2106.06340v1.pdf or https://dl.acm.org/doi/10.1145/3394171.3413630"
|
| 31 |
+
]
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"cell_type": "code",
|
| 35 |
+
"metadata": {
|
| 36 |
+
"colab": {
|
| 37 |
+
"base_uri": "https://localhost:8080/"
|
| 38 |
+
},
|
| 39 |
+
"id": "0Y1RfpzsCAl9",
|
| 40 |
+
"outputId": "a39470a0-9689-409d-a0a4-e2afd5d3b5dd"
|
| 41 |
+
},
|
| 42 |
+
"source": [
|
| 43 |
+
"## make sure you are using a runtime with GPU\n",
|
| 44 |
+
"## you can check at Runtime/Change runtime type in the top bar.\n",
|
| 45 |
+
"!nvidia-smi"
|
| 46 |
+
],
|
| 47 |
+
"execution_count": 1,
|
| 48 |
+
"outputs": [
|
| 49 |
+
{
|
| 50 |
+
"output_type": "stream",
|
| 51 |
+
"text": [
|
| 52 |
+
"Mon Jun 21 02:13:20 2021 \n",
|
| 53 |
+
"+-----------------------------------------------------------------------------+\n",
|
| 54 |
+
"| NVIDIA-SMI 465.27 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
| 55 |
+
"|-------------------------------+----------------------+----------------------+\n",
|
| 56 |
+
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
| 57 |
+
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
| 58 |
+
"| | | MIG M. |\n",
|
| 59 |
+
"|===============================+======================+======================|\n",
|
| 60 |
+
"| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n",
|
| 61 |
+
"| N/A 45C P8 10W / 70W | 0MiB / 15109MiB | 0% Default |\n",
|
| 62 |
+
"| | | N/A |\n",
|
| 63 |
+
"+-------------------------------+----------------------+----------------------+\n",
|
| 64 |
+
" \n",
|
| 65 |
+
"+-----------------------------------------------------------------------------+\n",
|
| 66 |
+
"| Processes: |\n",
|
| 67 |
+
"| GPU GI CI PID Type Process name GPU Memory |\n",
|
| 68 |
+
"| ID ID Usage |\n",
|
| 69 |
+
"|=============================================================================|\n",
|
| 70 |
+
"| No running processes found |\n",
|
| 71 |
+
"+-----------------------------------------------------------------------------+\n"
|
| 72 |
+
],
|
| 73 |
+
"name": "stdout"
|
| 74 |
+
}
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"cell_type": "markdown",
|
| 79 |
+
"metadata": {
|
| 80 |
+
"id": "0Qzzx2UpDkqw"
|
| 81 |
+
},
|
| 82 |
+
"source": [
|
| 83 |
+
"## Installation\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"All file changes made by this notebook are temporary. \n",
|
| 86 |
+
"You can try to mount your own google drive to store files if you want.\n"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"metadata": {
|
| 92 |
+
"colab": {
|
| 93 |
+
"base_uri": "https://localhost:8080/"
|
| 94 |
+
},
|
| 95 |
+
"id": "VA_4CeWZCHLP",
|
| 96 |
+
"outputId": "4b0f176f-87e7-4772-8b47-c2098d8f3bf6"
|
| 97 |
+
},
|
| 98 |
+
"source": [
|
| 99 |
+
"!git clone https://github.com/neuralchen/SimSwap\n",
|
| 100 |
+
"!cd SimSwap && git pull"
|
| 101 |
+
],
|
| 102 |
+
"execution_count": 2,
|
| 103 |
+
"outputs": [
|
| 104 |
+
{
|
| 105 |
+
"output_type": "stream",
|
| 106 |
+
"text": [
|
| 107 |
+
"Cloning into 'SimSwap'...\n",
|
| 108 |
+
"remote: Enumerating objects: 362, done.\u001b[K\n",
|
| 109 |
+
"remote: Counting objects: 100% (362/362), done.\u001b[K\n",
|
| 110 |
+
"remote: Compressing objects: 100% (281/281), done.\u001b[K\n",
|
| 111 |
+
"remote: Total 362 (delta 149), reused 272 (delta 67), pack-reused 0\u001b[K\n",
|
| 112 |
+
"Receiving objects: 100% (362/362), 101.31 MiB | 32.47 MiB/s, done.\n",
|
| 113 |
+
"Resolving deltas: 100% (149/149), done.\n",
|
| 114 |
+
"Already up to date.\n"
|
| 115 |
+
],
|
| 116 |
+
"name": "stdout"
|
| 117 |
+
}
|
| 118 |
+
]
|
| 119 |
+
},
|
| 120 |
+
{
|
| 121 |
+
"cell_type": "code",
|
| 122 |
+
"metadata": {
|
| 123 |
+
"id": "Y5K4au_UCkKn",
|
| 124 |
+
"colab": {
|
| 125 |
+
"base_uri": "https://localhost:8080/"
|
| 126 |
+
},
|
| 127 |
+
"outputId": "9691a7a4-192e-4ec2-c3c1-1f2c933d7b6a"
|
| 128 |
+
},
|
| 129 |
+
"source": [
|
| 130 |
+
"!pip install insightface==0.2.1 onnxruntime moviepy\n",
|
| 131 |
+
"!pip install googledrivedownloader\n",
|
| 132 |
+
"!pip install imageio==2.4.1"
|
| 133 |
+
],
|
| 134 |
+
"execution_count": 3,
|
| 135 |
+
"outputs": [
|
| 136 |
+
{
|
| 137 |
+
"output_type": "stream",
|
| 138 |
+
"text": [
|
| 139 |
+
"Collecting insightface==0.2.1\n",
|
| 140 |
+
" Downloading https://files.pythonhosted.org/packages/ee/1e/6395bbe0db665f187c8e49266cda54fcf661f182192370d409423e4943e4/insightface-0.2.1-py2.py3-none-any.whl\n",
|
| 141 |
+
"Collecting onnxruntime\n",
|
| 142 |
+
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/f9/76/3d0f8bb2776961c7335693df06eccf8d099e48fa6fb552c7546867192603/onnxruntime-1.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5MB)\n",
|
| 143 |
+
"\u001b[K |████████████████████████████████| 4.5MB 10.2MB/s \n",
|
| 144 |
+
"\u001b[?25hRequirement already satisfied: moviepy in /usr/local/lib/python3.7/dist-packages (0.2.3.5)\n",
|
| 145 |
+
"Collecting onnx\n",
|
| 146 |
+
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/3f/9b/54c950d3256e27f970a83cd0504efb183a24312702deed0179453316dbd0/onnx-1.9.0-cp37-cp37m-manylinux2010_x86_64.whl (12.2MB)\n",
|
| 147 |
+
"\u001b[K |████████████████████████████████| 12.2MB 51.4MB/s \n",
|
| 148 |
+
"\u001b[?25hRequirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (3.2.2)\n",
|
| 149 |
+
"Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (4.41.1)\n",
|
| 150 |
+
"Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (7.1.2)\n",
|
| 151 |
+
"Requirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (0.16.2)\n",
|
| 152 |
+
"Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (2.23.0)\n",
|
| 153 |
+
"Requirement already satisfied: scikit-learn in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (0.22.2.post1)\n",
|
| 154 |
+
"Requirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (4.1.2.30)\n",
|
| 155 |
+
"Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.19.5)\n",
|
| 156 |
+
"Requirement already satisfied: easydict in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.9)\n",
|
| 157 |
+
"Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from insightface==0.2.1) (1.4.1)\n",
|
| 158 |
+
"Requirement already satisfied: flatbuffers in /usr/local/lib/python3.7/dist-packages (from onnxruntime) (1.12)\n",
|
| 159 |
+
"Requirement already satisfied: protobuf in /usr/local/lib/python3.7/dist-packages (from onnxruntime) (3.12.4)\n",
|
| 160 |
+
"Requirement already satisfied: decorator<5.0,>=4.0.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (4.4.2)\n",
|
| 161 |
+
"Requirement already satisfied: imageio<3.0,>=2.1.2 in /usr/local/lib/python3.7/dist-packages (from moviepy) (2.4.1)\n",
|
| 162 |
+
"Requirement already satisfied: typing-extensions>=3.6.2.1 in /usr/local/lib/python3.7/dist-packages (from onnx->insightface==0.2.1) (3.7.4.3)\n",
|
| 163 |
+
"Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from onnx->insightface==0.2.1) (1.15.0)\n",
|
| 164 |
+
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (1.3.1)\n",
|
| 165 |
+
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (2.8.1)\n",
|
| 166 |
+
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (0.10.0)\n",
|
| 167 |
+
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->insightface==0.2.1) (2.4.7)\n",
|
| 168 |
+
"Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->insightface==0.2.1) (2.5.1)\n",
|
| 169 |
+
"Requirement already satisfied: PyWavelets>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->insightface==0.2.1) (1.1.1)\n",
|
| 170 |
+
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (2.10)\n",
|
| 171 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (2021.5.30)\n",
|
| 172 |
+
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (3.0.4)\n",
|
| 173 |
+
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->insightface==0.2.1) (1.24.3)\n",
|
| 174 |
+
"Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.7/dist-packages (from scikit-learn->insightface==0.2.1) (1.0.1)\n",
|
| 175 |
+
"Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from protobuf->onnxruntime) (57.0.0)\n",
|
| 176 |
+
"Installing collected packages: onnx, insightface, onnxruntime\n",
|
| 177 |
+
"Successfully installed insightface-0.2.1 onnx-1.9.0 onnxruntime-1.8.0\n",
|
| 178 |
+
"Requirement already satisfied: googledrivedownloader in /usr/local/lib/python3.7/dist-packages (0.4)\n",
|
| 179 |
+
"Requirement already satisfied: imageio==2.4.1 in /usr/local/lib/python3.7/dist-packages (2.4.1)\n",
|
| 180 |
+
"Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio==2.4.1) (7.1.2)\n",
|
| 181 |
+
"Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from imageio==2.4.1) (1.19.5)\n"
|
| 182 |
+
],
|
| 183 |
+
"name": "stdout"
|
| 184 |
+
}
|
| 185 |
+
]
|
| 186 |
+
},
|
| 187 |
+
{
|
| 188 |
+
"cell_type": "code",
|
| 189 |
+
"metadata": {
|
| 190 |
+
"colab": {
|
| 191 |
+
"base_uri": "https://localhost:8080/"
|
| 192 |
+
},
|
| 193 |
+
"id": "gQ7ZoIbLFCye",
|
| 194 |
+
"outputId": "bb35e7e2-14b7-4f36-d62a-499ba041cf64"
|
| 195 |
+
},
|
| 196 |
+
"source": [
|
| 197 |
+
"import os\n",
|
| 198 |
+
"os.chdir(\"SimSwap\")\n",
|
| 199 |
+
"!ls"
|
| 200 |
+
],
|
| 201 |
+
"execution_count": 4,
|
| 202 |
+
"outputs": [
|
| 203 |
+
{
|
| 204 |
+
"output_type": "stream",
|
| 205 |
+
"text": [
|
| 206 |
+
" crop_224\t models\t\t test_one_image.py\n",
|
| 207 |
+
" data\t\t options\t\t test_video_swapmulti.py\n",
|
| 208 |
+
" demo_file\t output\t\t test_video_swapsingle.py\n",
|
| 209 |
+
" doc\t\t README.md\t\t test_wholeimage_swapmulti.py\n",
|
| 210 |
+
" insightface_func 'SimSwap colab.ipynb' test_wholeimage_swapsingle.py\n",
|
| 211 |
+
" LICENSE\t simswaplogo\t\t util\n"
|
| 212 |
+
],
|
| 213 |
+
"name": "stdout"
|
| 214 |
+
}
|
| 215 |
+
]
|
| 216 |
+
},
|
| 217 |
+
{
|
| 218 |
+
"cell_type": "code",
|
| 219 |
+
"metadata": {
|
| 220 |
+
"colab": {
|
| 221 |
+
"base_uri": "https://localhost:8080/"
|
| 222 |
+
},
|
| 223 |
+
"id": "gLti1J0pEFjJ",
|
| 224 |
+
"outputId": "e93c3f98-01df-458e-b791-c32f7343e705"
|
| 225 |
+
},
|
| 226 |
+
"source": [
|
| 227 |
+
"from google_drive_downloader import GoogleDriveDownloader\n",
|
| 228 |
+
"\n",
|
| 229 |
+
"### it seems that google drive link may not be permenant, you can find this ID from our open url.\n",
|
| 230 |
+
"# GoogleDriveDownloader.download_file_from_google_drive(file_id='1TLNdIufzwesDbyr_nVTR7Zrx9oRHLM_N',\n",
|
| 231 |
+
"# dest_path='./arcface_model/arcface_checkpoint.tar')\n",
|
| 232 |
+
"# GoogleDriveDownloader.download_file_from_google_drive(file_id='1PXkRiBUYbu1xWpQyDEJvGKeqqUFthJcI',\n",
|
| 233 |
+
"# dest_path='./checkpoints.zip')\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"!wget -P ./arcface_model https://github.com/neuralchen/SimSwap/releases/download/1.0/arcface_checkpoint.tar\n",
|
| 236 |
+
"!wget https://github.com/neuralchen/SimSwap/releases/download/1.0/checkpoints.zip\n",
|
| 237 |
+
"!unzip ./checkpoints.zip -d ./checkpoints\n",
|
| 238 |
+
"!wget -P ./parsing_model/checkpoint https://github.com/neuralchen/SimSwap/releases/download/1.0/79999_iter.pth"
|
| 239 |
+
],
|
| 240 |
+
"execution_count": 5,
|
| 241 |
+
"outputs": [
|
| 242 |
+
{
|
| 243 |
+
"output_type": "stream",
|
| 244 |
+
"text": [
|
| 245 |
+
"Downloading 1TLNdIufzwesDbyr_nVTR7Zrx9oRHLM_N into ./arcface_model/arcface_checkpoint.tar... Done.\n",
|
| 246 |
+
"Downloading 1PXkRiBUYbu1xWpQyDEJvGKeqqUFthJcI into ./checkpoints.zip... Done.\n",
|
| 247 |
+
"Archive: ./checkpoints.zip\n",
|
| 248 |
+
" creating: ./checkpoints/people/\n",
|
| 249 |
+
" inflating: ./checkpoints/people/iter.txt \n",
|
| 250 |
+
" inflating: ./checkpoints/people/latest_net_D1.pth \n",
|
| 251 |
+
" inflating: ./checkpoints/people/latest_net_D2.pth \n",
|
| 252 |
+
" inflating: ./checkpoints/people/latest_net_G.pth \n",
|
| 253 |
+
" inflating: ./checkpoints/people/loss_log.txt \n",
|
| 254 |
+
" inflating: ./checkpoints/people/opt.txt \n",
|
| 255 |
+
" creating: ./checkpoints/people/web/\n",
|
| 256 |
+
" creating: ./checkpoints/people/web/images/\n"
|
| 257 |
+
],
|
| 258 |
+
"name": "stdout"
|
| 259 |
+
}
|
| 260 |
+
]
|
| 261 |
+
},
|
| 262 |
+
{
|
| 263 |
+
"cell_type": "code",
|
| 264 |
+
"metadata": {
|
| 265 |
+
"colab": {
|
| 266 |
+
"base_uri": "https://localhost:8080/"
|
| 267 |
+
},
|
| 268 |
+
"id": "aSRnK5V4HI-k",
|
| 269 |
+
"outputId": "e688746c-c33a-485c-808c-54a7370f0c53"
|
| 270 |
+
},
|
| 271 |
+
"source": [
|
| 272 |
+
"## You can upload filed manually\n",
|
| 273 |
+
"# from google.colab import drive\n",
|
| 274 |
+
"# drive.mount('/content/gdrive')\n",
|
| 275 |
+
"\n",
|
| 276 |
+
"### Now onedrive file can be downloaded in Colab directly!\n",
|
| 277 |
+
"### If the link blow is not permanent, you can just download it from the \n",
|
| 278 |
+
"### open url(can be found at [our repo]/doc/guidance/preparation.md) and copy the assigned download link here.\n",
|
| 279 |
+
"### many thanks to woctezuma for this very useful help\n",
|
| 280 |
+
"!wget --no-check-certificate \"https://sh23tw.dm.files.1drv.com/y4mmGiIkNVigkSwOKDcV3nwMJulRGhbtHdkheehR5TArc52UjudUYNXAEvKCii2O5LAmzGCGK6IfleocxuDeoKxDZkNzDRSt4ZUlEt8GlSOpCXAFEkBwaZimtWGDRbpIGpb_pz9Nq5jATBQpezBS6G_UtspWTkgrXHHxhviV2nWy8APPx134zOZrUIbkSF6xnsqzs3uZ_SEX_m9Rey0ykpx9w\" -O antelope.zip\n",
|
| 281 |
+
"!unzip ./antelope.zip -d ./insightface_func/models/\n"
|
| 282 |
+
],
|
| 283 |
+
"execution_count": 6,
|
| 284 |
+
"outputs": [
|
| 285 |
+
{
|
| 286 |
+
"output_type": "stream",
|
| 287 |
+
"text": [
|
| 288 |
+
"--2021-06-21 02:14:17-- https://sh23tw.dm.files.1drv.com/y4mmGiIkNVigkSwOKDcV3nwMJulRGhbtHdkheehR5TArc52UjudUYNXAEvKCii2O5LAmzGCGK6IfleocxuDeoKxDZkNzDRSt4ZUlEt8GlSOpCXAFEkBwaZimtWGDRbpIGpb_pz9Nq5jATBQpezBS6G_UtspWTkgrXHHxhviV2nWy8APPx134zOZrUIbkSF6xnsqzs3uZ_SEX_m9Rey0ykpx9w\n",
|
| 289 |
+
"Resolving sh23tw.dm.files.1drv.com (sh23tw.dm.files.1drv.com)... 13.107.42.12\n",
|
| 290 |
+
"Connecting to sh23tw.dm.files.1drv.com (sh23tw.dm.files.1drv.com)|13.107.42.12|:443... connected.\n",
|
| 291 |
+
"HTTP request sent, awaiting response... 200 OK\n",
|
| 292 |
+
"Length: 248024513 (237M) [application/zip]\n",
|
| 293 |
+
"Saving to: ‘antelope.zip’\n",
|
| 294 |
+
"\n",
|
| 295 |
+
"antelope.zip 100%[===================>] 236.53M 6.16MB/s in 31s \n",
|
| 296 |
+
"\n",
|
| 297 |
+
"2021-06-21 02:14:48 (7.66 MB/s) - ‘antelope.zip’ saved [248024513/248024513]\n",
|
| 298 |
+
"\n",
|
| 299 |
+
"Archive: ./antelope.zip\n",
|
| 300 |
+
" creating: ./insightface_func/models/antelope/\n",
|
| 301 |
+
" inflating: ./insightface_func/models/antelope/glintr100.onnx \n",
|
| 302 |
+
" inflating: ./insightface_func/models/antelope/scrfd_10g_bnkps.onnx \n"
|
| 303 |
+
],
|
| 304 |
+
"name": "stdout"
|
| 305 |
+
}
|
| 306 |
+
]
|
| 307 |
+
},
|
| 308 |
+
{
|
| 309 |
+
"cell_type": "markdown",
|
| 310 |
+
"metadata": {
|
| 311 |
+
"id": "BsGmIMxLVxyO"
|
| 312 |
+
},
|
| 313 |
+
"source": [
|
| 314 |
+
"## Inference"
|
| 315 |
+
]
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"cell_type": "code",
|
| 319 |
+
"metadata": {
|
| 320 |
+
"colab": {
|
| 321 |
+
"base_uri": "https://localhost:8080/"
|
| 322 |
+
},
|
| 323 |
+
"id": "PfSsND36EMvn",
|
| 324 |
+
"outputId": "f28c98fd-4c6d-40fa-e3c7-99b606c7492a"
|
| 325 |
+
},
|
| 326 |
+
"source": [
|
| 327 |
+
"import cv2\n",
|
| 328 |
+
"import torch\n",
|
| 329 |
+
"import fractions\n",
|
| 330 |
+
"import numpy as np\n",
|
| 331 |
+
"from PIL import Image\n",
|
| 332 |
+
"import torch.nn.functional as F\n",
|
| 333 |
+
"from torchvision import transforms\n",
|
| 334 |
+
"from models.models import create_model\n",
|
| 335 |
+
"from options.test_options import TestOptions\n",
|
| 336 |
+
"from insightface_func.face_detect_crop_multi import Face_detect_crop\n",
|
| 337 |
+
"from util.videoswap import video_swap\n",
|
| 338 |
+
"from util.add_watermark import watermark_image"
|
| 339 |
+
],
|
| 340 |
+
"execution_count": 7,
|
| 341 |
+
"outputs": [
|
| 342 |
+
{
|
| 343 |
+
"output_type": "stream",
|
| 344 |
+
"text": [
|
| 345 |
+
"Imageio: 'ffmpeg-linux64-v3.3.1' was not found on your computer; downloading it now.\n",
|
| 346 |
+
"Try 1. Download from https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg-linux64-v3.3.1 (43.8 MB)\n",
|
| 347 |
+
"Downloading: 8192/45929032 bytes (0.0%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b1286144/45929032 bytes (2.8%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b3653632/45929032 bytes (8.0%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b7479296/45929032 bytes (16.3%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b11526144/45929032 bytes (25.1%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b15171584/45929032 bytes (33.0%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b18997248/45929032 bytes (41.4%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b22724608/45929032 bytes (49.5%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b26673152/45929032 bytes (58.1%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b30728192/45929032 bytes (66.9%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b34725888/45929032 bytes (75.6%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b38879232/45929032 bytes (84.7%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b42680320/45929032 bytes (92.9%)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b45929032/45929032 bytes (100.0%)\n",
|
| 348 |
+
" Done\n",
|
| 349 |
+
"File saved as /root/.imageio/ffmpeg/ffmpeg-linux64-v3.3.1.\n"
|
| 350 |
+
],
|
| 351 |
+
"name": "stdout"
|
| 352 |
+
}
|
| 353 |
+
]
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"cell_type": "code",
|
| 357 |
+
"metadata": {
|
| 358 |
+
"id": "rxSbZ2EDNDlf"
|
| 359 |
+
},
|
| 360 |
+
"source": [
|
| 361 |
+
"transformer = transforms.Compose([\n",
|
| 362 |
+
" transforms.ToTensor(),\n",
|
| 363 |
+
" #transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])\n",
|
| 364 |
+
" ])\n",
|
| 365 |
+
"\n",
|
| 366 |
+
"transformer_Arcface = transforms.Compose([\n",
|
| 367 |
+
" transforms.ToTensor(),\n",
|
| 368 |
+
" transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])\n",
|
| 369 |
+
" ])\n",
|
| 370 |
+
"\n",
|
| 371 |
+
"detransformer = transforms.Compose([\n",
|
| 372 |
+
" transforms.Normalize([0, 0, 0], [1/0.229, 1/0.224, 1/0.225]),\n",
|
| 373 |
+
" transforms.Normalize([-0.485, -0.456, -0.406], [1, 1, 1])\n",
|
| 374 |
+
" ])"
|
| 375 |
+
],
|
| 376 |
+
"execution_count": 8,
|
| 377 |
+
"outputs": []
|
| 378 |
+
},
|
| 379 |
+
{
|
| 380 |
+
"cell_type": "code",
|
| 381 |
+
"metadata": {
|
| 382 |
+
"colab": {
|
| 383 |
+
"base_uri": "https://localhost:8080/"
|
| 384 |
+
},
|
| 385 |
+
"id": "wwJOwR9LNKRz",
|
| 386 |
+
"outputId": "bdc82f7b-21c4-403f-94d1-b92911698b4a"
|
| 387 |
+
},
|
| 388 |
+
"source": [
|
| 389 |
+
"opt = TestOptions()\n",
|
| 390 |
+
"opt.initialize()\n",
|
| 391 |
+
"opt.parser.add_argument('-f') ## dummy arg to avoid bug\n",
|
| 392 |
+
"opt = opt.parse()\n",
|
| 393 |
+
"opt.pic_a_path = './demo_file/Iron_man.jpg' ## or replace it with image from your own google drive\n",
|
| 394 |
+
"opt.video_path = './demo_file/multi_people_1080p.mp4' ## or replace it with video from your own google drive\n",
|
| 395 |
+
"opt.output_path = './output/demo.mp4'\n",
|
| 396 |
+
"opt.temp_path = './tmp'\n",
|
| 397 |
+
"opt.Arc_path = './arcface_model/arcface_checkpoint.tar'\n",
|
| 398 |
+
"opt.isTrain = False\n",
|
| 399 |
+
"opt.use_mask = True ## new feature up-to-date\n",
|
| 400 |
+
"\n",
|
| 401 |
+
"crop_size = opt.crop_size\n",
|
| 402 |
+
"\n",
|
| 403 |
+
"torch.nn.Module.dump_patches = True\n",
|
| 404 |
+
"model = create_model(opt)\n",
|
| 405 |
+
"model.eval()\n",
|
| 406 |
+
"\n",
|
| 407 |
+
"app = Face_detect_crop(name='antelope', root='./insightface_func/models')\n",
|
| 408 |
+
"app.prepare(ctx_id= 0, det_thresh=0.6, det_size=(640,640))\n",
|
| 409 |
+
"\n",
|
| 410 |
+
"with torch.no_grad():\n",
|
| 411 |
+
" pic_a = opt.pic_a_path\n",
|
| 412 |
+
" # img_a = Image.open(pic_a).convert('RGB')\n",
|
| 413 |
+
" img_a_whole = cv2.imread(pic_a)\n",
|
| 414 |
+
" img_a_align_crop, _ = app.get(img_a_whole,crop_size)\n",
|
| 415 |
+
" img_a_align_crop_pil = Image.fromarray(cv2.cvtColor(img_a_align_crop[0],cv2.COLOR_BGR2RGB)) \n",
|
| 416 |
+
" img_a = transformer_Arcface(img_a_align_crop_pil)\n",
|
| 417 |
+
" img_id = img_a.view(-1, img_a.shape[0], img_a.shape[1], img_a.shape[2])\n",
|
| 418 |
+
"\n",
|
| 419 |
+
" # convert numpy to tensor\n",
|
| 420 |
+
" img_id = img_id.cuda()\n",
|
| 421 |
+
"\n",
|
| 422 |
+
" #create latent id\n",
|
| 423 |
+
" img_id_downsample = F.interpolate(img_id, size=(112,112))\n",
|
| 424 |
+
" latend_id = model.netArc(img_id_downsample)\n",
|
| 425 |
+
" latend_id = latend_id.detach().to('cpu')\n",
|
| 426 |
+
" latend_id = latend_id/np.linalg.norm(latend_id,axis=1,keepdims=True)\n",
|
| 427 |
+
" latend_id = latend_id.to('cuda')\n",
|
| 428 |
+
"\n",
|
| 429 |
+
" video_swap(opt.video_path, latend_id, model, app, opt.output_path, temp_results_dir=opt.temp_path, use_mask=opt.use_mask)"
|
| 430 |
+
],
|
| 431 |
+
"execution_count": 9,
|
| 432 |
+
"outputs": [
|
| 433 |
+
{
|
| 434 |
+
"output_type": "stream",
|
| 435 |
+
"text": [
|
| 436 |
+
"------------ Options -------------\n",
|
| 437 |
+
"Arc_path: models/BEST_checkpoint.tar\n",
|
| 438 |
+
"aspect_ratio: 1.0\n",
|
| 439 |
+
"batchSize: 8\n",
|
| 440 |
+
"checkpoints_dir: ./checkpoints\n",
|
| 441 |
+
"cluster_path: features_clustered_010.npy\n",
|
| 442 |
+
"data_type: 32\n",
|
| 443 |
+
"dataroot: ./datasets/cityscapes/\n",
|
| 444 |
+
"display_winsize: 512\n",
|
| 445 |
+
"engine: None\n",
|
| 446 |
+
"export_onnx: None\n",
|
| 447 |
+
"f: /root/.local/share/jupyter/runtime/kernel-6d955151-4911-464a-824d-f0806d8071f6.json\n",
|
| 448 |
+
"feat_num: 3\n",
|
| 449 |
+
"fineSize: 512\n",
|
| 450 |
+
"fp16: False\n",
|
| 451 |
+
"gpu_ids: [0]\n",
|
| 452 |
+
"how_many: 50\n",
|
| 453 |
+
"image_size: 224\n",
|
| 454 |
+
"input_nc: 3\n",
|
| 455 |
+
"instance_feat: False\n",
|
| 456 |
+
"isTrain: False\n",
|
| 457 |
+
"label_feat: False\n",
|
| 458 |
+
"label_nc: 0\n",
|
| 459 |
+
"latent_size: 512\n",
|
| 460 |
+
"loadSize: 1024\n",
|
| 461 |
+
"load_features: False\n",
|
| 462 |
+
"local_rank: 0\n",
|
| 463 |
+
"max_dataset_size: inf\n",
|
| 464 |
+
"model: pix2pixHD\n",
|
| 465 |
+
"nThreads: 2\n",
|
| 466 |
+
"n_blocks_global: 6\n",
|
| 467 |
+
"n_blocks_local: 3\n",
|
| 468 |
+
"n_clusters: 10\n",
|
| 469 |
+
"n_downsample_E: 4\n",
|
| 470 |
+
"n_downsample_global: 3\n",
|
| 471 |
+
"n_local_enhancers: 1\n",
|
| 472 |
+
"name: people\n",
|
| 473 |
+
"nef: 16\n",
|
| 474 |
+
"netG: global\n",
|
| 475 |
+
"ngf: 64\n",
|
| 476 |
+
"niter_fix_global: 0\n",
|
| 477 |
+
"no_flip: False\n",
|
| 478 |
+
"no_instance: False\n",
|
| 479 |
+
"norm: batch\n",
|
| 480 |
+
"norm_G: spectralspadesyncbatch3x3\n",
|
| 481 |
+
"ntest: inf\n",
|
| 482 |
+
"onnx: None\n",
|
| 483 |
+
"output_nc: 3\n",
|
| 484 |
+
"output_path: ./output/\n",
|
| 485 |
+
"phase: test\n",
|
| 486 |
+
"pic_a_path: ./crop_224/gdg.jpg\n",
|
| 487 |
+
"pic_b_path: ./crop_224/zrf.jpg\n",
|
| 488 |
+
"resize_or_crop: scale_width\n",
|
| 489 |
+
"results_dir: ./results/\n",
|
| 490 |
+
"semantic_nc: 3\n",
|
| 491 |
+
"serial_batches: False\n",
|
| 492 |
+
"temp_path: ./temp_results\n",
|
| 493 |
+
"tf_log: False\n",
|
| 494 |
+
"use_dropout: False\n",
|
| 495 |
+
"use_encoded_image: False\n",
|
| 496 |
+
"verbose: False\n",
|
| 497 |
+
"video_path: ./demo_file/multi_people_1080p.mp4\n",
|
| 498 |
+
"which_epoch: latest\n",
|
| 499 |
+
"-------------- End ----------------\n",
|
| 500 |
+
"input mean and std: 127.5 127.5\n",
|
| 501 |
+
"find model: ./insightface_func/models/antelope/glintr100.onnx recognition\n",
|
| 502 |
+
"find model: ./insightface_func/models/antelope/scrfd_10g_bnkps.onnx detection\n",
|
| 503 |
+
"set det-size: (640, 640)\n"
|
| 504 |
+
],
|
| 505 |
+
"name": "stdout"
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"output_type": "stream",
|
| 509 |
+
"text": [
|
| 510 |
+
"\r 0%| | 0/594 [00:00<?, ?it/s]"
|
| 511 |
+
],
|
| 512 |
+
"name": "stderr"
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"output_type": "stream",
|
| 516 |
+
"text": [
|
| 517 |
+
"(142, 366, 4)\n"
|
| 518 |
+
],
|
| 519 |
+
"name": "stdout"
|
| 520 |
+
},
|
| 521 |
+
{
|
| 522 |
+
"output_type": "stream",
|
| 523 |
+
"text": [
|
| 524 |
+
"100%|██████████| 594/594 [08:45<00:00, 1.13it/s]\n"
|
| 525 |
+
],
|
| 526 |
+
"name": "stderr"
|
| 527 |
+
},
|
| 528 |
+
{
|
| 529 |
+
"output_type": "stream",
|
| 530 |
+
"text": [
|
| 531 |
+
"[MoviePy] >>>> Building video ./output/demo.mp4\n",
|
| 532 |
+
"[MoviePy] Writing audio in demoTEMP_MPY_wvf_snd.mp3\n"
|
| 533 |
+
],
|
| 534 |
+
"name": "stdout"
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"output_type": "stream",
|
| 538 |
+
"text": [
|
| 539 |
+
"100%|██████████| 438/438 [00:00<00:00, 877.18it/s]\n"
|
| 540 |
+
],
|
| 541 |
+
"name": "stderr"
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"output_type": "stream",
|
| 545 |
+
"text": [
|
| 546 |
+
"[MoviePy] Done.\n",
|
| 547 |
+
"[MoviePy] Writing video ./output/demo.mp4\n"
|
| 548 |
+
],
|
| 549 |
+
"name": "stdout"
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"output_type": "stream",
|
| 553 |
+
"text": [
|
| 554 |
+
"100%|██████████| 595/595 [00:53<00:00, 11.15it/s]\n"
|
| 555 |
+
],
|
| 556 |
+
"name": "stderr"
|
| 557 |
+
},
|
| 558 |
+
{
|
| 559 |
+
"output_type": "stream",
|
| 560 |
+
"text": [
|
| 561 |
+
"[MoviePy] Done.\n",
|
| 562 |
+
"[MoviePy] >>>> Video ready: ./output/demo.mp4 \n",
|
| 563 |
+
"\n"
|
| 564 |
+
],
|
| 565 |
+
"name": "stdout"
|
| 566 |
+
}
|
| 567 |
+
]
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"cell_type": "code",
|
| 571 |
+
"metadata": {
|
| 572 |
+
"id": "Rty2GsyZZrI6"
|
| 573 |
+
},
|
| 574 |
+
"source": [],
|
| 575 |
+
"execution_count": null,
|
| 576 |
+
"outputs": []
|
| 577 |
+
}
|
| 578 |
+
]
|
| 579 |
+
}
|
SimSwap/arcface_model/arcface_checkpoint.tar
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52ea5ce4902017b77a2bb811dd9a82f57dee3883e06c18a42d288437263c7a20
|
| 3 |
+
size 209280521
|
SimSwap/checkpoints/people/iter.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
519
|
| 2 |
+
4062
|
SimSwap/checkpoints/people/latest_net_D1.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:42903e7cb7d8e250f96ad62efa00e6b8a8c2c507588d8e5e3f264a4dc4d925de
|
| 3 |
+
size 27865618
|
SimSwap/checkpoints/people/latest_net_D2.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e17ba6e4198ea06e5428079a14b3e2106627f2786e14a55d89b0ae3c647111bc
|
| 3 |
+
size 27865618
|
SimSwap/checkpoints/people/latest_net_G.pth
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24caf144e9aabd5acd1127b06f13ed3528240adb9e747d77a94ac3f33e672330
|
| 3 |
+
size 220243703
|
SimSwap/checkpoints/people/loss_log.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
SimSwap/checkpoints/people/opt.txt
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
------------ Options -------------
|
| 2 |
+
batchSize: 8
|
| 3 |
+
beta1: 0.5
|
| 4 |
+
checkpoints_dir: ./checkpoints
|
| 5 |
+
continue_train: False
|
| 6 |
+
data_type: 32
|
| 7 |
+
dataroot: ./datasets/cityscapes/
|
| 8 |
+
debug: False
|
| 9 |
+
display_freq: 99
|
| 10 |
+
display_winsize: 512
|
| 11 |
+
feat_num: 3
|
| 12 |
+
fineSize: 512
|
| 13 |
+
fp16: False
|
| 14 |
+
gan_mode: hinge
|
| 15 |
+
gpu_ids: [0]
|
| 16 |
+
image_size: 224
|
| 17 |
+
input_nc: 3
|
| 18 |
+
instance_feat: False
|
| 19 |
+
isTrain: True
|
| 20 |
+
label_feat: False
|
| 21 |
+
label_nc: 0
|
| 22 |
+
lambda_GP: 10.0
|
| 23 |
+
lambda_feat: 10.0
|
| 24 |
+
lambda_id: 20.0
|
| 25 |
+
lambda_rec: 10.0
|
| 26 |
+
latent_size: 512
|
| 27 |
+
loadSize: 1024
|
| 28 |
+
load_features: False
|
| 29 |
+
load_pretrain:
|
| 30 |
+
local_rank: 0
|
| 31 |
+
lr: 0.0002
|
| 32 |
+
max_dataset_size: inf
|
| 33 |
+
model: pix2pixHD
|
| 34 |
+
nThreads: 2
|
| 35 |
+
n_blocks_global: 6
|
| 36 |
+
n_blocks_local: 3
|
| 37 |
+
n_clusters: 10
|
| 38 |
+
n_downsample_E: 4
|
| 39 |
+
n_downsample_global: 3
|
| 40 |
+
n_layers_D: 4
|
| 41 |
+
n_local_enhancers: 1
|
| 42 |
+
name: people
|
| 43 |
+
ndf: 64
|
| 44 |
+
nef: 16
|
| 45 |
+
netG: global
|
| 46 |
+
ngf: 64
|
| 47 |
+
niter: 10000
|
| 48 |
+
niter_decay: 10000
|
| 49 |
+
niter_fix_global: 0
|
| 50 |
+
no_flip: False
|
| 51 |
+
no_ganFeat_loss: False
|
| 52 |
+
no_html: False
|
| 53 |
+
no_instance: False
|
| 54 |
+
no_vgg_loss: False
|
| 55 |
+
norm: batch
|
| 56 |
+
norm_G: spectralspadesyncbatch3x3
|
| 57 |
+
num_D: 2
|
| 58 |
+
output_nc: 3
|
| 59 |
+
phase: train
|
| 60 |
+
pool_size: 0
|
| 61 |
+
print_freq: 100
|
| 62 |
+
resize_or_crop: scale_width
|
| 63 |
+
save_epoch_freq: 10000
|
| 64 |
+
save_latest_freq: 10000
|
| 65 |
+
semantic_nc: 3
|
| 66 |
+
serial_batches: False
|
| 67 |
+
tf_log: False
|
| 68 |
+
times_G: 1
|
| 69 |
+
use_dropout: False
|
| 70 |
+
verbose: False
|
| 71 |
+
which_epoch: latest
|
| 72 |
+
-------------- End ----------------
|
SimSwap/cog.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
build:
|
| 2 |
+
gpu: true
|
| 3 |
+
python_version: "3.8"
|
| 4 |
+
system_packages:
|
| 5 |
+
- "libgl1-mesa-glx"
|
| 6 |
+
- "libglib2.0-0"
|
| 7 |
+
python_packages:
|
| 8 |
+
- "imageio==2.9.0"
|
| 9 |
+
- "torch==1.8.0"
|
| 10 |
+
- "torchvision==0.9.0"
|
| 11 |
+
- "numpy==1.21.1"
|
| 12 |
+
- "insightface==0.2.1"
|
| 13 |
+
- "ipython==7.21.0"
|
| 14 |
+
- "Pillow==8.3.1"
|
| 15 |
+
- "opencv-python==4.5.3.56"
|
| 16 |
+
- "Fraction==1.5.1"
|
| 17 |
+
- "onnxruntime-gpu==1.8.1"
|
| 18 |
+
- "moviepy==1.0.3"
|
| 19 |
+
|
| 20 |
+
predict: "predict.py:Predictor"
|
SimSwap/data/data_loader_Swapping.py
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import glob
|
| 3 |
+
import torch
|
| 4 |
+
import random
|
| 5 |
+
from PIL import Image
|
| 6 |
+
from torch.utils import data
|
| 7 |
+
from torchvision import transforms as T
|
| 8 |
+
|
| 9 |
+
class data_prefetcher():
|
| 10 |
+
def __init__(self, loader):
|
| 11 |
+
self.loader = loader
|
| 12 |
+
self.dataiter = iter(loader)
|
| 13 |
+
self.stream = torch.cuda.Stream()
|
| 14 |
+
self.mean = torch.tensor([0.485, 0.456, 0.406]).cuda().view(1,3,1,1)
|
| 15 |
+
self.std = torch.tensor([0.229, 0.224, 0.225]).cuda().view(1,3,1,1)
|
| 16 |
+
# With Amp, it isn't necessary to manually convert data to half.
|
| 17 |
+
# if args.fp16:
|
| 18 |
+
# self.mean = self.mean.half()
|
| 19 |
+
# self.std = self.std.half()
|
| 20 |
+
self.num_images = len(loader)
|
| 21 |
+
self.preload()
|
| 22 |
+
|
| 23 |
+
def preload(self):
|
| 24 |
+
try:
|
| 25 |
+
self.src_image1, self.src_image2 = next(self.dataiter)
|
| 26 |
+
except StopIteration:
|
| 27 |
+
self.dataiter = iter(self.loader)
|
| 28 |
+
self.src_image1, self.src_image2 = next(self.dataiter)
|
| 29 |
+
|
| 30 |
+
with torch.cuda.stream(self.stream):
|
| 31 |
+
self.src_image1 = self.src_image1.cuda(non_blocking=True)
|
| 32 |
+
self.src_image1 = self.src_image1.sub_(self.mean).div_(self.std)
|
| 33 |
+
self.src_image2 = self.src_image2.cuda(non_blocking=True)
|
| 34 |
+
self.src_image2 = self.src_image2.sub_(self.mean).div_(self.std)
|
| 35 |
+
|
| 36 |
+
def next(self):
|
| 37 |
+
torch.cuda.current_stream().wait_stream(self.stream)
|
| 38 |
+
src_image1 = self.src_image1
|
| 39 |
+
src_image2 = self.src_image2
|
| 40 |
+
self.preload()
|
| 41 |
+
return src_image1, src_image2
|
| 42 |
+
|
| 43 |
+
def __len__(self):
|
| 44 |
+
"""Return the number of images."""
|
| 45 |
+
return self.num_images
|
| 46 |
+
|
| 47 |
+
class SwappingDataset(data.Dataset):
|
| 48 |
+
"""Dataset class for the Artworks dataset and content dataset."""
|
| 49 |
+
|
| 50 |
+
def __init__(self,
|
| 51 |
+
image_dir,
|
| 52 |
+
img_transform,
|
| 53 |
+
subffix='jpg',
|
| 54 |
+
random_seed=1234):
|
| 55 |
+
"""Initialize and preprocess the Swapping dataset."""
|
| 56 |
+
self.image_dir = image_dir
|
| 57 |
+
self.img_transform = img_transform
|
| 58 |
+
self.subffix = subffix
|
| 59 |
+
self.dataset = []
|
| 60 |
+
self.random_seed = random_seed
|
| 61 |
+
self.preprocess()
|
| 62 |
+
self.num_images = len(self.dataset)
|
| 63 |
+
|
| 64 |
+
def preprocess(self):
|
| 65 |
+
"""Preprocess the Swapping dataset."""
|
| 66 |
+
print("processing Swapping dataset images...")
|
| 67 |
+
|
| 68 |
+
temp_path = os.path.join(self.image_dir,'*/')
|
| 69 |
+
pathes = glob.glob(temp_path)
|
| 70 |
+
self.dataset = []
|
| 71 |
+
for dir_item in pathes:
|
| 72 |
+
join_path = glob.glob(os.path.join(dir_item,'*.jpg'))
|
| 73 |
+
print("processing %s"%dir_item,end='\r')
|
| 74 |
+
temp_list = []
|
| 75 |
+
for item in join_path:
|
| 76 |
+
temp_list.append(item)
|
| 77 |
+
self.dataset.append(temp_list)
|
| 78 |
+
random.seed(self.random_seed)
|
| 79 |
+
random.shuffle(self.dataset)
|
| 80 |
+
print('Finished preprocessing the Swapping dataset, total dirs number: %d...'%len(self.dataset))
|
| 81 |
+
|
| 82 |
+
def __getitem__(self, index):
|
| 83 |
+
"""Return two src domain images and two dst domain images."""
|
| 84 |
+
dir_tmp1 = self.dataset[index]
|
| 85 |
+
dir_tmp1_len = len(dir_tmp1)
|
| 86 |
+
|
| 87 |
+
filename1 = dir_tmp1[random.randint(0,dir_tmp1_len-1)]
|
| 88 |
+
filename2 = dir_tmp1[random.randint(0,dir_tmp1_len-1)]
|
| 89 |
+
image1 = self.img_transform(Image.open(filename1))
|
| 90 |
+
image2 = self.img_transform(Image.open(filename2))
|
| 91 |
+
return image1, image2
|
| 92 |
+
|
| 93 |
+
def __len__(self):
|
| 94 |
+
"""Return the number of images."""
|
| 95 |
+
return self.num_images
|
| 96 |
+
|
| 97 |
+
def GetLoader( dataset_roots,
|
| 98 |
+
batch_size=16,
|
| 99 |
+
dataloader_workers=8,
|
| 100 |
+
random_seed = 1234
|
| 101 |
+
):
|
| 102 |
+
"""Build and return a data loader."""
|
| 103 |
+
|
| 104 |
+
num_workers = dataloader_workers
|
| 105 |
+
data_root = dataset_roots
|
| 106 |
+
random_seed = random_seed
|
| 107 |
+
|
| 108 |
+
c_transforms = []
|
| 109 |
+
|
| 110 |
+
c_transforms.append(T.ToTensor())
|
| 111 |
+
c_transforms = T.Compose(c_transforms)
|
| 112 |
+
|
| 113 |
+
content_dataset = SwappingDataset(
|
| 114 |
+
data_root,
|
| 115 |
+
c_transforms,
|
| 116 |
+
"jpg",
|
| 117 |
+
random_seed)
|
| 118 |
+
content_data_loader = data.DataLoader(dataset=content_dataset,batch_size=batch_size,
|
| 119 |
+
drop_last=True,shuffle=True,num_workers=num_workers,pin_memory=True)
|
| 120 |
+
prefetcher = data_prefetcher(content_data_loader)
|
| 121 |
+
return prefetcher
|
| 122 |
+
|
| 123 |
+
def denorm(x):
|
| 124 |
+
out = (x + 1) / 2
|
| 125 |
+
return out.clamp_(0, 1)
|
SimSwap/docs/css/bootstrap-theme.min.css
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
| 3 |
+
* Copyright 2011-2016 Twitter, Inc.
|
| 4 |
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
| 5 |
+
*/.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
|
| 6 |
+
/*# sourceMappingURL=bootstrap-theme.min.css.map */
|
SimSwap/docs/css/bootstrap.min.css
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
SimSwap/docs/css/ie10-viewport-bug-workaround.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* IE10 viewport hack for Surface/desktop Windows 8 bug
|
| 3 |
+
* Copyright 2014-2015 Twitter, Inc.
|
| 4 |
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/*
|
| 8 |
+
* See the Getting Started docs for more information:
|
| 9 |
+
* http://getbootstrap.com/getting-started/#support-ie10-width
|
| 10 |
+
*/
|
| 11 |
+
@-ms-viewport { width: device-width; }
|
| 12 |
+
@-o-viewport { width: device-width; }
|
| 13 |
+
@viewport { width: device-width; }
|
SimSwap/docs/css/jumbotron.css
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Move down content because we have a fixed navbar that is 50px tall */
|
| 2 |
+
body {
|
| 3 |
+
padding-top: 50px;
|
| 4 |
+
padding-bottom: 20px;
|
| 5 |
+
}
|
SimSwap/docs/css/page.css
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.which-image-container {
|
| 2 |
+
display: flex;
|
| 3 |
+
flex-wrap: wrap;
|
| 4 |
+
align-items: center;
|
| 5 |
+
flex-direction: column;
|
| 6 |
+
justify-content: space-between;
|
| 7 |
+
height: 100%;
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
.which-image-container :nth-child(2) {
|
| 11 |
+
display: flex;
|
| 12 |
+
flex-wrap: wrap;
|
| 13 |
+
align-items: center;
|
| 14 |
+
flex-direction: column;
|
| 15 |
+
justify-content: flex-end;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.which-image {
|
| 19 |
+
display: inline-block;
|
| 20 |
+
flex: 1;
|
| 21 |
+
flex-basis: 45%;
|
| 22 |
+
margin: 1% 1% 1% 1%;
|
| 23 |
+
width: 100%;
|
| 24 |
+
height: auto;
|
| 25 |
+
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.which-image img {
|
| 29 |
+
float: right;
|
| 30 |
+
width: 100%;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.image-display2 img {
|
| 34 |
+
float: right;
|
| 35 |
+
width: 100%;
|
| 36 |
+
}
|
| 37 |
+
/* .image-display{
|
| 38 |
+
align-items: center;
|
| 39 |
+
}
|
| 40 |
+
.image-display2{
|
| 41 |
+
align-items: center;
|
| 42 |
+
} */
|
| 43 |
+
.select-show {
|
| 44 |
+
border-style: dashed;
|
| 45 |
+
border-width: 2px;
|
| 46 |
+
border-color: purple;
|
| 47 |
+
|
| 48 |
+
/* padding: 2px; */
|
| 49 |
+
}
|
SimSwap/docs/favicon.ico
ADDED
|
|
SimSwap/docs/fonts/glyphicons-halflings-regular.eot
ADDED
|
Binary file (20.1 kB). View file
|
|
|
SimSwap/docs/fonts/glyphicons-halflings-regular.svg
ADDED
|
|
SimSwap/docs/fonts/glyphicons-halflings-regular.ttf
ADDED
|
Binary file (45.4 kB). View file
|
|
|
SimSwap/docs/fonts/glyphicons-halflings-regular.woff
ADDED
|
Binary file (23.4 kB). View file
|
|
|
SimSwap/docs/fonts/glyphicons-halflings-regular.woff2
ADDED
|
Binary file (18 kB). View file
|
|
|
SimSwap/docs/guidance/preparation.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Preparation
|
| 3 |
+
|
| 4 |
+
### Installation
|
| 5 |
+
**We highly recommand that you use Anaconda for Installation**
|
| 6 |
+
```
|
| 7 |
+
conda create -n simswap python=3.6
|
| 8 |
+
conda activate simswap
|
| 9 |
+
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=10.2 -c pytorch
|
| 10 |
+
(option): pip install --ignore-installed imageio
|
| 11 |
+
pip install insightface==0.2.1 onnxruntime moviepy
|
| 12 |
+
(option): pip install onnxruntime-gpu (If you want to reduce the inference time)(It will be diffcult to install onnxruntime-gpu , the specify version of onnxruntime-gpu may depends on your machine and cuda version.)
|
| 13 |
+
```
|
| 14 |
+
- ***We have now updated the prepare document. The main change gpu version of onnx is supported now. If you have configured the environment before, now use pip install onnxruntime-gpu ,You can increase the computing speed.***
|
| 15 |
+
- We use the face detection and alignment methods from **[insightface](https://github.com/deepinsight/insightface)** for image preprocessing. Please download the relative files and unzip them to ./insightface_func/models from [this link](https://onedrive.live.com/?authkey=%21ADJ0aAOSsc90neY&cid=4A83B6B633B029CC&id=4A83B6B633B029CC%215837&parId=4A83B6B633B029CC%215834&action=locate).
|
| 16 |
+
- We use the face parsing from **[face-parsing.PyTorch](https://github.com/zllrunning/face-parsing.PyTorch)** for image postprocessing. Please download the relative file and place it in ./parsing_model/checkpoint from [this link](https://drive.google.com/file/d/154JgKpzCPW82qINcVieuPH3fZ2e0P812/view).
|
| 17 |
+
- The pytorch and cuda versions above are most recommanded. They may vary.
|
| 18 |
+
- Using insightface with different versions is not recommanded. Please use this specific version.
|
| 19 |
+
- These settings are tested valid on both Windows and Ubuntu.
|
| 20 |
+
|
| 21 |
+
### Pretrained model
|
| 22 |
+
There are two archive files in the drive: **checkpoints.zip** and **arcface_checkpoint.tar**
|
| 23 |
+
|
| 24 |
+
- **Copy the arcface_checkpoint.tar into ./arcface_model**
|
| 25 |
+
- **Unzip checkpoints.zip, place it in the root dir ./**
|
| 26 |
+
|
| 27 |
+
[[Google Drive]](https://drive.google.com/drive/folders/1jV6_0FIMPC53FZ2HzZNJZGMe55bbu17R?usp=sharing)
|
| 28 |
+
[[Baidu Drive]](https://pan.baidu.com/s/1wFV11RVZMHqd-ky4YpLdcA) Password: ```jd2v```
|
| 29 |
+
|
| 30 |
+
**Simswap 512 (optional)**
|
| 31 |
+
|
| 32 |
+
The checkpoint of **Simswap 512 beta version** has been uploaded in [Github release](https://github.com/neuralchen/SimSwap/releases/download/512_beta/512.zip).If you want to experience Simswap 512, feel free to try.
|
| 33 |
+
- **Unzip 512.zip, place it in the root dir ./checkpoints**.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
### Note
|
| 37 |
+
We expect users to have GPU with at least 3G memory. For those who do not, we provide [[Colab Notebook implementation]](https://colab.research.google.com/github/neuralchen/SimSwap/blob/main/SimSwap%20colab.ipynb).
|
SimSwap/docs/guidance/usage.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!--
|
| 2 |
+
* @FilePath: \SimSwap\docs\guidance\usage.md
|
| 3 |
+
* @Author: AceSix
|
| 4 |
+
* @Date: 2021-06-28 10:01:40
|
| 5 |
+
* @LastEditors: AceSix
|
| 6 |
+
* @LastEditTime: 2021-06-28 10:05:11
|
| 7 |
+
* Copyright (C) 2021 SJTU. All rights reserved.
|
| 8 |
+
-->
|
| 9 |
+
|
| 10 |
+
# Usage
|
| 11 |
+
|
| 12 |
+
###### Before running, please make sure you have installed the environment and downloaded requested files according to the [preparation guidance](./preparation.md).
|
| 13 |
+
###### The below example command lines are using mask by default.
|
| 14 |
+
|
| 15 |
+
### Simple face swapping for already face-aligned images
|
| 16 |
+
```
|
| 17 |
+
python test_one_image.py --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path crop_224/6.jpg --pic_b_path crop_224/ds.jpg --output_path output/
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
### Face swapping for video
|
| 21 |
+
|
| 22 |
+
- Swap only one face within the video(the one with highest confidence by face detection).
|
| 23 |
+
```
|
| 24 |
+
python test_video_swapsingle.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --video_path ./demo_file/multi_people_1080p.mp4 --output_path ./output/multi_test_swapsingle.mp4 --temp_path ./temp_results
|
| 25 |
+
```
|
| 26 |
+
- Swap all faces within the video.
|
| 27 |
+
```
|
| 28 |
+
python test_video_swapmulti.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --video_path ./demo_file/multi_people_1080p.mp4 --output_path ./output/multi_test_swapmulti.mp4 --temp_path ./temp_results
|
| 29 |
+
```
|
| 30 |
+
- Swap the ***specific*** face within the video.
|
| 31 |
+
```
|
| 32 |
+
python test_video_swapspecific.py --crop_size 224 --use_mask --pic_specific_path ./demo_file/specific1.png --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --video_path ./demo_file/multi_people_1080p.mp4 --output_path ./output/multi_test_specific.mp4 --temp_path ./temp_results
|
| 33 |
+
```
|
| 34 |
+
When changing the specified face, you need to give a picture of the person whose face is to be changed. Then assign the picture path to the argument "***--pic_specific_path***". This picture should be a front face and show the entire head and neck, which can help accurately change the face (if you still don’t know how to choose the picture, you can refer to the specific*.png of [./demo_file/](https://github.com/neuralchen/SimSwap/tree/main/demo_file)). It would be better if this picture was taken from the video to be changed.
|
| 35 |
+
|
| 36 |
+
- Swap ***multi specific*** face with **multi specific id** within the video.
|
| 37 |
+
```
|
| 38 |
+
python test_video_swap_multispecific.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --video_path ./demo_file/multi_people_1080p.mp4 --output_path ./output/multi_test_multispecific.mp4 --temp_path ./temp_results --multisepcific_dir ./demo_file/multispecific
|
| 39 |
+
```
|
| 40 |
+
The folder you assign to ***"--multisepcific_dir"*** should be looked like:
|
| 41 |
+
```
|
| 42 |
+
$Your folder name$
|
| 43 |
+
|
| 44 |
+
├── DST_01.jpg(png)
|
| 45 |
+
└── DST_02.jpg(png)
|
| 46 |
+
└──...
|
| 47 |
+
└── SRC_01.jpg(png)
|
| 48 |
+
└── SRC_02.jpg(png)
|
| 49 |
+
└──...
|
| 50 |
+
```
|
| 51 |
+
The result is that the face corresponding to SRC_01.jpg (png) in the video will be replaced by the face corresponding to DST_01.jpg (png). Then the character corresponding to SRC_02.jpg(png) will be replaced by the face of DST_02.jpg(png), and so on. Note that when using your own data and naming it, do not remove the **0** in SRC_(DST_)**0**1.jpg(png), etc.
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
### Face swapping for Arbitrary images
|
| 56 |
+
|
| 57 |
+
- Swap only one face within one image(the one with highest confidence by face detection). The result would be saved to ./output/result_whole_swapsingle.jpg
|
| 58 |
+
```
|
| 59 |
+
python test_wholeimage_swapsingle.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/
|
| 60 |
+
```
|
| 61 |
+
- Swap all faces within one image. The result would be saved to ./output/result_whole_swapmulti.jpg
|
| 62 |
+
```
|
| 63 |
+
python test_wholeimage_swapmulti.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/
|
| 64 |
+
```
|
| 65 |
+
- Swap **specific** face within one image. The result would be saved to ./output/result_whole_swapspecific.jpg
|
| 66 |
+
```
|
| 67 |
+
python test_wholeimage_swapspecific.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/ --pic_specific_path ./demo_file/specific2.png
|
| 68 |
+
```
|
| 69 |
+
- Swap **multi specific** face with **multi specific id** within one image. The result would be saved to ./output/result_whole_swap_multispecific.jpg
|
| 70 |
+
```
|
| 71 |
+
python test_wholeimage_swap_multispecific.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/ --multisepcific_dir ./demo_file/multispecific
|
| 72 |
+
```
|
| 73 |
+
### About using Simswap 512 (beta version)
|
| 74 |
+
We trained a beta version of Simswap 512 on [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) and open sourced the model (if you think the Simswap 512 is cool, please star our [VGGFace2-HQ](https://github.com/NNNNAI/VGGFace2-HQ) repo).
|
| 75 |
+
|
| 76 |
+
The usage of applying Simswap 512 is to modify the value of the argument: "***--crop_size***" to 512 , take the command line of "Swap **multi specific** face with **multi specific id** within one image." as an example, the following command line can get the result without watermark:
|
| 77 |
+
```
|
| 78 |
+
python test_wholeimage_swap_multispecific.py --crop_size 512 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/ --multisepcific_dir ./demo_file/multispecific
|
| 79 |
+
```
|
| 80 |
+
The effect of Simswap 512 is shown below.
|
| 81 |
+
<img src="../img/result_whole_swap_multispecific_512.jpg"/>
|
| 82 |
+
|
| 83 |
+
### About watermark of simswap logo
|
| 84 |
+
The above example command lines are to add the simswap logo as the watermark by default. After our discussion, we have added a hyper parameter to control whether to remove watermark.
|
| 85 |
+
|
| 86 |
+
The usage of removing the watermark is to add an argument: "***--no_simswaplogo***" to the command line, take the command line of "Swap all faces within one image" as an example, the following command line can get the result without watermark:
|
| 87 |
+
```
|
| 88 |
+
python test_wholeimage_swapmulti.py --no_simswaplogo --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/Iron_man.jpg --pic_b_path ./demo_file/multi_people.jpg --output_path ./output/
|
| 89 |
+
```
|
| 90 |
+
### About using mask for better result
|
| 91 |
+
We provide two methods to paste the face back to the original image after changing the face: Using mask or using bounding box. At present, the effect of using mask is the best. All the above code examples are using mask. If you want to use the bounding box, you only need to remove the --use_mask in the code example.
|
| 92 |
+
Difference between using mask and not using mask can be found [here](https://imgsli.com/NjE3OTA).
|
| 93 |
+
|
| 94 |
+
### Difference between single face swapping and all face swapping are shown below.
|
| 95 |
+
<img src="../img/multi_face_comparison.png"/>
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
### Parameters
|
| 101 |
+
| Parameters | Function |
|
| 102 |
+
| :---- | :---- |
|
| 103 |
+
| --name | The SimSwap training logs name |
|
| 104 |
+
| --pic_a_path | Path of image with the target face |
|
| 105 |
+
| --pic_b_path | Path of image with the source face to swap |
|
| 106 |
+
| --pic_specific_path | Path of image with the specific face to be swapped |
|
| 107 |
+
|--multisepcific_dir |Path of image folder for multi specific face swapping|
|
| 108 |
+
| --video_path | Path of video with the source face to swap |
|
| 109 |
+
| --temp_path | Path to store intermediate files |
|
| 110 |
+
| --output_path | Path of directory to store the face swapping result |
|
| 111 |
+
| --no_simswaplogo |The hyper parameter to control whether to remove watermark |
|
| 112 |
+
| --use_mask |The hyper parameter to control whether to use face parsing for the better visual effects(I recommend to use)|
|
| 113 |
+
|
| 114 |
+
### Note
|
| 115 |
+
We expect users to have GPU with at least 3G memory.the For those who do not, we will provide Colab Notebook implementation in the future.
|
SimSwap/docs/img/LRGT_201110059_201110091.webp
ADDED
|
Git LFS Details
|
SimSwap/docs/img/anni.webp
ADDED
|
Git LFS Details
|
SimSwap/docs/img/chenglong.webp
ADDED
|
Git LFS Details
|
SimSwap/docs/img/girl2-RGB.png
ADDED
|
Git LFS Details
|
SimSwap/docs/img/girl2.gif
ADDED
|
Git LFS Details
|
SimSwap/docs/img/id/Iron_man.jpg
ADDED
|
SimSwap/docs/img/id/anni.jpg
ADDED
|
SimSwap/docs/img/id/chenglong.jpg
ADDED
|
SimSwap/docs/img/id/wuyifan.png
ADDED
|
Git LFS Details
|
SimSwap/docs/img/id/zhoujielun.jpg
ADDED
|
SimSwap/docs/img/id/zhuyin.jpg
ADDED
|
Git LFS Details
|
SimSwap/docs/img/logo.png
ADDED
|
SimSwap/docs/img/logo1.png
ADDED
|
SimSwap/docs/img/logo2.png
ADDED
|
SimSwap/docs/img/mama_mask_short.webp
ADDED
|
Git LFS Details
|
SimSwap/docs/img/mama_mask_wuyifan_short.webp
ADDED
|
Git LFS Details
|
SimSwap/docs/img/multi_face_comparison.png
ADDED
|
Git LFS Details
|
SimSwap/docs/img/new.gif
ADDED
|
SimSwap/docs/img/nrsig.png
ADDED
|
Git LFS Details
|
SimSwap/docs/img/result_whole_swap_multispecific_512.jpg
ADDED
|
Git LFS Details
|
SimSwap/docs/img/results1.PNG
ADDED
|
|
Git LFS Details
|