mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-06 04:52:13 -07:00
修正小問題與加上設定檔機制。
This commit is contained in:
parent
cd83f6fedf
commit
a50ea84b3d
5 changed files with 82 additions and 6 deletions
56
.vscode/launch.json
vendored
56
.vscode/launch.json
vendored
|
@ -3,7 +3,8 @@
|
|||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
|
||||
"name": "DFL train TEST",
|
||||
|
@ -21,6 +22,59 @@
|
|||
"--model-dir", "${env:WORKSPACE}\\model",
|
||||
"--model", "TEST"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DFL train",
|
||||
"subProcess": true,
|
||||
"justMyCode": true,
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "D:\\DeepFaceLab\\_internal\\DeepFaceLab\\main.py",
|
||||
"python": "D:\\DeepFaceLab\\_internal\\python-3.6.8\\python.exe",
|
||||
"cwd": "D:\\DeepFaceLab\\workspace",
|
||||
"console": "integratedTerminal",
|
||||
"gevent": true,
|
||||
"args": ["train",
|
||||
"--training-data-src-dir", "D:\\DeepFaceLab\\workspace\\data_src\\aligned",
|
||||
"--training-data-dst-dir", "D:\\DeepFaceLab\\workspace\\data_dst\\aligned",
|
||||
"--model-dir", "D:\\DeepFaceLab\\workspace\\model",
|
||||
"--model", "SAEHD"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "DFL merge",
|
||||
"subProcess": true,
|
||||
"justMyCode": true,
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "D:\\DeepFaceLab\\_internal\\DeepFaceLab\\main.py",
|
||||
"python": "D:\\DeepFaceLab\\_internal\\python-3.6.8\\python.exe",
|
||||
"cwd": "D:\\DeepFaceLab\\workspace",
|
||||
"console": "integratedTerminal",
|
||||
"gevent": true,
|
||||
"args": ["merge",
|
||||
"--input-dir", "data_dst",
|
||||
"--output-dir", "data_dst\\merged",
|
||||
"--output-mask-dir", "..\\_internal\\__delete",
|
||||
"--aligned-dir", "data_dst\\aligned",
|
||||
"--model-dir", "model",
|
||||
"--model", "SAEHD",
|
||||
"--force-model-name", "df-ud",
|
||||
"--force-gpu-idxs", "0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Auto DFL",
|
||||
"subProcess": true,
|
||||
"justMyCode": true,
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "D:\\DeepFaceLab\\_internal\\DeepFaceLab\\autodfl.py",
|
||||
"python": "D:\\DeepFaceLab\\_internal\\python-3.6.8\\python.exe",
|
||||
"cwd": "D:\\DeepFaceLab\\_internal\\DeepFaceLab",
|
||||
"console": "integratedTerminal",
|
||||
"gevent": true,
|
||||
"args": []
|
||||
}
|
||||
]
|
||||
}
|
10
autodfl.py
Normal file
10
autodfl.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
import ymauto.MergeDefault as MD
|
||||
|
||||
md = MD.MergeArgs("config.json")
|
||||
|
||||
print(md.g("sandy", "name"))
|
||||
print(md.g("beauty", "deep", "gender"))
|
||||
# print(md.g("version1"))
|
||||
# print(md.g("deep", "method"))
|
||||
# print(md.g("deep", "methoda", "PP"))
|
||||
# print([v + '真神' for v in md.g("array")])
|
2
main.py
2
main.py
|
@ -173,7 +173,7 @@ if __name__ == "__main__":
|
|||
output_path = Path(arguments.output_dir),
|
||||
output_mask_path = Path(arguments.output_mask_dir),
|
||||
aligned_path = Path(arguments.aligned_dir) if arguments.aligned_dir is not None else None,
|
||||
force_gpu_idxs = arguments.force_gpu_idxs,
|
||||
force_gpu_idxs = [ int(x) for x in arguments.force_gpu_idxs.split(',') ] if arguments.force_gpu_idxs is not None else None,
|
||||
cpu_only = arguments.cpu_only)
|
||||
|
||||
p = subparsers.add_parser( "merge", help="Merger")
|
||||
|
|
|
@ -16,6 +16,8 @@ from DFLIMG import DFLIMG
|
|||
from facelib import FaceEnhancer, FaceType, LandmarksProcessor, XSegNet
|
||||
from merger import FrameInfo, InteractiveMergerSubprocessor, MergerConfig
|
||||
|
||||
import ymauto.MergeDefault as MD
|
||||
md = MD.MergeArgs('config.json')
|
||||
|
||||
def main (model_class_name=None,
|
||||
saved_models_path=None,
|
||||
|
@ -69,13 +71,19 @@ def main (model_class_name=None,
|
|||
place_model_on_cpu=True,
|
||||
run_on_cpu=run_on_cpu)
|
||||
|
||||
is_interactive = io.input_bool ("Use interactive merger?", True) if not io.is_colab() else False
|
||||
if md.g(None, "interactive") is None:
|
||||
is_interactive = io.input_bool ("Use interactive merger?", True) if not io.is_colab() else False
|
||||
else:
|
||||
is_interactive = md.g(None, "interactive")
|
||||
|
||||
if not is_interactive:
|
||||
cfg.ask_settings()
|
||||
|
||||
subprocess_count = io.input_int("Number of workers?", max(8, multiprocessing.cpu_count()),
|
||||
|
||||
if md.g(None, "subprocess_count") is None:
|
||||
subprocess_count = io.input_int("Number of workers?", max(8, multiprocessing.cpu_count()),
|
||||
valid_range=[1, multiprocessing.cpu_count()], help_message="Specify the number of threads to process. A low value may affect performance. A high value may result in memory error. The value may not be greater than CPU cores." )
|
||||
else:
|
||||
subprocess_count = md.g(4, "subprocess_count")
|
||||
|
||||
input_path_image_paths = pathex.get_image_paths(input_path)
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import copy
|
|||
from facelib import FaceType
|
||||
from core.interact import interact as io
|
||||
|
||||
import ymauto.MergeDefault as MD
|
||||
md = MD.MergeArgs('config.json')
|
||||
|
||||
class MergerConfig(object):
|
||||
TYPE_NONE = 0
|
||||
|
@ -189,12 +191,14 @@ class MergerConfigMasked(MergerConfig):
|
|||
self.bicubic_degrade_power = np.clip ( self.bicubic_degrade_power+diff, 0, 100)
|
||||
|
||||
def ask_settings(self):
|
||||
print("mode: " + md.g('mode'))
|
||||
|
||||
s = """Choose mode: \n"""
|
||||
for key in mode_dict.keys():
|
||||
s += f"""({key}) {mode_dict[key]}\n"""
|
||||
io.log_info(s)
|
||||
mode = io.input_int ("", mode_str_dict.get(self.default_mode, 1) )
|
||||
|
||||
|
||||
self.mode = mode_dict.get (mode, self.default_mode )
|
||||
|
||||
if 'raw' not in self.mode:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue