Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mfrashad
GitHub Repository: mfrashad/gancreate-saai
Path: blob/main/gancreate.ipynb
330 views
Kernel: Python 3

API Server

from IPython.display import Javascript display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 200})''')) !pip install ninja opensimplex gradio moviepy==1.0.3 tts pyrebase !apt install ffmpeg !pip install git+https://github.com/1adrianb/face-alignment@v1.0.1 !pip install fbpca boto3 requests==2.23.0 #urllib3==1.25.11 # !git submodule update --init --recursive !python -c "import nltk; nltk.download('wordnet')"
<IPython.core.display.Javascript object>
Collecting ninja Downloading ninja-1.10.2-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (108 kB) |████████████████████████████████| 108 kB 5.3 MB/s Collecting opensimplex Downloading opensimplex-0.3-py3-none-any.whl (15 kB) Collecting gradio Downloading gradio-2.3.0-py3-none-any.whl (3.4 MB) |████████████████████████████████| 3.4 MB 39.9 MB/s Collecting moviepy==1.0.3 Downloading moviepy-1.0.3.tar.gz (388 kB) |████████████████████████████████| 388 kB 50.4 MB/s Collecting tts Downloading TTS-0.2.2.tar.gz (1.4 MB) |████████████████████████████████| 1.4 MB 34.3 MB/s Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting pyrebase Downloading Pyrebase-3.0.27-py3-none-any.whl (9.6 kB) Requirement already satisfied: decorator<5.0,>=4.0.2 in /usr/local/lib/python3.7/dist-packages (from moviepy==1.0.3) (4.4.2) Requirement already satisfied: tqdm<5.0,>=4.11.2 in /usr/local/lib/python3.7/dist-packages (from moviepy==1.0.3) (4.62.0) Requirement already satisfied: requests<3.0,>=2.8.1 in /usr/local/lib/python3.7/dist-packages (from moviepy==1.0.3) (2.23.0) Collecting proglog<=1.0.0 Downloading proglog-0.1.9.tar.gz (10 kB) Requirement already satisfied: numpy>=1.17.3 in /usr/local/lib/python3.7/dist-packages (from moviepy==1.0.3) (1.19.5) Collecting imageio<3.0,>=2.5 Downloading imageio-2.9.0-py3-none-any.whl (3.3 MB) |████████████████████████████████| 3.3 MB 29.0 MB/s Collecting imageio_ffmpeg>=0.2.0 Downloading imageio_ffmpeg-0.4.5-py3-none-manylinux2010_x86_64.whl (26.9 MB) |████████████████████████████████| 26.9 MB 130 kB/s Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from imageio<3.0,>=2.5->moviepy==1.0.3) (7.1.2) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3.0,>=2.8.1->moviepy==1.0.3) (2021.5.30) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3.0,>=2.8.1->moviepy==1.0.3) (3.0.4) 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<3.0,>=2.8.1->moviepy==1.0.3) (1.24.3) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3.0,>=2.8.1->moviepy==1.0.3) (2.10) Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from gradio) (3.2.2) Collecting ffmpy Downloading ffmpy-0.3.0.tar.gz (4.8 kB) Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from gradio) (1.1.5) Collecting paramiko Downloading paramiko-2.7.2-py2.py3-none-any.whl (206 kB) |████████████████████████████████| 206 kB 50.1 MB/s Requirement already satisfied: Flask>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from gradio) (1.1.4) Collecting flask-cachebuster Downloading Flask-CacheBuster-1.0.0.tar.gz (3.1 kB) Collecting markdown2 Downloading markdown2-2.4.1-py2.py3-none-any.whl (34 kB) Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from gradio) (1.4.1) Collecting Flask-Login Downloading Flask_Login-0.5.0-py2.py3-none-any.whl (16 kB) Collecting Flask-Cors>=3.0.8 Downloading Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB) Collecting pycryptodome Downloading pycryptodome-3.10.1-cp35-abi3-manylinux2010_x86_64.whl (1.9 MB) |████████████████████████████████| 1.9 MB 31.0 MB/s Collecting analytics-python Downloading analytics_python-1.4.0-py2.py3-none-any.whl (15 kB) Requirement already satisfied: itsdangerous<2.0,>=0.24 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio) (1.1.0) Requirement already satisfied: click<8.0,>=5.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio) (7.1.2) Requirement already satisfied: Werkzeug<2.0,>=0.15 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio) (1.0.1) Requirement already satisfied: Jinja2<3.0,>=2.10.1 in /usr/local/lib/python3.7/dist-packages (from Flask>=1.1.1->gradio) (2.11.3) Requirement already satisfied: Six in /usr/local/lib/python3.7/dist-packages (from Flask-Cors>=3.0.8->gradio) (1.15.0) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from Jinja2<3.0,>=2.10.1->Flask>=1.1.1->gradio) (2.0.1) Collecting fsspec>=2021.04.0 Downloading fsspec-2021.8.1-py3-none-any.whl (119 kB) |████████████████████████████████| 119 kB 53.3 MB/s Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from tts) (3.13) Collecting mecab-python3==1.0.3 Downloading mecab_python3-1.0.3-cp37-cp37m-manylinux1_x86_64.whl (487 kB) |████████████████████████████████| 487 kB 51.3 MB/s Requirement already satisfied: soundfile in /usr/local/lib/python3.7/dist-packages (from tts) (0.10.3.post1) Collecting umap-learn==0.5.1 Downloading umap-learn-0.5.1.tar.gz (80 kB) |████████████████████████████████| 80 kB 9.3 MB/s Requirement already satisfied: cython in /usr/local/lib/python3.7/dist-packages (from tts) (0.29.24) Collecting anyascii Downloading anyascii-0.3.0-py3-none-any.whl (284 kB) |████████████████████████████████| 284 kB 44.1 MB/s Collecting pysbd Downloading pysbd-0.3.4-py3-none-any.whl (71 kB) |████████████████████████████████| 71 kB 8.8 MB/s Collecting pypinyin Downloading pypinyin-0.42.0-py2.py3-none-any.whl (1.3 MB) |████████████████████████████████| 1.3 MB 37.7 MB/s Requirement already satisfied: gdown in /usr/local/lib/python3.7/dist-packages (from tts) (3.6.4) Requirement already satisfied: torch>=1.7 in /usr/local/lib/python3.7/dist-packages (from tts) (1.9.0+cu102) Collecting librosa==0.8.0 Downloading librosa-0.8.0.tar.gz (183 kB) |████████████████████████████████| 183 kB 48.3 MB/s Collecting pyworld Downloading pyworld-0.3.0.tar.gz (212 kB) |████████████████████████████████| 212 kB 41.8 MB/s Installing build dependencies ... done Getting requirements to build wheel ... done Preparing wheel metadata ... done Collecting coqpit Downloading coqpit-0.0.14-py3-none-any.whl (13 kB) Requirement already satisfied: jieba in /usr/local/lib/python3.7/dist-packages (from tts) (0.42.1) Collecting gruut[cs,de,es,fr,it,nl,pt,ru,sv]~=1.2.0 Downloading gruut-1.2.3.tar.gz (11.1 MB) |████████████████████████████████| 11.1 MB 20.5 MB/s Requirement already satisfied: inflect in /usr/local/lib/python3.7/dist-packages (from tts) (2.1.0) Collecting tensorboardX Downloading tensorboardX-2.4-py2.py3-none-any.whl (124 kB) |████████████████████████████████| 124 kB 48.8 MB/s Collecting numba==0.53 Downloading numba-0.53.0-cp37-cp37m-manylinux2014_x86_64.whl (3.4 MB) |████████████████████████████████| 3.4 MB 41.6 MB/s Collecting unidic-lite==1.0.8 Downloading unidic-lite-1.0.8.tar.gz (47.4 MB) |████████████████████████████████| 47.4 MB 60 kB/s Requirement already satisfied: audioread>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.0->tts) (2.1.9) Requirement already satisfied: scikit-learn!=0.19.0,>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.0->tts) (0.22.2.post1) Requirement already satisfied: joblib>=0.14 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.0->tts) (1.0.1) Requirement already satisfied: resampy>=0.2.2 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.0->tts) (0.2.2) Requirement already satisfied: pooch>=1.0 in /usr/local/lib/python3.7/dist-packages (from librosa==0.8.0->tts) (1.4.0) Collecting llvmlite<0.37,>=0.36.0rc1 Downloading llvmlite-0.36.0-cp37-cp37m-manylinux2010_x86_64.whl (25.3 MB) |████████████████████████████████| 25.3 MB 1.6 MB/s Requirement already satisfied: setuptools in /usr/local/lib/python3.7/dist-packages (from numba==0.53->tts) (57.4.0) Collecting pynndescent>=0.5 Downloading pynndescent-0.5.4.tar.gz (1.1 MB) |████████████████████████████████| 1.1 MB 36.6 MB/s Collecting Babel~=2.8.0 Downloading Babel-2.8.1-py2.py3-none-any.whl (8.6 MB) |████████████████████████████████| 8.6 MB 9.2 MB/s Collecting gruut-ipa~=0.9.0 Downloading gruut-ipa-0.9.3.tar.gz (34 kB) Collecting jsonlines~=1.2.0 Downloading jsonlines-1.2.0-py2.py3-none-any.whl (7.6 kB) Collecting num2words==0.5.10 Downloading num2words-0.5.10-py3-none-any.whl (101 kB) |████████████████████████████████| 101 kB 11.4 MB/s Collecting python-crfsuite~=0.9.7 Downloading python_crfsuite-0.9.7-cp37-cp37m-manylinux1_x86_64.whl (743 kB) |████████████████████████████████| 743 kB 57.6 MB/s Collecting gruut_lang_ru~=1.2.0 Downloading gruut_lang_ru-1.2.tar.gz (16.9 MB) |████████████████████████████████| 16.9 MB 269 kB/s Collecting gruut_lang_nl~=1.2.0 Downloading gruut_lang_nl-1.2.tar.gz (7.4 MB) |████████████████████████████████| 7.4 MB 39.8 MB/s Collecting gruut_lang_sv~=1.2.0 Downloading gruut_lang_sv-1.2.tar.gz (2.1 MB) |████████████████████████████████| 2.1 MB 31.7 MB/s Collecting gruut_lang_cs~=1.2.0 Downloading gruut_lang_cs-1.2.tar.gz (5.8 MB) |████████████████████████████████| 5.8 MB 23.8 MB/s Collecting gruut_lang_it~=1.2.0 Downloading gruut_lang_it-1.2.tar.gz (1.9 MB) |████████████████████████████████| 1.9 MB 35.8 MB/s Collecting gruut_lang_de~=1.2.0 Downloading gruut_lang_de-1.2.tar.gz (9.4 MB) |████████████████████████████████| 9.4 MB 22.5 MB/s Collecting gruut_lang_es~=1.2.0 Downloading gruut_lang_es-1.2.tar.gz (15.2 MB) |████████████████████████████████| 15.2 MB 195 kB/s Collecting gruut_lang_pt~=1.2.0 Downloading gruut_lang_pt-1.2.tar.gz (3.4 MB) |████████████████████████████████| 3.4 MB 35.6 MB/s Collecting gruut_lang_fr~=1.2.0 Downloading gruut_lang_fr-1.2.1.tar.gz (12.1 MB) |████████████████████████████████| 12.1 MB 22.7 MB/s Requirement already satisfied: docopt>=0.6.2 in /usr/local/lib/python3.7/dist-packages (from num2words==0.5.10->gruut[cs,de,es,fr,it,nl,pt,ru,sv]~=1.2.0->tts) (0.6.2) Requirement already satisfied: pytz>=2015.7 in /usr/local/lib/python3.7/dist-packages (from Babel~=2.8.0->gruut[cs,de,es,fr,it,nl,pt,ru,sv]~=1.2.0->tts) (2018.9) Requirement already satisfied: appdirs in /usr/local/lib/python3.7/dist-packages (from pooch>=1.0->librosa==0.8.0->tts) (1.4.4) Requirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from pooch>=1.0->librosa==0.8.0->tts) (21.0) Requirement already satisfied: cffi>=1.0 in /usr/local/lib/python3.7/dist-packages (from soundfile->tts) (1.14.6) Requirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.0->soundfile->tts) (2.20) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch>=1.7->tts) (3.7.4.3) Collecting requests<3.0,>=2.8.1 Downloading requests-2.11.1-py2.py3-none-any.whl (514 kB) |████████████████████████████████| 514 kB 46.7 MB/s Collecting oauth2client==3.0.0 Downloading oauth2client-3.0.0.tar.gz (77 kB) |████████████████████████████████| 77 kB 6.1 MB/s Collecting python-jwt==2.0.1 Downloading python_jwt-2.0.1-py2.py3-none-any.whl (8.8 kB) Collecting pycryptodome Downloading pycryptodome-3.4.3.tar.gz (6.5 MB) |████████████████████████████████| 6.5 MB 20.2 MB/s Collecting requests-toolbelt==0.7.0 Downloading requests_toolbelt-0.7.0-py2.py3-none-any.whl (52 kB) |████████████████████████████████| 52 kB 1.0 MB/s Collecting gcloud==0.17.0 Downloading gcloud-0.17.0.tar.gz (458 kB) |████████████████████████████████| 458 kB 52.4 MB/s Requirement already satisfied: httplib2>=0.9.1 in /usr/local/lib/python3.7/dist-packages (from gcloud==0.17.0->pyrebase) (0.17.4) Requirement already satisfied: googleapis-common-protos in /usr/local/lib/python3.7/dist-packages (from gcloud==0.17.0->pyrebase) (1.53.0) Requirement already satisfied: protobuf!=3.0.0.b2.post1,>=3.0.0b2 in /usr/local/lib/python3.7/dist-packages (from gcloud==0.17.0->pyrebase) (3.17.3) Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python3.7/dist-packages (from oauth2client==3.0.0->pyrebase) (0.4.8) Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python3.7/dist-packages (from oauth2client==3.0.0->pyrebase) (0.2.8) Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from oauth2client==3.0.0->pyrebase) (4.7.2) Collecting jws>=0.1.3 Downloading jws-0.1.3.tar.gz (8.1 kB) Requirement already satisfied: python-dateutil>2.1 in /usr/local/lib/python3.7/dist-packages (from analytics-python->gradio) (2.8.2) Collecting backoff==1.10.0 Downloading backoff-1.10.0-py2.py3-none-any.whl (31 kB) Collecting monotonic>=1.5 Downloading monotonic-1.6-py2.py3-none-any.whl (8.2 kB) 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->gradio) (2.4.7) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->gradio) (1.3.1) Collecting bcrypt>=3.1.3 Downloading bcrypt-3.2.0-cp36-abi3-manylinux2010_x86_64.whl (63 kB) |████████████████████████████████| 63 kB 2.3 MB/s Collecting cryptography>=2.5 Downloading cryptography-3.4.8-cp36-abi3-manylinux_2_24_x86_64.whl (3.0 MB) |████████████████████████████████| 3.0 MB 35.2 MB/s Collecting pynacl>=1.0.1 Downloading PyNaCl-1.4.0-cp35-abi3-manylinux1_x86_64.whl (961 kB) |████████████████████████████████| 961 kB 37.7 MB/s Building wheels for collected packages: moviepy, proglog, tts, librosa, umap-learn, unidic-lite, gruut, gruut-ipa, gruut-lang-cs, gruut-lang-de, gruut-lang-es, gruut-lang-fr, gruut-lang-it, gruut-lang-nl, gruut-lang-pt, gruut-lang-ru, gruut-lang-sv, pynndescent, gcloud, oauth2client, pycryptodome, jws, ffmpy, flask-cachebuster, pyworld Building wheel for moviepy (setup.py) ... done Created wheel for moviepy: filename=moviepy-1.0.3-py3-none-any.whl size=110744 sha256=91fe6f0f8db6bdb9f2355fd8e9af2c4a5d0d635183784a2f032152214c1d438d Stored in directory: /root/.cache/pip/wheels/56/dc/2b/9cd600d483c04af3353d66623056fc03faed76b7518faae4df Building wheel for proglog (setup.py) ... done Created wheel for proglog: filename=proglog-0.1.9-py3-none-any.whl size=6157 sha256=64d12892c82fbfb56994ec9b4d349560be17fb2cd6fdf45455979c7c70b4b409 Stored in directory: /root/.cache/pip/wheels/12/36/1f/dc61e6ac10781d63cf6fa045eb09fa613a667384e12cb6e6e0 Building wheel for tts (PEP 517) ... done Created wheel for tts: filename=TTS-0.2.2-cp37-cp37m-linux_x86_64.whl size=561483 sha256=6a6a9699cfb57a941fe4dace4b7b96e89cca253cab4200750664fde1cc285eac Stored in directory: /root/.cache/pip/wheels/c0/b2/df/b3419f79638f8d2f3e7bf328b6b3cf3e2ccdc0a4ed15fb9de8 Building wheel for librosa (setup.py) ... done Created wheel for librosa: filename=librosa-0.8.0-py3-none-any.whl size=201395 sha256=236c8aee1dd9419b75764d509c77ae6cdd124cad90adc175edf9ff66d9cedc6b Stored in directory: /root/.cache/pip/wheels/de/1e/aa/d91797ae7e1ce11853ee100bee9d1781ae9d750e7458c95afb Building wheel for umap-learn (setup.py) ... done Created wheel for umap-learn: filename=umap_learn-0.5.1-py3-none-any.whl size=76564 sha256=846fe50e3324e6a7dc2e55ae6bc16f8219b9000916d6961d15c93e52e3a45382 Stored in directory: /root/.cache/pip/wheels/01/e7/bb/347dc0e510803d7116a13d592b10cc68262da56a8eec4dd72f Building wheel for unidic-lite (setup.py) ... done Created wheel for unidic-lite: filename=unidic_lite-1.0.8-py3-none-any.whl size=47658836 sha256=db5d20c08a9d25d0ca155715ec3b27e663fe493b4da84766acb2db47e59f0a66 Stored in directory: /root/.cache/pip/wheels/de/69/b1/112140b599f2b13f609d485a99e357ba68df194d2079c5b1a2 Building wheel for gruut (setup.py) ... done Created wheel for gruut: filename=gruut-1.2.3-py3-none-any.whl size=11091278 sha256=a49b9574fa37cfc88967635951697dda3f271ee206a3d83403c02b4cf5c16406 Stored in directory: /root/.cache/pip/wheels/03/b4/52/94a0c0762e55a284000bc16c089a4239c600749a5b9f0f31ad Building wheel for gruut-ipa (setup.py) ... done Created wheel for gruut-ipa: filename=gruut_ipa-0.9.3-py3-none-any.whl size=39001 sha256=2856b6ab4f3bed23b941ac05285edfd6ce66c1120c1bc9eebcc3870f7fff535f Stored in directory: /root/.cache/pip/wheels/1a/54/14/3e4f28f11774f67536576662cb932b3cac8428e26be86b3410 Building wheel for gruut-lang-cs (setup.py) ... done Created wheel for gruut-lang-cs: filename=gruut_lang_cs-1.2-py3-none-any.whl size=5796595 sha256=e0d6f99fbb47fd439e0cd09e0d44ccb63908ee232a8ed2a19fdc6734d7dafd42 Stored in directory: /root/.cache/pip/wheels/55/c6/7a/44b8bab3aedb5b889ef425c2e516019c7e9e9869125d3c2dc6 Building wheel for gruut-lang-de (setup.py) ... done Created wheel for gruut-lang-de: filename=gruut_lang_de-1.2-py3-none-any.whl size=9574679 sha256=a3270a908fc3284ed38f7bc37d89676e6c0544a5cfa2c9846b6c522094a1dc61 Stored in directory: /root/.cache/pip/wheels/c5/1f/2c/a23ce1aac2c09cf617df745642d280e0be6f894862f63c05b4 Building wheel for gruut-lang-es (setup.py) ... done Created wheel for gruut-lang-es: filename=gruut_lang_es-1.2-py3-none-any.whl size=15403815 sha256=62d5aebd1edcd41de141db0f411fc04ccf1b7dd3c47f766c8a5f9cfdb257f3bb Stored in directory: /root/.cache/pip/wheels/0f/57/11/d4a2445ff6dd3a228db36548f95c1f763d3defbff2b7fcdb85 Building wheel for gruut-lang-fr (setup.py) ... done Created wheel for gruut-lang-fr: filename=gruut_lang_fr-1.2.1-py3-none-any.whl size=12103216 sha256=1fb11b295ec3b05fae70c7b4ddd0a6805269004fa4f6ac69c0836919ff7a4b77 Stored in directory: /root/.cache/pip/wheels/14/62/e7/e103446f6db651133ac6871bfe0a6a582f00a74a1f0c44ca2f Building wheel for gruut-lang-it (setup.py) ... done Created wheel for gruut-lang-it: filename=gruut_lang_it-1.2-py3-none-any.whl size=1944818 sha256=b410b81d3de8bea08efa9cd8db90dbfa132da46a0e3bed3dfe170f235cb45243 Stored in directory: /root/.cache/pip/wheels/4a/f4/2d/0dc17ee06d958a37a6a873d7ba15bb90f710e307941dc8928f Building wheel for gruut-lang-nl (setup.py) ... done Created wheel for gruut-lang-nl: filename=gruut_lang_nl-1.2-py3-none-any.whl size=7399313 sha256=7a343bba3c2ddef433f5681167dbfebff70f21bceb8dea6cd775ce78c56db810 Stored in directory: /root/.cache/pip/wheels/a2/c0/d8/125b811bf3df62785bffbfdccafe9d414ebc4770a35080669b Building wheel for gruut-lang-pt (setup.py) ... done Created wheel for gruut-lang-pt: filename=gruut_lang_pt-1.2-py3-none-any.whl size=3412234 sha256=98d888917ab8ac60fe620d0a5b993dc583f1b467a28b6986ca175d77a0d976a9 Stored in directory: /root/.cache/pip/wheels/6a/c6/e2/458765db8d0ded8b33a1fc7551d28e5ae06b450ff5af0a585c Building wheel for gruut-lang-ru (setup.py) ... done Created wheel for gruut-lang-ru: filename=gruut_lang_ru-1.2-py3-none-any.whl size=16955789 sha256=9479c3ef15a1d9f2a57efe060dfe2ddfb90cbf1b6e2bde310a763781d69dbb7e Stored in directory: /root/.cache/pip/wheels/b4/36/50/5375078bb647157ed425620b69fc87ba9830161886c600d175 Building wheel for gruut-lang-sv (setup.py) ... done Created wheel for gruut-lang-sv: filename=gruut_lang_sv-1.2-py3-none-any.whl size=2104835 sha256=8c8f493670fc2f9e07e08d017436b4d160ce56c3b03b5475b1d88fc73e8840ff Stored in directory: /root/.cache/pip/wheels/71/2c/0b/a087fc907ed77d1dde8df72ab70fffde05ea8bcf06b33b1acb Building wheel for pynndescent (setup.py) ... done Created wheel for pynndescent: filename=pynndescent-0.5.4-py3-none-any.whl size=52373 sha256=9840af3f91126b7ac57a08feaf5ac846529f829c582d0c1ade1a33b765b4b46b Stored in directory: /root/.cache/pip/wheels/d0/5b/62/3401692ddad12324249c774c4b15ccb046946021e2b581c043 Building wheel for gcloud (setup.py) ... done Created wheel for gcloud: filename=gcloud-0.17.0-py3-none-any.whl size=638015 sha256=e08f38be448cedda9357941e6ec3b624d6d0b2d3a4d32853bd4f97526487ca09 Stored in directory: /root/.cache/pip/wheels/76/10/90/62a8de50d755940978e1473ed4ce4b579664fcc16077d0dc99 Building wheel for oauth2client (setup.py) ... done Created wheel for oauth2client: filename=oauth2client-3.0.0-py3-none-any.whl size=106375 sha256=9d55cee78fce18ea55ec2ce5e921ad1479e54e49afeed4d7517640c69fcac7cd Stored in directory: /root/.cache/pip/wheels/86/73/7a/3b3f76a2142176605ff38fbca574327962c71e25a43197a4c1 Building wheel for pycryptodome (setup.py) ... done Created wheel for pycryptodome: filename=pycryptodome-3.4.3-cp37-cp37m-linux_x86_64.whl size=6814284 sha256=86ac8b26967ea8f4f43b4ea3b0bf4bb703392984ae32e4ebb6bbce626f6e67d0 Stored in directory: /root/.cache/pip/wheels/f3/83/08/de4131c0bbbbafa5bf3bd64cb0e86d40bed3ee43f3ff307112 Building wheel for jws (setup.py) ... done Created wheel for jws: filename=jws-0.1.3-py3-none-any.whl size=9410 sha256=3d41576e9074cbdc4d87aff33b6eec1c72ed774b9a5aa4573f0f0febcd5337eb Stored in directory: /root/.cache/pip/wheels/2e/ff/95/daf0797fca284304b39ee45749e750fdcdcaa081d46dc8fd99 Building wheel for ffmpy (setup.py) ... done Created wheel for ffmpy: filename=ffmpy-0.3.0-py3-none-any.whl size=4710 sha256=c1cdfbcb8fb6bdd95333a65e028283fc4fe5f487edc33ef69e03f89c1c7339ac Stored in directory: /root/.cache/pip/wheels/13/e4/6c/e8059816e86796a597c6e6b0d4c880630f51a1fcfa0befd5e6 Building wheel for flask-cachebuster (setup.py) ... done Created wheel for flask-cachebuster: filename=Flask_CacheBuster-1.0.0-py3-none-any.whl size=3371 sha256=5553146a3196f72c302eb45c396f09ad2f71ef6325d7707f48d82dd4d8b93ff8 Stored in directory: /root/.cache/pip/wheels/28/c0/c4/44687421dab41455be93112bd1b0dee1f3c5a9aa27bee63708 Building wheel for pyworld (PEP 517) ... done Created wheel for pyworld: filename=pyworld-0.3.0-cp37-cp37m-linux_x86_64.whl size=609070 sha256=5e9a29a02abd4a930e26dcbfaad4723c7e9e5273f107fb61d00eb8213981e7b2 Stored in directory: /root/.cache/pip/wheels/e7/7c/11/c775fffa0e1e7b05a6604b4323408a77f80fb4ab304d96b5c6 Successfully built moviepy proglog tts librosa umap-learn unidic-lite gruut gruut-ipa gruut-lang-cs gruut-lang-de gruut-lang-es gruut-lang-fr gruut-lang-it gruut-lang-nl gruut-lang-pt gruut-lang-ru gruut-lang-sv pynndescent gcloud oauth2client pycryptodome jws ffmpy flask-cachebuster pyworld Installing collected packages: llvmlite, requests, python-crfsuite, numba, num2words, jsonlines, gruut-ipa, Babel, pynndescent, pynacl, oauth2client, monotonic, jws, gruut-lang-sv, gruut-lang-ru, gruut-lang-pt, gruut-lang-nl, gruut-lang-it, gruut-lang-fr, gruut-lang-es, gruut-lang-de, gruut-lang-cs, gruut, cryptography, bcrypt, backoff, unidic-lite, umap-learn, tensorboardX, requests-toolbelt, pyworld, python-jwt, pysbd, pypinyin, pycryptodome, proglog, paramiko, mecab-python3, markdown2, librosa, imageio-ffmpeg, imageio, gcloud, fsspec, Flask-Login, Flask-Cors, flask-cachebuster, ffmpy, coqpit, anyascii, analytics-python, tts, pyrebase, opensimplex, ninja, moviepy, gradio Attempting uninstall: llvmlite Found existing installation: llvmlite 0.34.0 Uninstalling llvmlite-0.34.0: Successfully uninstalled llvmlite-0.34.0 Attempting uninstall: requests Found existing installation: requests 2.23.0 Uninstalling requests-2.23.0: Successfully uninstalled requests-2.23.0 Attempting uninstall: numba Found existing installation: numba 0.51.2 Uninstalling numba-0.51.2: Successfully uninstalled numba-0.51.2 Attempting uninstall: Babel Found existing installation: Babel 2.9.1 Uninstalling Babel-2.9.1: Successfully uninstalled Babel-2.9.1 Attempting uninstall: oauth2client Found existing installation: oauth2client 4.1.3 Uninstalling oauth2client-4.1.3: Successfully uninstalled oauth2client-4.1.3 Attempting uninstall: librosa Found existing installation: librosa 0.8.1 Uninstalling librosa-0.8.1: Successfully uninstalled librosa-0.8.1 Attempting uninstall: imageio Found existing installation: imageio 2.4.1 Uninstalling imageio-2.4.1: Successfully uninstalled imageio-2.4.1 Attempting uninstall: moviepy Found existing installation: moviepy 0.2.3.5 Uninstalling moviepy-0.2.3.5: Successfully uninstalled moviepy-0.2.3.5 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow-datasets 4.0.1 requires requests>=2.19.0, but you have requests 2.11.1 which is incompatible. tensorboard 2.6.0 requires requests<3,>=2.21.0, but you have requests 2.11.1 which is incompatible. spacy 2.2.4 requires requests<3.0.0,>=2.13.0, but you have requests 2.11.1 which is incompatible. pydrive 1.3.1 requires oauth2client>=4.0.0, but you have oauth2client 3.0.0 which is incompatible. pandas-datareader 0.9.0 requires requests>=2.19.0, but you have requests 2.11.1 which is incompatible. google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.11.1 which is incompatible. google-api-core 1.26.3 requires requests<3.0.0dev,>=2.18.0, but you have requests 2.11.1 which is incompatible. datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible. albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible. Successfully installed Babel-2.8.1 Flask-Cors-3.0.10 Flask-Login-0.5.0 analytics-python-1.4.0 anyascii-0.3.0 backoff-1.10.0 bcrypt-3.2.0 coqpit-0.0.14 cryptography-3.4.8 ffmpy-0.3.0 flask-cachebuster-1.0.0 fsspec-2021.8.1 gcloud-0.17.0 gradio-2.3.0 gruut-1.2.3 gruut-ipa-0.9.3 gruut-lang-cs-1.2 gruut-lang-de-1.2 gruut-lang-es-1.2 gruut-lang-fr-1.2.1 gruut-lang-it-1.2 gruut-lang-nl-1.2 gruut-lang-pt-1.2 gruut-lang-ru-1.2 gruut-lang-sv-1.2 imageio-2.9.0 imageio-ffmpeg-0.4.5 jsonlines-1.2.0 jws-0.1.3 librosa-0.8.0 llvmlite-0.36.0 markdown2-2.4.1 mecab-python3-1.0.3 monotonic-1.6 moviepy-1.0.3 ninja-1.10.2 num2words-0.5.10 numba-0.53.0 oauth2client-3.0.0 opensimplex-0.3 paramiko-2.7.2 proglog-0.1.9 pycryptodome-3.4.3 pynacl-1.4.0 pynndescent-0.5.4 pypinyin-0.42.0 pyrebase-3.0.27 pysbd-0.3.4 python-crfsuite-0.9.7 python-jwt-2.0.1 pyworld-0.3.0 requests-2.11.1 requests-toolbelt-0.7.0 tensorboardX-2.4 tts-0.2.2 umap-learn-0.5.1 unidic-lite-1.0.8 Reading package lists... Done Building dependency tree Reading state information... Done ffmpeg is already the newest version (7:3.4.8-0ubuntu0.2). 0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded. Collecting git+https://github.com/1adrianb/[email protected] Cloning https://github.com/1adrianb/face-alignment (to revision v1.0.1) to /tmp/pip-req-build-nqw83_nh Running command git clone -q https://github.com/1adrianb/face-alignment /tmp/pip-req-build-nqw83_nh Running command git checkout -q 87a496b158ff9a215aa6f48262f4e13d8e6c4dd7 Requirement already satisfied: torch in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (1.9.0+cu102) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (1.19.5) Requirement already satisfied: scipy>=0.17 in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (1.4.1) Requirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (0.16.2) Requirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (4.1.2.30) Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from face-alignment==1.0.1) (4.62.0) Requirement already satisfied: PyWavelets>=0.4.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->face-alignment==1.0.1) (1.1.1) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->face-alignment==1.0.1) (3.2.2) Requirement already satisfied: pillow>=4.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->face-alignment==1.0.1) (7.1.2) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->face-alignment==1.0.1) (2.6.2) Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->face-alignment==1.0.1) (2.9.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->face-alignment==1.0.1) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->face-alignment==1.0.1) (1.3.1) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->face-alignment==1.0.1) (2.8.2) 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!=3.0.0,>=2.0.0->scikit-image->face-alignment==1.0.1) (2.4.7) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib!=3.0.0,>=2.0.0->scikit-image->face-alignment==1.0.1) (1.15.0) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch->face-alignment==1.0.1) (3.7.4.3) Building wheels for collected packages: face-alignment Building wheel for face-alignment (setup.py) ... done Created wheel for face-alignment: filename=face_alignment-1.0.1-py2.py3-none-any.whl size=22899 sha256=0318eb394c68b609f179a7b62bbb8a0c0f6a5e68ec7b44f7f3b811787285715b Stored in directory: /tmp/pip-ephem-wheel-cache-2jqg62nj/wheels/37/83/21/9ae379e23a548af5d4eb335071fda470d2857c7811ba7079a9 Successfully built face-alignment Installing collected packages: face-alignment Successfully installed face-alignment-1.0.1 Collecting fbpca Downloading fbpca-1.0.tar.gz (11 kB) Collecting boto3 Downloading boto3-1.18.40-py3-none-any.whl (131 kB) |████████████████████████████████| 131 kB 6.1 MB/s Collecting requests==2.23.0 Downloading requests-2.23.0-py2.py3-none-any.whl (58 kB) |████████████████████████████████| 58 kB 5.5 MB/s Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests==2.23.0) (2021.5.30) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests==2.23.0) (2.10) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests==2.23.0) (3.0.4) 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==2.23.0) (1.24.3) Collecting botocore<1.22.0,>=1.21.40 Downloading botocore-1.21.40-py3-none-any.whl (7.9 MB) |████████████████████████████████| 7.9 MB 28.2 MB/s Collecting jmespath<1.0.0,>=0.7.1 Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB) Collecting s3transfer<0.6.0,>=0.5.0 Downloading s3transfer-0.5.0-py3-none-any.whl (79 kB) |████████████████████████████████| 79 kB 7.4 MB/s Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/local/lib/python3.7/dist-packages (from botocore<1.22.0,>=1.21.40->boto3) (2.8.2) Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB) |████████████████████████████████| 127 kB 55.8 MB/s Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.22.0,>=1.21.40->boto3) (1.15.0) Building wheels for collected packages: fbpca Building wheel for fbpca (setup.py) ... done Created wheel for fbpca: filename=fbpca-1.0-py3-none-any.whl size=11376 sha256=cff3502102843541a680d39d5d5d6c6774763a452908da981f35e39f1bc6c50e Stored in directory: /root/.cache/pip/wheels/93/08/0c/1b9866c35c8d3f136d100dfe88036a32e0795437daca089f70 Successfully built fbpca Installing collected packages: urllib3, jmespath, botocore, s3transfer, requests, fbpca, boto3 Attempting uninstall: urllib3 Found existing installation: urllib3 1.24.3 Uninstalling urllib3-1.24.3: Successfully uninstalled urllib3-1.24.3 Attempting uninstall: requests Found existing installation: requests 2.11.1 Uninstalling requests-2.11.1: Successfully uninstalled requests-2.11.1 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pyrebase 3.0.27 requires requests==2.11.1, but you have requests 2.23.0 which is incompatible. datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible. Successfully installed boto3-1.18.40 botocore-1.21.40 fbpca-1.0 jmespath-0.10.0 requests-2.23.0 s3transfer-0.5.0 urllib3-1.25.11 [nltk_data] Downloading package wordnet to /root/nltk_data... [nltk_data] Unzipping corpora/wordnet.zip.
from google.colab import drive drive.mount('/content/drive')
Mounted at /content/drive
%cd /content/drive/MyDrive/Colab/fyp
/content/drive/MyDrive/Colab/fyp
try: # set up path import sys sys.path.append('/content/drive/MyDrive/Colab/fyp/ganspace') sys.path.append('/content/drive/MyDrive/Colab/fyp/first-order-model') sys.path.append('/content/drive/MyDrive/Colab/fyp/iPERCore') sys.path.append('/content/drive/MyDrive/Colab/fyp/Wav2Lip') print('Paths added') except Exception as e: print(e) pass
Paths added
#@title Install impersonator dependencies # set CUDA_HOME, here we use CUDA 10.1 from IPython.display import Javascript display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 200})''')) import os os.environ["CUDA_HOME"] = "/usr/local/cuda-10.1" !echo $CUDA_HOME %cd /content/drive/MyDrive/Colab/fyp/iPERCore/ !python setup.py develop %cd /content/
<IPython.core.display.Javascript object>
/usr/local/cuda-10.1 /content/drive/MyDrive/Colab/fyp/iPERCore Cuda version is 10.1 /usr/bin/python3 -m pip install pip==20.2.4 Collecting pip==20.2.4 Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB) |████████████████████████████████| 1.5 MB 5.3 MB/s Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.1.3 Uninstalling pip-21.1.3: Successfully uninstalled pip-21.1.3 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. pip-tools 6.2.0 requires pip>=20.3, but you have pip 20.2.4 which is incompatible. Successfully installed pip-20.2.4 /usr/bin/python3 -m pip install torch==1.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html Looking in links: https://download.pytorch.org/whl/torch_stable.html Collecting torch==1.7.0+cu101 Downloading https://download.pytorch.org/whl/cu101/torch-1.7.0%2Bcu101-cp37-cp37m-linux_x86_64.whl (735.3 MB) |████████████████████████████████| 735.3 MB 23 kB/s Collecting dataclasses Downloading dataclasses-0.6-py3-none-any.whl (14 kB) Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0+cu101) (0.16.0) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0+cu101) (1.19.5) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0+cu101) (3.7.4.3) Installing collected packages: dataclasses, torch Attempting uninstall: torch Found existing installation: torch 1.9.0+cu102 Uninstalling torch-1.9.0+cu102: Successfully uninstalled torch-1.9.0+cu102 ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. torchvision 0.10.0+cu102 requires torch==1.9.0, but you'll have torch 1.7.0+cu101 which is incompatible. torchtext 0.10.0 requires torch==1.9.0, but you'll have torch 1.7.0+cu101 which is incompatible. Successfully installed dataclasses-0.6 torch-1.7.0+cu101 /usr/bin/python3 -m pip install torchvision==0.8.1+cu101 -f https://download.pytorch.org/whl/torch_stable.html Looking in links: https://download.pytorch.org/whl/torch_stable.html Collecting torchvision==0.8.1+cu101 Downloading https://download.pytorch.org/whl/cu101/torchvision-0.8.1%2Bcu101-cp37-cp37m-linux_x86_64.whl (12.7 MB) |████████████████████████████████| 12.7 MB 6.3 MB/s Requirement already satisfied: pillow>=4.1.1 in /usr/local/lib/python3.7/dist-packages (from torchvision==0.8.1+cu101) (7.1.2) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from torchvision==0.8.1+cu101) (1.19.5) Requirement already satisfied: torch==1.7.0 in /usr/local/lib/python3.7/dist-packages (from torchvision==0.8.1+cu101) (1.7.0+cu101) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0->torchvision==0.8.1+cu101) (3.7.4.3) Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0->torchvision==0.8.1+cu101) (0.16.0) Requirement already satisfied: dataclasses in /usr/local/lib/python3.7/dist-packages (from torch==1.7.0->torchvision==0.8.1+cu101) (0.6) Installing collected packages: torchvision Attempting uninstall: torchvision Found existing installation: torchvision 0.10.0+cu102 Uninstalling torchvision-0.10.0+cu102: Successfully uninstalled torchvision-0.10.0+cu102 Successfully installed torchvision-0.8.1+cu101 /usr/bin/python3 -m pip install mmcv-full==1.2.0 -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html Looking in links: https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/index.html Collecting mmcv-full==1.2.0 Downloading https://download.openmmlab.com/mmcv/dist/cu101/torch1.7.0/mmcv_full-1.2.0-cp37-cp37m-manylinux1_x86_64.whl (19.8 MB) |████████████████████████████████| 19.8 MB 271 kB/s Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from mmcv-full==1.2.0) (3.13) Collecting yapf Downloading yapf-0.31.0-py2.py3-none-any.whl (185 kB) |████████████████████████████████| 185 kB 5.3 MB/s Requirement already satisfied: opencv-python>=3 in /usr/local/lib/python3.7/dist-packages (from mmcv-full==1.2.0) (4.1.2.30) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from mmcv-full==1.2.0) (1.19.5) Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from mmcv-full==1.2.0) (7.1.2) Collecting addict Downloading addict-2.4.0-py3-none-any.whl (3.8 kB) Installing collected packages: yapf, addict, mmcv-full Successfully installed addict-2.4.0 mmcv-full-1.2.0 yapf-0.31.0 /usr/bin/python3 -m pip install numpy>=1.19.3 Requirement already satisfied: numpy>=1.19.3 in /usr/local/lib/python3.7/dist-packages (1.19.5) /usr/bin/python3 -m pip install numpy>=1.19.3 Requirement already satisfied: numpy>=1.19.3 in /usr/local/lib/python3.7/dist-packages (1.19.5) /usr/bin/python3 -m pip install scipy>=1.5.2 Collecting scipy>=1.5.2 Downloading scipy-1.7.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (28.5 MB) |████████████████████████████████| 28.5 MB 76 kB/s Requirement already satisfied: numpy<1.23.0,>=1.16.5 in /usr/local/lib/python3.7/dist-packages (from scipy>=1.5.2) (1.19.5) Installing collected packages: scipy Attempting uninstall: scipy Found existing installation: scipy 1.4.1 Uninstalling scipy-1.4.1: Successfully uninstalled scipy-1.4.1 ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible. Successfully installed scipy-1.7.1 /usr/bin/python3 -m pip install scikit-image>=0.17.2 Collecting scikit-image>=0.17.2 Downloading scikit_image-0.18.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (29.2 MB) |████████████████████████████████| 29.2 MB 121 kB/s Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (2.9.0) Requirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (1.19.5) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (3.2.2) Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (1.7.1) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (2021.8.30) Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (7.1.2) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (1.1.1) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image>=0.17.2) (2.6.2) 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!=3.0.0,>=2.0.0->scikit-image>=0.17.2) (2.4.7) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.17.2) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.17.2) (1.3.1) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.17.2) (2.8.2) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from cycler>=0.10->matplotlib!=3.0.0,>=2.0.0->scikit-image>=0.17.2) (1.15.0) Installing collected packages: scikit-image Attempting uninstall: scikit-image Found existing installation: scikit-image 0.16.2 Uninstalling scikit-image-0.16.2: Successfully uninstalled scikit-image-0.16.2 ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible. Successfully installed scikit-image-0.18.3 /usr/bin/python3 -m pip install opencv-python>=4.4.0.40 Collecting opencv-python>=4.4.0.40 Downloading opencv_python-4.5.3.56-cp37-cp37m-manylinux2014_x86_64.whl (49.9 MB) |████████████████████████████████| 49.9 MB 27 kB/s Requirement already satisfied: numpy>=1.14.5 in /usr/local/lib/python3.7/dist-packages (from opencv-python>=4.4.0.40) (1.19.5) Installing collected packages: opencv-python Attempting uninstall: opencv-python Found existing installation: opencv-python 4.1.2.30 Uninstalling opencv-python-4.1.2.30: Successfully uninstalled opencv-python-4.1.2.30 ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts. We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default. albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you'll have imgaug 0.2.9 which is incompatible. Successfully installed opencv-python-4.5.3.56 /usr/bin/python3 -m pip install tensorboardX>=2.1 Requirement already satisfied: tensorboardX>=2.1 in /usr/local/lib/python3.7/dist-packages (2.4) Requirement already satisfied: protobuf>=3.8.0 in /usr/local/lib/python3.7/dist-packages (from tensorboardX>=2.1) (3.17.3) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from tensorboardX>=2.1) (1.19.5) Requirement already satisfied: six>=1.9 in /usr/local/lib/python3.7/dist-packages (from protobuf>=3.8.0->tensorboardX>=2.1) (1.15.0) /usr/bin/python3 -m pip install tqdm>=4.48.2 Requirement already satisfied: tqdm>=4.48.2 in /usr/local/lib/python3.7/dist-packages (4.62.0) /usr/bin/python3 -m pip install visdom>=0.1.8.9 Collecting visdom>=0.1.8.9 Downloading visdom-0.1.8.9.tar.gz (676 kB) |████████████████████████████████| 676 kB 5.4 MB/s Requirement already satisfied: numpy>=1.8 in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (1.19.5) Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (1.7.1) Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (2.23.0) Requirement already satisfied: tornado in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (5.1.1) Requirement already satisfied: pyzmq in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (22.2.1) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (1.15.0) Collecting jsonpatch Downloading jsonpatch-1.32-py2.py3-none-any.whl (12 kB) Collecting torchfile Downloading torchfile-0.1.0.tar.gz (5.2 kB) Collecting websocket-client Downloading websocket_client-1.2.1-py2.py3-none-any.whl (52 kB) |████████████████████████████████| 52 kB 1.5 MB/s Requirement already satisfied: pillow in /usr/local/lib/python3.7/dist-packages (from visdom>=0.1.8.9) (7.1.2) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->visdom>=0.1.8.9) (2021.5.30) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->visdom>=0.1.8.9) (2.10) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->visdom>=0.1.8.9) (3.0.4) 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->visdom>=0.1.8.9) (1.25.11) Collecting jsonpointer>=1.9 Downloading jsonpointer-2.1-py2.py3-none-any.whl (7.4 kB) Building wheels for collected packages: visdom, torchfile Building wheel for visdom (setup.py) ... done Created wheel for visdom: filename=visdom-0.1.8.9-py3-none-any.whl size=655250 sha256=9c230dbacf5d4e2db434e6337b169149153c53de067b681a2d084ae0e035337b Stored in directory: /root/.cache/pip/wheels/2d/d1/9b/cde923274eac9cbb6ff0d8c7c72fe30a3da9095a38fd50bbf1 Building wheel for torchfile (setup.py) ... done Created wheel for torchfile: filename=torchfile-0.1.0-py3-none-any.whl size=5710 sha256=bc4b8455fc276796471d8b196c64401708e6aef00683506e04a81ba7cb7cf42a Stored in directory: /root/.cache/pip/wheels/ac/5c/3a/a80e1c65880945c71fd833408cd1e9a8cb7e2f8f37620bb75b Successfully built visdom torchfile Installing collected packages: jsonpointer, jsonpatch, torchfile, websocket-client, visdom Successfully installed jsonpatch-1.32 jsonpointer-2.1 torchfile-0.1.0 visdom-0.1.8.9 websocket-client-1.2.1 /usr/bin/python3 -m pip install easydict>=1.9 Requirement already satisfied: easydict>=1.9 in /usr/local/lib/python3.7/dist-packages (1.9) /usr/bin/python3 -m pip install toml>=0.10.2 Requirement already satisfied: toml>=0.10.2 in /usr/local/lib/python3.7/dist-packages (0.10.2) /usr/bin/python3 -m pip install git+https://github.com/open-mmlab/mmdetection.git@8179440ec5f75fe95484854af61ce6f6279f3bbc Collecting git+https://github.com/open-mmlab/mmdetection.git@8179440ec5f75fe95484854af61ce6f6279f3bbc Cloning https://github.com/open-mmlab/mmdetection.git (to revision 8179440ec5f75fe95484854af61ce6f6279f3bbc) to /tmp/pip-req-build-lbg0vgdd Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from mmdet==2.6.0) (3.2.2) Collecting mmpycocotools Downloading mmpycocotools-12.0.3.tar.gz (23 kB) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from mmdet==2.6.0) (1.19.5) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from mmdet==2.6.0) (1.15.0) Collecting terminaltables Downloading terminaltables-3.1.0.tar.gz (12 kB) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mmdet==2.6.0) (1.3.1) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mmdet==2.6.0) (0.10.0) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mmdet==2.6.0) (2.8.2) 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->mmdet==2.6.0) (2.4.7) Requirement already satisfied: setuptools>=18.0 in /usr/local/lib/python3.7/dist-packages (from mmpycocotools->mmdet==2.6.0) (57.4.0) Requirement already satisfied: cython>=0.27.3 in /usr/local/lib/python3.7/dist-packages (from mmpycocotools->mmdet==2.6.0) (0.29.24) Building wheels for collected packages: mmdet, mmpycocotools, terminaltables Building wheel for mmdet (setup.py) ... done Created wheel for mmdet: filename=mmdet-2.6.0-py3-none-any.whl size=490174 sha256=fa12d27568780367a052ebfa9761b307129b56b214bacbafa3624c736870e761 Stored in directory: /root/.cache/pip/wheels/c1/07/c9/55f832a7f1740f48e9ef244ed2b15d6bb042b75244ce041edd Building wheel for mmpycocotools (setup.py) ... done Created wheel for mmpycocotools: filename=mmpycocotools-12.0.3-cp37-cp37m-linux_x86_64.whl size=264251 sha256=609eb25a3a17d498cb1f40d07a48ff379b1af234e4329213d70ad35b7101baab Stored in directory: /root/.cache/pip/wheels/cc/fa/4a/067979eccddf6a22b46722493df8e07b0541956a5ab5bac8b1 Building wheel for terminaltables (setup.py) ... done Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15354 sha256=dcf66a542518bfd7263ae378b33e2b7a94eedabd8cc0bda1bc6109ec0aba7ffd Stored in directory: /root/.cache/pip/wheels/ba/ad/c8/2d98360791161cd3db6daf6b5e730f34021fc9367d5879f497 Successfully built mmdet mmpycocotools terminaltables Installing collected packages: mmpycocotools, terminaltables, mmdet Successfully installed mmdet-2.6.0 mmpycocotools-12.0.3 terminaltables-3.1.0 /usr/bin/python3 -m pip install git+https://github.com/open-mmlab/mmediting@d4086aaf8a36ae830f1714aad585900d24ad1156 Collecting git+https://github.com/open-mmlab/mmediting@d4086aaf8a36ae830f1714aad585900d24ad1156 Cloning https://github.com/open-mmlab/mmediting (to revision d4086aaf8a36ae830f1714aad585900d24ad1156) to /tmp/pip-req-build-tq_6gldd Requirement already satisfied: lmdb in /usr/local/lib/python3.7/dist-packages (from mmedit==0.5.0) (0.99) Requirement already satisfied: mmcv-full>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from mmedit==0.5.0) (1.2.0) Requirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from mmedit==0.5.0) (0.18.3) Requirement already satisfied: tensorboard in /usr/local/lib/python3.7/dist-packages (from mmedit==0.5.0) (2.6.0) Requirement already satisfied: yapf in /usr/local/lib/python3.7/dist-packages (from mmedit==0.5.0) (0.31.0) Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from mmcv-full>=1.0.0->mmedit==0.5.0) (1.19.5) Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from mmcv-full>=1.0.0->mmedit==0.5.0) (3.13) Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from mmcv-full>=1.0.0->mmedit==0.5.0) (7.1.2) Requirement already satisfied: addict in /usr/local/lib/python3.7/dist-packages (from mmcv-full>=1.0.0->mmedit==0.5.0) (2.4.0) Requirement already satisfied: opencv-python>=3 in /usr/local/lib/python3.7/dist-packages (from mmcv-full>=1.0.0->mmedit==0.5.0) (4.5.3.56) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (2021.8.30) Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (2.9.0) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (3.2.2) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (2.6.2) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (1.1.1) Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image->mmedit==0.5.0) (1.7.1) Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (57.4.0) Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (0.37.0) Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (0.12.0) Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (1.0.1) Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (1.34.0) Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (3.3.4) Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (1.39.0) Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (2.23.0) Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (0.6.1) Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (0.4.5) Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (1.8.0) Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->mmedit==0.5.0) (3.17.3) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->mmedit==0.5.0) (1.3.1) 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!=3.0.0,>=2.0.0->scikit-image->mmedit==0.5.0) (2.4.7) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->mmedit==0.5.0) (2.8.2) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->mmedit==0.5.0) (0.10.0) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from absl-py>=0.4->tensorboard->mmedit==0.5.0) (1.15.0) Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard->mmedit==0.5.0) (0.2.8) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard->mmedit==0.5.0) (4.2.2) Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in /usr/local/lib/python3.7/dist-packages (from google-auth<2,>=1.6.3->tensorboard->mmedit==0.5.0) (4.7.2) Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard->mmedit==0.5.0) (4.6.4) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->mmedit==0.5.0) (3.0.4) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->mmedit==0.5.0) (2.10) 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<3,>=2.21.0->tensorboard->mmedit==0.5.0) (1.25.11) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->mmedit==0.5.0) (2021.5.30) Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard->mmedit==0.5.0) (1.3.0) Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard->mmedit==0.5.0) (0.4.8) Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard->mmedit==0.5.0) (3.7.4.3) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->markdown>=2.6.8->tensorboard->mmedit==0.5.0) (3.5.0) Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard->mmedit==0.5.0) (3.1.1) Building wheels for collected packages: mmedit Building wheel for mmedit (setup.py) ... done Created wheel for mmedit: filename=mmedit-0.5.0-py2.py3-none-any.whl size=220163 sha256=678bbecfeca959731f9dcfbf54863123831f43b7f6260206fd3b5651f9dccb50 Stored in directory: /root/.cache/pip/wheels/e4/96/40/2b20e71f449b7769d9626c6197c4e10693fa5853b7345f9bdd Successfully built mmedit Installing collected packages: mmedit Successfully installed mmedit-0.5.0 /usr/bin/python3 -m pip install git+https://github.com/iPERDance/neural_renderer.git@e5f54f71a8941acf372514eb92e289872f272653 Collecting git+https://github.com/iPERDance/neural_renderer.git@e5f54f71a8941acf372514eb92e289872f272653 Cloning https://github.com/iPERDance/neural_renderer.git (to revision e5f54f71a8941acf372514eb92e289872f272653) to /tmp/pip-req-build-_694c8fv Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (1.19.5) Requirement already satisfied: torch in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (1.7.0+cu101) Requirement already satisfied: torchvision in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (0.8.1+cu101) Requirement already satisfied: scikit-image in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (0.18.3) Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (4.62.0) Requirement already satisfied: imageio in /usr/local/lib/python3.7/dist-packages (from neural-renderer==1.1.3) (2.9.0) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from torch->neural-renderer==1.1.3) (3.7.4.3) Requirement already satisfied: future in /usr/local/lib/python3.7/dist-packages (from torch->neural-renderer==1.1.3) (0.16.0) Requirement already satisfied: dataclasses in /usr/local/lib/python3.7/dist-packages (from torch->neural-renderer==1.1.3) (0.6) Requirement already satisfied: pillow>=4.1.1 in /usr/local/lib/python3.7/dist-packages (from torchvision->neural-renderer==1.1.3) (7.1.2) Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image->neural-renderer==1.1.3) (1.1.1) Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image->neural-renderer==1.1.3) (2021.8.30) Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->neural-renderer==1.1.3) (3.2.2) Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image->neural-renderer==1.1.3) (2.6.2) Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image->neural-renderer==1.1.3) (1.7.1) 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!=3.0.0,>=2.0.0->scikit-image->neural-renderer==1.1.3) (2.4.7) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->neural-renderer==1.1.3) (1.3.1) Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->neural-renderer==1.1.3) (2.8.2) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image->neural-renderer==1.1.3) (0.10.0) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image->neural-renderer==1.1.3) (1.15.0) Building wheels for collected packages: neural-renderer Building wheel for neural-renderer (setup.py) ... done Created wheel for neural-renderer: filename=neural_renderer-1.1.3-cp37-cp37m-linux_x86_64.whl size=5675340 sha256=633994f8eafb27c1f9ca8eb74f1847e03156e39b10be093f640755caae2a826c Stored in directory: /root/.cache/pip/wheels/06/62/a4/71ebf253f9481f653ec789c5e0ac11c14a31fac223001a7a3f Successfully built neural-renderer Installing collected packages: neural-renderer Successfully installed neural-renderer-1.1.3 running develop running egg_info writing iPERCore.egg-info/PKG-INFO writing dependency_links to iPERCore.egg-info/dependency_links.txt writing entry points to iPERCore.egg-info/entry_points.txt writing requirements to iPERCore.egg-info/requires.txt writing top-level names to iPERCore.egg-info/top_level.txt adding license file 'LICENSE' writing manifest file 'iPERCore.egg-info/SOURCES.txt' running build_ext Creating /usr/local/lib/python3.7/dist-packages/iPERCore.egg-link (link to .) Adding iPERCore 0.2.0 to easy-install.pth file Installing run_imitator script to /usr/local/bin Installing run_swapper script to /usr/local/bin Installing run_viewer script to /usr/local/bin Installed /content/drive/My Drive/Colab/fyp/iPERCore Processing dependencies for iPERCore==0.2.0 Searching for toml==0.10.2 Best match: toml 0.10.2 Adding toml 0.10.2 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for easydict==1.9 Best match: easydict 1.9 Adding easydict 1.9 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for visdom==0.1.8.9 Best match: visdom 0.1.8.9 Adding visdom 0.1.8.9 to easy-install.pth file Installing visdom script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for tqdm==4.62.0 Best match: tqdm 4.62.0 Adding tqdm 4.62.0 to easy-install.pth file Installing tqdm script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for tensorboardX==2.4 Best match: tensorboardX 2.4 Adding tensorboardX 2.4 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for opencv-python==4.5.3.56 Best match: opencv-python 4.5.3.56 Adding opencv-python 4.5.3.56 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for scikit-image==0.18.3 Best match: scikit-image 0.18.3 Adding scikit-image 0.18.3 to easy-install.pth file Installing skivi script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for scipy==1.7.1 Best match: scipy 1.7.1 Adding scipy 1.7.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for numpy==1.19.5 Best match: numpy 1.19.5 Adding numpy 1.19.5 to easy-install.pth file Installing f2py script to /usr/local/bin Installing f2py3 script to /usr/local/bin Installing f2py3.7 script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for pyzmq==22.2.1 Best match: pyzmq 22.2.1 Adding pyzmq 22.2.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for six==1.15.0 Best match: six 1.15.0 Adding six 1.15.0 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for jsonpatch==1.32 Best match: jsonpatch 1.32 Adding jsonpatch 1.32 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for torchfile==0.1.0 Best match: torchfile 0.1.0 Adding torchfile 0.1.0 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for websocket-client==1.2.1 Best match: websocket-client 1.2.1 Adding websocket-client 1.2.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for Pillow==7.1.2 Best match: Pillow 7.1.2 Adding Pillow 7.1.2 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for tornado==5.1.1 Best match: tornado 5.1.1 Adding tornado 5.1.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for requests==2.23.0 Best match: requests 2.23.0 Adding requests 2.23.0 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for protobuf==3.17.3 Best match: protobuf 3.17.3 Adding protobuf 3.17.3 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for tifffile==2021.8.30 Best match: tifffile 2021.8.30 Adding tifffile 2021.8.30 to easy-install.pth file Installing lsm2bin script to /usr/local/bin Installing tiff2fsspec script to /usr/local/bin Installing tiffcomment script to /usr/local/bin Installing tifffile script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for networkx==2.6.2 Best match: networkx 2.6.2 Adding networkx 2.6.2 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for PyWavelets==1.1.1 Best match: PyWavelets 1.1.1 Adding PyWavelets 1.1.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for imageio==2.9.0 Best match: imageio 2.9.0 Adding imageio 2.9.0 to easy-install.pth file Installing imageio_download_bin script to /usr/local/bin Installing imageio_remove_bin script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for matplotlib==3.2.2 Best match: matplotlib 3.2.2 Adding matplotlib 3.2.2 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for jsonpointer==2.1 Best match: jsonpointer 2.1 Adding jsonpointer 2.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for idna==2.10 Best match: idna 2.10 Adding idna 2.10 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for chardet==3.0.4 Best match: chardet 3.0.4 Adding chardet 3.0.4 to easy-install.pth file Installing chardetect script to /usr/local/bin Using /usr/local/lib/python3.7/dist-packages Searching for certifi==2021.5.30 Best match: certifi 2021.5.30 Adding certifi 2021.5.30 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for urllib3==1.25.11 Best match: urllib3 1.25.11 Adding urllib3 1.25.11 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for cycler==0.10.0 Best match: cycler 0.10.0 Adding cycler 0.10.0 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for kiwisolver==1.3.1 Best match: kiwisolver 1.3.1 Adding kiwisolver 1.3.1 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for pyparsing==2.4.7 Best match: pyparsing 2.4.7 Adding pyparsing 2.4.7 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Searching for python-dateutil==2.8.2 Best match: python-dateutil 2.8.2 Adding python-dateutil 2.8.2 to easy-install.pth file Using /usr/local/lib/python3.7/dist-packages Finished processing dependencies for iPERCore==0.2.0 /content
#@title Define Cropping Functions import os from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip import face_alignment import imageio import numpy as np from skimage.transform import resize import matplotlib.pyplot as plt import matplotlib.animation as animation from IPython.display import HTML, clear_output import cv2 import shutil import warnings warnings.filterwarnings("ignore") hog = cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device='cuda') image_size = 512 def create_bounding_box(target_landmarks, expansion_factor=1): target_landmarks = np.array(target_landmarks) x_y_min = target_landmarks.reshape(-1, 68, 2).min(axis=1) x_y_max = target_landmarks.reshape(-1, 68, 2).max(axis=1) expansion_factor = (expansion_factor-1)/2 bb_expansion_x = (x_y_max[:, 0] - x_y_min[:, 0]) * expansion_factor bb_expansion_y = (x_y_max[:, 1] - x_y_min[:, 1]) * expansion_factor x_y_min[:, 0] -= bb_expansion_x x_y_max[:, 0] += bb_expansion_x x_y_min[:, 1] -= bb_expansion_y x_y_max[:, 1] += bb_expansion_y return np.hstack((x_y_min, x_y_max-x_y_min)) def fix_dims(im): if im.ndim == 2: im = np.tile(im[..., None], [1, 1, 3]) return im[...,:3] def get_crop(im, center_face=True, crop_face=True, expansion_factor=1, landmarks=None): im = fix_dims(im) if (center_face or crop_face) and not landmarks: landmarks = fa.get_landmarks_from_image(im) if (center_face or crop_face) and landmarks: rects = create_bounding_box(landmarks, expansion_factor=expansion_factor) x0,y0,w,h = sorted(rects, key=lambda x: x[2]*x[3])[-1] if crop_face: s = max(h, w) x0 += (w-s)//2 x1 = x0 + s y0 += (h-s)//2 y1 = y0 + s else: img_h,img_w = im.shape[:2] img_s = min(img_h,img_w) x0 = min(max(0, x0+(w-img_s)//2), img_w-img_s) x1 = x0 + img_s y0 = min(max(0, y0+(h-img_s)//2), img_h-img_s) y1 = y0 + img_s else: h,w = im.shape[:2] s = min(h,w) x0 = (w-s)//2 x1 = x0 + s y0 = (h-s)//2 y1 = y0 + s return int(x0),int(x1),int(y0),int(y1) def pad_crop_resize(im, x0=None, x1=None, y0=None, y1=None, new_h=256, new_w=256): im = fix_dims(im) h,w = im.shape[:2] if x0 is None: x0 = 0 if x1 is None: x1 = w if y0 is None: y0 = 0 if y1 is None: y1 = h if x0<0 or x1>w or y0<0 or y1>h: im = np.pad(im, pad_width=[(max(-y0,0),max(y1-h,0)),(max(-x0,0),max(x1-w,0)),(0,0)], mode='edge') return resize(im[max(y0,0):y1-min(y0,0),max(x0,0):x1-min(x0,0)], (new_h, new_w)) def get_crop_body(im, center_body=True, crop_body=True, expansion_factor=1, rects=None): im = fix_dims(im) if (center_body or crop_body) and rects is None: rects, _ = hog.detectMultiScale(im, winStride=(4, 4),padding=(8,8), scale=expansion_factor) if (center_body or crop_body) and rects is not None and len(rects): x0,y0,w,h = sorted(rects, key=lambda x: x[2]*x[3])[-1] if crop_body: x0 += w//2-h//2 x1 = x0+h y1 = y0+h else: img_h,img_w = im.shape[:2] x0 += (w-img_h)//2 x1 = x0+img_h y0 = 0 y1 = img_h else: h,w = im.shape[:2] x0 = (w-h)//2 x1 = (w+h)//2 y0 = 0 y1 = h return int(x0),int(x1),int(y0),int(y1) def crop_resize(im, size, crop=False): if im.shape[:2] == size: return im if size[0]<im.shape[0] or size[1]<im.shape[1]: interp = cv2.INTER_AREA else: interp = cv2.INTER_CUBIC if not crop: return np.clip(cv2.resize(im, size[::-1], interpolation=interp),0,1) ratio = max(size[0]/im.shape[0], size[1]/im.shape[1]) im = np.clip(cv2.resize(im, (int(np.ceil(im.shape[1]*ratio)), int(np.ceil(im.shape[0]*ratio))), interpolation=interp),0,1) return im[(im.shape[0]-size[0])//2:(im.shape[0]-size[0])//2+size[0], (im.shape[1]-size[1])//2:(im.shape[1]-size[1])//2+size[1]]
Downloading: "https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth" to /root/.cache/torch/hub/checkpoints/s3fd-619a316812.pth
0%| | 0.00/85.7M [00:00<?, ?B/s]
Downloading: "https://www.adrianbulat.com/downloads/python-fan/2DFAN4-11f355bf06.pth.tar" to /root/.cache/torch/hub/checkpoints/2DFAN4-11f355bf06.pth.tar
0%| | 0.00/91.2M [00:00<?, ?B/s]
#@title Define GANSpace functions from ipywidgets import fixed # Taken from https://github.com/alexanderkuk/log-progress def log_progress(sequence, every=1, size=None, name='Items'): from ipywidgets import IntProgress, HTML, VBox from IPython.display import display is_iterator = False if size is None: try: size = len(sequence) except TypeError: is_iterator = True if size is not None: if every is None: if size <= 200: every = 1 else: every = int(size / 200) # every 0.5% else: assert every is not None, 'sequence is iterator, set every' if is_iterator: progress = IntProgress(min=0, max=1, value=1) progress.bar_style = 'info' else: progress = IntProgress(min=0, max=size, value=0) label = HTML() box = VBox(children=[label, progress]) display(box) index = 0 try: for index, record in enumerate(sequence, 1): if index == 1 or index % every == 0: if is_iterator: label.value = '{name}: {index} / ?'.format( name=name, index=index ) else: progress.value = index label.value = u'{name}: {index} / {size}'.format( name=name, index=index, size=size ) yield record except: progress.bar_style = 'danger' raise else: progress.bar_style = 'success' progress.value = index label.value = "{name}: {index}".format( name=name, index=str(index or '?') ) def name_direction(sender): if not text.value: print('Please name the direction before saving') return if num in named_directions.values(): target_key = list(named_directions.keys())[list(named_directions.values()).index(num)] print(f'Direction already named: {target_key}') print(f'Overwriting... ') del(named_directions[target_key]) named_directions[text.value] = [num, start_layer.value, end_layer.value] save_direction(random_dir, text.value) for item in named_directions: print(item, named_directions[item]) def save_direction(direction, filename): filename += ".npy" np.save(filename, direction, allow_pickle=True, fix_imports=True) print(f'Latent direction saved as {filename}') def project_image(target_image, step, model, center=False, seed=303, use_clip=True, video=False): if model == 'portrait': pkl = '/content/drive/MyDrive/Colab/models/portrait-001000.pkl' elif model == 'character': pkl = '/content/drive/MyDrive/Colab/models/character-002600.pkl' elif model == 'model': pkl = '/content/drive/MyDrive/Colab/models/modelv4-001600.pkl' elif model == 'lookbook': pkl = '/content/drive/MyDrive/Colab/models/lookbook-001800.pkl' else: print('Model PKL file does not exists') !python /content/drive/MyDrive/Colab/fyp/stylegan2-ada-pytorch/pbaylies_projector.py --network={pkl} --outdir=/content/projector_output/ --target-image={target_image} --num-steps={step} --use-clip={use_clip} --use-center={center} --seed={seed} --save-video={video} projected_w = np.load('/content/projector_output/projected_w.npz')['w'].squeeze() return projected_w def mix_w(w1, w2, content, style): for i in range(0,5): w2[i] = w1[i] * (1 - content) + w2[i] * content for i in range(5, 16): w2[i] = w1[i] * (1 - style) + w2[i] * style return w2 def display_sample_pytorch(seed=None, truncation=0.5, directions=None, distances=None, scale=1, start=0, end=14, w=None, disp=True, save=None): # blockPrint() model.truncation = truncation if w is None: w = model.sample_latent(1, seed=seed).detach().cpu().numpy() w = [w]*model.get_max_latents() # one per layer else: w = [np.expand_dims(x, 0) for x in w] if directions != None and distances != None: for l in range(start, end): for i in range(len(directions)): w[l] = w[l] + directions[i] * distances[i] * scale torch.cuda.empty_cache() #save image and display out = model.sample_np(w) final_im = Image.fromarray((out * 255).astype(np.uint8)).resize((500,500),Image.LANCZOS) if save is not None: if disp == False: print(save) final_im.save(f'out/{seed}_{save:05}.png') if disp: display(final_im) return final_im def generate_mov(seed, truncation, direction_vec, scale, layers, n_frames, out_name = 'out', noise_spec = None, loop=True): """Generates a mov moving back and forth along the chosen direction vector""" # Example of reading a generated set of images, and storing as MP4. %mkdir out movieName = f'out/{out_name}.mp4' offset = -10 step = 20 / n_frames imgs = [] for i in log_progress(range(n_frames), name = "Generating frames"): print(f'\r{i} / {n_frames}', end='') w = model.sample_latent(1, seed=seed).cpu().numpy() model.truncation = truncation w = [w]*model.get_max_latents() # one per layer for l in layers: if l <= model.get_max_latents(): w[l] = w[l] + direction_vec * offset * scale #save image and display out = model.sample_np(w) final_im = Image.fromarray((out * 255).astype(np.uint8)) imgs.append(out) #increase offset offset += step if loop: imgs += imgs[::-1] with imageio.get_writer(movieName, mode='I') as writer: for image in log_progress(list(imgs), name = "Creating animation"): writer.append_data(img_as_ubyte(image))
#@title Load Model for GANSpace selected_model = 'portrait'#@param ["portrait", "character", "model", "lookbook"] # Load model from IPython.utils import io import torch import PIL import numpy as np import ipywidgets as widgets from PIL import Image import imageio from models import get_instrumented_model from decomposition import get_or_compute from config import Config from skimage import img_as_ubyte # Speed up computation torch.autograd.set_grad_enabled(False) torch.backends.cudnn.benchmark = True # Specify model to use config = Config( model='StyleGAN2', layer='style', output_class=selected_model, components=80, use_w=True, batch_size=5_000, # style layer quite small ) inst = get_instrumented_model(config.model, config.output_class, config.layer, torch.device('cuda'), use_w=config.use_w) path_to_components = get_or_compute(config, inst) model = inst.model comps = np.load(path_to_components) lst = comps.files latent_dirs = [] latent_stdevs = [] load_activations = False for item in lst: if load_activations: if item == 'act_comp': for i in range(comps[item].shape[0]): latent_dirs.append(comps[item][i]) if item == 'act_stdev': for i in range(comps[item].shape[0]): latent_stdevs.append(comps[item][i]) else: if item == 'lat_comp': for i in range(comps[item].shape[0]): latent_dirs.append(comps[item][i]) if item == 'lat_stdev': for i in range(comps[item].shape[0]): latent_stdevs.append(comps[item][i]) def load_model(output_class): global config global inst global model config = Config( model='StyleGAN2', layer='style', output_class=output_class, components=80, use_w=True, batch_size=5_000, # style layer quite small ) inst = get_instrumented_model(config.model, config.output_class, config.layer, torch.device('cuda'), use_w=config.use_w) path_to_components = get_or_compute(config, inst) model = inst.model comps = np.load(path_to_components) lst = comps.files latent_dirs = [] latent_stdevs = [] load_activations = False for item in lst: if load_activations: if item == 'act_comp': for i in range(comps[item].shape[0]): latent_dirs.append(comps[item][i]) if item == 'act_stdev': for i in range(comps[item].shape[0]): latent_stdevs.append(comps[item][i]) else: if item == 'lat_comp': for i in range(comps[item].shape[0]): latent_dirs.append(comps[item][i]) if item == 'lat_stdev': for i in range(comps[item].shape[0]): latent_stdevs.append(comps[item][i])
StyleGAN2: Optimized CUDA op FusedLeakyReLU not available, using native PyTorch fallback. StyleGAN2: Optimized CUDA op UpFirDn2d not available, using native PyTorch fallback. /content/drive/MyDrive/Colab/fyp/ganspace/models/checkpoints/stylegan2/stylegan2_portrait_512.pt

