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

Next #734

Merged
merged 39 commits into from
Jul 19, 2023
Merged

Next #734

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c6a1387
Fix video frames lower than threads
henryruhs Jun 28, 2023
eca4f0f
Skip target audio (#656)
henryruhs Jun 29, 2023
b104741
Improve return typing
henryruhs Jun 30, 2023
b710cc8
Use face enhancer device according to execution provider
henryruhs Jul 1, 2023
a81e172
Lock face by reference (#679)
henryruhs Jul 2, 2023
542f119
Use sys.exit() over quit()
henryruhs Jul 4, 2023
fb26fbb
Split frame processor error to reduce confusion
henryruhs Jul 4, 2023
89ee0bc
Improve face reference by introducing more CLI args
henryruhs Jul 8, 2023
fb31af0
Prevent AttributeError if face is None
henryruhs Jul 9, 2023
d59c55d
Update dependencies
henryruhs Jul 9, 2023
7529ba6
Move reference creation to process_video
henryruhs Jul 9, 2023
0b178d5
Allow to initialize UI with source path and target path
henryruhs Jul 12, 2023
5d6d438
Allow to initialize UI with source path and target path
henryruhs Jul 12, 2023
a722c3f
Allow to initialize UI with source path and target path
henryruhs Jul 12, 2023
868ea7a
Use onnxruntime-coreml for old MacOS
henryruhs Jul 15, 2023
25b4b6e
Fix typing
henryruhs Jul 15, 2023
98c2869
Fix typing
henryruhs Jul 15, 2023
9869b96
Fix typing
henryruhs Jul 15, 2023
ead12e3
Temp fix for enhancer
henryruhs Jul 15, 2023
a01dd98
Temp fix for enhancer
henryruhs Jul 15, 2023
671a5c8
Keyboard bindings to change reference face via Up/Down
henryruhs Jul 15, 2023
f38239e
Fix slow preview
henryruhs Jul 15, 2023
9aa5023
ignore
henryruhs Jul 15, 2023
0bb4f7f
Update README and ISSUE TEMPLATES
henryruhs Jul 16, 2023
855b8e2
Right/Left to update frames by +10/-10
henryruhs Jul 16, 2023
e1d7f00
Fix fps mismatch
henryruhs Jul 16, 2023
77cd226
Add fps parameter to extract_frames()
henryruhs Jul 16, 2023
14208e8
Minor wording cosmetics
henryruhs Jul 16, 2023
56dbf66
Improve enhancer performance by using cropped face
henryruhs Jul 17, 2023
663439f
Fix suggested threads and memory
henryruhs Jul 17, 2023
61b5090
Extract frames with FPS output
henryruhs Jul 18, 2023
a93af16
Remove default max-memory
henryruhs Jul 18, 2023
fffdef9
Remove release_resources() as it does not work
henryruhs Jul 18, 2023
b343214
Ignore torch import
henryruhs Jul 18, 2023
5cfa5a1
Add drag and drop for source and target
henryruhs Jul 19, 2023
c3d922f
Fix typing
henryruhs Jul 19, 2023
7c63281
Bump version
henryruhs Jul 19, 2023
2117292
Limit Left/Right binding to videos
henryruhs Jul 19, 2023
0822848
Add key binding hits to preview
henryruhs Jul 19, 2023
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 .flake8
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[flake8]
select = E3, E4, F
per-file-ignores = roop/core.py:E402
per-file-ignores = roop/core.py:E402,F401
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Bug
about: Report a bug
title: '[Bug]'
labels: 'bug'

---

## Description

A concise description of the bug and how to reproduce it.

## Error

Paste the error or exception from your console:

```

```

## Details

What operating system are you using?

- [ ] Windows
- [ ] MacOS (Apple Silicon)
- [ ] MacOS (Apple Legacy)
- [ ] Linux
- [ ] Linux in WSL

What execution provider are you using?

- [ ] CPU
- [ ] CUDA
- [ ] CoreML
- [ ] DirectML
- [ ] OpenVINO
- [ ] Other

What version of Roop are you using?

- [ ] 1.0.0
- [ ] 1.1.0
- [ ] next
39 changes: 0 additions & 39 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Installation
about: Platform and installation issues
title: '[Installation]'
labels: 'installation'

---

Please **DO NOT OPEN** platform and installation issues!

- Check the [troubleshooting](https://github.com/s0md3v/roop/wiki/4.-Troubleshooting) that covers many issues.
- Join our helpful community on [Discord](https://discord.gg/Y9p4ZQ2sB9) for instant help.
11 changes: 0 additions & 11 deletions .github/ISSUE_TEMPLATE/suggestion.md

This file was deleted.

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ You can watch some demos [here](https://drive.google.com/drive/folders/1KHv8n_rd
## Disclaimer
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.

The developers of this software are aware of its possible unethical applicaitons and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.
The developers of this software are aware of its possible unethical applications and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.

Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.

## How do I install it?

**Issues regarding installation will be closed from now on, we cannot handle the amount of requests.**
### Basic

- **Basic:** It is more likely to work on your computer but it will also be very slow. You can follow instructions for the basic install [here](https://github.com/s0md3v/roop/wiki/1.-Installation).
It is more likely to work on your computer but it will also be very slow. You can follow instructions for the basic install [here](https://github.com/s0md3v/roop/wiki/1.-Installation).

- **Acceleration:** If you have a good GPU and are ready for solving any software issues you may face, you can enable GPU which is wayyy faster. To do this, first follow the basic install instructions given above and then follow GPU-specific instructions [here](https://github.com/s0md3v/roop/wiki/2.-Acceleration).
### Acceleration

If you have a good GPU and are ready for solving any software issues you may face, you can enable GPU which is wayyy faster. To do this, first follow the basic install instructions given above and then follow GPU-specific instructions [here](https://github.com/s0md3v/roop/wiki/2.-Acceleration).

## How do I use it?
> Note: When you run this program for the first time, it will download some models ~300MB in size.

Executing `python run.py` command will launch this window:

![gui-demo](gui-demo.png)

Choose a face (image with desired face) and the target image/video (image/video in which you want to replace the face) and click on `Start`. Open file explorer and navigate to the directory you select your output to be in. You will find a directory named `<video_title>` where you can see the frames being swapped in realtime. Once the processing is done, it will create the output file. That's it.
Expand All @@ -36,10 +38,13 @@ options:
-t TARGET_PATH, --target TARGET_PATH select an target image or video
-o OUTPUT_PATH, --output OUTPUT_PATH select output file or directory
--frame-processor FRAME_PROCESSOR [FRAME_PROCESSOR ...] frame processors (choices: face_swapper, face_enhancer, ...)
--keep-fps keep original fps
--keep-audio keep original audio
--keep-fps keep target fps
--keep-frames keep temporary frames
--skip-audio skip target audio
--many-faces process every face
--reference-face-position REFERENCE_FACE_POSITION position of the reference face
--reference-frame-number REFERENCE_FRAME_NUMBER number of the reference frame
--similar-face-distance SIMILAR_FACE_DISTANCE face distance used for recognition
--video-encoder {libx264,libx265,libvpx-vp9} adjust output video encoder
--video-quality [0-51] adjust output video quality
--max-memory MAX_MEMORY maximum amount of RAM in GB
Expand Down
Binary file modified gui-demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions requirements-ci.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
numpy==1.23.5
opencv-python==4.7.0.72
opencv-python==4.8.0.74
onnx==1.14.0
insightface==0.7.3
psutil==5.9.5
tk==0.1.0
customtkinter==5.1.3
customtkinter==5.2.0
tkinterdnd2==0.3.0
torch==2.0.1
torchvision==0.15.2
onnxruntime==1.15.0
tensorflow==2.12.0
tensorflow==2.13.0
opennsfw2==0.10.2
protobuf==4.23.2
protobuf==4.23.4
tqdm==4.65.0
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
--extra-index-url https://download.pytorch.org/whl/cu118

numpy==1.23.5
opencv-python==4.7.0.72
opencv-python==4.8.0.74
onnx==1.14.0
insightface==0.7.3
psutil==5.9.5
tk==0.1.0
customtkinter==5.1.3
pillow==9.5.0
customtkinter==5.2.0
tkinterdnd2==0.3.0
pillow==10.0.0
torch==2.0.1+cu118; sys_platform != 'darwin'
torch==2.0.1; sys_platform == 'darwin'
torchvision==0.15.2+cu118; sys_platform != 'darwin'
torchvision==0.15.2; sys_platform == 'darwin'
onnxruntime==1.15.0; sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-coreml==1.13.1; sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-silicon==1.13.1; sys_platform == 'darwin' and platform_machine == 'arm64'
onnxruntime-gpu==1.15.0; sys_platform != 'darwin'
tensorflow==2.13.0rc1; sys_platform == 'darwin'
tensorflow==2.12.0; sys_platform != 'darwin'
tensorflow==2.13.0
opennsfw2==0.10.2
protobuf==4.23.2
protobuf==4.23.4
tqdm==4.65.0
gfpgan==1.3.8
6 changes: 4 additions & 2 deletions roop/capturer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import Any
from typing import Optional
import cv2

from roop.typing import Frame

def get_video_frame(video_path: str, frame_number: int = 0) -> Any:

def get_video_frame(video_path: str, frame_number: int = 0) -> Optional[Frame]:
capture = cv2.VideoCapture(video_path)
frame_total = capture.get(cv2.CAP_PROP_FRAME_COUNT)
capture.set(cv2.CAP_PROP_POS_FRAMES, min(frame_total, frame_number - 1))
Expand Down
Loading
Loading