From 4069a4838799ad25863b33321554e2bff80c6137 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 5 Jun 2020 20:23:55 +0300 Subject: [PATCH 01/64] download checkpoint from S3 --- scripts/download_data.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/scripts/download_data.sh b/scripts/download_data.sh index 150dce5e5..96a5f07f4 100755 --- a/scripts/download_data.sh +++ b/scripts/download_data.sh @@ -1,15 +1,14 @@ #!/usr/bin/env bash -# vox-adv-cpk-wget.pth.tar (https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view) -echo "Downloading model's weights (vox-adv-cpk.pth.tar)" - -file_id=1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3 filename=vox-adv-cpk.pth.tar -echo "Getting cookie" -curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${file_id}" > /dev/null -code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)" -echo "Downloading data" -curl -Lb /tmp/cookie "https://drive.google.com/uc?export=download&confirm=${code}&id=${file_id}" -o ${filename} + +curl https://avatarify.s3.amazonaws.com/weights/$filename -o $filename echo "Expected checksum: 8a45a24037871c045fbb8a6a8aa95ebc" -echo "Found checksum: $(md5sum ${filename})" + +if [ "$(uname)" == "Darwin" ]; then + sum=`md5 ${filename}` +else + sum=`md5sum ${filename}` +fi +echo "Found checksum: $sum" From 2b2d940a4b988b38819374130cdd53d11939efd1 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 5 Jun 2020 20:54:48 +0300 Subject: [PATCH 02/64] add extra text for camera selector for better guidance --- afy/cam_fomm.py | 2 +- afy/camera_selector.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 35c1535a5..3c65e03f7 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -128,7 +128,7 @@ def select_camera(config): cam_frames = cam_selector.query_cameras(config['query_n_cams']) if cam_frames: - cam_id = cam_selector.select_camera(cam_frames, window="CLICK ON YOUR CAMERA") + cam_id = cam_selector.select_camera(cam_frames) log(f"Selected camera {cam_id}") with open(cam_config, 'w') as f: diff --git a/afy/camera_selector.py b/afy/camera_selector.py index 9b5100853..897562d01 100644 --- a/afy/camera_selector.py +++ b/afy/camera_selector.py @@ -46,7 +46,7 @@ def make_grid(images, cell_size=(320, 240), cols=2): # add rect img = cv2.rectangle(img, (1, 1), (w0 - 1, h0 - 1), (0, 0, 255), 2) # add id - img = cv2.putText(img, f'{camid}', (10, 30), 0, 1, (0, 255, 0), 2) + img = cv2.putText(img, f'Camera {camid}', (10, 30), 0, 1, (0, 255, 0), 2) c = i % cols r = i // cols grid[r * h0:(r + 1) * h0, c * w0:(c + 1) * w0] = img[..., :3] @@ -64,11 +64,18 @@ def mouse_callback(event, x, y, flags, userdata): g_selected_cam = camid -def select_camera(cam_frames, window="cameras"): +def select_camera(cam_frames, window="Camera selector"): cell_size = 320, 240 grid_cols = 2 grid = make_grid(cam_frames, cols=grid_cols) + # to fit the text if only one cam available + if grid.shape[1] == 320: + cell_size = 640, 480 + grid = cv2.resize(grid, cell_size) + + cv2.putText(grid, f'Click on the web camera to use', (10, grid.shape[0] - 30), 0, 0.7, (200, 200, 200), 2) + cv2.namedWindow(window) cv2.setMouseCallback(window, mouse_callback, (cell_size, grid_cols, cam_frames)) cv2.imshow(window, grid) From 5429be4e8cb01c6f2e5a5c5cb11c32f56ff8e0d1 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 5 Jun 2020 21:39:57 +0300 Subject: [PATCH 03/64] better performace text output --- afy/cam_fomm.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 3c65e03f7..e72114258 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -116,6 +116,24 @@ def print_help(): info('\n\n') +def draw_fps(frame, fps, timing, x0=10, y0=20, ystep=30, fontsz=0.5, color=(255, 255, 255)): + frame = frame.copy() + cv2.putText(frame, f"FPS: {fps:.1f}", (x0, y0 + ystep * 0), 0, fontsz * IMG_SIZE / 256, color, 1) + cv2.putText(frame, f"Model time (ms): {timing['predict']:.1f}", (x0, y0 + ystep * 1), 0, fontsz * IMG_SIZE / 256, color, 1) + cv2.putText(frame, f"Preproc time (ms): {timing['preproc']:.1f}", (x0, y0 + ystep * 2), 0, fontsz * IMG_SIZE / 256, color, 1) + cv2.putText(frame, f"Postproc time (ms): {timing['postproc']:.1f}", (x0, y0 + ystep * 3), 0, fontsz * IMG_SIZE / 256, color, 1) + return frame + + +def draw_calib_text(frame, thk=2, fontsz=0.5, color=(0, 0, 255)): + frame = frame.copy() + cv2.putText(frame, "FIT FACE IN RECTANGLE", (40, 20), 0, fontsz * IMG_SIZE / 255, color, thk) + cv2.putText(frame, "W - ZOOM IN", (60, 40), 0, fontsz * IMG_SIZE / 255, color, thk) + cv2.putText(frame, "S - ZOOM OUT", (60, 60), 0, fontsz * IMG_SIZE / 255, color, thk) + cv2.putText(frame, "THEN PRESS X", (60, 245), 0, fontsz * IMG_SIZE / 255, color, thk) + return frame + + def select_camera(config): cam_config = config['cam_config'] cam_id = None @@ -128,7 +146,7 @@ def select_camera(config): cam_frames = cam_selector.query_cameras(config['query_n_cams']) if cam_frames: - cam_id = cam_selector.select_camera(cam_frames) + cam_id = cam_selector.select_camera(cam_frames, window="CLICK ON YOUR CAMERA") log(f"Selected camera {cam_id}") with open(cam_config, 'w') as f: @@ -393,17 +411,10 @@ def select_camera(config): preview_frame = cv2.putText(preview_frame, display_string, (10, 220), 0, 0.5 * IMG_SIZE / 256, (255, 255, 255), 1) if show_fps: - timing_string = f"FPS/Model/Pre/Post: {fps:.1f} / {timing['predict']:.1f} / {timing['preproc']:.1f} / {timing['postproc']:.1f}" - preview_frame = cv2.putText(preview_frame, timing_string, (10, 240), 0, 0.3 * IMG_SIZE / 256, (255, 255, 255), 1) + preview_frame = draw_fps(preview_frame, fps, timing) if not is_calibrated: - color = (0, 0, 255) - thk = 2 - fontsz = 0.5 - preview_frame = cv2.putText(preview_frame, "FIT FACE IN RECTANGLE", (40, 20), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "W - ZOOM IN", (60, 40), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "S - ZOOM OUT", (60, 60), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "THEN PRESS X", (60, 245), 0, fontsz * IMG_SIZE / 255, color, thk) + preview_frame = draw_calib_text(preview_frame) if not opt.hide_rect: draw_rect(preview_frame) From 3b279a76613405d9c62d70ee05828444b01839c4 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 5 Jun 2020 21:40:50 +0300 Subject: [PATCH 04/64] fix undefine var problem when --no-vcam is set --- afy/cam_fomm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index e72114258..b8fa569ba 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -207,6 +207,9 @@ def select_camera(config): enable_vcam = not opt.no_stream + ret, frame = cap.read() + stream_img_size = frame.shape[1], frame.shape[0] + if enable_vcam: if _platform in ['linux', 'linux2']: try: @@ -215,8 +218,6 @@ def select_camera(config): log("pyfakewebcam is not installed.") exit(1) - ret, frame = cap.read() - stream_img_size = frame.shape[1], frame.shape[0] stream = pyfakewebcam.FakeWebcam(f'/dev/video{opt.virt_cam}', *stream_img_size) else: enable_vcam = False From 39d08b6494983ec62e0b57990e0b9732508f6444 Mon Sep 17 00:00:00 2001 From: msharp9 Date: Sun, 7 Jun 2020 00:37:07 -0600 Subject: [PATCH 05/64] Fixed camera bug due to second competiting program (#204) Co-authored-by: Matt Sharp --- afy/videocaptureasync.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/afy/videocaptureasync.py b/afy/videocaptureasync.py index 16abd2654..ad14b22eb 100644 --- a/afy/videocaptureasync.py +++ b/afy/videocaptureasync.py @@ -15,7 +15,7 @@ def __init__(self, src=0, width=640, height=480): self.cap = cv2.VideoCapture(self.src) if not self.cap.isOpened(): raise RuntimeError("Cannot open camera") - + self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height) self.grabbed, self.frame = self.cap.read() @@ -36,7 +36,7 @@ def start(self): self.thread = threading.Thread(target=self.update, args=(), daemon=True) self.thread.start() - # (warmup) wait for the first successfully grabbed frame + # (warmup) wait for the first successfully grabbed frame warmup_start_time = time.time() while not self.grabbed: warmup_elapsed_time = (time.time() - warmup_start_time) @@ -44,7 +44,7 @@ def start(self): raise RuntimeError(f"Failed to succesfully grab frame from the camera (timeout={WARMUP_TIMEOUT}s). Try to restart.") time.sleep(0.5) - + return self def update(self): @@ -55,9 +55,14 @@ def update(self): self.frame = frame def read(self): - with self.read_lock: - frame = self.frame.copy() - grabbed = self.grabbed + while True: + try: + with self.read_lock: + frame = self.frame.copy() + grabbed = self.grabbed + except AttributeError: + continue + break return grabbed, frame def stop(self): From b5d1df783fa624e5be06e9a6c514b709f92f49ca Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 7 Jun 2020 09:43:43 +0300 Subject: [PATCH 06/64] delete legacy code --- afy/utils.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/afy/utils.py b/afy/utils.py index 8b8741670..db1e90434 100644 --- a/afy/utils.py +++ b/afy/utils.py @@ -70,13 +70,6 @@ def tocp(self, str): log(f"{str} took {t:.4f}ms") return t - @staticmethod - def print(name=''): - log(f'\n=== {name} Timimg ===') - for fn, times in self.timing.items(): - min, max, mean, p95 = np.min(times), np.max(times), np.mean(times), np.percentile(times, 95) - log(f'{fn}:\tmin: {min:.4f}\tmax: {max:.4f}\tmean: {mean:.4f}ms\tp95: {p95:.4f}ms') - class AccumDict: def __init__(self, num_f=3): From c9241c2806f72f03e455f4358aeaa2c1c7a3aee4 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 7 Jun 2020 15:35:10 +0300 Subject: [PATCH 07/64] disable warning message which make people open issues on github --- afy/cam_fomm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index b8fa569ba..6342e2d93 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -221,10 +221,10 @@ def select_camera(config): stream = pyfakewebcam.FakeWebcam(f'/dev/video{opt.virt_cam}', *stream_img_size) else: enable_vcam = False - log("Virtual camera is supported only on Linux.") + # log("Virtual camera is supported only on Linux.") - if not enable_vcam: - log("Virtual camera streaming will be disabled.") + # if not enable_vcam: + # log("Virtual camera streaming will be disabled.") cur_ava = 0 avatar = None From 8ccf6033ec4a92cf6a756d1d4014810c4184a0fb Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Tue, 9 Jun 2020 21:15:32 +0300 Subject: [PATCH 08/64] add frame checks --- afy/videocaptureasync.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/afy/videocaptureasync.py b/afy/videocaptureasync.py index ad14b22eb..8b9631739 100644 --- a/afy/videocaptureasync.py +++ b/afy/videocaptureasync.py @@ -50,18 +50,18 @@ def start(self): def update(self): while self.started: grabbed, frame = self.cap.read() + if not grabbed or frame is None or frame.size == 0: + print('bad camera frame') + continue with self.read_lock: self.grabbed = grabbed self.frame = frame def read(self): while True: - try: - with self.read_lock: - frame = self.frame.copy() - grabbed = self.grabbed - except AttributeError: - continue + with self.read_lock: + frame = self.frame.copy() + grabbed = self.grabbed break return grabbed, frame From 5ec7f0a0b5e17cc78ebf14519375af7966988230 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Tue, 9 Jun 2020 21:23:35 +0300 Subject: [PATCH 09/64] rm print --- afy/videocaptureasync.py | 1 - 1 file changed, 1 deletion(-) diff --git a/afy/videocaptureasync.py b/afy/videocaptureasync.py index 8b9631739..141822b21 100644 --- a/afy/videocaptureasync.py +++ b/afy/videocaptureasync.py @@ -51,7 +51,6 @@ def update(self): while self.started: grabbed, frame = self.cap.read() if not grabbed or frame is None or frame.size == 0: - print('bad camera frame') continue with self.read_lock: self.grabbed = grabbed From 4cfc7fe469f2b2e3990a6f28e7a460df4e605b7e Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Tue, 9 Jun 2020 21:39:44 +0300 Subject: [PATCH 10/64] kill older processes by default --- run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/run.sh b/run.sh index d56fd2d4b..1c61a4617 100755 --- a/run.sh +++ b/run.sh @@ -4,6 +4,7 @@ ENABLE_CONDA=1 ENABLE_VCAM=1 +KILL_PS=1 FOMM_CONFIG=fomm/config/vox-adv-256.yaml FOMM_CKPT=vox-adv-cpk.pth.tar From 01db88c8580b982278ae944b89b3bfab5d98c1dd Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 14 Jun 2020 12:01:24 +0300 Subject: [PATCH 11/64] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc211e9a4..aafa16690 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ Avatarify comes with a standard set of avatars of famous people, but you can ext Follow these advices for better visual quality: * Make square crop of your avatar picture. -* Crop avatar's face so that it's not too close not too far. Use standard avarars as reference. +* Crop avatar's face so that it's not too close not too far. Use standard avatars as reference. * Prefer pictures with uniform background. It will diminish visual artifacts. ## Run From baf08c57f24d0083491dc5e48f02c2a758af0215 Mon Sep 17 00:00:00 2001 From: mintmaker <54767039+mintmaker@users.noreply.github.com> Date: Tue, 16 Jun 2020 18:42:49 +0200 Subject: [PATCH 12/64] Fixing a reloading issue and a typo (#221) * Fixing reloading issue After reloading the list of avatars as images was a tuple of the list of images and the list of avatar names. * Fixing typo in is_new_frame_better Probably the global predictor was used and therefore no error was produced when alievk tested the function. --- afy/cam_fomm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 6342e2d93..6ef6dae41 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -24,7 +24,7 @@ exit() -def is_new_frame_better(source, driving, precitor): +def is_new_frame_better(source, driving, predictor): global avatar_kp global display_string @@ -376,7 +376,7 @@ def select_camera(config): elif key == ord('l'): try: log('Reloading avatars...') - avatars = load_images() + avatars, avatar_names = load_images() passthrough = False log("Images reloaded") except: From 56e8f6d7ffc91c0e40908ef5e85465412fd6edfd Mon Sep 17 00:00:00 2001 From: "Thong Vo (Bob)" Date: Fri, 19 Jun 2020 02:03:26 -0400 Subject: [PATCH 13/64] Fix opencv versions for compatibility (#228) The latest opencv version cause compatibility issue for MacOS Sierra (10.12 or less) By changing the numpy requirement to this version, all MacOS/Windows/Linux are compatible. --- requirements_client.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_client.txt b/requirements_client.txt index 0d3028df7..e2c5ae880 100644 --- a/requirements_client.txt +++ b/requirements_client.txt @@ -3,4 +3,4 @@ PyYAML==5.1 requests==2.23 msgpack-numpy==0.4.5 pyzmq==19.0.0 -opencv-python==3.4.9.33 \ No newline at end of file +opencv-python==3.4.5.20 From 5638984581297c3c0576b483adef61b79cb46513 Mon Sep 17 00:00:00 2001 From: Mikael Gueck Date: Fri, 10 Jul 2020 17:15:56 +0300 Subject: [PATCH 14/64] Dockerize the "Remote GPU" service (#224) * Dockerfile * add docker support in run.sh and readme * Update README * Update TOC * Update TOC * Fix headless error * use GPU as default * Update README.md * Create install_docker.sh * update install for v4l2loopback Co-authored-by: monsteruser Co-authored-by: mintmaker <54767039+mintmaker@users.noreply.github.com> --- Dockerfile | 28 +++++++++ README.md | 20 +++++- run.sh | 125 ++++++++++++++++++++++++++++++++------ scripts/install_docker.sh | 9 +++ 4 files changed, 162 insertions(+), 20 deletions(-) create mode 100644 Dockerfile create mode 100644 scripts/install_docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..067a25c66 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM nvcr.io/nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 + +RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update \ + && DEBIAN_FRONTEND=noninteractive apt-get -qqy install curl python3-pip python3-tk ffmpeg git less nano libsm6 libxext6 libxrender-dev \ + && rm -rf /var/lib/apt/lists/* + +ARG PYTORCH_WHEEL="https://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.whl" +ARG FACE_ALIGNMENT_GIT="git+https://github.com/1adrianb/face-alignment" +ARG AVATARIFY_COMMIT="01db88c8580b982278ae944b89b3bfab5d98c1dd" +ARG FOMM_COMMIT="efbe0a6f17b38360ff9a446fddfbb3ce5493534c" + +RUN git clone https://github.com/alievk/avatarify.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ + && git clone https://github.com/alievk/first-order-model.git /app/avatarify/fomm && cd /app/avatarify/fomm && git checkout ${FOMM_COMMIT} + +WORKDIR /app/avatarify + +RUN bash scripts/download_data.sh + +RUN pip3 install ${PYTORCH_WHEEL} ${FACE_ALIGNMENT_GIT} -r requirements.txt \ + && pip3 install ${PYTORCH_WHEEL} ${FACE_ALIGNMENT_GIT} -r fomm/requirements.txt \ + && rm -rf /root/.cache/pip + +ENV PYTHONPATH="/app/avatarify:/app/avatarify/fomm" + +EXPOSE 5557 +EXPOSE 5558 + +CMD ["python3", "afy/cam_fomm.py", "--config", "fomm/config/vox-adv-256.yaml", "--checkpoint", "vox-adv-cpk.pth.tar", "--virt-cam", "9", "--relative", "--adapt_scale", "--is-worker"] diff --git a/README.md b/README.md index aafa16690..c94bd8e41 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Created by: GitHub community. - [Mac](#mac) - [Windows](#windows) - [Remote GPU](#remote-gpu) + - [Docker](#docker) - [Setup avatars](#setup-avatars) - [Run](#run) - [Linux](#linux-1) @@ -87,6 +88,7 @@ bash scripts/install.sh ``` 3. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). + #### Mac *(!) Note*: we found out that in versions after [v4.6.8 (March 23, 2020)](https://zoom.us/client/4.6.19178.0323/ZoomInstaller.pkg) Zoom disabled support for virtual cameras on Mac. To use Avatarify in Zoom you can choose from 2 options: - Install [Zoom v4.6.8](https://zoom.us/client/4.6.19178.0323/ZoomInstaller.pkg) which is the last version that supports virtual cameras @@ -137,8 +139,23 @@ The steps 10-11 are required only once during setup. #### Remote GPU -You can offload the heavy work to [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [server with a GPU](https://github.com/alievk/avatarify/wiki/Remote-GPU) and use your laptop just to communicate the video stream. +You can offload the heavy work to [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [server with a GPU](https://github.com/alievk/avatarify/wiki/Remote-GPU) and use your laptop just to communicate the video stream. The server and client software are native and dockerized available. + +### Docker +Docker images are only availabe on Linux. +1. Install Docker following the [Documentation](https://docs.docker.com/engine/install/). Then run this [step](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to make docker available for your user. +2. For using the gpu (hardly recommended): Install nvidia drivers and [nvidia docker](https://github.com/NVIDIA/nvidia-docker#quickstart). +3. Clone `avatarify` and install its dependencies (v4l2loopback kernel module): +```bash +git clone https://github.com/alievk/avatarify.git +cd avatarify +bash scripts/install_docker.sh +``` +4. Build the Dockerfile: +```bash +docker build -t avatarify +``` ## Setup avatars Avatarify comes with a standard set of avatars of famous people, but you can extend this set simply copying your avatars into `avatars` folder. @@ -162,6 +179,7 @@ Run: ```bash bash run.sh ``` +If you haven't installed a GPU add the `--no-gpus` flag. In order to use Docker add the `--docker` flag. `cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. diff --git a/run.sh b/run.sh index 1c61a4617..789806b88 100755 --- a/run.sh +++ b/run.sh @@ -5,11 +5,17 @@ ENABLE_CONDA=1 ENABLE_VCAM=1 KILL_PS=1 +USE_DOCKER=0 +IS_WORKER=0 +IS_CLIENT=0 +DOCKER_IS_LOCAL_CLIENT=0 +DOCKER_NO_GPU=0 FOMM_CONFIG=fomm/config/vox-adv-256.yaml FOMM_CKPT=vox-adv-cpk.pth.tar ARGS="" +DOCKER_ARGS="" while (( "$#" )); do case "$1" in @@ -26,6 +32,31 @@ while (( "$#" )); do KILL_PS=0 shift ;; + --docker) + USE_DOCKER=1 + shift + ;; + --no-gpus) + DOCKER_NO_GPU=1 + shift + ;; + --is-worker) + IS_WORKER=1 + ARGS="$ARGS $1" + DOCKER_ARGS="$DOCKER_ARGS -p 5557:5557 -p 5558:5558" + shift + ;; + --is-client) + IS_CLIENT=1 + ARGS="$ARGS $1" + shift + ;; + --is-local-client) + IS_CLIENT=1 + DOCKER_IS_LOCAL_CLIENT=1 + ARGS="$ARGS --is-client" + shift + ;; *|-*|--*) ARGS="$ARGS $1" shift @@ -35,28 +66,84 @@ done eval set -- "$ARGS" -if [[ $KILL_PS == 1 ]]; then - kill -9 $(ps aux | grep 'afy/cam_fomm.py' | awk '{print $2}') 2> /dev/null -fi -source scripts/settings.sh -if [[ $ENABLE_VCAM == 1 ]]; then - bash scripts/create_virtual_camera.sh -fi +if [[ $USE_DOCKER == 0 ]]; then + + if [[ $KILL_PS == 1 ]]; then + kill -9 $(ps aux | grep 'afy/cam_fomm.py' | awk '{print $2}') 2> /dev/null + fi + + source scripts/settings.sh + + if [[ $ENABLE_VCAM == 1 ]]; then + bash scripts/create_virtual_camera.sh + fi + + if [[ $ENABLE_CONDA == 1 ]]; then + source $(conda info --base)/etc/profile.d/conda.sh + conda activate $CONDA_ENV_NAME + fi + + export PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/fomm + + python afy/cam_fomm.py \ + --config $FOMM_CONFIG \ + --checkpoint $FOMM_CKPT \ + --virt-cam $CAMID_VIRT \ + --relative \ + --adapt_scale \ + $@ +else -if [[ $ENABLE_CONDA == 1 ]]; then - source $(conda info --base)/etc/profile.d/conda.sh - conda activate $CONDA_ENV_NAME -fi + source scripts/settings.sh + + if [[ $ENABLE_VCAM == 1 ]]; then + bash scripts/create_virtual_camera.sh + fi + + if [[ $DOCKER_NO_GPU == 0 ]]; then + DOCKER_ARGS="$DOCKER_ARGS --gpus all" + fi + + if [[ $DOCKER_IS_LOCAL_CLIENT == 1 ]]; then + DOCKER_ARGS="$DOCKER_ARGS --network=host" + elif [[ $IS_CLIENT == 1 ]]; then + DOCKER_ARGS="$DOCKER_ARGS -p 5557:5554 -p 5557:5558" + fi -export PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/fomm + -python afy/cam_fomm.py \ - --config $FOMM_CONFIG \ - --checkpoint $FOMM_CKPT \ - --virt-cam $CAMID_VIRT \ - --relative \ - --adapt_scale \ - $@ + + if [[ $IS_WORKER == 0 ]]; then + xhost +local:root + docker run $DOCKER_ARGS -it --rm --privileged \ + -v $PWD:/root/.torch/models \ + -v $PWD/avatars:/app/avatarify/avatars \ + --env="DISPLAY" \ + --env="QT_X11_NO_MITSHM=1" \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + avatarify python3 afy/cam_fomm.py \ + --config $FOMM_CONFIG \ + --checkpoint $FOMM_CKPT \ + --virt-cam $CAMID_VIRT \ + --relative \ + --adapt_scale \ + $@ + xhost -local:root + else + docker run $DOCKER_ARGS -it --rm --privileged \ + -v $PWD:/root/.torch/models \ + -v $PWD/avatars:/app/avatarify/avatars \ + avatarify python3 afy/cam_fomm.py \ + --config $FOMM_CONFIG \ + --checkpoint $FOMM_CKPT \ + --virt-cam $CAMID_VIRT \ + --relative \ + --adapt_scale \ + $@ + fi + + +fi diff --git a/scripts/install_docker.sh b/scripts/install_docker.sh new file mode 100644 index 000000000..b4e3802eb --- /dev/null +++ b/scripts/install_docker.sh @@ -0,0 +1,9 @@ +if [[ ! $@ =~ "no-vcam" ]]; then + rm -rf v4l2loopback 2> /dev/null + git clone https://github.com/umlaeute/v4l2loopback + echo "--- Installing v4l2loopback (sudo privelege required)" + cd v4l2loopback + make && sudo make install + sudo depmod -a + cd .. +fi From 960c603bf7ad61ab45c58be2730e2a39874459b7 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 11 Jul 2020 11:23:32 +0300 Subject: [PATCH 15/64] make a tag for Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 067a25c66..3a36eeddd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update \ ARG PYTORCH_WHEEL="https://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.whl" ARG FACE_ALIGNMENT_GIT="git+https://github.com/1adrianb/face-alignment" -ARG AVATARIFY_COMMIT="01db88c8580b982278ae944b89b3bfab5d98c1dd" +ARG AVATARIFY_COMMIT="v0.1-docker" ARG FOMM_COMMIT="efbe0a6f17b38360ff9a446fddfbb3ce5493534c" RUN git clone https://github.com/alievk/avatarify.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ From 38cb170f6586a242d03bce6b05608f0bb48cf7af Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 11 Jul 2020 11:37:37 +0300 Subject: [PATCH 16/64] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c94bd8e41..aee7e876a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first- Created by: GitHub community. ## News -- **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can running Avatarify on any computer without GPU! +- **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! +- **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! - **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify/wiki/Remote-GPU). - **24 April 2020.** Added Windows installation [tutorial](https://www.youtube.com/watch?v=lym9ANVb120). - **17 April 2020.** Created Slack community. Please join via [invitation link](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg). From 894ae77f4dd73daf2e27a7390bd420a60c43329a Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 11 Jul 2020 17:31:33 +0300 Subject: [PATCH 17/64] mute verbose messages --- afy/predictor_remote.py | 14 ++++++-------- afy/predictor_worker.py | 30 +++++++++++++++--------------- afy/utils.py | 12 ++++++++++++ 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/afy/predictor_remote.py b/afy/predictor_remote.py index 1a2baec31..675f5012e 100644 --- a/afy/predictor_remote.py +++ b/afy/predictor_remote.py @@ -1,6 +1,6 @@ from arguments import opt from networking import SerializingContext, check_connection -from utils import Tee, TicToc, AccumDict, Once +from utils import Logger, TicToc, AccumDict, Once import multiprocessing as mp import queue @@ -25,7 +25,7 @@ def __init__(self, *args, in_addr=None, out_addr=None, **kwargs): self.out_addr = out_addr self.predictor_args = (args, kwargs) self.timing = AccumDict() - self.log = Tee('./var/log/predictor_remote.log') + self.log = Logger('./var/log/predictor_remote.log', verbose=opt.verbose) self.send_queue = mp.Queue(QUEUE_SIZE) self.recv_queue = mp.Queue(QUEUE_SIZE) @@ -88,8 +88,7 @@ def _send_recv_async(self, method, args, critical): 'id': self._i_msg } - if opt.verbose: - self.log("send", meta) + self.log("send", meta) if critical: self.send_queue.put((meta, data)) @@ -111,8 +110,7 @@ def _send_recv_async(self, method, args, critical): self.log('recv_queue is empty') return None - if opt.verbose: - self.log("recv", meta_recv) + self.log("recv", meta_recv) tt.tic() if meta_recv['name'] == 'predict': @@ -128,7 +126,7 @@ def _send_recv_async(self, method, args, critical): @staticmethod def send_worker(address, send_queue, worker_alive): timing = AccumDict() - log = Tee('./var/log/send_worker.log') + log = Logger('./var/log/send_worker.log', opt.verbose) ctx = SerializingContext() sender = ctx.socket(zmq.PUSH) @@ -163,7 +161,7 @@ def send_worker(address, send_queue, worker_alive): @staticmethod def recv_worker(address, recv_queue, worker_alive): timing = AccumDict() - log = Tee('./var/log/recv_worker.log') + log = Logger('./var/log/recv_worker.log') ctx = SerializingContext() receiver = ctx.socket(zmq.PULL) diff --git a/afy/predictor_worker.py b/afy/predictor_worker.py index 2afca0460..05a959baa 100644 --- a/afy/predictor_worker.py +++ b/afy/predictor_worker.py @@ -1,7 +1,7 @@ from predictor_local import PredictorLocal from arguments import opt from networking import SerializingContext, check_connection -from utils import Tee, TicToc, AccumDict, Once +from utils import Logger, TicToc, AccumDict, Once import cv2 import numpy as np @@ -58,14 +58,14 @@ def run(self): @staticmethod def recv_worker(port, recv_queue, worker_alive): timing = AccumDict() - log = Tee('./var/log/recv_worker.log') + log = Logger('./var/log/recv_worker.log', verbose=opt.verbose) ctx = SerializingContext() socket = ctx.socket(zmq.PULL) socket.bind(f"tcp://*:{port}") socket.RCVTIMEO = RECV_TIMEOUT - log(f'Receiving on port {port}') + log(f'Receiving on port {port}', important=True) try: while worker_alive.value: @@ -92,17 +92,17 @@ def recv_worker(port, recv_queue, worker_alive): Once(timing, log, per=1) except KeyboardInterrupt: - log("recv_worker: user interrupt") + log("recv_worker: user interrupt", important=True) worker_alive.value = 0 - log("recv_worker exit") + log("recv_worker exit", important=True) @staticmethod def predictor_worker(recv_queue, send_queue, worker_alive): predictor = None predictor_args = () timing = AccumDict() - log = Tee('./var/log/predictor_worker.log') + log = Logger('./var/log/predictor_worker.log', verbose=opt.verbose) try: while worker_alive.value: @@ -129,7 +129,7 @@ def predictor_worker(recv_queue, send_queue, worker_alive): args = msgpack.unpackb(data) timing.add('UNPACK', tt.toc()) except ValueError: - log("Invalid Message") + log("Invalid Message", important=True) continue tt.tic() @@ -142,7 +142,7 @@ def predictor_worker(recv_queue, send_queue, worker_alive): del predictor predictor_args = args predictor = PredictorLocal(*predictor_args[0], **predictor_args[1]) - log("Initialized predictor with:", predictor_args) + log("Initialized predictor with:", predictor_args, important=True) result = True tt.tic() # don't account for init elif method['name'] == 'predict': @@ -172,24 +172,24 @@ def predictor_worker(recv_queue, send_queue, worker_alive): Once(timing, log, per=1) except KeyboardInterrupt: - log("predictor_worker: user interrupt") + log("predictor_worker: user interrupt", important=True) except Exception as e: - log("predictor_worker error") + log("predictor_worker error", important=True) traceback.print_exc() worker_alive.value = 0 - log("predictor_worker exit") + log("predictor_worker exit", important=True) @staticmethod def send_worker(port, send_queue, worker_alive): timing = AccumDict() - log = Tee('./var/log/send_worker.log') + log = Logger('./var/log/send_worker.log', verbose=opt.verbose) ctx = SerializingContext() socket = ctx.socket(zmq.PUSH) socket.bind(f"tcp://*:{port}") - log(f'Sending on port {port}') + log(f'Sending on port {port}', important=True) try: while worker_alive.value: @@ -215,10 +215,10 @@ def send_worker(port, send_queue, worker_alive): Once(timing, log, per=1) except KeyboardInterrupt: - log("predictor_worker: user interrupt") + log("predictor_worker: user interrupt", important=True) worker_alive.value = 0 - log("send_worker exit") + log("send_worker exit", important=True) def run_worker(in_port=None, out_port=None): diff --git a/afy/utils.py b/afy/utils.py index db1e90434..307a4d26f 100644 --- a/afy/utils.py +++ b/afy/utils.py @@ -34,6 +34,18 @@ def flush(self): self.file.flush() +class Logger(): + def __init__(self, filename, verbose=True): + self.tee = Tee(filename) + self.verbose = verbose + + def __call__(self, *args, important=False, **kwargs): + if not self.verbose and not important: + return + + self.tee(*args, **kwargs) + + class Once(): _id = {} From e3204ec50afc675fdde8b916ed8b9831ba1bab3c Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 11 Jul 2020 17:42:36 +0300 Subject: [PATCH 18/64] mute performance logs --- afy/predictor_remote.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/afy/predictor_remote.py b/afy/predictor_remote.py index 675f5012e..9c63a1f19 100644 --- a/afy/predictor_remote.py +++ b/afy/predictor_remote.py @@ -119,7 +119,8 @@ def _send_recv_async(self, method, args, critical): result = msgpack.unpackb(data_recv) self.timing.add('UNPACK', tt.toc()) - Once(self.timing, per=1) + if opt.verbose: + Once(self.timing, per=1) return result @@ -147,7 +148,8 @@ def send_worker(address, send_queue, worker_alive): sender.send_data(*msg) timing.add('SEND', tt.toc()) - Once(timing, log, per=1) + if opt.verbose: + Once(timing, log, per=1) except KeyboardInterrupt: log("send_worker: user interrupt") finally: @@ -187,7 +189,8 @@ def recv_worker(address, recv_queue, worker_alive): log('recv_queue full') continue - Once(timing, log, per=1) + if opt.verbose: + Once(timing, log, per=1) except KeyboardInterrupt: log("recv_worker: user interrupt") finally: From 0d45279cf68cacd31ed49403244b7da2421768f5 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Wed, 15 Jul 2020 15:57:22 +0300 Subject: [PATCH 19/64] freeze opencv version --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index ad4c21da1..c3ab49804 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,7 @@ kiwisolver==1.0.1 matplotlib==2.2.2 networkx==2.1 numpy==1.15.0 +opencv-python==4.2.0.34 pandas==0.23.4 Pillow==6.2.2 pycparser==2.18 From 0b4434a40f277bd53c95474ee3fb1ea6ad65cf4d Mon Sep 17 00:00:00 2001 From: josharmour Date: Fri, 24 Jul 2020 04:53:21 -0700 Subject: [PATCH 20/64] Update README.md (#248) Added second argument to docker build command. Added instruction to change directory into repo before building. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aee7e876a..a7c1b45b9 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,8 @@ bash scripts/install_docker.sh ``` 4. Build the Dockerfile: ```bash -docker build -t avatarify +cd avatarify +docker build -t avatarify . ``` ## Setup avatars Avatarify comes with a standard set of avatars of famous people, but you can extend this set simply copying your avatars into `avatars` folder. From ac0775033ba619eafe27e4376e17b6324f6fab62 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Wed, 29 Jul 2020 10:40:18 +0300 Subject: [PATCH 21/64] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7c1b45b9..366c793d2 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ :arrow_forward: [AI-generated Elon Musk](https://youtu.be/lONuXGNqLO0) -# Avatarify +# Open Avatarify Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). Democratized. Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first-order-model). -Created by: GitHub community. +**Open Avatarify is not affiliated with Avatarify Inc.** ## News - **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! From 60c7876d4c79a39594772df3ad64302ff69b912c Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Tue, 4 Aug 2020 00:05:51 +0300 Subject: [PATCH 22/64] update weights link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 366c793d2..61776d036 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Of course, you also need a webcam! ## Install #### Download network weights -Download model's weights from [Dropbox](https://www.dropbox.com/s/t7h24l6wx9vreto/vox-adv-cpk.pth.tar?dl=0), [Yandex.Disk](https://yadi.sk/d/M0FWpz2ExBfgAA) or [Google Drive](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] +Download model's weights from [here](https://avatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] #### Linux Linux uses `v4l2loopback` to create virtual camera. From 980172ac7f8f0c1066df66d2f36e66e1bbb5277d Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 13 Sep 2020 13:48:14 +0400 Subject: [PATCH 23/64] Change S3 link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 61776d036..341a7ce67 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ Of course, you also need a webcam! ## Install #### Download network weights -Download model's weights from [here](https://avatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] +Download model's weights from [here](https://openavatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] #### Linux Linux uses `v4l2loopback` to create virtual camera. From 182bf4a10aba279cb837d6c8e6c281191114fd77 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 13 Sep 2020 19:30:56 +0400 Subject: [PATCH 24/64] Fix S3 link --- scripts/download_data.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download_data.sh b/scripts/download_data.sh index 96a5f07f4..4bcc96249 100755 --- a/scripts/download_data.sh +++ b/scripts/download_data.sh @@ -2,7 +2,7 @@ filename=vox-adv-cpk.pth.tar -curl https://avatarify.s3.amazonaws.com/weights/$filename -o $filename +curl https://openavatarify.s3.amazonaws.com/weights/$filename -o $filename echo "Expected checksum: 8a45a24037871c045fbb8a6a8aa95ebc" From 62f0d357494d9f4fecf7bd7ab226563ee97113f5 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 3 Oct 2020 21:55:44 +0300 Subject: [PATCH 25/64] Change avatarify commit Set commit in which S3 link for weights was changed --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3a36eeddd..332965b3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update \ ARG PYTORCH_WHEEL="https://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.whl" ARG FACE_ALIGNMENT_GIT="git+https://github.com/1adrianb/face-alignment" -ARG AVATARIFY_COMMIT="v0.1-docker" +ARG AVATARIFY_COMMIT="182bf4a10aba279cb837d6c8e6c281191114fd77" ARG FOMM_COMMIT="efbe0a6f17b38360ff9a446fddfbb3ce5493534c" RUN git clone https://github.com/alievk/avatarify.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ From c15c9f08daabf0826361ee3977e288b063ab3c41 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 2 Nov 2020 15:36:06 +0300 Subject: [PATCH 26/64] Install git from anaconda --- scripts/install_windows.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install_windows.bat b/scripts/install_windows.bat index f8dd1d27d..f1723f0e3 100644 --- a/scripts/install_windows.bat +++ b/scripts/install_windows.bat @@ -11,6 +11,7 @@ call conda activate %CONDA_ENV_NAME% call conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch call conda install -y python-blosc==1.7.0 -c conda-forge +call conda install -y -c anaconda git REM ###FOMM### call rmdir fomm /s /q From 2f4a17da1573a75a87e5f3ca89b0509462606b56 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 2 Nov 2020 15:37:18 +0300 Subject: [PATCH 27/64] don't check git existence it will be installed later from anaconda --- scripts/install_windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_windows.bat b/scripts/install_windows.bat index f1723f0e3..b9f2a393b 100644 --- a/scripts/install_windows.bat +++ b/scripts/install_windows.bat @@ -2,7 +2,7 @@ REM Check prerequisites call conda --version >nul 2>&1 && ( echo conda found ) || ( echo conda not found. Please refer to the README and install Miniconda. && exit /B 1) -call git --version >nul 2>&1 && ( echo git found ) || ( echo git not found. Please refer to the README and install Git. && exit /B 1) +REM call git --version >nul 2>&1 && ( echo git found ) || ( echo git not found. Please refer to the README and install Git. && exit /B 1) call scripts/settings_windows.bat From f0290944a3095065aacea4603987bd5b8cb9d211 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 2 Nov 2020 16:43:25 +0300 Subject: [PATCH 28/64] use-feature=2020-resolver --- scripts/install_windows.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install_windows.bat b/scripts/install_windows.bat index b9f2a393b..0d69376a2 100644 --- a/scripts/install_windows.bat +++ b/scripts/install_windows.bat @@ -17,4 +17,4 @@ REM ###FOMM### call rmdir fomm /s /q call git clone https://github.com/alievk/first-order-model.git fomm -call pip install -r requirements.txt +call pip install -r requirements.txt --use-feature=2020-resolver From e3302b94059f0dfb6b32b82ff2c1e3ca3834cbb3 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 6 Nov 2020 15:12:15 +0300 Subject: [PATCH 29/64] install numpy from conda to fix the mkl-fft conflict --- requirements.txt | 2 +- scripts/install.sh | 63 +++++++++++++++++++------------------ scripts/install_windows.bat | 1 + 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/requirements.txt b/requirements.txt index c3ab49804..8e44b7cc0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ imageio==2.3.0 kiwisolver==1.0.1 matplotlib==2.2.2 networkx==2.1 -numpy==1.15.0 +#numpy==1.15.0 opencv-python==4.2.0.34 pandas==0.23.4 Pillow==6.2.2 diff --git a/scripts/install.sh b/scripts/install.sh index f3b994500..02e058256 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,31 +1,32 @@ -#!/usr/bin/env bash - -# check prerequisites -command -v conda >/dev/null 2>&1 || { echo >&2 "conda not found. Please refer to the README and install Miniconda."; exit 1; } -command -v git >/dev/null 2>&1 || { echo >&2 "git not found. Please refer to the README and install Git."; exit 1; } - -source scripts/settings.sh - -# v4l2loopback -if [[ ! $@ =~ "no-vcam" ]]; then - rm -rf v4l2loopback 2> /dev/null - git clone https://github.com/alievk/v4l2loopback.git - echo "--- Installing v4l2loopback (sudo privelege required)" - cd v4l2loopback - make && sudo make install - sudo depmod -a - cd .. -fi - -source $(conda info --base)/etc/profile.d/conda.sh -conda create -y -n $CONDA_ENV_NAME python=3.7 -conda activate $CONDA_ENV_NAME - -conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch -conda install -y python-blosc==1.7.0 -c conda-forge - -# FOMM -rm -rf fomm 2> /dev/null -git clone https://github.com/alievk/first-order-model.git fomm - -pip install -r requirements.txt +#!/usr/bin/env bash + +# check prerequisites +command -v conda >/dev/null 2>&1 || { echo >&2 "conda not found. Please refer to the README and install Miniconda."; exit 1; } +command -v git >/dev/null 2>&1 || { echo >&2 "git not found. Please refer to the README and install Git."; exit 1; } + +source scripts/settings.sh + +# v4l2loopback +if [[ ! $@ =~ "no-vcam" ]]; then + rm -rf v4l2loopback 2> /dev/null + git clone https://github.com/alievk/v4l2loopback.git + echo "--- Installing v4l2loopback (sudo privelege required)" + cd v4l2loopback + make && sudo make install + sudo depmod -a + cd .. +fi + +source $(conda info --base)/etc/profile.d/conda.sh +conda create -y -n $CONDA_ENV_NAME python=3.7 +conda activate $CONDA_ENV_NAME + +conda install -y -c conda-forge numpy==1.15.0 +conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch +conda install -y python-blosc==1.7.0 -c conda-forge + +# FOMM +rm -rf fomm 2> /dev/null +git clone https://github.com/alievk/first-order-model.git fomm + +pip install -r requirements.txt diff --git a/scripts/install_windows.bat b/scripts/install_windows.bat index 0d69376a2..ce7992233 100644 --- a/scripts/install_windows.bat +++ b/scripts/install_windows.bat @@ -9,6 +9,7 @@ call scripts/settings_windows.bat call conda create -y -n %CONDA_ENV_NAME% python=3.7 call conda activate %CONDA_ENV_NAME% +call conda install -y -c conda-forge numpy==1.15.0 call conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch call conda install -y python-blosc==1.7.0 -c conda-forge call conda install -y -c anaconda git From 1fd241af061ce15d0afcda064eafc3425d99d5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Rast=C3=A9n?= Date: Fri, 11 Dec 2020 20:49:10 +0100 Subject: [PATCH 30/64] Fix using current avatar for overlay It would always use the last avatar loaded from disk, even if the current avatar was downloaded StyleGAN --- afy/cam_fomm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 6ef6dae41..53c3a7182 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -393,7 +393,7 @@ def select_camera(config): log(key) if overlay_alpha > 0: - preview_frame = cv2.addWeighted( avatars[cur_ava], overlay_alpha, frame, 1.0 - overlay_alpha, 0.0) + preview_frame = cv2.addWeighted( avatar, overlay_alpha, frame, 1.0 - overlay_alpha, 0.0) else: preview_frame = frame.copy() From 3e0272574d5927a35c1319ed71aa473cb31f00b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Sun, 13 Dec 2020 10:28:20 +0100 Subject: [PATCH 31/64] Automatically select camera if only 1 is detected (#317) --- afy/cam_fomm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 53c3a7182..9f301656c 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -146,7 +146,10 @@ def select_camera(config): cam_frames = cam_selector.query_cameras(config['query_n_cams']) if cam_frames: - cam_id = cam_selector.select_camera(cam_frames, window="CLICK ON YOUR CAMERA") + if len(cam_frames) == 1: + cam_id = list(cam_frames)[0] + else: + cam_id = cam_selector.select_camera(cam_frames, window="CLICK ON YOUR CAMERA") log(f"Selected camera {cam_id}") with open(cam_config, 'w') as f: From 98945b2a94259a29aac6f39775873c386d885249 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sun, 13 Dec 2020 12:29:14 +0300 Subject: [PATCH 32/64] Delete cam_fomm.py.orig --- afy/cam_fomm.py.orig | 374 ------------------------------------------- 1 file changed, 374 deletions(-) delete mode 100644 afy/cam_fomm.py.orig diff --git a/afy/cam_fomm.py.orig b/afy/cam_fomm.py.orig deleted file mode 100644 index 5fd631d2a..000000000 --- a/afy/cam_fomm.py.orig +++ /dev/null @@ -1,374 +0,0 @@ -import os, sys -import glob -import yaml -import time -import requests - -import numpy as np -import cv2 - -from afy.videocaptureasync import VideoCaptureAsync -from afy.arguments import opt -from afy.utils import Once, log, crop, pad_img, resize, TicToc - - -from sys import platform as _platform -_streaming = False -if _platform == 'linux' or _platform == 'linux2': - import pyfakewebcam - _streaming = True - - -if _platform == 'darwin': - if opt.worker_host is None: - log('\nOnly remote GPU mode is supported for Mac (use --worker-host option to connect to the server)') - log('Standalone version will be available lately!\n') - exit() - - -def is_new_frame_better(source, driving, precitor): - global avatar_kp - global display_string - - if avatar_kp is None: - display_string = "No face detected in avatar." - return False - - if predictor.get_start_frame() is None: - display_string = "No frame to compare to." - return True - - driving_smaller = resize(driving, (128, 128))[..., :3] - new_kp = predictor.get_frame_kp(driving) - - if new_kp is not None: - new_norm = (np.abs(avatar_kp - new_kp) ** 2).sum() - old_norm = (np.abs(avatar_kp - predictor.get_start_frame_kp()) ** 2).sum() - - out_string = "{0} : {1}".format(int(new_norm * 100), int(old_norm * 100)) - display_string = out_string - log(out_string) - - return new_norm < old_norm - else: - display_string = "No face found!" - return False - - -def load_stylegan_avatar(): - url = "https://thispersondoesnotexist.com/image" - r = requests.get(url, headers={'User-Agent': "My User Agent 1.0"}).content - - image = np.frombuffer(r, np.uint8) - image = cv2.imdecode(image, cv2.IMREAD_COLOR) - image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) - - image = resize(image, (IMG_SIZE, IMG_SIZE)) - - return image - - -def change_avatar(predictor, new_avatar): - global avatar, avatar_kp, kp_source - avatar_kp = predictor.get_frame_kp(new_avatar) - kp_source = None - avatar = new_avatar - predictor.set_source_image(avatar) - - -def draw_rect(img, rw=0.6, rh=0.8, color=(255, 0, 0), thickness=2): - h, w = img.shape[:2] - l = w * (1 - rw) // 2 - r = w - l - u = h * (1 - rh) // 2 - d = h - u - img = cv2.rectangle(img, (int(l), int(u)), (int(r), int(d)), color, thickness) - - -def print_help(): - log('\n\n=== Control keys ===') - log('1-9: Change avatar') - log('W: Zoom camera in') - log('S: Zoom camera out') - log('A: Previous avatar in folder') - log('D: Next avatar in folder') - log('Q: Get random avatar') - log('X: Calibrate face pose') - log('I: Show FPS') - log('ESC: Quit') - log('\nFull key list: https://github.com/alievk/avatarify#controls') - log('\n\n') - -if __name__ == "__main__": - - global display_string - display_string = "" - - IMG_SIZE = 256 - - if opt.no_stream: - log('Force no streaming') - _streaming = False - - log('Loading Predictor') - predictor_args = { - 'config_path': opt.config, - 'checkpoint_path': opt.checkpoint, - 'relative': opt.relative, - 'adapt_movement_scale': opt.adapt_scale, - 'enc_downscale': opt.enc_downscale - } - if opt.is_worker: - from afy import predictor_worker - predictor_worker.run_worker(opt.worker_port) - sys.exit(0) - elif opt.worker_host: - from afy import predictor_remote - predictor = predictor_remote.PredictorRemote( - worker_host=opt.worker_host, worker_port=opt.worker_port, - **predictor_args - ) - else: - from afy import predictor_local - predictor = predictor_local.PredictorLocal( - **predictor_args - ) - - avatars=[] - images_list = sorted(glob.glob(f'{opt.avatars}/*')) - for i, f in enumerate(images_list): - if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.png'): - key = len(avatars) + 1 - log(f'Key {key}: {f}') - img = cv2.imread(f) - if img.ndim == 2: - img = np.tile(img[..., None], [1, 1, 3]) - img = img[..., :3][..., ::-1] - img = resize(img, (IMG_SIZE, IMG_SIZE)) - avatars.append(img) - - - cap = VideoCaptureAsync(opt.cam) - cap.start() - - if _streaming: - ret, frame = cap.read() - stream_img_size = frame.shape[1], frame.shape[0] - stream = pyfakewebcam.FakeWebcam(f'/dev/video{opt.virt_cam}', *stream_img_size) - - cur_ava = 0 - avatar = None - change_avatar(predictor, avatars[cur_ava]) - passthrough = False - - cv2.namedWindow('cam', cv2.WINDOW_GUI_NORMAL) - cv2.moveWindow('cam', 500, 250) - - frame_proportion = 0.9 - frame_offset_x = 0 - frame_offset_y = 0 - - overlay_alpha = 0.0 - preview_flip = False - output_flip = False - find_keyframe = False - is_calibrated = False - - fps_hist = [] - fps = 0 - show_fps = False - - print_help() - - try: - while True: - tt = TicToc() - - timing = { - 'preproc': 0, - 'predict': 0, - 'postproc': 0 - } - - green_overlay = False - - tt.tic() - - ret, frame = cap.read() - if not ret: - log("Can't receive frame (stream end?). Exiting ...") - break - - frame = frame[..., ::-1] - frame_orig = frame.copy() - - frame, lrudwh = crop(frame, p=frame_proportion, offset_x=frame_offset_x, offset_y=frame_offset_y) - frame_lrudwh = lrudwh - frame = resize(frame, (IMG_SIZE, IMG_SIZE))[..., :3] - - if find_keyframe: - if is_new_frame_better(avatar, frame, predictor): - log("Taking new frame!") - green_overlay = True - predictor.reset_frames() - - timing['preproc'] = tt.toc() - - if passthrough: - out = frame - else: - tt.tic() - pred = predictor.predict(frame) - out = pred - timing['predict'] = tt.toc() - - tt.tic() - - if not opt.no_pad: - out = pad_img(out, stream_img_size) - - key = cv2.waitKey(1) - - if key == 27: # ESC - break - elif key == ord('d'): - cur_ava += 1 - if cur_ava >= len(avatars): - cur_ava = 0 - passthrough = False - change_avatar(predictor, avatars[cur_ava]) - elif key == ord('a'): - cur_ava -= 1 - if cur_ava < 0: - cur_ava = len(avatars) - 1 - passthrough = False - change_avatar(predictor, avatars[cur_ava]) - elif key == ord('w'): - frame_proportion -= 0.05 - frame_proportion = max(frame_proportion, 0.1) - elif key == ord('s'): - frame_proportion += 0.05 - frame_proportion = min(frame_proportion, 1.0) - elif key == ord('H'): - if frame_lrudwh[0] - 1 > 0: - frame_offset_x -= 1 - elif key == ord('h'): - if frame_lrudwh[0] - 5 > 0: - frame_offset_x -= 5 - elif key == ord('K'): - if frame_lrudwh[1] + 1 < frame_lrudwh[4]: - frame_offset_x += 1 - elif key == ord('k'): - if frame_lrudwh[1] + 5 < frame_lrudwh[4]: - frame_offset_x += 5 - elif key == ord('J'): - if frame_lrudwh[2] - 1 > 0: - frame_offset_y -= 1 - elif key == ord('j'): - if frame_lrudwh[2] - 5 > 0: - frame_offset_y -= 5 - elif key == ord('U'): - if frame_lrudwh[3] + 1 < frame_lrudwh[5]: - frame_offset_y += 1 - elif key == ord('u'): - if frame_lrudwh[3] + 5 < frame_lrudwh[5]: - frame_offset_y += 5 - elif key == ord('Z'): - frame_offset_x = 0 - frame_offset_y = 0 - frame_proportion = 0.9 - elif key == ord('x'): - predictor.reset_frames() - - if not is_calibrated: - cv2.namedWindow('avatarify', cv2.WINDOW_GUI_NORMAL) - cv2.moveWindow('avatarify', 600, 250) - - is_calibrated = True - elif key == ord('z'): - overlay_alpha = max(overlay_alpha - 0.1, 0.0) - elif key == ord('c'): - overlay_alpha = min(overlay_alpha + 0.1, 1.0) - elif key == ord('r'): - preview_flip = not preview_flip - elif key == ord('t'): - output_flip = not output_flip - elif key == ord('f'): - find_keyframe = not find_keyframe - elif key == ord('q'): - try: - log('Loading StyleGAN avatar...') - avatar = load_stylegan_avatar() - passthrough = False - change_avatar(predictor, avatar) - except: - log('Failed to load StyleGAN avatar') - elif key == ord('i'): - show_fps = not show_fps - elif 48 < key < 58: - cur_ava = min(key - 49, len(avatars) - 1) - passthrough = False - change_avatar(predictor, avatars[cur_ava]) - elif key == 48: - passthrough = not passthrough - elif key != -1: - log(key) - - if _streaming: - out = resize(out, stream_img_size) - stream.schedule_frame(out) - - if overlay_alpha > 0: - preview_frame = cv2.addWeighted( avatars[cur_ava], overlay_alpha, frame, 1.0 - overlay_alpha, 0.0) - else: - preview_frame = frame.copy() - - if preview_flip: - preview_frame = cv2.flip(preview_frame, 1) - - if output_flip: - out = cv2.flip(out, 1) - - if green_overlay: - green_alpha = 0.8 - overlay = preview_frame.copy() - overlay[:] = (0, 255, 0) - preview_frame = cv2.addWeighted( preview_frame, green_alpha, overlay, 1.0 - green_alpha, 0.0) - - timing['postproc'] = tt.toc() - - if find_keyframe: - preview_frame = cv2.putText(preview_frame, display_string, (10, 220), 0, 0.5 * IMG_SIZE / 256, (255, 255, 255), 1) - - if show_fps: - timing_string = f"FPS/Model/Pre/Post: {fps:.1f} / {timing['predict']:.1f} / {timing['preproc']:.1f} / {timing['postproc']:.1f}" - preview_frame = cv2.putText(preview_frame, timing_string, (10, 240), 0, 0.3 * IMG_SIZE / 256, (255, 255, 255), 1) - - if not is_calibrated: - color = (0, 0, 255) - thk = 2 - fontsz = 0.5 - preview_frame = cv2.putText(preview_frame, "FIT FACE IN RECTANGLE", (40, 20), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "W - ZOOM IN", (60, 40), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "S - ZOOM OUT", (60, 60), 0, fontsz * IMG_SIZE / 255, color, thk) - preview_frame = cv2.putText(preview_frame, "THEN PRESS X", (60, 245), 0, fontsz * IMG_SIZE / 255, color, thk) - - if not opt.hide_rect: - draw_rect(preview_frame) - - # cv2.imshow('cam', preview_frame[..., ::-1]) - if is_calibrated: - cv2.destroyWindow('cam') - cv2.imshow('avatarify', out[..., ::-1]) - else: - cv2.imshow('cam', preview_frame[..., ::-1]) - - fps_hist.append(tt.toc(total=True)) - if len(fps_hist) == 10: - fps = 10 / (sum(fps_hist) / 1000) - fps_hist = [] - except KeyboardInterrupt: - pass - - cap.stop() - cv2.destroyAllWindows() From aba260fbf8efdb59a7592d640d22f5cdfae437c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Sun, 13 Dec 2020 10:44:41 +0100 Subject: [PATCH 33/64] Fix crash if zooming out near frame edge (#319) Added clamping of offsets so that lrud always lies within image boundaries. The adjusted offsets are returned to main so that it is no longer necessary to test if an offset increase/decrease should be allowed. --- afy/cam_fomm.py | 28 ++++++++++------------------ afy/utils.py | 10 +++++++++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 9f301656c..9d4a17e6c 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -275,8 +275,8 @@ def select_camera(config): frame = frame[..., ::-1] frame_orig = frame.copy() - frame, lrudwh = crop(frame, p=frame_proportion, offset_x=frame_offset_x, offset_y=frame_offset_y) - frame_lrudwh = lrudwh + frame, (frame_offset_x, frame_offset_y) = crop(frame, p=frame_proportion, offset_x=frame_offset_x, offset_y=frame_offset_y) + frame = resize(frame, (IMG_SIZE, IMG_SIZE))[..., :3] if find_keyframe: @@ -323,29 +323,21 @@ def select_camera(config): frame_proportion += 0.05 frame_proportion = min(frame_proportion, 1.0) elif key == ord('H'): - if frame_lrudwh[0] - 1 > 0: - frame_offset_x -= 1 + frame_offset_x -= 1 elif key == ord('h'): - if frame_lrudwh[0] - 5 > 0: - frame_offset_x -= 5 + frame_offset_x -= 5 elif key == ord('K'): - if frame_lrudwh[1] + 1 < frame_lrudwh[4]: - frame_offset_x += 1 + frame_offset_x += 1 elif key == ord('k'): - if frame_lrudwh[1] + 5 < frame_lrudwh[4]: - frame_offset_x += 5 + frame_offset_x += 5 elif key == ord('J'): - if frame_lrudwh[2] - 1 > 0: - frame_offset_y -= 1 + frame_offset_y -= 1 elif key == ord('j'): - if frame_lrudwh[2] - 5 > 0: - frame_offset_y -= 5 + frame_offset_y -= 5 elif key == ord('U'): - if frame_lrudwh[3] + 1 < frame_lrudwh[5]: - frame_offset_y += 1 + frame_offset_y += 1 elif key == ord('u'): - if frame_lrudwh[3] + 5 < frame_lrudwh[5]: - frame_offset_y += 5 + frame_offset_y += 5 elif key == ord('Z'): frame_offset_x = 0 frame_offset_y = 0 diff --git a/afy/utils.py b/afy/utils.py index 307a4d26f..6c66e59f9 100644 --- a/afy/utils.py +++ b/afy/utils.py @@ -114,6 +114,10 @@ def __repr__(self): return self.__str__() +def clamp(value, min_value, max_value): + return max(min(value, max_value), min_value) + + def crop(img, p=0.7, offset_x=0, offset_y=0): h, w = img.shape[:2] x = int(min(w, h) * p) @@ -121,12 +125,16 @@ def crop(img, p=0.7, offset_x=0, offset_y=0): r = w - l u = (h - x) // 2 d = h - u + + offset_x = clamp(offset_x, -l, w - r) + offset_y = clamp(offset_y, -u, h - d) + l += offset_x r += offset_x u += offset_y d += offset_y - return img[u:d, l:r], (l,r,u,d,w,h) + return img[u:d, l:r], (offset_x, offset_y) def pad_img(img, target_size, default_pad=0): From f09f6e621663dfe1affe150bf22e60d1c73d1821 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 14 Dec 2020 14:24:21 +0300 Subject: [PATCH 34/64] Add GUI app link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 341a7ce67..eee81aa0a 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,8 @@ bash scripts/install_mac.sh #### Windows +**New**: Check out our [app](https://github.com/alievk/avatarify/wiki/Windows-App) with graphical interface! + :arrow_forward: [Video tutorial](https://youtu.be/lym9ANVb120) This guide is tested for Windows 10. From 0fbf0e2026c0f696d0af383102f98b1ccb5f4399 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 14 Dec 2020 14:26:53 +0300 Subject: [PATCH 35/64] Add Windows app news line --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index eee81aa0a..bed2c1415 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first- **Open Avatarify is not affiliated with Avatarify Inc.** ## News +- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify/wiki/Windows-App). - **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! - **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! - **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify/wiki/Remote-GPU). From e7e5a6891447e9200b6d14fb8e26a8220902656a Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 14 Dec 2020 14:30:34 +0300 Subject: [PATCH 36/64] Add Windows app link in the header --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bed2c1415..92b820246 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ![](docs/mona.gif) + Download [Windows app (beta)](https://github.com/alievk/avatarify/wiki/Windows-App) + [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) [](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg) From 5367a0e9659d3745cd327edc90acf562490c8d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Mon, 14 Dec 2020 14:17:32 +0100 Subject: [PATCH 37/64] Exit if either window is closed (#321) --- afy/cam_fomm.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 9d4a17e6c..86e2078a9 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -302,6 +302,11 @@ def select_camera(config): key = cv2.waitKey(1) + if cv2.getWindowProperty('cam', cv2.WND_PROP_VISIBLE) < 1.0: + break + elif is_calibrated and cv2.getWindowProperty('avatarify', cv2.WND_PROP_VISIBLE) < 1.0: + break + if key == 27: # ESC break elif key == ord('d'): From e6bfe9e559f1dcd414397a7392dff68ab1d19b51 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 18 Dec 2020 19:02:17 +0300 Subject: [PATCH 38/64] remove Zoom issue warning --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92b820246..c09bb999b 100644 --- a/README.md +++ b/README.md @@ -94,13 +94,14 @@ bash scripts/install.sh #### Mac + We will use [CamTwist](http://camtwiststudio.com) to create virtual camera for Mac. From 04a60d3fa6a818e3a1e3071242a7338ebcd324b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Wed, 23 Dec 2020 10:55:50 +0100 Subject: [PATCH 39/64] Add overlay drawing of landmarks (#318) --- README.md | 3 ++- afy/cam_fomm.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c09bb999b..b92dc5e94 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ R | Mirror reference window. T | Mirror output window. L | Reload avatars. I | Show FPS +O | Toggle face detection overlay. ESC | Quit ## Driving your avatar @@ -251,7 +252,7 @@ ESC | Quit These are the main principles for driving your avatar: * Align your face in the camera window as closely as possible in proportion and position to the target avatar. Use zoom in/out function (W/S keys) and camera left, right, up, down translation (U/H/J/K keys). When you have aligned, hit 'X' to use this frame as reference to drive the rest of the animation -* Use the overlay function (Z/C keys) to match your and avatar's face expressions as close as possible +* Use the image overlay function (Z/C keys) or the face detection overlay function (O key) to match your and avatar's face expressions as close as possible Alternatively, you can hit 'F' for the software to attempt to find a better reference frame itself. This will slow down the framerate, but while this is happening, you can keep moving your head around: the preview window will flash green when it finds your facial pose is a closer match to the avatar than the one it is currently using. You will see two numbers displayed as well: the first number is how closely you are currently aligned to the avatar, and the second number is how closely the reference frame is aligned. diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 86e2078a9..7a77e70a2 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -16,6 +16,8 @@ log = Tee('./var/log/cam_fomm.log') +# Where to split an array from face_alignment to separate each landmark +LANDMARK_SLICE_ARRAY = np.array([17, 22, 27, 31, 36, 42, 48, 60]) if _platform == 'darwin': if not opt.is_client: @@ -96,6 +98,13 @@ def draw_rect(img, rw=0.6, rh=0.8, color=(255, 0, 0), thickness=2): d = h - u img = cv2.rectangle(img, (int(l), int(u)), (int(r), int(d)), color, thickness) +def kp_to_pixels(arr): + '''Convert normalized landmark locations to screen pixels''' + return ((arr + 1) * 127).astype(np.int32) + +def draw_face_landmarks(img, face_kp, color=(20, 80, 255)): + if face_kp is not None: + img = cv2.polylines(img, np.split(kp_to_pixels(face_kp), LANDMARK_SLICE_ARRAY), False, color) def print_help(): info('\n\n=== Control keys ===') @@ -125,6 +134,13 @@ def draw_fps(frame, fps, timing, x0=10, y0=20, ystep=30, fontsz=0.5, color=(255, return frame +def draw_landmark_text(frame, thk=2, fontsz=0.5, color=(0, 0, 255)): + frame = frame.copy() + cv2.putText(frame, "ALIGN FACES", (60, 20), 0, fontsz * IMG_SIZE / 255, color, thk) + cv2.putText(frame, "THEN PRESS X", (60, 245), 0, fontsz * IMG_SIZE / 255, color, thk) + return frame + + def draw_calib_text(frame, thk=2, fontsz=0.5, color=(0, 0, 255)): frame = frame.copy() cv2.putText(frame, "FIT FACE IN RECTANGLE", (40, 20), 0, fontsz * IMG_SIZE / 255, color, thk) @@ -247,6 +263,8 @@ def select_camera(config): find_keyframe = False is_calibrated = False + show_landmarks = False + fps_hist = [] fps = 0 show_fps = False @@ -355,6 +373,7 @@ def select_camera(config): cv2.moveWindow('avatarify', 600, 250) is_calibrated = True + show_landmarks = False elif key == ord('z'): overlay_alpha = max(overlay_alpha - 0.1, 0.0) elif key == ord('c'): @@ -365,6 +384,8 @@ def select_camera(config): output_flip = not output_flip elif key == ord('f'): find_keyframe = not find_keyframe + elif key == ord('o'): + show_landmarks = not show_landmarks elif key == ord('q'): try: log('Loading StyleGAN avatar...') @@ -396,6 +417,14 @@ def select_camera(config): preview_frame = cv2.addWeighted( avatar, overlay_alpha, frame, 1.0 - overlay_alpha, 0.0) else: preview_frame = frame.copy() + + if show_landmarks: + # Dim the background to make it easier to see the landmarks + preview_frame = cv2.convertScaleAbs(preview_frame, alpha=0.5, beta=0.0) + + draw_face_landmarks(preview_frame, avatar_kp, (200, 20, 10)) + frame_kp = predictor.get_frame_kp(frame) + draw_face_landmarks(preview_frame, frame_kp) if preview_flip: preview_frame = cv2.flip(preview_frame, 1) @@ -416,6 +445,8 @@ def select_camera(config): if not is_calibrated: preview_frame = draw_calib_text(preview_frame) + elif show_landmarks: + preview_frame = draw_landmark_text(preview_frame) if not opt.hide_rect: draw_rect(preview_frame) From ac4580ed055369e5b53fa0721c2d3ecd78876415 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 26 Dec 2020 00:40:04 +0300 Subject: [PATCH 40/64] Fix Python version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b92dc5e94..13ade3999 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ bash scripts/install_mac.sh This guide is tested for Windows 10. -1. Install [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#windows-installers). +1. Install [Miniconda Python 3.8](https://docs.conda.io/en/latest/miniconda.html#windows-installers). 2. Install [Git](https://git-scm.com/download/win). 3. Press Windows button and type "miniconda". Run suggested Anaconda Prompt. 4. Download and install Avatarify (please copy-paste these commands and don't change them): From caf430a4c76c8ef2bef802d701b2a857d25d49e6 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Wed, 6 Jan 2021 13:09:53 +0400 Subject: [PATCH 41/64] Hide Windows App links Users report issues for the GUI and the terminal apps in same threads. New users even don't know there're two version. I think we should provide a single version, the GUI one. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 13ade3999..9bfc37667 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](docs/mona.gif) - Download [Windows app (beta)](https://github.com/alievk/avatarify/wiki/Windows-App) + [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) @@ -117,7 +117,7 @@ bash scripts/install_mac.sh #### Windows -**New**: Check out our [app](https://github.com/alievk/avatarify/wiki/Windows-App) with graphical interface! + :arrow_forward: [Video tutorial](https://youtu.be/lym9ANVb120) From 782450a7e5c1b781a8f78729da1496087f511f7f Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 9 Jan 2021 16:14:02 +0400 Subject: [PATCH 42/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9bfc37667..83b656054 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) -[](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg) + :arrow_forward: [Demo](https://youtu.be/Q7LFDT-FRzs) From 1fabdb2b66891f0b6c3aefaf7116165f77f8374b Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Wed, 13 Jan 2021 09:20:18 +0300 Subject: [PATCH 43/64] fix yaml warning --- afy/predictor_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/afy/predictor_local.py b/afy/predictor_local.py index 46f0aea19..34d8c66b0 100644 --- a/afy/predictor_local.py +++ b/afy/predictor_local.py @@ -31,7 +31,7 @@ def __init__(self, config_path, checkpoint_path, relative=False, adapt_movement_ def load_checkpoints(self): with open(self.config_path) as f: - config = yaml.load(f) + config = yaml.load(f, Loader=yaml.FullLoader) generator = OcclusionAwareGenerator(**config['model_params']['generator_params'], **config['model_params']['common_params']) From 95071c56064907f3fe1cbaa5377a37081a626ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Wed, 13 Jan 2021 11:12:37 +0100 Subject: [PATCH 44/64] Skip broken images in avatars/ folder --- afy/cam_fomm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/afy/cam_fomm.py b/afy/cam_fomm.py index 7a77e70a2..13ac1d4a3 100644 --- a/afy/cam_fomm.py +++ b/afy/cam_fomm.py @@ -74,6 +74,10 @@ def load_images(IMG_SIZE = 256): for i, f in enumerate(images_list): if f.endswith('.jpg') or f.endswith('.jpeg') or f.endswith('.png'): img = cv2.imread(f) + if img is None: + log("Failed to open image: {}".format(f)) + continue + if img.ndim == 2: img = np.tile(img[..., None], [1, 1, 3]) img = img[..., :3][..., ::-1] From a300fcaadb6a6964e69d4a90db9e7d72bb87e791 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Thu, 14 Jan 2021 18:36:32 +0300 Subject: [PATCH 45/64] Less dependencies (#346) --- afy/predictor_local.py | 24 +++++++++++++++- requirements.txt | 37 ++++-------------------- scripts/install.sh | 64 +++++++++++++++++++++--------------------- 3 files changed, 60 insertions(+), 65 deletions(-) diff --git a/afy/predictor_local.py b/afy/predictor_local.py index 34d8c66b0..2f7797ec9 100644 --- a/afy/predictor_local.py +++ b/afy/predictor_local.py @@ -6,7 +6,29 @@ from sync_batchnorm import DataParallelWithCallback import numpy as np import face_alignment -from animate import normalize_kp + + +def normalize_kp(kp_source, kp_driving, kp_driving_initial, adapt_movement_scale=False, + use_relative_movement=False, use_relative_jacobian=False): + if adapt_movement_scale: + source_area = ConvexHull(kp_source['value'][0].data.cpu().numpy()).volume + driving_area = ConvexHull(kp_driving_initial['value'][0].data.cpu().numpy()).volume + adapt_movement_scale = np.sqrt(source_area) / np.sqrt(driving_area) + else: + adapt_movement_scale = 1 + + kp_new = {k: v for k, v in kp_driving.items()} + + if use_relative_movement: + kp_value_diff = (kp_driving['value'] - kp_driving_initial['value']) + kp_value_diff *= adapt_movement_scale + kp_new['value'] = kp_value_diff + kp_source['value'] + + if use_relative_jacobian: + jacobian_diff = torch.matmul(kp_driving['jacobian'], torch.inverse(kp_driving_initial['jacobian'])) + kp_new['jacobian'] = torch.matmul(jacobian_diff, kp_source['jacobian']) + + return kp_new def to_tensor(a): diff --git a/requirements.txt b/requirements.txt index 8e44b7cc0..5f598be67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,34 +1,7 @@ -#cffi==1.11.5 -cloudpickle==0.5.3 -cycler==0.10.0 -dask==0.18.2 -decorator==4.3.0 -imageio==2.3.0 -kiwisolver==1.0.1 -matplotlib==2.2.2 -networkx==2.1 -#numpy==1.15.0 opencv-python==4.2.0.34 -pandas==0.23.4 -Pillow==6.2.2 -pycparser==2.18 -pygit==0.1 -pyparsing==2.2.0 -python-dateutil==2.7.3 -pytz==2018.5 -PyWavelets==0.5.2 -PyYAML==5.1 -scikit-image==0.14.0 -scikit-learn==0.19.2 -scipy==1.1.0 -six==1.11.0 -toolz==0.9.0 -#torch==1.0.0 -#torchvision==0.2.1 -tqdm==4.24.0 -requests==2.23 face-alignment==1.0.0 -pyfakewebcam==0.1.0 -msgpack-numpy==0.4.5 -pyzmq==19.0.0 -#blosc==1.7.0 +pyzmq==20.0.0 +msgpack-numpy==0.4.7.1 +pyyaml==5.3.1 +requests==2.25.1 +pyfakewebcam==0.1.0 \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 02e058256..29323f3c0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,32 +1,32 @@ -#!/usr/bin/env bash - -# check prerequisites -command -v conda >/dev/null 2>&1 || { echo >&2 "conda not found. Please refer to the README and install Miniconda."; exit 1; } -command -v git >/dev/null 2>&1 || { echo >&2 "git not found. Please refer to the README and install Git."; exit 1; } - -source scripts/settings.sh - -# v4l2loopback -if [[ ! $@ =~ "no-vcam" ]]; then - rm -rf v4l2loopback 2> /dev/null - git clone https://github.com/alievk/v4l2loopback.git - echo "--- Installing v4l2loopback (sudo privelege required)" - cd v4l2loopback - make && sudo make install - sudo depmod -a - cd .. -fi - -source $(conda info --base)/etc/profile.d/conda.sh -conda create -y -n $CONDA_ENV_NAME python=3.7 -conda activate $CONDA_ENV_NAME - -conda install -y -c conda-forge numpy==1.15.0 -conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch -conda install -y python-blosc==1.7.0 -c conda-forge - -# FOMM -rm -rf fomm 2> /dev/null -git clone https://github.com/alievk/first-order-model.git fomm - -pip install -r requirements.txt +#!/usr/bin/env bash + +# check prerequisites +command -v conda >/dev/null 2>&1 || { echo >&2 "conda not found. Please refer to the README and install Miniconda."; exit 1; } +command -v git >/dev/null 2>&1 || { echo >&2 "git not found. Please refer to the README and install Git."; exit 1; } + +source scripts/settings.sh + +# v4l2loopback +if [[ ! $@ =~ "no-vcam" ]]; then + rm -rf v4l2loopback 2> /dev/null + git clone https://github.com/alievk/v4l2loopback.git + echo "--- Installing v4l2loopback (sudo privelege required)" + cd v4l2loopback + make && sudo make install + sudo depmod -a + cd .. +fi + +source $(conda info --base)/etc/profile.d/conda.sh +conda create -y -n $CONDA_ENV_NAME python=3.7 +conda activate $CONDA_ENV_NAME + +conda install -y -c conda-forge numpy==1.15.0 +conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch +conda install -y python-blosc==1.7.0 -c conda-forge + +# FOMM +rm -rf fomm 2> /dev/null +git clone https://github.com/alievk/first-order-model.git fomm + +pip install -r requirements.txt From 0ca3677d98d923152b66a9432db0225253437476 Mon Sep 17 00:00:00 2001 From: Sarah G Date: Sat, 16 Jan 2021 10:42:33 +0100 Subject: [PATCH 46/64] Fixes for running with Docker (#338) * Fixed Dockerfile for python3.7 compatibility, add support older versions Docker gpu in run.sh * Error variable on run script * Remove usage of DOCKER_DEPRECATION_WARNING in run script * Use latest stable version on master for avatarify git commit Dockerfile --- Dockerfile | 19 ++++++++++++++----- run.sh | 12 +++++++----- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 332965b3f..feafffb9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,21 @@ FROM nvcr.io/nvidia/cuda:10.0-cudnn7-runtime-ubuntu18.04 RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update \ - && DEBIAN_FRONTEND=noninteractive apt-get -qqy install curl python3-pip python3-tk ffmpeg git less nano libsm6 libxext6 libxrender-dev \ + && DEBIAN_FRONTEND=noninteractive apt-get -qqy install curl python3-pip python3-tk python3.7-dev ffmpeg git less nano libsm6 libxext6 libxrender-dev \ && rm -rf /var/lib/apt/lists/* -ARG PYTORCH_WHEEL="https://download.pytorch.org/whl/cu100/torch-1.0.0-cp36-cp36m-linux_x86_64.whl" +# use python3.7 by default +RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 \ + && update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2 \ + && update-alternatives --set python /usr/bin/python3.7 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 \ + && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2 \ + && update-alternatives --set python3 /usr/bin/python3.7 \ + && python -m pip install --upgrade setuptools pip wheel + +ARG PYTORCH_WHEEL="https://download.pytorch.org/whl/cu100/torch-1.0.0-cp37-cp37m-linux_x86_64.whl" ARG FACE_ALIGNMENT_GIT="git+https://github.com/1adrianb/face-alignment" -ARG AVATARIFY_COMMIT="182bf4a10aba279cb837d6c8e6c281191114fd77" +ARG AVATARIFY_COMMIT="a300fcaadb6a6964e69d4a90db9e7d72bb87e791" ARG FOMM_COMMIT="efbe0a6f17b38360ff9a446fddfbb3ce5493534c" RUN git clone https://github.com/alievk/avatarify.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ @@ -16,8 +25,8 @@ WORKDIR /app/avatarify RUN bash scripts/download_data.sh -RUN pip3 install ${PYTORCH_WHEEL} ${FACE_ALIGNMENT_GIT} -r requirements.txt \ - && pip3 install ${PYTORCH_WHEEL} ${FACE_ALIGNMENT_GIT} -r fomm/requirements.txt \ +RUN pip3 install ${PYTORCH_WHEEL} -r requirements.txt \ + && pip3 install ${PYTORCH_WHEEL} -r fomm/requirements.txt \ && rm -rf /root/.cache/pip ENV PYTHONPATH="/app/avatarify:/app/avatarify/fomm" diff --git a/run.sh b/run.sh index 789806b88..24ffc6ed3 100755 --- a/run.sh +++ b/run.sh @@ -97,13 +97,18 @@ if [[ $USE_DOCKER == 0 ]]; then else source scripts/settings.sh - + if [[ $ENABLE_VCAM == 1 ]]; then bash scripts/create_virtual_camera.sh fi if [[ $DOCKER_NO_GPU == 0 ]]; then - DOCKER_ARGS="$DOCKER_ARGS --gpus all" + if nvidia-container-runtime -v &> /dev/null; then + DOCKER_ARGS="$DOCKER_ARGS --runtime=nvidia" + echo "Warning : Outdated Docker gpu support, please update !" + else + DOCKER_ARGS="$DOCKER_ARGS --gpus all" + fi fi if [[ $DOCKER_IS_LOCAL_CLIENT == 1 ]]; then @@ -112,9 +117,7 @@ else DOCKER_ARGS="$DOCKER_ARGS -p 5557:5554 -p 5557:5558" fi - - if [[ $IS_WORKER == 0 ]]; then xhost +local:root docker run $DOCKER_ARGS -it --rm --privileged \ @@ -144,6 +147,5 @@ else --adapt_scale \ $@ fi - fi From b26d9cf1d1d52cb363c868bdb27d0866e169a4e9 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Mon, 18 Jan 2021 23:48:52 +0300 Subject: [PATCH 47/64] 30x series support (#350) --- requirements.txt | 2 +- scripts/install.sh | 5 ++--- scripts/install_windows.bat | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5f598be67..a602caba5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ opencv-python==4.2.0.34 -face-alignment==1.0.0 +face-alignment==1.3.3 pyzmq==20.0.0 msgpack-numpy==0.4.7.1 pyyaml==5.3.1 diff --git a/scripts/install.sh b/scripts/install.sh index 29323f3c0..58f2b0f32 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -21,9 +21,8 @@ source $(conda info --base)/etc/profile.d/conda.sh conda create -y -n $CONDA_ENV_NAME python=3.7 conda activate $CONDA_ENV_NAME -conda install -y -c conda-forge numpy==1.15.0 -conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch -conda install -y python-blosc==1.7.0 -c conda-forge +conda install -y numpy==1.19.0 scikit-image python-blosc==1.7.0 -c conda-forge +conda install -y pytorch==1.7.1 torchvision cudatoolkit=11.0 -c pytorch # FOMM rm -rf fomm 2> /dev/null diff --git a/scripts/install_windows.bat b/scripts/install_windows.bat index ce7992233..be90396da 100644 --- a/scripts/install_windows.bat +++ b/scripts/install_windows.bat @@ -9,9 +9,8 @@ call scripts/settings_windows.bat call conda create -y -n %CONDA_ENV_NAME% python=3.7 call conda activate %CONDA_ENV_NAME% -call conda install -y -c conda-forge numpy==1.15.0 -call conda install -y pytorch==1.0.0 torchvision==0.2.1 cuda100 -c pytorch -call conda install -y python-blosc==1.7.0 -c conda-forge +call conda install -y numpy==1.19.0 scikit-image python-blosc==1.7.0 -c conda-forge +call conda install -y pytorch==1.7.1 torchvision cudatoolkit=11.0 -c pytorch call conda install -y -c anaconda git REM ###FOMM### From 501a625b3a1edc8d60e2cb076d628214ef6bdb4a Mon Sep 17 00:00:00 2001 From: Yves Date: Sat, 6 Feb 2021 23:26:11 +0100 Subject: [PATCH 48/64] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83b656054..23d2c2f46 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first- **Open Avatarify is not affiliated with Avatarify Inc.** ## News -- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify/wiki/Windows-App). +- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify/wiki/Windows-App-(Beta)). - **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! - **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! - **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify/wiki/Remote-GPU). From 746bb46ab0bc293f9fdd1037d6383c56dc54ae0e Mon Sep 17 00:00:00 2001 From: Onur Akpolat Date: Thu, 18 Feb 2021 09:28:01 +0100 Subject: [PATCH 49/64] Update cask syntax --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23d2c2f46..c3317915e 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ codesign --remove-signature /Applications/zoom.us.app We will use [CamTwist](http://camtwiststudio.com) to create virtual camera for Mac. -1. Install [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#macosx-installers) or use *Homebrew Cask*: `brew cask install miniconda`. +1. Install [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#macosx-installers) or use *Homebrew Cask*: `brew install --cask miniconda`. 2. [Download](https://github.com/alievk/avatarify/archive/master.zip) and unpack the repository or use `git`: ```bash git clone https://github.com/alievk/avatarify.git From bf9dea4bf5990dc3c0740ddce3a9f49b714cda5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Sat, 3 Apr 2021 17:49:51 +0200 Subject: [PATCH 50/64] Move instructions to docs/ folder (#401) --- README.md | 328 ++----------------------------------------------- docs/README.md | 316 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 324 insertions(+), 320 deletions(-) create mode 100644 docs/README.md diff --git a/README.md b/README.md index c3317915e..96edfdf38 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](docs/mona.gif) - + [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) @@ -10,336 +10,24 @@ :arrow_forward: [AI-generated Elon Musk](https://youtu.be/lONuXGNqLO0) -# Open Avatarify +# Avatarify Python -Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). Democratized. +Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). Formerly known as Open Avatarify + +Avatarify Python requires manually downloading and installing some dependencies, and is therefore best suited for users who have some experience with command line applications. [Avatarify Desktop](https://github.com/alievk/avatarify-desktop), which aims to be easier to install and use, is recommended for most users. If you still want to use Avatarify Python, proceed to the [install instructions](docs/). Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first-order-model). **Open Avatarify is not affiliated with Avatarify Inc.** ## News -- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify/wiki/Windows-App-(Beta)). +- **7 Mar 2021.** Renamed project to Avatarify Python to distinguish it from other versions of Avatarify +- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify-desktop). - **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! - **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! -- **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify/wiki/Remote-GPU). +- **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify-python/wiki/Remote-GPU). - **24 April 2020.** Added Windows installation [tutorial](https://www.youtube.com/watch?v=lym9ANVb120). - **17 April 2020.** Created Slack community. Please join via [invitation link](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg). - **15 April 2020.** Added [StyleGAN-generated](https://www.thispersondoesnotexist.com) avatars. Just press `Q` and now you drive a person that never existed. Every time you push the button – new avatar is sampled. - **13 April 2020.** Added Windows support (kudos to [9of9](https://github.com/9of9)). -## Table of Contents -- [Requirements](#requirements) -- [Install](#install) - - [Download network weights](#download-network-weights) - - [Linux](#linux) - - [Mac](#mac) - - [Windows](#windows) - - [Remote GPU](#remote-gpu) - - [Docker](#docker) -- [Setup avatars](#setup-avatars) -- [Run](#run) - - [Linux](#linux-1) - - [Mac](#mac-1) - - [Windows](#windows-1) -- [Controls](#controls) -- [Driving your avatar](#driving-your-avatar) -- [Configure video meeting app](#configure-video-meeting-app) - - [Skype](#skype) - - [Zoom](#zoom) - - [Teams](#teams) - - [Slack](#slack) -- [Uninstall](#uninstall) -- [Contribution](#contribution) -- [FAQ](#faq) -- [Troubleshooting](#troubleshooting) - -## Requirements - -You can run Avatarify in two modes: *locally* and *remotely*. - -To run Avatarify *locally* you need a CUDA-enabled (NVIDIA) video card. Otherwise it will fallback to the central processor and run very slowly. These are performance metrics for some hardware: - -- GeForce GTX 1080 Ti: **33 frames per second** -- GeForce GTX 1070: **15 frames per second** -- GeForce GTX 950: **9 frames per second** - -You can also run Avatarify *remotely* on [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) (easy) or on a [dedicated server](https://github.com/alievk/avatarify/wiki/Remote-GPU) with a GPU (harder). There are no special PC requirements for this mode, only a stable internet connection. - -Of course, you also need a webcam! - - - -## Install - -#### Download network weights -Download model's weights from [here](https://openavatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] - -#### Linux -Linux uses `v4l2loopback` to create virtual camera. - - -1. Download [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#linux-installers) and install using command: -```bash -bash Miniconda3-latest-Linux-x86_64.sh -``` -2. Clone `avatarify` and install its dependencies (sudo privelege is required): -```bash -git clone https://github.com/alievk/avatarify.git -cd avatarify -bash scripts/install.sh -``` -3. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). - - -#### Mac - - - -We will use [CamTwist](http://camtwiststudio.com) to create virtual camera for Mac. - -1. Install [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#macosx-installers) or use *Homebrew Cask*: `brew install --cask miniconda`. -2. [Download](https://github.com/alievk/avatarify/archive/master.zip) and unpack the repository or use `git`: -```bash -git clone https://github.com/alievk/avatarify.git -cd avatarify -bash scripts/install_mac.sh -``` -3. Download and install [CamTwist](http://camtwiststudio.com) from [here](http://camtwiststudio.com/download). It's easy. - -#### Windows - - - -:arrow_forward: [Video tutorial](https://youtu.be/lym9ANVb120) - -This guide is tested for Windows 10. - - -1. Install [Miniconda Python 3.8](https://docs.conda.io/en/latest/miniconda.html#windows-installers). -2. Install [Git](https://git-scm.com/download/win). -3. Press Windows button and type "miniconda". Run suggested Anaconda Prompt. -4. Download and install Avatarify (please copy-paste these commands and don't change them): -```bash -git clone https://github.com/alievk/avatarify.git -cd avatarify -scripts\install_windows.bat -``` -5. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). -6. Run `run_windows.bat`. If installation was successful, two windows "cam" and "avatarify" will appear. Leave these windows open for the next installation steps. -7. Install [OBS Studio](https://obsproject.com/) for capturing Avatarify output. -8. Install [VirtualCam plugin](https://obsproject.com/forum/resources/obs-virtualcam.539/). Choose `Install and register only 1 virtual camera`. -9. Run OBS Studio. -10. In the Sources section, press on Add button ("+" sign), select Windows Capture and press OK. In the appeared window, choose "[python.exe]: avatarify" in Window drop-down menu and press OK. Then select Edit -> Transform -> Fit to screen. -11. In OBS Studio, go to Tools -> VirtualCam. Check AutoStart, set Buffered Frames to 0 and press Start. -12. Now `OBS-Camera` camera should be available in Zoom (or other videoconferencing software). - -The steps 10-11 are required only once during setup. - -#### Remote GPU - -You can offload the heavy work to [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [server with a GPU](https://github.com/alievk/avatarify/wiki/Remote-GPU) and use your laptop just to communicate the video stream. The server and client software are native and dockerized available. - -### Docker -Docker images are only availabe on Linux. - -1. Install Docker following the [Documentation](https://docs.docker.com/engine/install/). Then run this [step](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to make docker available for your user. -2. For using the gpu (hardly recommended): Install nvidia drivers and [nvidia docker](https://github.com/NVIDIA/nvidia-docker#quickstart). -3. Clone `avatarify` and install its dependencies (v4l2loopback kernel module): -```bash -git clone https://github.com/alievk/avatarify.git -cd avatarify -bash scripts/install_docker.sh -``` -4. Build the Dockerfile: -```bash -cd avatarify -docker build -t avatarify . -``` -## Setup avatars -Avatarify comes with a standard set of avatars of famous people, but you can extend this set simply copying your avatars into `avatars` folder. - -Follow these advices for better visual quality: -* Make square crop of your avatar picture. -* Crop avatar's face so that it's not too close not too far. Use standard avatars as reference. -* Prefer pictures with uniform background. It will diminish visual artifacts. - -## Run -Your web cam must be plugged-in. - -**Note:** run your video-conferencing app only after Avatarify is started. - -#### Linux -The run script will create virtual camera `/dev/video9`. You can change these settings in `scripts/settings.sh`. - - -You can use command `v4l2-ctl --list-devices` to list all devices in your system. - -Run: -```bash -bash run.sh -``` -If you haven't installed a GPU add the `--no-gpus` flag. In order to use Docker add the `--docker` flag. - -`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. - -#### Mac -*Note*: On Mac Avatarify runs only with [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [dedicated server](https://github.com/alievk/avatarify/wiki/Remote-GPU) with GPU. - -Please find where you downloaded `avatarify` and substitute path `/path/to/avatarify` below. - - -1. To run Avatarify please follow instructions for [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [dedicated server](https://github.com/alievk/avatarify/wiki/Remote-GPU). -2. Go to [CamTwist](http://camtwiststudio.com). -3. Choose `Desktop+` and press `Select`. -4. In the `Settings` section choose `Confine to Application Window` and select `python (avatarify)` from the drop-down menu. - -`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. - -#### Windows - - - -1. In Anaconda Prompt: -``` -cd C:\path\to\avatarify -run_windows.bat -``` -2. Run OBS Studio. It should automaitcally start streaming video from Avatarify to `OBS-Camera`. - -`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. - -**Note:** To reduce video latency, in OBS Studio right click on the preview window and uncheck Enable Preview. - -## Controls - - -Keys | Controls ---- | --- -1-9 | These will immediately switch between the first 9 avatars. -Q | Turns on StyleGAN-generated avatar. Every time you push the button – new avatar is sampled. -0 | Toggles avatar display on and off. -A/D | Previous/next avatar in folder. -W/S | Zoom camera in/out. -U/H/J/K | Translate camera. `H` - left, `K` - right, `U` - up, `J` - Down by 5 pixels. Add `Shift` to adjust by 1 pixel. -Shift-Z | Reset camera zoom and translation -Z/C | Adjust avatar target overlay opacity. -X | Reset reference frame. -F | Toggle reference frame search mode. -R | Mirror reference window. -T | Mirror output window. -L | Reload avatars. -I | Show FPS -O | Toggle face detection overlay. -ESC | Quit - -## Driving your avatar - -These are the main principles for driving your avatar: - -* Align your face in the camera window as closely as possible in proportion and position to the target avatar. Use zoom in/out function (W/S keys) and camera left, right, up, down translation (U/H/J/K keys). When you have aligned, hit 'X' to use this frame as reference to drive the rest of the animation -* Use the image overlay function (Z/C keys) or the face detection overlay function (O key) to match your and avatar's face expressions as close as possible - -Alternatively, you can hit 'F' for the software to attempt to find a better reference frame itself. This will slow down the framerate, but while this is happening, you can keep moving your head around: the preview window will flash green when it finds your facial pose is a closer match to the avatar than the one it is currently using. You will see two numbers displayed as well: the first number is how closely you are currently aligned to the avatar, and the second number is how closely the reference frame is aligned. - -You want to get the first number as small as possible - around 10 is usually a good alignment. When you are done, press 'F' again to exit reference frame search mode. - -You don't need to be exact, and some other configurations can yield better results still, but it's usually a good starting point. - -## Configure video meeting app - -Avatarify supports any video-conferencing app where video input source can be changed (Zoom, Skype, Hangouts, Slack, ...). Here are a few examples how to configure particular app to use Avatarify. - -### Skype - -Go to Settings -> Audio & Video, choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) camera. - - - -### Zoom - -Go to Settings -> Video and choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) from Camera drop-down menu. - - - -### Teams - -Go to your profile picture -> Settings -> Devices and choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) from Camera drop-down menu. - - - -### Slack - -Make a call, allow browser using cameras, click on Settings icon, choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) in Video settings drop-down menu. - - - - -## Uninstall -To remove Avatarify and its related programs follow the [instructions](https://github.com/alievk/avatarify/wiki/Removing-Avatarify) in the Wiki. - - -## Contribution - -Our goal is to democratize photorealistic avatars for video-conferencing. To make the technology even more accessible, we have to tackle the following problems: - -* ~~Add support for more platforms (Linux and Mac are already supported).~~ -* ~~Remote GPU support. This is a work in progress.~~ -* Porting to non-CUDA GPUs (Intel integrated GPUs, AMD GPUs, etc) and optimization. The goal is to run Avatarify real-time (at least 10FPS) on modern laptops. - -Please make pull requests if you have any improvements or bug-fixes. - - -## FAQ - -Q: **Do I need any knowledge of programming to run Avatarify?** -A: Not really, but you need some beginner-level knowledge of the command line. For Windows we recorded a video [tutorial](https://www.youtube.com/watch?v=lym9ANVb120), so it’ll be easy to install. - -Q: **Why does it work so slow on my Macbook?** -A: The model used in Avatarify requires a CUDA-enabled NVIDIA GPU to perform heavy computations. Macbooks don’t have such GPUs, and for processing use CPU, which has much less computing power to run Avatarify smoothly. - -Q: **I don’t have a NVIDIA GPU, can I run it?** -A: You still can run it without a NVIDIA GPU, but with drastically reduced performance (<1fps). - -Q: **I have an ATI GPU (e.g. Radeon). Why does it work so slow?** -A: To run the neural network Avatarify uses PyTorch library, which is optimized for CUDA. If PyTorch can’t find a CUDA-enabled GPU in your system it will fallback to CPU. The performance on the CPU will be much worse. - -Q: **How to add a new avatar?** -A: It’s easy. All you need is to find a picture of your avatar and put it in the `avatars` folder. [More](https://github.com/alievk/avatarify#setup-avatars). - -Q: **My avatar looks distorted.** -A: You need to calibrate your face position. Please follow the [tips](https://github.com/alievk/avatarify#driving-your-avatar) or watch the video [tutorial](https://youtu.be/lym9ANVb120?t=662). - -Q: **Can I use a cloud GPU?** -A: This is work in progress. See the relevant [discussion](https://github.com/alievk/avatarify/issues/115). - -Q: **Avatarify crashed, what to do?** -A: First, try to find your error in the [troubleshooting](https://github.com/alievk/avatarify#troubleshooting) section. If it is not there, try to find it in the [issues](https://github.com/alievk/avatarify/issues). If you couldn’t find your issue there, please open a new one using the issue template. - -Q: **Can I use Avatarify for commercial purposes?** -A: No. Avatarify and First Order Motion Model are licensed under Creative Commons Non-Commercial license, which prohibits commercial use. - -Q: **What video conferencing apps does Avatarify support?** -A: Avatarify creates a virtual camera which can be plugged into any app where video input source can be changed (Zoom, Skype, Hangouts, Slack, ...). - -Q: **Where can I discuss Avatarify-related topics with the community?** -A: We have Slack. Please join: [](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg) - - -## Troubleshooting - -Please follow the [Wiki](https://github.com/alievk/avatarify/wiki/Troubleshooting) page. diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..a1fed5a66 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,316 @@ +## Table of Contents +- [Requirements](#requirements) +- [Install](#install) + - [Download network weights](#download-network-weights) + - [Linux](#linux) + - [Mac](#mac) + - [Windows](#windows) + - [Remote GPU](#remote-gpu) + - [Docker](#docker) +- [Setup avatars](#setup-avatars) +- [Run](#run) + - [Linux](#linux-1) + - [Mac](#mac-1) + - [Windows](#windows-1) +- [Controls](#controls) +- [Driving your avatar](#driving-your-avatar) +- [Configure video meeting app](#configure-video-meeting-app) + - [Skype](#skype) + - [Zoom](#zoom) + - [Teams](#teams) + - [Slack](#slack) +- [Uninstall](#uninstall) +- [Contribution](#contribution) +- [FAQ](#faq) +- [Troubleshooting](#troubleshooting) + +## Requirements + +You can run Avatarify in two modes: *locally* and *remotely*. + +To run Avatarify *locally* you need a CUDA-enabled (NVIDIA) video card. Otherwise it will fallback to the central processor and run very slowly. These are performance metrics for some hardware: + +- GeForce GTX 1080 Ti: **33 frames per second** +- GeForce GTX 1070: **15 frames per second** +- GeForce GTX 950: **9 frames per second** + +You can also run Avatarify *remotely* on [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) (easy) or on a [dedicated server](https://github.com/alievk/avatarify-python/wiki/Remote-GPU) with a GPU (harder). There are no special PC requirements for this mode, only a stable internet connection. + +Of course, you also need a webcam! + + + +## Install + +#### Download network weights +Download model's weights from [here](https://openavatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] + +#### Linux +Linux uses `v4l2loopback` to create virtual camera. + + +1. Download [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#linux-installers) and install using command: +```bash +bash Miniconda3-latest-Linux-x86_64.sh +``` +2. Clone `avatarify` and install its dependencies (sudo privelege is required): +```bash +git clone https://github.com/alievk/avatarify-python.git +cd avatarify +bash scripts/install.sh +``` +3. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). + + +#### Mac + + + +We will use [CamTwist](http://camtwiststudio.com) to create virtual camera for Mac. + +1. Install [Miniconda Python 3.7](https://docs.conda.io/en/latest/miniconda.html#macosx-installers) or use *Homebrew Cask*: `brew install --cask miniconda`. +2. [Download](https://github.com/alievk/avatarify-python/archive/master.zip) and unpack the repository or use `git`: +```bash +git clone https://github.com/alievk/avatarify-python.git +cd avatarify +bash scripts/install_mac.sh +``` +3. Download and install [CamTwist](http://camtwiststudio.com) from [here](http://camtwiststudio.com/download). It's easy. + +#### Windows + + + +:arrow_forward: [Video tutorial](https://youtu.be/lym9ANVb120) + +This guide is tested for Windows 10. + + +1. Install [Miniconda Python 3.8](https://docs.conda.io/en/latest/miniconda.html#windows-installers). +2. Install [Git](https://git-scm.com/download/win). +3. Press Windows button and type "miniconda". Run suggested Anaconda Prompt. +4. Download and install Avatarify (please copy-paste these commands and don't change them): +```bash +git clone https://github.com/alievk/avatarify-python.git +cd avatarify +scripts\install_windows.bat +``` +5. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). +6. Run `run_windows.bat`. If installation was successful, two windows "cam" and "avatarify" will appear. Leave these windows open for the next installation steps. +7. Install [OBS Studio](https://obsproject.com/) for capturing Avatarify output. +8. Install [VirtualCam plugin](https://obsproject.com/forum/resources/obs-virtualcam.539/). Choose `Install and register only 1 virtual camera`. +9. Run OBS Studio. +10. In the Sources section, press on Add button ("+" sign), select Windows Capture and press OK. In the appeared window, choose "[python.exe]: avatarify" in Window drop-down menu and press OK. Then select Edit -> Transform -> Fit to screen. +11. In OBS Studio, go to Tools -> VirtualCam. Check AutoStart, set Buffered Frames to 0 and press Start. +12. Now `OBS-Camera` camera should be available in Zoom (or other videoconferencing software). + +The steps 10-11 are required only once during setup. + +#### Remote GPU + +You can offload the heavy work to [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [server with a GPU](https://github.com/alievk/avatarify-python/wiki/Remote-GPU) and use your laptop just to communicate the video stream. The server and client software are native and dockerized available. + +### Docker +Docker images are only availabe on Linux. + +1. Install Docker following the [Documentation](https://docs.docker.com/engine/install/). Then run this [step](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to make docker available for your user. +2. For using the gpu (hardly recommended): Install nvidia drivers and [nvidia docker](https://github.com/NVIDIA/nvidia-docker#quickstart). +3. Clone `avatarify` and install its dependencies (v4l2loopback kernel module): +```bash +git clone https://github.com/alievk/avatarify-python.git +cd avatarify +bash scripts/install_docker.sh +``` +4. Build the Dockerfile: +```bash +cd avatarify +docker build -t avatarify . +``` +## Setup avatars +Avatarify comes with a standard set of avatars of famous people, but you can extend this set simply copying your avatars into `avatars` folder. + +Follow these advices for better visual quality: +* Make square crop of your avatar picture. +* Crop avatar's face so that it's not too close not too far. Use standard avatars as reference. +* Prefer pictures with uniform background. It will diminish visual artifacts. + +## Run +Your web cam must be plugged-in. + +**Note:** run your video-conferencing app only after Avatarify is started. + +#### Linux +The run script will create virtual camera `/dev/video9`. You can change these settings in `scripts/settings.sh`. + + +You can use command `v4l2-ctl --list-devices` to list all devices in your system. + +Run: +```bash +bash run.sh +``` +If you haven't installed a GPU add the `--no-gpus` flag. In order to use Docker add the `--docker` flag. + +`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. + +#### Mac +*Note*: On Mac Avatarify runs only with [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [dedicated server](https://github.com/alievk/avatarify-python/wiki/Remote-GPU) with GPU. + +Please find where you downloaded `avatarify` and substitute path `/path/to/avatarify` below. + + +1. To run Avatarify please follow instructions for [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) or a [dedicated server](https://github.com/alievk/avatarify-python/wiki/Remote-GPU). +2. Go to [CamTwist](http://camtwiststudio.com). +3. Choose `Desktop+` and press `Select`. +4. In the `Settings` section choose `Confine to Application Window` and select `python (avatarify)` from the drop-down menu. + +`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. + +#### Windows + + + +1. In Anaconda Prompt: +``` +cd C:\path\to\avatarify +run_windows.bat +``` +2. Run OBS Studio. It should automaitcally start streaming video from Avatarify to `OBS-Camera`. + +`cam` and `avatarify` windows will pop-up. The `cam` window is for controlling your face position and `avatarify` is for the avatar animation preview. Please follow these [recommendations](#driving-your-avatar) to drive your avatars. + +**Note:** To reduce video latency, in OBS Studio right click on the preview window and uncheck Enable Preview. + +## Controls + + +Keys | Controls +--- | --- +1-9 | These will immediately switch between the first 9 avatars. +Q | Turns on StyleGAN-generated avatar. Every time you push the button – new avatar is sampled. +0 | Toggles avatar display on and off. +A/D | Previous/next avatar in folder. +W/S | Zoom camera in/out. +U/H/J/K | Translate camera. `H` - left, `K` - right, `U` - up, `J` - Down by 5 pixels. Add `Shift` to adjust by 1 pixel. +Shift-Z | Reset camera zoom and translation +Z/C | Adjust avatar target overlay opacity. +X | Reset reference frame. +F | Toggle reference frame search mode. +R | Mirror reference window. +T | Mirror output window. +L | Reload avatars. +I | Show FPS +O | Toggle face detection overlay. +ESC | Quit + +## Driving your avatar + +These are the main principles for driving your avatar: + +* Align your face in the camera window as closely as possible in proportion and position to the target avatar. Use zoom in/out function (W/S keys) and camera left, right, up, down translation (U/H/J/K keys). When you have aligned, hit 'X' to use this frame as reference to drive the rest of the animation +* Use the image overlay function (Z/C keys) or the face detection overlay function (O key) to match your and avatar's face expressions as close as possible + +Alternatively, you can hit 'F' for the software to attempt to find a better reference frame itself. This will slow down the framerate, but while this is happening, you can keep moving your head around: the preview window will flash green when it finds your facial pose is a closer match to the avatar than the one it is currently using. You will see two numbers displayed as well: the first number is how closely you are currently aligned to the avatar, and the second number is how closely the reference frame is aligned. + +You want to get the first number as small as possible - around 10 is usually a good alignment. When you are done, press 'F' again to exit reference frame search mode. + +You don't need to be exact, and some other configurations can yield better results still, but it's usually a good starting point. + +## Configure video meeting app + +Avatarify supports any video-conferencing app where video input source can be changed (Zoom, Skype, Hangouts, Slack, ...). Here are a few examples how to configure particular app to use Avatarify. + +### Skype + +Go to Settings -> Audio & Video, choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) camera. + + + +### Zoom + +Go to Settings -> Video and choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) from Camera drop-down menu. + + + +### Teams + +Go to your profile picture -> Settings -> Devices and choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) from Camera drop-down menu. + + + +### Slack + +Make a call, allow browser using cameras, click on Settings icon, choose `avatarify` (Linux), `CamTwist` (Mac) or `OBS-Camera` (Windows) in Video settings drop-down menu. + + + + +## Uninstall +To remove Avatarify and its related programs follow the [instructions](https://github.com/alievk/avatarify-python/wiki/Removing-Avatarify) in the Wiki. + + +## Contribution + +Our goal is to democratize photorealistic avatars for video-conferencing. To make the technology even more accessible, we have to tackle the following problems: + +* ~~Add support for more platforms (Linux and Mac are already supported).~~ +* ~~Remote GPU support. This is a work in progress.~~ +* Porting to non-CUDA GPUs (Intel integrated GPUs, AMD GPUs, etc) and optimization. The goal is to run Avatarify real-time (at least 10FPS) on modern laptops. + +Please make pull requests if you have any improvements or bug-fixes. + + +## FAQ + +Q: **Do I need any knowledge of programming to run Avatarify?** +A: Not really, but you need some beginner-level knowledge of the command line. For Windows we recorded a video [tutorial](https://www.youtube.com/watch?v=lym9ANVb120), so it’ll be easy to install. + +Q: **Why does it work so slow on my Macbook?** +A: The model used in Avatarify requires a CUDA-enabled NVIDIA GPU to perform heavy computations. Macbooks don’t have such GPUs, and for processing use CPU, which has much less computing power to run Avatarify smoothly. + +Q: **I don’t have a NVIDIA GPU, can I run it?** +A: You still can run it without a NVIDIA GPU, but with drastically reduced performance (<1fps). + +Q: **I have an ATI GPU (e.g. Radeon). Why does it work so slow?** +A: To run the neural network Avatarify uses PyTorch library, which is optimized for CUDA. If PyTorch can’t find a CUDA-enabled GPU in your system it will fallback to CPU. The performance on the CPU will be much worse. + +Q: **How to add a new avatar?** +A: It’s easy. All you need is to find a picture of your avatar and put it in the `avatars` folder. [More](https://github.com/alievk/avatarify-python#setup-avatars). + +Q: **My avatar looks distorted.** +A: You need to calibrate your face position. Please follow the [tips](https://github.com/alievk/avatarify-python#driving-your-avatar) or watch the video [tutorial](https://youtu.be/lym9ANVb120?t=662). + +Q: **Can I use a cloud GPU?** +A: This is work in progress. See the relevant [discussion](https://github.com/alievk/avatarify-python/issues/115). + +Q: **Avatarify crashed, what to do?** +A: First, try to find your error in the [troubleshooting](https://github.com/alievk/avatarify-python#troubleshooting) section. If it is not there, try to find it in the [issues](https://github.com/alievk/avatarify-python/issues). If you couldn’t find your issue there, please open a new one using the issue template. + +Q: **Can I use Avatarify for commercial purposes?** +A: No. Avatarify and First Order Motion Model are licensed under Creative Commons Non-Commercial license, which prohibits commercial use. + +Q: **What video conferencing apps does Avatarify support?** +A: Avatarify creates a virtual camera which can be plugged into any app where video input source can be changed (Zoom, Skype, Hangouts, Slack, ...). + +Q: **Where can I discuss Avatarify-related topics with the community?** +A: We have Slack. Please join: [](https://join.slack.com/t/avatarify/shared_invite/zt-dyoqy8tc-~4U2ObQ6WoxuwSaWKKVOgg) + + +## Troubleshooting + +Please follow the [Wiki](https://github.com/alievk/avatarify-python/wiki/Troubleshooting) page. + From f2f65d0945f62553ab8da8ca2487f3c390239262 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 3 Apr 2021 19:03:40 +0300 Subject: [PATCH 51/64] Update README.md --- README.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 96edfdf38..92fcc304e 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,18 @@ ![](docs/mona.gif) - - -[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) - - - -:arrow_forward: [Demo](https://youtu.be/Q7LFDT-FRzs) - -:arrow_forward: [AI-generated Elon Musk](https://youtu.be/lONuXGNqLO0) - # Avatarify Python -Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). Formerly known as Open Avatarify +Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). Avatarify Python requires manually downloading and installing some dependencies, and is therefore best suited for users who have some experience with command line applications. [Avatarify Desktop](https://github.com/alievk/avatarify-desktop), which aims to be easier to install and use, is recommended for most users. If you still want to use Avatarify Python, proceed to the [install instructions](docs/). Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first-order-model). -**Open Avatarify is not affiliated with Avatarify Inc.** +**Avatarify Python is not affiliated with Avatarify Inc.** ## News - **7 Mar 2021.** Renamed project to Avatarify Python to distinguish it from other versions of Avatarify -- **14 December 2020.** Released Windows GUI app beta. Check it out [here](https://github.com/alievk/avatarify-desktop). +- **14 December 2020.** Released Avatarify Desktop. Check it out [here](https://github.com/alievk/avatarify-desktop). - **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! - **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! - **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify-python/wiki/Remote-GPU). From 13b6fb1b2be70b88ece68bbb6cb068563e250f50 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 3 Apr 2021 19:04:33 +0300 Subject: [PATCH 52/64] Update README.md --- docs/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/README.md b/docs/README.md index a1fed5a66..7aa98130d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,3 +1,9 @@ +[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) + +:arrow_forward: [Demo](https://youtu.be/Q7LFDT-FRzs) + +:arrow_forward: [AI-generated Elon Musk](https://youtu.be/lONuXGNqLO0) + ## Table of Contents - [Requirements](#requirements) - [Install](#install) From ebf350ccf8a6cc9295598311db6838887769be50 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Sat, 3 Apr 2021 19:07:37 +0300 Subject: [PATCH 53/64] fix links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92fcc304e..0db767b69 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Avatarify Python -Photorealistic avatars for video-conferencing [apps](#configure-video-meeting-app). +Photorealistic avatars for video-conferencing. Avatarify Python requires manually downloading and installing some dependencies, and is therefore best suited for users who have some experience with command line applications. [Avatarify Desktop](https://github.com/alievk/avatarify-desktop), which aims to be easier to install and use, is recommended for most users. If you still want to use Avatarify Python, proceed to the [install instructions](docs/). @@ -13,7 +13,7 @@ Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first- ## News - **7 Mar 2021.** Renamed project to Avatarify Python to distinguish it from other versions of Avatarify - **14 December 2020.** Released Avatarify Desktop. Check it out [here](https://github.com/alievk/avatarify-desktop). -- **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! +- **11 July 2020.** Added Docker support. Now you can run Avatarify from Docker on [Linux](https://github.com/alievk/avatarify-python/blob/master/docs/README.md#docker). Thanks to [mikaelhg](https://github.com/mikaelhg) and [mintmaker](https://github.com/mintmaker) for contribution! - **22 May 2020.** Added [Google Colab](https://colab.research.google.com/github/alievk/avatarify/blob/master/avatarify.ipynb) mode. Now you can run Avatarify on any computer without GPU! - **7 May 2020.** Added remote GPU support for all platforms (based on [mynameisfiber's](https://github.com/mynameisfiber) solution). [Demo](https://youtu.be/3Dz_bUIPYFM). Deployment [instructions](https://github.com/alievk/avatarify-python/wiki/Remote-GPU). - **24 April 2020.** Added Windows installation [tutorial](https://www.youtube.com/watch?v=lym9ANVb120). From bda482329706b93e97eb41988130592eae853bc8 Mon Sep 17 00:00:00 2001 From: Christian <38144453+christianll9@users.noreply.github.com> Date: Wed, 4 Aug 2021 18:54:37 +0200 Subject: [PATCH 54/64] Fix folder name 'avatarify' to 'avatarify-python' --- docs/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/README.md b/docs/README.md index 7aa98130d..f873f8015 100644 --- a/docs/README.md +++ b/docs/README.md @@ -63,10 +63,10 @@ bash Miniconda3-latest-Linux-x86_64.sh 2. Clone `avatarify` and install its dependencies (sudo privelege is required): ```bash git clone https://github.com/alievk/avatarify-python.git -cd avatarify +cd avatarify-python bash scripts/install.sh ``` -3. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). +3. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify-python` directory (don't unpack it). #### Mac @@ -86,7 +86,7 @@ We will use [CamTwist](http://camtwiststudio.com) to create virtual camera for M 2. [Download](https://github.com/alievk/avatarify-python/archive/master.zip) and unpack the repository or use `git`: ```bash git clone https://github.com/alievk/avatarify-python.git -cd avatarify +cd avatarify-python bash scripts/install_mac.sh ``` 3. Download and install [CamTwist](http://camtwiststudio.com) from [here](http://camtwiststudio.com/download). It's easy. @@ -106,10 +106,10 @@ This guide is tested for Windows 10. 4. Download and install Avatarify (please copy-paste these commands and don't change them): ```bash git clone https://github.com/alievk/avatarify-python.git -cd avatarify +cd avatarify-python scripts\install_windows.bat ``` -5. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify` directory (don't unpack it). +5. [Download network weights](#download-network-weights) and place `vox-adv-cpk.pth.tar` file in the `avatarify-python` directory (don't unpack it). 6. Run `run_windows.bat`. If installation was successful, two windows "cam" and "avatarify" will appear. Leave these windows open for the next installation steps. 7. Install [OBS Studio](https://obsproject.com/) for capturing Avatarify output. 8. Install [VirtualCam plugin](https://obsproject.com/forum/resources/obs-virtualcam.539/). Choose `Install and register only 1 virtual camera`. @@ -132,7 +132,7 @@ Docker images are only availabe on Linux. 3. Clone `avatarify` and install its dependencies (v4l2loopback kernel module): ```bash git clone https://github.com/alievk/avatarify-python.git -cd avatarify +cd avatarify-python bash scripts/install_docker.sh ``` 4. Build the Dockerfile: From 33d517d76914957a413d892bbc8e4a9906115076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Aires=20Rast=C3=A9n?= Date: Thu, 5 Aug 2021 10:25:31 +0200 Subject: [PATCH 55/64] Update Dockerfile to use new repository name --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index feafffb9b..57cace115 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ARG FACE_ALIGNMENT_GIT="git+https://github.com/1adrianb/face-alignment" ARG AVATARIFY_COMMIT="a300fcaadb6a6964e69d4a90db9e7d72bb87e791" ARG FOMM_COMMIT="efbe0a6f17b38360ff9a446fddfbb3ce5493534c" -RUN git clone https://github.com/alievk/avatarify.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ +RUN git clone https://github.com/alievk/avatarify-python.git /app/avatarify && cd /app/avatarify && git checkout ${AVATARIFY_COMMIT} \ && git clone https://github.com/alievk/first-order-model.git /app/avatarify/fomm && cd /app/avatarify/fomm && git checkout ${FOMM_COMMIT} WORKDIR /app/avatarify From 2f0aa2da025334f5bffe27fd6324031905b19447 Mon Sep 17 00:00:00 2001 From: Christian <38144453+christianll9@users.noreply.github.com> Date: Tue, 10 Aug 2021 18:08:55 +0200 Subject: [PATCH 56/64] Further name changing --- docs/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index f873f8015..b9c5c2055 100644 --- a/docs/README.md +++ b/docs/README.md @@ -129,7 +129,7 @@ Docker images are only availabe on Linux. 1. Install Docker following the [Documentation](https://docs.docker.com/engine/install/). Then run this [step](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to make docker available for your user. 2. For using the gpu (hardly recommended): Install nvidia drivers and [nvidia docker](https://github.com/NVIDIA/nvidia-docker#quickstart). -3. Clone `avatarify` and install its dependencies (v4l2loopback kernel module): +3. Clone `avatarify-python` and install its dependencies (v4l2loopback kernel module): ```bash git clone https://github.com/alievk/avatarify-python.git cd avatarify-python @@ -137,7 +137,7 @@ bash scripts/install_docker.sh ``` 4. Build the Dockerfile: ```bash -cd avatarify +cd avatarify-python docker build -t avatarify . ``` ## Setup avatars From d2fd24706d4eba19a97719061d5af48953b49c31 Mon Sep 17 00:00:00 2001 From: 645775992 <645775992@qq.com> Date: Fri, 11 Nov 2022 10:52:34 +0800 Subject: [PATCH 57/64] update pyyaml 5.3.1 to 5.4 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a602caba5..4a5e10f73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,6 @@ opencv-python==4.2.0.34 face-alignment==1.3.3 pyzmq==20.0.0 msgpack-numpy==0.4.7.1 -pyyaml==5.3.1 +pyyaml==5.4 requests==2.25.1 pyfakewebcam==0.1.0 \ No newline at end of file From 7307581bfea5f984e0c6875831affaa5d68c28a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 23:19:58 +0000 Subject: [PATCH 58/64] Bump requests from 2.23 to 2.31.0 Bumps [requests](https://github.com/psf/requests) from 2.23 to 2.31.0. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.23.0...v2.31.0) --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- requirements_client.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4a5e10f73..c6eecaa24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ face-alignment==1.3.3 pyzmq==20.0.0 msgpack-numpy==0.4.7.1 pyyaml==5.4 -requests==2.25.1 +requests==2.31.0 pyfakewebcam==0.1.0 \ No newline at end of file diff --git a/requirements_client.txt b/requirements_client.txt index e2c5ae880..7528206c6 100644 --- a/requirements_client.txt +++ b/requirements_client.txt @@ -1,6 +1,6 @@ numpy==1.15.0 PyYAML==5.1 -requests==2.23 +requests==2.31.0 msgpack-numpy==0.4.5 pyzmq==19.0.0 opencv-python==3.4.5.20 From 44d8e2b5685ca41f54f0e3405bb3ba2a73628721 Mon Sep 17 00:00:00 2001 From: George Korepanov Date: Wed, 2 Aug 2023 21:10:47 +0300 Subject: [PATCH 59/64] Update S3 links to new location (#636) * Update s3 link in download data script * Update S3 link in README --- docs/README.md | 2 +- scripts/download_data.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index b9c5c2055..cafdab79d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -50,7 +50,7 @@ Of course, you also need a webcam! ## Install #### Download network weights -Download model's weights from [here](https://openavatarify.s3.amazonaws.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] +Download model's weights from [here](https://openavatarify.s3-avatarify.com/weights/vox-adv-cpk.pth.tar) or [here](https://yadi.sk/d/M0FWpz2ExBfgAA) or [here](https://drive.google.com/file/d/1coUCdyRXDbpWnEkA99NLNY60mb9dQ_n3/view?usp=sharing) [228 MB, md5sum `8a45a24037871c045fbb8a6a8aa95ebc`] #### Linux Linux uses `v4l2loopback` to create virtual camera. diff --git a/scripts/download_data.sh b/scripts/download_data.sh index 4bcc96249..a65f588df 100755 --- a/scripts/download_data.sh +++ b/scripts/download_data.sh @@ -2,7 +2,7 @@ filename=vox-adv-cpk.pth.tar -curl https://openavatarify.s3.amazonaws.com/weights/$filename -o $filename +curl https://openavatarify.s3-avatarify.com/weights/$filename -o $filename echo "Expected checksum: 8a45a24037871c045fbb8a6a8aa95ebc" From 2ede21dab7eb3f7e24848980787184b942b43b7d Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 29 Sep 2023 18:05:40 +0300 Subject: [PATCH 60/64] Apps (#666) * Add files via upload * Update README.md --- README.md | 6 ++++++ docs/appstore-badge.png | Bin 0 -> 4714 bytes docs/google-play-badge.png | Bin 0 -> 14220 bytes 3 files changed, 6 insertions(+) create mode 100644 docs/appstore-badge.png create mode 100644 docs/google-play-badge.png diff --git a/README.md b/README.md index 0db767b69..ceae0a88e 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,9 @@ Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first- - **15 April 2020.** Added [StyleGAN-generated](https://www.thispersondoesnotexist.com) avatars. Just press `Q` and now you drive a person that never existed. Every time you push the button – new avatar is sampled. - **13 April 2020.** Added Windows support (kudos to [9of9](https://github.com/9of9)). +## Avatarify apps + +We have deployed Avatarify on iOS and Android devices using our proprietary inference engine. The iOS version features the Life mode for recording animations in real time. However, the Life mode is not available on Android devices due to the diversity of the devices we have to support. + +[drawing](https://apps.apple.com/app/apple-store/id1512669147?pt=121960189&ct=GitHub&mt=8) +[drawing](https://play.google.com/store/apps/details?id=com.avatarify.android) diff --git a/docs/appstore-badge.png b/docs/appstore-badge.png new file mode 100644 index 0000000000000000000000000000000000000000..8e91eb3bd06fdf9100d62f7fc6295b6e58565d0c GIT binary patch literal 4714 zcmV-w5|!Px#eo#zQMMrQ(deWk^Ea0 z#(j*pBkZB__ALwJKE}7c0@tNzdDqjOjNg5l_MB6+`%2TE-#ujH_l5kSL;fd=;$Fu8 zI^-|8rE*8(wX477F4~$f=~Z2l4_}8To}HZ*h@|d^is^Y%uN_`DG&~nu4Mv@rfLOeT~h;9asE)uyxoTVc_wB1CF6(x*^ z(9YLuS61hU?vEbsbWT}0kk@iTP4U%-OyLvqBM)+QmN4{o`WzE~)Pm&EQh>w?h7*m` ziI7)VN8ap!{J_+s8nbix?SO?VPXZ>1b*Bmy2inM)9wt)PhX?CJTsx67$6D{6rBNSO z%g9^XD-zf3Tn=((#M*QZO-l#KAf)I9o`XurDhp4QeMMt&?ycqXULJt`*~rkom#F4EFDOJky<9e5fc`0K2;BuA>)q2 z;hTPRB|jbRk(l=WGLV-B@@g042dM>E3*P156Ujyej7T1*>4kFj3OUy@Kq3D=25DTo zN+p%N(o6$zC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W+Z<#4ZNPaFCDPdJmf6b sNK@{1vs^4Zu-UW9TP&8Ft+;>x14YhQpwbr*$p8QV07*qoM6N<$g5cIEA^-pY literal 0 HcmV?d00001 diff --git a/docs/google-play-badge.png b/docs/google-play-badge.png new file mode 100644 index 0000000000000000000000000000000000000000..1eaec7543628eedc4dd8bf170c2aa4663aa49238 GIT binary patch literal 14220 zcmbum1ys~u+cr9)DAFPz(kUni149f*Nh4j7BHhi; zo8bSWF9;IwcH2o#*A)W6yNh{UgCwU?Kp@!c)|xs99VJB}Q%8GFV>3q+b52itC(s%K z5f<}wGB&j}N6?#?TUtAaFm5+AGtyg|i7;yODM6K-B+ad?<-A?YHN2HIO}%YR1t|A5j6Jad{d$adC4(G28mv(9HBd z?VQ|P?EX$}X3Ax5XKruqfN%wEx&PDF$;uJo=xXKo|1k7_9{;xqfOwUZ{xiq_xE6c+ z|4iYEkah>#_(vfBV{2DUFDG*@b#qroHy2ZLX?L(pCd_V}gd|4+5Gy0N8T@_|}vgwh4jo+>)1is_B`!ITL`O`klnJQ+k)x zc_W9iOWC)ZV00pPp>yWrZDqU=1z}}t_-caQgUxiG1bg8;5g+RYBS8c7X8O&Z0jx>8 zG6O<8euZ7OhMDqZQbxys0hcL@_x4r`56m{mxpH~$^D#I$nM67Lgo~w4i}m7kC-A|B zJ3@$vH`Gcz*< znBrMW1@__XL7gIHdmaKah~c%4$a|I};$R^m#MzylojYsArAXz+RJJgefEn@jH=6c3 z4epy*x7we z=Cf7R)lJ&F3?rfw4fy#reClw`Zs=z6@BE~eK7qOEBpc7wmZ0l!r+El6EUfRG7OWD7 zq2klaW?KDfyH?QM!q3sn>_%zR>DuR2iN4ezixcYy14BbYg08PucNW?w8a%iTTQHrz zx4=WcIjD`2U zG08JYjvKfVT-se8Rv;r{v7&rTes7al!qgHmW63c{Gv3*lMLk)q&dbZ|a5L@s!!k=w z^!GGV9O@qyeze%0MUh%yPDx!gjF6^nzh5i^F|{^YtbeyT`c^XL$XUp*(TVy}+#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>>ou!od zJHtrAWBpiA^~#=u%;NE~zR0d&CVXN)U3;hJ16RN08K#ZIkd2+4BBg_n_rc0&S^aK) zP>7q=tna=O-|kaD`0COAS1ZJf&o)Z_W%J2W%5`+}V$jk^p+yf0@J8 zU)zUE6hioPX?0Dj`1wqu zQ7aatB^Vp;i*ftSf+BG78N0Z27YH}b}9tC9mtF)T^@rQhLLckYMi{>H0M z;@2T}I5h!DZ*H_xfW+Ma5q`<9`|a4}m1Vf||Q?&*K{A8Bsva2jtYl zsL`k^*P^ameBPF`Oh5x)S_0hsF2|R3E-ck{lfl1xKA4)AU}a}#lV4JT&Eh5qW~ve ziZSNcX=G)E4Vwm|A-z9Ad8om>Va9=%pWmb}nNQx0CmgWsd@sL-->oSIDknIzzjia( z^ZJA5ms@!$4ti-5`hPjrv3P()?0GnCHJk5Qu7Ho(sZT=dyDn(2+S53-O8w8=@&|LYGO*rqWG&8z|VA#ks~Und&*%A5B; zYxyM!%XS7mxPzgD4`xXdJ=fIa1+P!vPH+GH^}$GISJxciGM^3uB8vO!Xcxuq)wPp1 W`D#uo-c*?1%gIYCOO;3%1^+MTr}MP{ literal 0 HcmV?d00001 From 5614719900dafeed139b6edb19c2bcd8d743bfe4 Mon Sep 17 00:00:00 2001 From: Ali Aliev Date: Fri, 29 Sep 2023 18:06:03 +0300 Subject: [PATCH 61/64] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index ceae0a88e..6aa1f64b4 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,6 @@ Avatarify Python requires manually downloading and installing some dependencies, Based on [First Order Motion Model](https://github.com/AliaksandrSiarohin/first-order-model). -**Avatarify Python is not affiliated with Avatarify Inc.** - ## News - **7 Mar 2021.** Renamed project to Avatarify Python to distinguish it from other versions of Avatarify - **14 December 2020.** Released Avatarify Desktop. Check it out [here](https://github.com/alievk/avatarify-desktop). From 17eb8369b543fd835ef541a23875c3902e4d6078 Mon Sep 17 00:00:00 2001 From: Harold Kelvin <106593967+bx70Mk@users.noreply.github.com> Date: Mon, 19 Feb 2024 05:34:29 +0100 Subject: [PATCH 62/64] Update get_ngrok.sh --- scripts/get_ngrok.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/get_ngrok.sh b/scripts/get_ngrok.sh index 99cf01d6e..9a14b722b 100755 --- a/scripts/get_ngrok.sh +++ b/scripts/get_ngrok.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -command -v ./ngrok >/dev/null 2>&1 +# Check if ngrok is installed +command -v ngrok >/dev/null 2>&1 if [[ $? -ne 0 ]]; then - echo ngrok is not found, installing... - wget -q -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip - unzip -qq -n ngrok-stable-linux-amd64.zip - echo Done! + echo "ngrok is not found, installing..." + wget -q -nc https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz + tar -xzf ngrok-v3-stable-linux-amd64.tgz + echo "Done!" fi - From c4abb23be0805b50b107baac32f20890b9d71189 Mon Sep 17 00:00:00 2001 From: Russ Savage Date: Tue, 20 Feb 2024 14:07:48 -0800 Subject: [PATCH 63/64] fix: Adding version to ngrok config in colab notebook the latest ngrok agent requires a version number in the config file. --- avatarify.ipynb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/avatarify.ipynb b/avatarify.ipynb index 826d50ce3..7b15d83b7 100644 --- a/avatarify.ipynb +++ b/avatarify.ipynb @@ -419,6 +419,7 @@ "source": [ "config =\\\n", "f\"\"\"\n", + "version: 2\n", "authtoken: {authtoken}\n", "region: {region}\n", "console_ui: False\n", @@ -649,4 +650,4 @@ "outputs": [] } ] -} \ No newline at end of file +} From bbdac389e6a06349845f154d0461daded14dd4fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 05:26:21 +0000 Subject: [PATCH 64/64] --- updated-dependencies: - dependency-name: requests dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- requirements_client.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c6eecaa24..1e6240df0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ face-alignment==1.3.3 pyzmq==20.0.0 msgpack-numpy==0.4.7.1 pyyaml==5.4 -requests==2.31.0 +requests==2.32.0 pyfakewebcam==0.1.0 \ No newline at end of file diff --git a/requirements_client.txt b/requirements_client.txt index 7528206c6..da8920832 100644 --- a/requirements_client.txt +++ b/requirements_client.txt @@ -1,6 +1,6 @@ numpy==1.15.0 PyYAML==5.1 -requests==2.31.0 +requests==2.32.0 msgpack-numpy==0.4.5 pyzmq==19.0.0 opencv-python==3.4.5.20