GANSpace UI

#@title Portrait GANSpace UI import gradio as gr import numpy as np def generate_image(seed, truncation, female, realism, greyhair, shorthair, shortchin, ponytail, blackhair, start_layer, end_layer): scale = 1 seed, start_layer, end_layer = int(seed), int(start_layer), int(end_layer) w = None params = {'female': female, 'realism': realism, 'greyhair': greyhair, 'shorthair': shorthair, 'shortchin': shortchin, 'ponytail': ponytail, 'blackhair': blackhair} param_indexes = {'female': 1, 'realism': 4, 'greyhair': 5, 'shorthair': 6, 'shortchin': 8, 'ponytail': 9, 'blackhair': 10} directions = [] distances = [] for k, v in params.items(): directions.append(latent_dirs[param_indexes[k]]) distances.append(v) model.truncation = truncation if w is None: w = model.sample_latent(1, seed=seed).detach().cpu().numpy() w = [w]*model.get_max_latents() # one per layer else: w = [np.expand_dims(x, 0) for x in w] if directions != None and distances != None: for l in range(start_layer, end_layer): for i in range(len(directions)): w[l] = w[l] + directions[i] * distances[i] * 1 torch.cuda.empty_cache() #save image and display out = model.sample_np(w) final_im = Image.fromarray((out * 255).astype(np.uint8)) # final_im.save('/tmp/edit_output.jpg') # save the content to temp return final_im #return display_sample_pytorch(int(seed), truncation, directions, distances, scale, int(start_layer), int(end_layer), disp=False) truncation = gr.inputs.Slider(minimum=0, maximum=1, default=0.5, label="Truncation") start_layer = gr.inputs.Number(default=0, label="Start Layer") end_layer = gr.inputs.Number(default=14, label="End Layer") seed = gr.inputs.Number(default=0, label="Seed") slider_max_val = 20 slider_min_val = -20 slider_step = 1 female = gr.inputs.Slider(label="Female", minimum=slider_min_val, maximum=slider_max_val, default=0) realism = gr.inputs.Slider(label="Realism", minimum=slider_min_val, maximum=slider_max_val, default=0) greyhair = gr.inputs.Slider(label="Grey Hair", minimum=slider_min_val, maximum=slider_max_val, default=0) shorthair = gr.inputs.Slider(label="Short Hair", minimum=slider_min_val, maximum=slider_max_val, default=0) shortchin = gr.inputs.Slider(label="Short Chin", minimum=slider_min_val, maximum=slider_max_val, default=0) ponytail = gr.inputs.Slider(label="Ponytail", minimum=slider_min_val, maximum=slider_max_val, default=0) blackhair = gr.inputs.Slider(label="Black Hair", minimum=slider_min_val, maximum=slider_max_val, default=0) scale = 1 inputs = [seed, truncation, female, realism, greyhair, shorthair, shortchin, ponytail, blackhair, start_layer, end_layer] gr.Interface(generate_image, inputs, "image", live=True, title="GAN Editing").launch(debug=True)
Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch(). This share link will expire in 24 hours. If you need a permanent link, visit: https://gradio.app/introducing-hosted (NEW!) Running on External URL: https://29119.gradio.app Interface loading below...
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-7-7f3b9ee42a35> in <module>() 77 inputs = [seed, truncation, female, realism, greyhair, shorthair, shortchin, ponytail, blackhair, start_layer, end_layer] 78 ---> 79 gr.Interface(generate_image, inputs, "image", live=True, title="GAN Editing").launch(debug=True) /usr/local/lib/python3.7/dist-packages/gradio/interface.py in launch(self, inline, inbrowser, share, debug, auth, auth_message, private_endpoint, prevent_thread_lock) 585 while True: 586 sys.stdout.flush() --> 587 time.sleep(0.1) 588 is_in_interactive_mode = bool(getattr(sys, 'ps1', sys.flags.interactive)) 589 if not prevent_thread_lock and not is_in_interactive_mode: KeyboardInterrupt:
import hashlib seed = 'asds'
103889340637451552307951087327054883309227107387112946151010067908838645007837
#@title Character Gradio UI import gradio as gr import numpy as np import hashlib def generate_image(seed, truncation, monster, female, skimpy, light, bodysuit, bulky, human_head, start_layer, end_layer): scale = 1 seed = int(hashlib.sha256(seed.encode('utf-8')).hexdigest(), 16) % 10**8 params = {'monster': monster, 'female': female, 'skimpy': skimpy, 'light': light, 'bodysuit': bodysuit, 'bulky': bulky, 'human_head': human_head} param_indexes = {'monster': 0, 'female': 1, 'skimpy': 2, 'light': 4, 'bodysuit': 5, 'bulky': 6, 'human_head': 8} directions = [] distances = [] for k, v in params.items(): directions.append(latent_dirs[param_indexes[k]]) distances.append(v) style = {'description_width': 'initial'} return display_sample_pytorch(int(seed), truncation, directions, distances, scale, int(start_layer), int(end_layer), disp=False) truncation = gr.inputs.Slider(minimum=0, maximum=1, default=0.5, label="Truncation") start_layer = gr.inputs.Number(default=0, label="Start Layer") end_layer = gr.inputs.Number(default=14, label="End Layer") seed = gr.inputs.Textbox(default='0') slider_max_val = 20 slider_min_val = -20 slider_step = 1 monster = gr.inputs.Slider(label="Monster", minimum=slider_min_val, maximum=slider_max_val, default=0) female = gr.inputs.Slider(label="Female", minimum=slider_min_val, maximum=slider_max_val, default=0) skimpy = gr.inputs.Slider(label="Skimpy", minimum=slider_min_val, maximum=slider_max_val, default=0) light = gr.inputs.Slider(label="Light", minimum=slider_min_val, maximum=slider_max_val, default=0) bodysuit = gr.inputs.Slider(label="Bodysuit", minimum=slider_min_val, maximum=slider_max_val, default=0) bulky = gr.inputs.Slider(label="Bulky", minimum=slider_min_val, maximum=slider_max_val, default=0) human_head = gr.inputs.Slider(label="Human Head", minimum=slider_min_val, maximum=slider_max_val, default=0) scale = 1 inputs = [seed, truncation, monster, female, skimpy, light, bodysuit, bulky, human_head, start_layer, end_layer] gr.Interface(generate_image, inputs, "image", live=True, title="CharacterGAN").launch(debug=True)
Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch(). This share link will expire in 24 hours. If you need a permanent link, visit: https://gradio.app/introducing-hosted (NEW!) Running on External URL: https://53442.gradio.app Interface loading below...
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-10-546776d77710> in <module>() 58 inputs = [seed, truncation, monster, female, skimpy, light, bodysuit, bulky, human_head, start_layer, end_layer] 59 ---> 60 gr.Interface(generate_image, inputs, "image", live=True, title="CharacterGAN").launch(debug=True) /usr/local/lib/python3.7/dist-packages/gradio/interface.py in launch(self, inline, inbrowser, share, debug, auth, auth_message, private_endpoint, prevent_thread_lock) 585 while True: 586 sys.stdout.flush() --> 587 time.sleep(0.1) 588 is_in_interactive_mode = bool(getattr(sys, 'ps1', sys.flags.interactive)) 589 if not prevent_thread_lock and not is_in_interactive_mode: KeyboardInterrupt:

FOMM

#@title Load Checkpoint for FOMM from demo import load_checkpoints import moviepy.editor as mpe import matplotlib.pyplot as plt import matplotlib.animation as animation from IPython.display import HTML from demo import make_animation from skimage import img_as_ubyte #!gdown --id 1jmcn19-c3p8mf39aYNXUhdMqzqDYZhQ_ -O vox-cpk.pth.tar generator, kp_detector = load_checkpoints(config_path='/content/drive/MyDrive/Colab/fyp/first-order-model/config/vox-256.yaml', checkpoint_path='/content/drive/MyDrive/Colab/fyp/first-order-model/vox-cpk.pth.tar')
#@title FOMM UI import gradio as gr import moviepy.editor as mpe import matplotlib.pyplot as plt import matplotlib.animation as animation from IPython.display import HTML from demo import make_animation from skimage import img_as_ubyte def predict_video(image_path, video_path, relative, show_inputs, start_time=0, end_time=-1, center_video_to_head=True, crop_video_to_head=True, video_crop_expansion_factor=1.5, center_image_to_head=True, crop_image_to_head=True, image_crop_expansion_factor=2.5, speech="", speaker='p225'): video_crop_expansion_factor = max(video_crop_expansion_factor, 1) image_crop_expansion_factor = max(image_crop_expansion_factor, 1) if end_time > start_time: # cut video print('Cutting Video...') ffmpeg_extract_subclip(video_path, start_time, end_time, targetname='cut.mp4') video_path = 'cut.mp4' source_image = imageio.imread(image_path.name) reader = imageio.get_reader(video_path) source_image = pad_crop_resize(source_image, *get_crop(source_image, center_face=center_image_to_head, crop_face=crop_image_to_head, expansion_factor=image_crop_expansion_factor)) fps = reader.get_meta_data()['fps'] print('FPS', fps) #fps = 8 driving_video = [] landmarks = None try: for i,im in enumerate(reader): if not crop_video_to_head: break landmarks = fa.get_landmarks_from_image(im) if landmarks: break x0,x1,y0,y1 = get_crop(im, center_face=center_video_to_head, crop_face=crop_video_to_head, expansion_factor=video_crop_expansion_factor, landmarks=landmarks) reader.set_image_index(0) for im in reader: driving_video.append(pad_crop_resize(im,x0,x1,y0,y1)) except RuntimeError: pass # Generate animation predictions = make_animation(source_image, driving_video, generator, kp_detector, relative=relative) fig = plt.figure(figsize=(10 * show_inputs + 8 * (predictions is not None), 8)) ims = [] for i in range(len(driving_video)): cols = [] if show_inputs and speech == "": cols.append(source_image) cols.append(driving_video[i]) if predictions is not None: cols.append(predictions[i]) im = plt.imshow(np.concatenate(cols, axis=1), animated=True) plt.axis('off') ims.append([im]) plt.tight_layout() ani = animation.ArtistAnimation(fig, ims, interval=50, repeat_delay=1000) ani.save('output.mp4', fps=fps) plt.close() if speech != "": !tts --text "{speech}" --out_path speech.wav --model_name "tts_models/en/vctk/sc-glow-tts" --speaker_idx {speaker} !cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../output.mp4" --audio '../speech.wav' return 'Wav2Lip/results/result_voice.mp4' else: video_clip = mpe.VideoFileClip('output.mp4') audio_clip = mpe.AudioFileClip(video_path) final_clip = video_clip.set_audio(audio_clip) final_clip.write_videofile("result.mp4", fps=fps) return 'result.mp4' image_input = gr.inputs.Image(type="file") video_input = gr.inputs.Video(type="mp4") relative = gr.inputs.Checkbox(default=True, label="Relative") show_inputs = gr.inputs.Checkbox(default=True, label="Show Inputs") start_time = gr.inputs.Number(default=0, label="Start Time") end_time = gr.inputs.Number(default=-1, label="End Time") center_video_to_head = gr.inputs.Checkbox(default=True, label="Center Video to Head") crop_video_to_head = gr.inputs.Checkbox(default=True, label="Crop Video to Head") video_crop_expansion_factor = gr.inputs.Number(default=2, label="Video Crop Expansion Factor") center_image_to_head = gr.inputs.Checkbox(default=False, label="Center Image to Head") crop_image_to_head = gr.inputs.Checkbox(default=False, label="Crop Image to Head") image_crop_expansion_factor = gr.inputs.Number(default=2, label="Image Crop Expansion Factor") speech = gr.inputs.Textbox(label="Text to Speech", default="") speaker = gr.inputs.Dropdown(default='p225', choices=['p225', 'p226', 'p227', 'p228', 'p229', 'p230', 'p231', 'p232', 'p233', 'p234', 'p261']) inputs = [image_input, video_input, relative, show_inputs, start_time, end_time, center_video_to_head, crop_video_to_head, video_crop_expansion_factor, center_image_to_head, crop_image_to_head, image_crop_expansion_factor, speech, speaker] gr.Interface(predict_video, inputs, "video", live=False, title="Facial Animation").launch(debug=True)
Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch(). This share link will expire in 24 hours. If you need a permanent link, visit: https://gradio.app/introducing-hosted (NEW!) Running on External URL: https://41796.gradio.app Interface loading below...
FPS 25.0
100%|██████████| 339/339 [00:31<00:00, 10.60it/s]
Moviepy - Building video result.mp4. MoviePy - Writing audio in resultTEMP_MPY_wvf_snd.mp3
MoviePy - Done. Moviepy - Writing video result.mp4
Moviepy - Done ! Moviepy - video ready result.mp4 FPS 25.0
100%|██████████| 339/339 [00:32<00:00, 10.59it/s]
Moviepy - Building video result.mp4. MoviePy - Writing audio in resultTEMP_MPY_wvf_snd.mp3
MoviePy - Done. Moviepy - Writing video result.mp4
Moviepy - Done ! Moviepy - video ready result.mp4 FPS 25.0
100%|██████████| 339/339 [00:32<00:00, 10.59it/s]
Moviepy - Building video result.mp4. MoviePy - Writing audio in resultTEMP_MPY_wvf_snd.mp3
MoviePy - Done. Moviepy - Writing video result.mp4
Moviepy - Done ! Moviepy - video ready result.mp4 FPS 25.0
100%|██████████| 339/339 [00:31<00:00, 10.61it/s]
Moviepy - Building video result.mp4. MoviePy - Writing audio in resultTEMP_MPY_wvf_snd.mp3
MoviePy - Done. Moviepy - Writing video result.mp4
Moviepy - Done ! Moviepy - video ready result.mp4 FPS 25.0
100%|██████████| 339/339 [00:32<00:00, 10.55it/s]
Moviepy - Building video result.mp4. MoviePy - Writing audio in resultTEMP_MPY_wvf_snd.mp3
MoviePy - Done. Moviepy - Writing video result.mp4
Moviepy - Done ! Moviepy - video ready result.mp4
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-21-af786465d0c1> in <module>() 100 speech, speaker] 101 --> 102 gr.Interface(predict_video, inputs, "video", live=False, title="Facial Animation").launch(debug=True) /usr/local/lib/python3.7/dist-packages/gradio/interface.py in launch(self, inline, inbrowser, share, debug, auth, auth_message, private_endpoint, prevent_thread_lock) 584 while True: 585 sys.stdout.flush() --> 586 time.sleep(0.1) 587 is_in_interactive_mode = bool(getattr(sys, 'ps1', sys.flags.interactive)) 588 if not prevent_thread_lock and not is_in_interactive_mode: KeyboardInterrupt:

