|
发表于 2024-5-27 17:59:58
|
显示全部楼层
大佬,我是从github上面下载的代码,用Python调用的,现在报了一个这样的错误,能帮我看看吗
Traceback (most recent call last):
File "F:\deskbak\DeepFaceLab-master\DeepFaceLab-master\mainscripts\Merger.py", line 83, in main
if not aligned_path.exists():
^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'exists'
这是代码本体
import subprocess
def merge_faces(source_image_path, target_image_path, output_dir):
# 定义 DeepFaceLab 的路径和命令
deepfacelab_path = "F:/deskbak/DeepFaceLab-master/DeepFaceLab-master"
merge_command = [
"python",
f"{deepfacelab_path}/main.py",
"merge",
"--input-dir", source_image_path,
"--output-mask-dir", target_image_path,
"--model-dir", f"{deepfacelab_path}/models",
"--model", "SAEHD",
"--output-dir", output_dir
]
# 调用 DeepFaceLab 的 merge 功能
process = subprocess.run(merge_command)
# 检查命令是否成功执行
if process.returncode == 0:
print("Merge process completed successfully.")
else:
print("Error occurred during merge process.")
# 定义源图像路径、目标图像路径和输出路径
source_image_path = "C:/Users/admin/Desktop/byb/source_image_folder"
target_image_path = "C:/Users/admin/Desktop/byb/target_image_folder"
output_dir = "C:/Users/admin/Desktop/byb/output_folder"
# 调用 merge_faces 函数
merge_faces(source_image_path, target_image_path, output_dir) |
|