Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphical interface for dot #85

Merged
merged 18 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_dot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
build-and-test:
if: github.event.pull_request.draft == false
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
code-check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Code Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
args: [--max-line-length=150, --extend-ignore=E203]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]
Expand Down
23 changes: 12 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Update readme by @giorgiop in https://github.com/sensity-ai/dot/pull/6
* Add more press on README.md by @giorgiop in https://github.com/sensity-ai/dot/pull/7
* [ImgBot] Optimize images by @imgbot in https://github.com/sensity-ai/dot/pull/8
* Update README to Download Models from Github Release Binaries by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/19
* Update README + Add Github Templates by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/16
* Verify camera ID when running dot in camera mode by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/18
* Add Feature to Use Config Files by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/17
* Update README to Download Models from Github Release Binaries by @ajndkr in https://github.com/sensity-ai/dot/pull/19
* Update README + Add Github Templates by @ajndkr in https://github.com/sensity-ai/dot/pull/16
* Verify camera ID when running dot in camera mode by @ajndkr in https://github.com/sensity-ai/dot/pull/18
* Add Feature to Use Config Files by @ajndkr in https://github.com/sensity-ai/dot/pull/17
* ⬆️ Bump numpy from 1.21.1 to 1.22.0 by @dependabot in https://github.com/sensity-ai/dot/pull/25
* Update python version to 3.8 by @vassilispapadop in https://github.com/sensity-ai/dot/pull/28
* Requirements changes now trigger CI by @giorgiop in https://github.com/sensity-ai/dot/pull/27
* Fix python3.8 pip cache location in CI by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/29
* Fix `--save_folder` CLI Option by @vassilispapadop and @ghassen1302 in https://github.com/sensity-ai/dot/pull/26
* Add contributors list by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/31
* Add Google Colab demo notebook by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/33
* Speed up SimSwap's `reverse2original` by @AjinkyaIndulkar and @ghassen1302 in https://github.com/sensity-ai/dot/pull/20
* Add `bumpversion` for semantic versioning by @AjinkyaIndulkar in https://github.com/sensity-ai/dot/pull/34
* Fix python3.8 pip cache location in CI by @ajndkr in https://github.com/sensity-ai/dot/pull/29
* Fix `--save_folder` CLI Option by @vassilispapadop and @Ghassen-Chaabouni in https://github.com/sensity-ai/dot/pull/26
* Add contributors list by @ajndkr in https://github.com/sensity-ai/dot/pull/31
* Add Google Colab demo notebook by @ajndkr in https://github.com/sensity-ai/dot/pull/33
* Speed up SimSwap's `reverse2original` by @ajndkr and @Ghassen-Chaabouni in https://github.com/sensity-ai/dot/pull/20
* Add `bumpversion` for semantic versioning by @ajndkr in https://github.com/sensity-ai/dot/pull/34
* Update README with speed metrics by @giorgiop in https://github.com/sensity-ai/dot/pull/37
* Add a Graphical interface for dot by @Ghassen-Chaabouni in https://github.com/sensity-ai/dot/pull/85

## New Contributors
* @giorgiop made their first contribution in https://github.com/sensity-ai/dot/pull/6
* @ghassen1302 made their first contribution in https://github.com/sensity-ai/dot/pull/6
* @imgbot made their first contribution in https://github.com/sensity-ai/dot/pull/8
* @AjinkyaIndulkar made their first contribution in https://github.com/sensity-ai/dot/pull/19
* @ajndkr made their first contribution in https://github.com/sensity-ai/dot/pull/19
* @dependabot made their first contribution in https://github.com/sensity-ai/dot/pull/25
* @vassilispapadop made their first contribution in https://github.com/sensity-ai/dot/pull/28

Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,33 @@ pip install -e .

### Running dot

#### Graphical interface
Ghassen-Chaabouni marked this conversation as resolved.
Show resolved Hide resolved

To use the graphical interface of dot run

```bash
conda activate dot
Ghassen-Chaabouni marked this conversation as resolved.
Show resolved Hide resolved
dot-ui
```

Usage example:

1. Specify the source image in the field `source`.
2. Specify the camera id number in the field `target`. In most cases, `0` is the correct camera id.
3. Specify the config file in the field `config_file`. Select a default configuration from the dropdown list or use a custom file.
4. (Optional) Check the field `use_gpu` to use the GPU.
5. Click on the `RUN` button to start the deepfake.