Impersonator++

#@title Impersonator++ Gradio UI import gradio as gr import os.path as osp import platform import argparse import time import sys import subprocess from IPython.display import HTML from base64 import b64encode from moviepy.editor import ImageSequenceClip def imitate(im, video, bg_image, background, center_image_to_body, crop_image_to_body, image_crop_expansion_factor, keep_aspect_background, show_inputs, pose_fc, cam_fc): source_image = imageio.imread(im.name) source_image = pad_crop_resize(source_image, *get_crop_body(source_image, center_body=center_image_to_body, crop_body=crop_image_to_body, expansion_factor=image_crop_expansion_factor), new_h=800, new_w=800) imageio.imwrite('/content/crop.png', (source_image*255).astype(np.uint8)) if bg_image != 'None': bg_image = imageio.imread(bg_image.name) bg_image = crop_resize(bg_image/255, source_image.shape[:2], crop=keep_aspect_background) imageio.imwrite('/content/bg_crop.png', (bg_image*255).astype(np.uint8)) with imageio.get_reader(video, format='mp4') as reader: fps = reader.get_meta_data()['fps'] gpu_ids = "0" num_source = 1 assets_dir = "/content/drive/MyDrive/Colab/fyp/iPERCore/assets" output_dir = "/content/drive/MyDrive/Colab/fyp/iPERCore/results" shutil.rmtree(output_dir, ignore_errors=True) # symlink from the actual assets directory to this current directory work_asserts_dir = os.path.join("./assets") if not os.path.exists(work_asserts_dir): os.symlink(osp.abspath(assets_dir), osp.abspath(work_asserts_dir), target_is_directory=(platform.system() == "Windows")) cfg_path = osp.join(work_asserts_dir, "configs", "deploy.toml") model_id = "mymodel" src_path = "\"path?=/content/crop.png,name?=mymodel" if background=='replace' and os.path.exists('/content/bg_crop.png'): src_path += ',bg_path?=/content/bg_crop.png' src_path += '"' ref_path = "\"path?=%s," \ "name?=myoutput," \ "pose_fc?=%d,"\ "cam_fc?=%d,"\ "fps?=%f\""%(video,pose_fc,cam_fc,fps) options = '' if background=='inpaint': options += ' --use_inpaintor' !python -m iPERCore.services.run_imitator --gpu_ids $gpu_ids --num_source $num_source --image_size $image_size --output_dir $output_dir --model_id $model_id --cfg_path $cfg_path --src_path $src_path --ref_path $ref_path $options if show_inputs: return "/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4" else: result_dir = '/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput' frames = [os.path.abspath(os.path.join(result_dir, p)) for p in os.listdir(result_dir) if p.endswith(('jpg', 'png'))] frames.sort() #fps = last_frame/10 clip = ImageSequenceClip(frames, fps = fps) #import re #output_file = re.compile('\.png$').sub('.mp4', args.output) clip.write_videofile('impersonator_output.mp4') return 'impersonator_output.mp4' im = gr.inputs.Image(type="file", label="Source Image") bg_image = gr.inputs.Image(type="file", label="Background Image") background = gr.inputs.Radio(choices=['None', 'replace', 'inpaint'], label="Background") center_image_to_body = gr.inputs.Checkbox(default=True, label="Center Image to Body") crop_image_to_body = gr.inputs.Checkbox(default=False, label="Crop Image to Body") image_crop_expansion_factor = gr.inputs.Number(default=1.05, label="Image Crop Expansion Factor") keep_aspect_background = gr.inputs.Checkbox(default=True, label="Keep Background Aspect Ratio") show_inputs = gr.inputs.Checkbox(default=False, label="Show Inputs") pose_fc = gr.inputs.Number(default=300, label="Pose Smooth Factor") cam_fc = gr.inputs.Number(default=100, label="Camera Smooth Factor") inputs = [im, 'video', bg_image, background, center_image_to_body, crop_image_to_body, image_crop_expansion_factor, keep_aspect_background, show_inputs, pose_fc, cam_fc] iface = gr.Interface(imitate, inputs, "video", live=False, title="Full Body Animation") iface.launch(debug=True)
Colab notebook detected. This cell will run indefinitely so that you can see errors and logs. To turn off, set debug=False in launch(). This share link will expire in 24 hours. If you need a permanent link, visit: https://gradio.app/introducing-hosted (NEW!) Running on External URL: https://26129.gradio.app Interface loading below...
ffprobe -show_entries stream=codec_type -of json /tmp/1dlz75bh.mp4.avi -loglevel error ffmpeg -y -i /tmp/1dlz75bh.mp4.avi -ab 160k -ac 2 -ar 44100 -vn /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -loglevel quiet ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate /tmp/1dlz75bh.mp4.avi Pre-processing: start... ----------------------MetaProcess---------------------- meta_input: path: /content/crop.png bg_path: name: mymodel primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/vid_info.pkl ------------------------------------------------------- ----------------------MetaProcess---------------------- meta_input: path: /tmp/1dlz75bh.mp4.avi bg_path: name: myoutput audio: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 fps: 30.0 pose_fc: 300.0 cam_fc: 100.0 effect: primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/vid_info.pkl ------------------------------------------------------- None 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images... 100% 1/1 [00:00<00:00, 3.58it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images by estimated boxes ... 1it [00:00, 16.40it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 1.09it/s] 1.3 Preprocessing, finish 3D pose estimation successfully .... 1.4 Preprocessing, running Preprocessor to run human matting in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/parse ... 0% 0/1 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed " 100% 1/1 [00:00<00:00, 1.75it/s] 1.4 Preprocessing, finish run human matting. 1.5 Preprocessing, running Preprocessor to find 25 candidates front images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 13.34it/s] 1.5 Preprocessing, finish find the front images .... 1.6 Preprocessing, running Preprocessor to run background inpainting ... 100% 1/1 [00:02<00:00, 2.95s/it] 1.6 Preprocessing, finish run background inpainting .... 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... 100% 1/1 [00:02<00:00, 2.35s/it] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4.avi -vcodec h264 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 -loglevel quiet 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... Preprocessor has finished... /tmp/1dlz75bh.mp4.avi Writing frames to file ffmpeg -i /tmp/1dlz75bh.mp4.avi -start_number 0 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, avi, from '/tmp/1dlz75bh.mp4.avi': Metadata: encoder : Lavf57.83.100 Duration: 00:00:11.27, start: 0.000000, bitrate: 539 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 800x800 [SAR 1:1 DAR 1:1], 392 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native)) Press [q] to stop, [?] for help Output #0, image2, to '/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: png, rgb24, 800x800 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc57.107.100 png frame= 338 fps= 39 q=-0.0 Lsize=N/A time=00:00:11.26 bitrate=N/A dup=2 drop=0 speed= 1.3x video:48888kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images... 100% 338/338 [01:09<00:00, 4.88it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images by estimated boxes ... 338it [00:07, 46.47it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 100% 11/11 [00:15<00:00, 1.38s/it] 1.3 Preprocessing, finish 3D pose estimation successfully .... Preprocessor has finished... Pre-processing: digital deformation start... 0% 0/1 [00:00<?, ?it/s] Pre-processing: digital deformation completed... the current number of sources are 1, while the pre-defined number of sources are 1. Pre-processing: successfully... Step 2: running personalization on #train video clips = 1 0% 0/100 [00:00<?, ?it/s]Network AttLWB-SPADE was created Network patch_global was created Loading vgg19 from ./assets/checkpoints/losses/vgg19-dcbb9e9d.pth... Loading face model from ./assets/checkpoints/losses/sphere20a_20171020.pth Loading net: ./assets/checkpoints/neural_renders/AttLWB-SPADE_id_G_2020-05-18.pth /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " 100% 100/100 [04:44<00:00, 2.84s/it] saving the personalized model in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Step 2: personalization done, saved in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth... Step 3: running imitator. Network AttLWB-SPADE was created Loading net from /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Model Imitator was created /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " pred_: 100% 338/338 [02:38<00:00, 2.14it/s] 338it [00:08, 39.66it/s] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4.avi -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -vcodec h264 -shortest -strict -2 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 -loglevel quiet ----------------------MetaOutput---------------------- mymodel imitates myoutput in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 ------------------------------------------------------ Step 3: running imitator done. Moviepy - Building video impersonator_output.mp4. Moviepy - Writing video impersonator_output.mp4
Moviepy - Done ! Moviepy - video ready impersonator_output.mp4 ffprobe -show_entries stream=codec_type -of json /tmp/ba6rbn7o.mp4.avi -loglevel error ffmpeg -y -i /tmp/ba6rbn7o.mp4.avi -ab 160k -ac 2 -ar 44100 -vn /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -loglevel quiet ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate /tmp/ba6rbn7o.mp4.avi Pre-processing: start... ----------------------MetaProcess---------------------- meta_input: path: /content/crop.png bg_path: /content/bg_crop.png name: mymodel primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/vid_info.pkl ------------------------------------------------------- ----------------------MetaProcess---------------------- meta_input: path: /tmp/ba6rbn7o.mp4.avi bg_path: name: myoutput audio: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 fps: 30.0 pose_fc: 300.0 cam_fc: 100.0 effect: primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/vid_info.pkl ------------------------------------------------------- None 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images... 100% 1/1 [00:00<00:00, 3.45it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images by estimated boxes ... 1it [00:00, 16.54it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 1.20it/s] 1.3 Preprocessing, finish 3D pose estimation successfully .... 1.4 Preprocessing, running Preprocessor to run human matting in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/parse ... 0% 0/1 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed " 100% 1/1 [00:00<00:00, 1.62it/s] 1.4 Preprocessing, finish run human matting. 1.5 Preprocessing, running Preprocessor to find 25 candidates front images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 13.44it/s] 1.5 Preprocessing, finish find the front images .... 1.6 Preprocessing, running Preprocessor to run background inpainting ... 100% 1/1 [00:02<00:00, 2.95s/it] 1.6 Preprocessing, finish run background inpainting .... 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... 100% 1/1 [00:02<00:00, 2.34s/it] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4.avi -vcodec h264 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 -loglevel quiet 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... Preprocessor has finished... /tmp/ba6rbn7o.mp4.avi Writing frames to file ffmpeg -i /tmp/ba6rbn7o.mp4.avi -start_number 0 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, avi, from '/tmp/ba6rbn7o.mp4.avi': Metadata: encoder : Lavf57.83.100 Duration: 00:00:11.33, start: 0.000000, bitrate: 561 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 800x800 [SAR 1:1 DAR 1:1], 414 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native)) Press [q] to stop, [?] for help Output #0, image2, to '/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: png, rgb24, 800x800 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc57.107.100 png frame= 340 fps= 41 q=-0.0 Lsize=N/A time=00:00:11.33 bitrate=N/A dup=2 drop=0 speed=1.38x video:48254kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images... 100% 340/340 [01:10<00:00, 4.83it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images by estimated boxes ... 340it [00:07, 46.16it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 100% 11/11 [00:14<00:00, 1.34s/it] 1.3 Preprocessing, finish 3D pose estimation successfully .... Preprocessor has finished... Pre-processing: digital deformation start... 0% 0/1 [00:00<?, ?it/s] Pre-processing: digital deformation completed... the current number of sources are 1, while the pre-defined number of sources are 1. Pre-processing: successfully... Step 2: running personalization on #train video clips = 1 0% 0/100 [00:00<?, ?it/s]Network AttLWB-SPADE was created Network patch_global was created Loading vgg19 from ./assets/checkpoints/losses/vgg19-dcbb9e9d.pth... Loading face model from ./assets/checkpoints/losses/sphere20a_20171020.pth Loading net: ./assets/checkpoints/neural_renders/AttLWB-SPADE_id_G_2020-05-18.pth /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " 100% 100/100 [05:10<00:00, 3.10s/it] saving the personalized model in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Step 2: personalization done, saved in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth... Step 3: running imitator. Network AttLWB-SPADE was created Loading net from /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Model Imitator was created /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " pred_: 100% 340/340 [02:37<00:00, 2.16it/s] 340it [00:08, 42.24it/s] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4.avi -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -vcodec h264 -shortest -strict -2 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 -loglevel quiet ----------------------MetaOutput---------------------- mymodel imitates myoutput in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 ------------------------------------------------------ Step 3: running imitator done. Moviepy - Building video impersonator_output.mp4. Moviepy - Writing video impersonator_output.mp4
Moviepy - Done ! Moviepy - video ready impersonator_output.mp4 ffprobe -show_entries stream=codec_type -of json /tmp/9r4llhjb.mp4.avi -loglevel error ffmpeg -y -i /tmp/9r4llhjb.mp4.avi -ab 160k -ac 2 -ar 44100 -vn /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -loglevel quiet ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate /tmp/9r4llhjb.mp4.avi Pre-processing: start... ----------------------MetaProcess---------------------- meta_input: path: /content/crop.png bg_path: /content/bg_crop.png name: mymodel primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/vid_info.pkl ------------------------------------------------------- ----------------------MetaProcess---------------------- meta_input: path: /tmp/9r4llhjb.mp4.avi bg_path: name: myoutput audio: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 fps: 30.0 pose_fc: 300.0 cam_fc: 100.0 effect: primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/vid_info.pkl ------------------------------------------------------- None 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images... 100% 1/1 [00:00<00:00, 3.63it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images by estimated boxes ... 1it [00:00, 17.84it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 1.21it/s] 1.3 Preprocessing, finish 3D pose estimation successfully .... 1.4 Preprocessing, running Preprocessor to run human matting in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/parse ... 0% 0/1 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed " 100% 1/1 [00:00<00:00, 1.69it/s] 1.4 Preprocessing, finish run human matting. 1.5 Preprocessing, running Preprocessor to find 25 candidates front images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 13.52it/s] 1.5 Preprocessing, finish find the front images .... 1.6 Preprocessing, running Preprocessor to run background inpainting ... 100% 1/1 [00:02<00:00, 2.99s/it] 1.6 Preprocessing, finish run background inpainting .... 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... 100% 1/1 [00:02<00:00, 2.37s/it] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4.avi -vcodec h264 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 -loglevel quiet 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... Preprocessor has finished... /tmp/9r4llhjb.mp4.avi Writing frames to file ffmpeg -i /tmp/9r4llhjb.mp4.avi -start_number 0 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, avi, from '/tmp/9r4llhjb.mp4.avi': Metadata: encoder : Lavf57.83.100 Duration: 00:00:04.40, start: 0.000000, bitrate: 965 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1600x900 [SAR 1:1 DAR 16:9], 815 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native)) Press [q] to stop, [?] for help Output #0, image2, to '/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: png, rgb24, 1600x900 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc57.107.100 png frame= 132 fps= 26 q=-0.0 Lsize=N/A time=00:00:04.40 bitrate=N/A dup=2 drop=0 speed=0.863x video:21990kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images... 100% 132/132 [00:46<00:00, 2.86it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images by estimated boxes ... 132it [00:03, 38.48it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 100% 5/5 [00:07<00:00, 1.44s/it] 1.3 Preprocessing, finish 3D pose estimation successfully .... Preprocessor has finished... Pre-processing: digital deformation start... 0% 0/1 [00:00<?, ?it/s] Pre-processing: digital deformation completed... the current number of sources are 1, while the pre-defined number of sources are 1. Pre-processing: successfully... Step 2: running personalization on #train video clips = 1 0% 0/100 [00:00<?, ?it/s]Network AttLWB-SPADE was created Network patch_global was created Loading vgg19 from ./assets/checkpoints/losses/vgg19-dcbb9e9d.pth... Loading face model from ./assets/checkpoints/losses/sphere20a_20171020.pth Loading net: ./assets/checkpoints/neural_renders/AttLWB-SPADE_id_G_2020-05-18.pth /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " 100% 100/100 [04:46<00:00, 2.87s/it] saving the personalized model in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Step 2: personalization done, saved in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth... Step 3: running imitator. Network AttLWB-SPADE was created Loading net from /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Model Imitator was created /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " pred_: 100% 132/132 [01:01<00:00, 2.15it/s] 132it [00:03, 40.09it/s] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4.avi -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -vcodec h264 -shortest -strict -2 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 -loglevel quiet ----------------------MetaOutput---------------------- mymodel imitates myoutput in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 ------------------------------------------------------ Step 3: running imitator done. Moviepy - Building video impersonator_output.mp4. Moviepy - Writing video impersonator_output.mp4
Moviepy - Done ! Moviepy - video ready impersonator_output.mp4 ffprobe -show_entries stream=codec_type -of json /tmp/zvq5qdu2.mp4.avi -loglevel error ffmpeg -y -i /tmp/zvq5qdu2.mp4.avi -ab 160k -ac 2 -ar 44100 -vn /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -loglevel quiet ffprobe -v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate /tmp/zvq5qdu2.mp4.avi Pre-processing: start... ----------------------MetaProcess---------------------- meta_input: path: /content/crop.png bg_path: name: mymodel primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/vid_info.pkl ------------------------------------------------------- ----------------------MetaProcess---------------------- meta_input: path: /tmp/zvq5qdu2.mp4.avi bg_path: name: myoutput audio: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 fps: 30.0 pose_fc: 300.0 cam_fc: 100.0 effect: primitives_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput processed_dir: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed vid_info_path: /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/vid_info.pkl ------------------------------------------------------- None 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images... 100% 1/1 [00:00<00:00, 3.53it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/orig_images by estimated boxes ... 1it [00:00, 20.03it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 1.08it/s] 1.3 Preprocessing, finish 3D pose estimation successfully .... 1.4 Preprocessing, running Preprocessor to run human matting in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/parse ... 0% 0/1 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3103: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details. warnings.warn("The default behavior for interpolate/upsample with float scale_factor changed " 100% 1/1 [00:00<00:00, 1.75it/s] 1.4 Preprocessing, finish run human matting. 1.5 Preprocessing, running Preprocessor to find 25 candidates front images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/images ... 100% 1/1 [00:00<00:00, 13.55it/s] 1.5 Preprocessing, finish find the front images .... 1.6 Preprocessing, running Preprocessor to run background inpainting ... 100% 1/1 [00:02<00:00, 2.94s/it] 1.6 Preprocessing, finish run background inpainting .... 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... 100% 1/1 [00:02<00:00, 2.36s/it] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4.avi -vcodec h264 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 -loglevel quiet 1.7 Preprocessing, saving visualization to /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/processed/visual.mp4 ... Preprocessor has finished... /tmp/zvq5qdu2.mp4.avi Writing frames to file ffmpeg -i /tmp/zvq5qdu2.mp4.avi -start_number 0 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Input #0, avi, from '/tmp/zvq5qdu2.mp4.avi': Metadata: encoder : Lavf57.83.100 Duration: 00:00:04.40, start: 0.000000, bitrate: 965 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1600x900 [SAR 1:1 DAR 16:9], 815 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mpeg4 (native) -> png (native)) Press [q] to stop, [?] for help Output #0, image2, to '/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images/frame_%08d.png': Metadata: encoder : Lavf57.83.100 Stream #0:0: Video: png, rgb24, 1600x900 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc Metadata: encoder : Lavc57.107.100 png frame= 132 fps= 26 q=-0.0 Lsize=N/A time=00:00:04.40 bitrate=N/A dup=2 drop=0 speed=0.876x video:21990kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 1.1 Preprocessing, running Preprocessor to detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images... 100% 132/132 [00:45<00:00, 2.89it/s] 1.1 Preprocessing, finish detect the human boxes of /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images ... 1.2 Preprocessing, cropping all images in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/orig_images by estimated boxes ... 132it [00:03, 39.48it/s] 1.2 Preprocessing, finish crop the human by boxes, and save them in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 1.3 Preprocessing, running Preprocessor to 3D pose estimation of all images in/content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/images ... 100% 5/5 [00:06<00:00, 1.29s/it] 1.3 Preprocessing, finish 3D pose estimation successfully .... Preprocessor has finished... Pre-processing: digital deformation start... 0% 0/1 [00:00<?, ?it/s] Pre-processing: digital deformation completed... the current number of sources are 1, while the pre-defined number of sources are 1. Pre-processing: successfully... Step 2: running personalization on #train video clips = 1 0% 0/100 [00:00<?, ?it/s]Network AttLWB-SPADE was created Network patch_global was created Loading vgg19 from ./assets/checkpoints/losses/vgg19-dcbb9e9d.pth... Loading face model from ./assets/checkpoints/losses/sphere20a_20171020.pth Loading net: ./assets/checkpoints/neural_renders/AttLWB-SPADE_id_G_2020-05-18.pth /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " 100% 100/100 [04:42<00:00, 2.83s/it] saving the personalized model in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Step 2: personalization done, saved in /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth... Step 3: running imitator. Network AttLWB-SPADE was created Loading net from /content/drive/MyDrive/Colab/fyp/iPERCore/results/models/mymodel/personalized.pth Model Imitator was created /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3385: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details. warnings.warn("Default grid_sample and affine_grid behavior has changed " pred_: 100% 132/132 [01:01<00:00, 2.14it/s] 132it [00:03, 40.76it/s] ffmpeg -y -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4.avi -i /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/myoutput/processed/audio.mp3 -vcodec h264 -shortest -strict -2 /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 -loglevel quiet ----------------------MetaOutput---------------------- mymodel imitates myoutput in /content/drive/MyDrive/Colab/fyp/iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4 ------------------------------------------------------ Step 3: running imitator done. Moviepy - Building video impersonator_output.mp4. Moviepy - Writing video impersonator_output.mp4
Moviepy - Done ! Moviepy - video ready impersonator_output.mp4
--------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) <ipython-input-33-87bf7964192c> in <module>() 86 87 iface = gr.Interface(imitate, inputs, "video", live=False, title="Full Body Animation") ---> 88 iface.launch(debug=True) /usr/local/lib/python3.7/dist-packages/gradio/interface.py in launch(self, inline, inbrowser, share, debug, auth, auth_message, private_endpoint, prevent_thread_lock) 584 while True: 585 sys.stdout.flush() --> 586 time.sleep(0.1) 587 is_in_interactive_mode = bool(getattr(sys, 'ps1', sys.flags.interactive)) 588 if not prevent_thread_lock and not is_in_interactive_mode: KeyboardInterrupt:

Server

from IPython.display import Javascript display(Javascript('''google.colab.output.setIframeHeight(0, true, {maxHeight: 200})''')) !pip install fastapi nest-asyncio pyngrok uvicorn aiofiles python-multipart firebase-admin
<IPython.core.display.Javascript object>
Requirement already satisfied: fastapi in /usr/local/lib/python3.7/dist-packages (0.67.0) Requirement already satisfied: nest-asyncio in /usr/local/lib/python3.7/dist-packages (1.5.1) Requirement already satisfied: pyngrok in /usr/local/lib/python3.7/dist-packages (5.0.5) Requirement already satisfied: uvicorn in /usr/local/lib/python3.7/dist-packages (0.14.0) Requirement already satisfied: aiofiles in /usr/local/lib/python3.7/dist-packages (0.7.0) Requirement already satisfied: python-multipart in /usr/local/lib/python3.7/dist-packages (0.0.5) Requirement already satisfied: firebase-admin in /usr/local/lib/python3.7/dist-packages (4.4.0) Requirement already satisfied: starlette==0.14.2 in /usr/local/lib/python3.7/dist-packages (from fastapi) (0.14.2) Requirement already satisfied: pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2 in /usr/local/lib/python3.7/dist-packages (from fastapi) (1.8.2) Requirement already satisfied: PyYAML in /usr/local/lib/python3.7/dist-packages (from pyngrok) (3.13) Requirement already satisfied: click>=7.* in /usr/local/lib/python3.7/dist-packages (from uvicorn) (7.1.2) Requirement already satisfied: typing-extensions; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from uvicorn) (3.7.4.3) Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.7/dist-packages (from uvicorn) (0.12.0) Requirement already satisfied: asgiref>=3.3.4 in /usr/local/lib/python3.7/dist-packages (from uvicorn) (3.4.1) Requirement already satisfied: six>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from python-multipart) (1.15.0) Requirement already satisfied: cachecontrol>=0.12.6 in /usr/local/lib/python3.7/dist-packages (from firebase-admin) (0.12.6) Requirement already satisfied: google-api-python-client>=1.7.8 in /usr/local/lib/python3.7/dist-packages (from firebase-admin) (1.12.8) Requirement already satisfied: google-cloud-storage>=1.18.0 in /usr/local/lib/python3.7/dist-packages (from firebase-admin) (1.18.1) Requirement already satisfied: google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy" in /usr/local/lib/python3.7/dist-packages (from firebase-admin) (1.26.3) Requirement already satisfied: google-cloud-firestore>=1.4.0; platform_python_implementation != "PyPy" in /usr/local/lib/python3.7/dist-packages (from firebase-admin) (1.7.0) Requirement already satisfied: msgpack>=0.5.2 in /usr/local/lib/python3.7/dist-packages (from cachecontrol>=0.12.6->firebase-admin) (1.0.2) Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from cachecontrol>=0.12.6->firebase-admin) (2.11.1) Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin) (3.0.1) Requirement already satisfied: google-auth>=1.16.0 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin) (1.32.1) Requirement already satisfied: google-auth-httplib2>=0.0.3 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin) (0.0.4) Requirement already satisfied: httplib2<1dev,>=0.15.0 in /usr/local/lib/python3.7/dist-packages (from google-api-python-client>=1.7.8->firebase-admin) (0.17.4) Requirement already satisfied: google-cloud-core<2.0dev,>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from google-cloud-storage>=1.18.0->firebase-admin) (1.0.3) Requirement already satisfied: google-resumable-media<0.5.0dev,>=0.3.1 in /usr/local/lib/python3.7/dist-packages (from google-cloud-storage>=1.18.0->firebase-admin) (0.4.1) Requirement already satisfied: packaging>=14.3 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (21.0) Requirement already satisfied: protobuf>=3.12.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (3.17.3) Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (2018.9) Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (1.53.0) Requirement already satisfied: setuptools>=40.3.0 in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (57.2.0) Requirement already satisfied: grpcio<2.0dev,>=1.29.0; extra == "grpc" in /usr/local/lib/python3.7/dist-packages (from google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (1.34.1) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.16.0->google-api-python-client>=1.7.8->firebase-admin) (4.2.2) Requirement already satisfied: rsa<5,>=3.1.4; python_version >= "3.6" in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.16.0->google-api-python-client>=1.7.8->firebase-admin) (4.7.2) Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth>=1.16.0->google-api-python-client>=1.7.8->firebase-admin) (0.2.8) Requirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=14.3->google-api-core[grpc]<2.0.0dev,>=1.14.0; platform_python_implementation != "PyPy"->firebase-admin) (2.4.7) Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.7/dist-packages (from rsa<5,>=3.1.4; python_version >= "3.6"->google-auth>=1.16.0->google-api-python-client>=1.7.8->firebase-admin) (0.4.8)
firebase_admin.delete_app(firebase_admin.get_app())
#@title API Functions from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import FileResponse, StreamingResponse from fastapi import FastAPI, File, UploadFile, Form from pydantic import BaseModel from typing import Optional, Dict, List from io import StringIO, BytesIO from pydantic import BaseModel import shutil import datetime import firebase_admin from firebase_admin import credentials, firestore, storage # Use the application default credentials if not firebase_admin._apps: cred = credentials.Certificate("/content/drive/MyDrive/Colab/fyp/gancreate-firebase-adminsdk-yayqe-07b54a912d.json") firebase_admin.initialize_app(cred, { 'storageBucket': 'gancreate.appspot.com' }) db = firestore.client() bucket = storage.bucket() # Log the user in user = "YyzhczpqEzMw6uWHuikt0Icg2Sp1" app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=['*'], allow_credentials=True, allow_methods=['*'], allow_headers=['*'], ) @app.get('/') async def root(): return {'hello': 'world'} def sample(seed: int = None, truncation: float = 0.5, w=None): model.truncation = truncation if w is None: w = model.sample_latent(1, seed=seed).detach().cpu().numpy() w = [w]*model.get_max_latents() # one per layer #save image and display out = model.sample_np(w) return Image.fromarray((out * 255).astype(np.uint8)) @app.get('/generate') async def generate(model_type: str = 'portrait', seed: int = None, truncation: float = 0.5, w=None, save=False): if config.output_class != model_type: load_model(model_type) model.truncation = truncation if w is None: w = model.sample_latent(1, seed=seed).detach().cpu().numpy() w = [w]*model.get_max_latents() # one per layer #save image and display out = model.sample_np(w) final_im = Image.fromarray((out * 255).astype(np.uint8)) final_im.save('/tmp/output.jpg') # save the content to temp return FileResponse('/tmp/output.jpg', media_type="image/jpeg") class EditConfig(BaseModel): model_type: Optional[str] = "portrait" seed: Optional[int] = None truncation: Optional[float] = 0.5 start_layer: Optional[int] = 0 end_layer: Optional[int] = 14 attributes: Dict[str, float] latent_id: Optional[str] = "" save: Optional[bool] = False @app.post('/edit') async def edit(edit_config: EditConfig): model_type = edit_config.model_type if config.output_class != model_type: load_model(model_type) seed = edit_config.seed latent_id = edit_config.latent_id model.truncation = edit_config.truncation if latent_id is None or latent_id is "": w = model.sample_latent(1, seed=seed).detach().cpu().numpy() w = [w]*model.get_max_latents() # one per layer else: w = np.load(f"latents/{model_type}/{latent_id}.npy") w = [np.expand_dims(x, 0) for x in w] param_indexes = { "portrait": { 'Gender': 1, 'Realism': 4, 'Gray Hair': 5, 'Hair Length': 6, 'Chin': 8, 'Ponytail': 9, 'Black Hair': 10 }, "model": { 'Gender': 4, 'Dress': 0, 'Sleveeless': 1, 'Short Skirt': 3, 'Jacket': 5, 'Darkness': 7, 'Slimness': 9 }, "character": { 'Monster': 0, 'Gender': 1, 'Skimpiness': 2, 'Light': 4, 'Bodysuit': 5, 'Bulkiness': 6, 'Human Head': 8 } } directions = [] distances = [] for k, v in edit_config.attributes.items(): directions.append(latent_dirs[param_indexes[model_type][k]]) distances.append(v) if directions != None and distances != None: for l in range(edit_config.start_layer, edit_config.end_layer): for i in range(len(directions)): w[l] = w[l] + directions[i] * distances[i] * 1 torch.cuda.empty_cache() #save image and display out = model.sample_np(w) final_im = Image.fromarray((out * 255).astype(np.uint8)) final_im.save('/tmp/edit_output.jpg') # save the content to temp if edit_config.save: doc_ref = db.collection(f'{model_type}s').add({}) doc_id = doc_ref[1].id blob = bucket.blob(f'{model_type}s/{doc_id}.jpg') blob.upload_from_filename('/tmp/edit_output.jpg') blob.make_public() data = { "url": blob.public_url, "user": user, "created_at": datetime.datetime.now() } db.collection(f'{model_type}s').document(doc_id).set(data) np.save(f'latents/{model_type}/{doc_id}.npy', w) return FileResponse('/tmp/edit_output.jpg', media_type="image/jpeg") class AnimateFaceConfig(BaseModel): center_video_to_head: Optional[bool] = True crop_video_to_head: Optional[bool] = True center_image_to_head: Optional[bool] = True center_video_to_head: Optional[bool] = True video_crop_expansion_factor: Optional[float] = 1.5 image_crop_expansion_factor: Optional[float] = 2.5 speech: Optional[str] = "" speaker: Optional[str] = "p225" show_inputs: Optional[bool] = False @app.post("/animate/face") async def animate_face( files: List[UploadFile] = File(...), center_video_to_head: bool = Form(True), crop_video_to_head: bool = Form(True), video_crop_expansion_factor: float = Form(1.5), center_image_to_head: bool = Form(True), crop_image_to_head: bool = Form(True), image_crop_expansion_factor: float = Form(2.5), relative: bool = Form(True), speech: str = Form(""), speaker: str = Form("p225"), show_inputs: bool = Form(False), ): video_crop_expansion_factor = max(video_crop_expansion_factor, 1) image_crop_expansion_factor = max(image_crop_expansion_factor, 1) source_image = files[0] ref_video = files[1] with open(source_image.filename, "wb") as buffer: shutil.copyfileobj(source_image.file, buffer) video_path = "ref_video.mp4" with open(video_path, "wb") as buffer: shutil.copyfileobj(ref_video.file, buffer) source_image = imageio.imread(source_image.filename) reader = imageio.get_reader(video_path) source_image = pad_crop_resize(source_image, *get_crop(source_image, center_face=center_image_to_head, crop_face=crop_image_to_head, expansion_factor=image_crop_expansion_factor)) fps = reader.get_meta_data()['fps'] driving_video = [] landmarks = None try: for i,im in enumerate(reader): if not crop_video_to_head: break landmarks = fa.get_landmarks_from_image(im) if landmarks: break x0,x1,y0,y1 = get_crop(im, center_face=center_video_to_head, crop_face=crop_video_to_head, expansion_factor=video_crop_expansion_factor, landmarks=landmarks) reader.set_image_index(0) for im in reader: driving_video.append(pad_crop_resize(im,x0,x1,y0,y1)) except RuntimeError: pass # Generate animation predictions = make_animation(source_image, driving_video, generator, kp_detector, relative=relative) fig = plt.figure(figsize=(12 * show_inputs + 6 * (predictions is not None), 8)) ims = [] for i in range(len(driving_video)): cols = [] if show_inputs and speech == "": cols.append(source_image) cols.append(driving_video[i]) if predictions is not None: cols.append(predictions[i]) im = plt.imshow(np.concatenate(cols, axis=1), animated=True) plt.axis('off') ims.append([im]) plt.tight_layout() ani = animation.ArtistAnimation(fig, ims, interval=50, repeat_delay=1000) ani.save('output.mp4', fps=fps) plt.close() if speech != "": !tts --text "{speech}" --out_path speech.wav --model_name "tts_models/en/vctk/sc-glow-tts" --speaker_idx {speaker} !cd Wav2Lip && python inference.py --checkpoint_path checkpoints/wav2lip_gan.pth --face "../output.mp4" --audio '../speech.wav' return FileResponse('Wav2Lip/results/result_voice.mp4', media_type="video/mp4") else: video_clip = mpe.VideoFileClip('output.mp4') audio_clip = mpe.AudioFileClip(video_path) final_clip = video_clip.set_audio(audio_clip) final_clip.write_videofile("result.mp4", fps=fps) return FileResponse('result.mp4', media_type="video/mp4") @app.post("/animate/body") async def animate_body( files: List[UploadFile] = File(...), background: str = Form("None"), center_image_to_body: bool = Form(True), crop_image_to_body: bool = Form(False), image_crop_expansion_factor: float = Form(1.05) , keep_aspect_background: bool = Form(True), pose_fc: int = Form(300), cam_fc: int = Form(100), ): source_image = files[0] ref_video = files[1] bg_image = files[2] with open(source_image.filename, "wb") as buffer: shutil.copyfileobj(source_image.file, buffer) video_path = "ref_video.mp4" with open(video_path, "wb") as buffer: shutil.copyfileobj(ref_video.file, buffer) source_image = imageio.imread(source_image.filename) source_image = pad_crop_resize(source_image, *get_crop_body(source_image, center_body=center_image_to_body, crop_body=crop_image_to_body, expansion_factor=image_crop_expansion_factor)) imageio.imwrite('/content/crop.png', (source_image*255).astype(np.uint8)) if bg_image != 'None': with open(bg_image.filename, "wb") as buffer: shutil.copyfileobj(bg_image.file, buffer) bg_image = imageio.imread(bg_image.filename) bg_image = crop_resize(bg_image/255, source_image.shape[:2], crop=keep_aspect_background) imageio.imwrite('/content/bg_crop.png', (bg_image*255).astype(np.uint8)) with imageio.get_reader(video_path, format='mp4') as reader: fps = reader.get_meta_data()['fps'] gpu_ids = "0" num_source = 1 assets_dir = "/content/drive/MyDrive/Colab/fyp/iPERCore/assets" output_dir = "/content/drive/MyDrive/Colab/fyp/iPERCore/results" shutil.rmtree(output_dir, ignore_errors=True) # symlink from the actual assets directory to this current directory work_asserts_dir = os.path.join("./assets") if not os.path.exists(work_asserts_dir): os.symlink(osp.abspath(assets_dir), osp.abspath(work_asserts_dir), target_is_directory=(platform.system() == "Windows")) cfg_path = osp.join(work_asserts_dir, "configs", "deploy.toml") model_id = "mymodel" src_path = "\"path?=/content/crop.png,name?=mymodel" if background=='replace' and os.path.exists('/content/bg_crop.png'): src_path += ',bg_path?=/content/bg_crop.png' src_path += '"' ref_path = "\"path?=%s," \ "name?=myoutput," \ "pose_fc?=%d,"\ "cam_fc?=%d,"\ "fps?=%f\""%(video_path,pose_fc,cam_fc,fps) options = '' if background=='inpaint': options += ' --use_inpaintor' !python -m iPERCore.services.run_imitator --gpu_ids $gpu_ids --num_source $num_source --image_size $image_size --output_dir $output_dir --model_id $model_id --cfg_path $cfg_path --src_path $src_path --ref_path $ref_path $options return FileResponse('./iPERCore/results/primitives/mymodel/synthesis/imitations/mymodel-myoutput.mp4', media_type="video/mp4")
import nest_asyncio from pyngrok import ngrok import uvicorn ngrok_tunnel = ngrok.connect(8000) print('Public URL:', ngrok_tunnel.public_url+'/docs') nest_asyncio.apply() uvicorn.run(app, port=8000)
(Output Hidden)