You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-43Lines changed: 35 additions & 43 deletions
Original file line number
Diff line number
Diff line change
@@ -22,49 +22,20 @@ The tasks that I aim to accomplish here are:
22
22
## How do I install it?
23
23
24
24
The basic installation instructions for now are the same as those in the [s0md3v/roop](https://github.com/s0md3v/roop#how-do-i-install-it), check them out.
25
-
In short, you need to install python 3.9 or a later version, VC runtimes, and desired Execution Provider kit (depending on your hardware and OS).
25
+
In short, you need to install python 3.10 or a later version, VC runtimes, and desired Execution Provider kit (depending on your hardware and OS).
26
+
Then you need to install required python packages by running `pip install -r requirements.txt`. Installation result may vary, depending on your system, but in the most cases it should be installed successfully. Otherwise, get a look to the command output, usually you may fix minor issues (like version requirements change) by yourself.
27
+
28
+
If nothing helps, feel free to create an issue with your problem, we will try to figure it out.
26
29
27
30
## How do I use it?
28
31
29
-
Go to application folder and run `python run.py` with desired set of command-line parameters (or just pick one of the [example](#command-line-usage-examples) and make changes to suit your need).
30
-
31
-
Here is the list of all possible command-line parameters.
32
-
*`--source`: the image file containing a face, which will be used for deepfake magic.
33
-
*`--target`: an image, a video file, or a directory with PNG images for processing.
34
-
*`--output`: a path (either a file or a directory) to save the processing result. If not provided, the resulting file will be saved near the target with an automatically generated filename.
35
-
*`--frame-processor`: the frame processor module or modules that you want to apply to your files. See the [built-in frame processors](#built-in-frame-processors) section for the list of built-in modules and their possibilities.
36
-
*`--frame-handler`: a module to handle the `target`. In the most cases, you should omit that parameter (sinner will figure it out itself).
37
-
*`--fps`: the parameter to set the frames per second (FPS) in the resulting video. If not provided, the resulting video's FPS will be the same as the `target`'s video (or 30, if an image directory is used as the `target`).
38
-
*`--keep-audio`: defaults to `true`. Keeps the original audio in the resulting video.
39
-
*`--keep-frames`: defaults to `false`. Keeps processed frames in the `temp-dir` after finishing.
40
-
*`--many-faces`: defaults to `false`. If set to true, every frame processor in the processing chain will apply its magic to every face on every frame of the `target`. If set to `false`, only one face (the first one found, no heavy logic here) will be processed.
41
-
*`--max-memory`: defaults to `4` for Mac and `16` for any other platforms. The maximum amount of gigabytes of RAM that will be allowed for sinner use.
42
-
**Note 1**: AI processing usually requires a significant amount of RAM. While processing, you will see the memory usage statistics, and the `MEM LIMIT REACHED` statistics indicate a lack of RAM.
43
-
**Note 2**: This parameter does not affect the amount of used video RAM if a GPU-accelerated `execution-provider` is used.
44
-
*`--execution-provider`: defaults to `cpu`. This parameter specifies what kind of driver should be used to produce AI magic, and it depends on what your hardware and software capabilities. The `cpu` provider should fit as a basic choice, but any GPU-accelerated option is worth trying.
45
-
*`--execution-threads`: defaults to `1`. Configures the count of parallel simultaneous processing tasks. This value heavily depends on your hardware capabilities — how many computing cores it has, and what amount of memory it can use. Let's say, you have a CPU with 32 cores — so you can set `--execution-threads=32` and `--execution-provider=cpu` to use all its computing powers. In another case, a GPU with thousands of CUDA cores, will probably be much faster in total, but one thread will also require a lot of those cores to work with. For that case, I recommend doing some experiments, or waiting until the benchmark mode is implemented in sinner.
46
-
*`--extract-frames`: defaults to `false`. If set to true, all frames from the `target` will be extracted to a temporary folder as a sequence of PNG files right before processing. If set to false, every frame will be extracted to a memory only by a processor module's request. The first way requires some disk space for temporary frames, the second way might be a little slower in some cases.
47
-
*`--temp-dir`: defaults to the `temp` subdirectory in the application directory. A way to provide a directory, where processed (and, in the case of `--in-memory=false`, extracted too) frames will be saved.
48
-
*`--benchmark`: runs a benchmark on a selected `frame-processor` to determine the optimal value for the execution-threads parameter. Additionally, you can specify the `--execution-provider` parameter to choose a specific execution provider (if not provided, all available providers will be tried in sequence). Furthermore, you have the option to specify the `--source` and `--target` parameters to use custom files during the benchmark (if not provided, default test files will be used).
49
-
*`--gui`: starts in GUI mode (experimental).
50
-
51
-
**FrameResizer:**
52
-
*`--scale`: Scales output frames to certain float value. Example: `--scale=0.5` will halve frame in both size and `--scale=2` will zoom it twice.
53
-
*`--height`: Set output frames height to this integer value, the width also will be scaled proportional.
54
-
*`--width`: Set output frames width to this integer value, the height also will be scaled proportional.
55
-
*`--height-max`: Set output frames height to this integer value, but only if current frame height is greater. The width also will be scaled proportional.
56
-
*`--width-max`: Set output frames width to this integer value, but only if current frame width is greater. The width also will be scaled proportional.
57
-
*`--height-max`: Set output frames height to this integer value, but only if current frame height is smaller. The width also will be scaled proportional.
58
-
*`--width-max`: Set output frames width to this integer value, but only if current frame width is smaller. The width also will be scaled proportional.
59
-
**Note**: The size keys priority is: all `height` keys will be used in the first place; if they skipped, then all `width` keys will be used; and if no `height` or `width` keys are provided, then `scale` key is used.
60
-
61
-
**FaceEnhancer:**
62
-
*`--upscale`: Scales output frames to certain float value. Example: `--scale=0.5` will halve frame in both size and `--scale=2` will zoom it twice.
63
-
**Note**: You can combine this parameter with `FrameResizer` scaling possibilities. As example:
Thus, all frames will be halved before enhancing, and restored to original size with FaceEnhancer with its magic. The profit is that the processing of smaller frames can be faster.
32
+
Go to application folder and run `python sin.py` with desired set of command-line parameters (or just pick one of [examples](#command-line-usage-examples) and make changes to suit your need).
33
+
34
+
You can get the list of all available command-line parameters by running the program with `--h` or `--help` keys. Those commands will list all configurable modules and their supported parameters.
35
+
1
36
+
Some modules may have the same parameters. It is okay: those parameters (and its values) are shared. It is also okay, if parameters expected values are different between modules: usually, they will be harmonized in runtime. But if something goes wrong, you will get an explicit error message.
37
+
38
+
Also, you can read about modules parameters [here](/docs/modules.md)
68
39
69
40
## Built-in frame processors
70
41
@@ -74,26 +45,47 @@ you want to use, and provide them with some sources to work on. Here is the list
74
45

75
46
-`FaceEnhancer`: performs face restoration and enhances the quality of the `target`. The processor is based on the libraries of the [ARC Lab GFPGAN project](https://github.com/TencentARC/GFPGAN).
76
47

48
+
-`FrameExtractor`: use this processor in the processing chain when using video file as the target to force sinner extract frames to a temporary folder as a sequence of PNG files. If not used, every frame will be extracted into the memory by a processor module's request. The first way requires some disk space for temporary frames, the second way might be a little slower in some cases.
77
49
-`FrameResizer`: resizes frames to certain size.
78
50
-`DummyProcessor`: literally does nothing; it is just a test tool.
Swap one face on the `d:\pictures\other_cool_photo.jpg` picture to face from the `d:\pictures\cool_photo.jpg` picture and save resulting image to `d:\pictures\cool_photo_other_cool_photo.png` (autogenerated name).
Swap all faces on the `d:\videos\not_a_porn.mp4` video file to the face from `d:\pictures\cool_photo.jpg` and enhance all faces quality, both processing will be made using the `cuda` provider, and result will be saved to the `d:\results\result.mp4`.
Enhance all faces in every PNG file in the `d:\pictures\pngs_dir` directory using the `cuda` provider and 8 simultaneous execution threads, with limit of 24 Gb RAM, and save every enhanced image to the `d:\pictures\pngs_dir\enhanced` directory.<br/>
94
66
**Note 1**: only PNG images are supported at the moment.<br/>
95
67
**Note 2**: even if the selected frame processor does not require a `source`, you should provide one at this time.
96
68
69
+
## Configuration file
70
+
71
+
You can store commonly used options in the configuration file, to make them apply on every run by default. Just edit `sinner.ini` file in the application directory and add desired parameters inside the `[sinner]` section as key-value pairs.
72
+
73
+
Example:
74
+
```ini
75
+
[sinner]
76
+
keep-frames=1
77
+
many-faces=1
78
+
execution-provider=gpu
79
+
execution-threads=2
80
+
```
81
+
82
+
Any parameter set from command line will override corresponding parameter from the ini file.
83
+
84
+
You also can pass path to the custom configuration file as a command line parameter:
85
+
```cmd
86
+
python sin.py --ini="d:\path\custom.ini"
87
+
```
88
+
97
89
## FAQ
98
90
99
91
:question: What are the differences between sinner and roop?<br/>
0 commit comments