For more information about each field, click on the menu `Help/Usage`.

Watch the following demo video for better understanding of the interface

<p align="center">
<img src="./assets/gui_dot_demo.gif" width="500" height="406"/>
</p>
Ghassen-Chaabouni marked this conversation as resolved.
Show resolved Hide resolved

#### CLI

Run `dot --help` to get a full list of available options.

1. Simswap
Expand Down
Binary file added assets/gui_dot_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 15 additions & 7 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt --strip-extras setup.cfg
#
absl-py==1.1.0
# via mediapipe
asttokens==2.0.5
# via stack-data
atomicwrites==1.4.1
# via pytest
attrs==21.4.0
# via
# mediapipe
Expand All @@ -30,10 +32,20 @@ click==8.0.2
# via
# black
# dot (setup.cfg)
colorama==0.4.6
# via
# click
# ipython
# pytest
# tqdm
coverage==6.4.2
# via pytest-cov
customtkinter==5.2.0
# via dot (setup.cfg)
cycler==0.11.0
# via matplotlib
darkdetect==0.8.0
# via customtkinter
decorator==5.1.1
# via
# ipdb
Expand Down Expand Up @@ -68,7 +80,7 @@ ipython==8.10.0
# via
# dot (setup.cfg)
# ipdb
isort==5.9.3
isort==5.12.0
# via dot (setup.cfg)
jedi==0.18.1
# via ipython
Expand Down Expand Up @@ -130,8 +142,6 @@ parso==0.8.3
# via jedi
pathspec==0.9.0
# via black
pexpect==4.8.0
# via ipython
pickleshare==0.7.5
# via ipython
pillow==9.3.0
Expand All @@ -156,8 +166,6 @@ protobuf==3.20.2
# dot (setup.cfg)
# mediapipe
# onnxruntime
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.2
# via stack-data
py==1.11.0
Expand Down
24 changes: 22 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile setup.cfg
#
Expand All @@ -14,10 +14,21 @@ chardet==4.0.0
# via requests
click==8.0.2
# via dot (setup.cfg)
colorama==0.4.6
# via
# click
# pytest
# tqdm
customtkinter==5.2.0
# via dot (setup.cfg)
cycler==0.11.0
# via matplotlib
darkdetect==0.8.0
# via customtkinter
dlib==19.19.0
# via dot (setup.cfg)
exceptiongroup==1.1.2
# via pytest
face-alignment==1.3.3
# via dot (setup.cfg)
flatbuffers==2.0
Expand All @@ -28,6 +39,8 @@ idna==2.10
# via requests
imageio==2.19.3
# via scikit-image
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.3
# via matplotlib
kornia==0.6.5
Expand Down Expand Up @@ -72,6 +85,7 @@ packaging==21.3
# via
# kornia
# matplotlib
# pytest
# scikit-image
pillow==9.3.0
# via
Expand All @@ -80,6 +94,8 @@ pillow==9.3.0
# matplotlib
# scikit-image
# torchvision
pluggy==1.2.0
# via pytest
protobuf==3.20.2
# via
# dot (setup.cfg)
Expand All @@ -89,6 +105,8 @@ pyparsing==3.0.9
# via
# matplotlib
# packaging
pytest==7.4.0
# via dot (setup.cfg)
python-dateutil==2.8.2
# via matplotlib
pywavelets==1.3.0
Expand All @@ -112,6 +130,8 @@ six==1.16.0
# python-dateutil
tifffile==2022.5.4
# via scikit-image
tomli==2.0.1
# via pytest
torch==1.9.0
# via
# dot (setup.cfg)
Expand Down
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ install_requires =
scipy
torch
torchvision
customtkinter
pytest

[options.extras_require]
dev =
Expand All @@ -53,7 +55,7 @@ dev =
flake8
ipdb
ipython
isort
isort==5.12.0
pre-commit
pytest
pytest-cov
Expand All @@ -65,3 +67,4 @@ where = src
[options.entry_points]
console_scripts =
dot = dot.__main__:main
dot-ui = dot.ui.ui:main
4 changes: 3 additions & 1 deletion src/dot/faceswap_cv2/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
)

# define globals
CACHED_PREDICTOR_PATH = "./assets/models/shape_predictor_68_face_landmarks.dat"
CACHED_PREDICTOR_PATH = (
"./saved_models/faceswap_cv/shape_predictor_68_face_landmarks.dat"
)


class Swap:
Expand Down
Loading