未验证 提交 c11d9140 编写于 作者: 郭佳慧 提交者: GitHub

Add output filename to support concurrent work in FOM. (#204)


增加文件名的参数filename,以便可以多并发执行
first_order_predictor.py
上级 183ffd18
......@@ -25,6 +25,7 @@ parser.add_argument("--weight_path",
parser.add_argument("--source_image", type=str, help="path to source image")
parser.add_argument("--driving_video", type=str, help="path to driving video")
parser.add_argument("--output", default='output', help="path to output")
parser.add_argument("--filename", default='result.mp4', help="filename to output")
parser.add_argument("--relative",
dest="relative",
action="store_true",
......@@ -65,6 +66,7 @@ if __name__ == "__main__":
paddle.set_device('cpu')
predictor = FirstOrderPredictor(output=args.output,
filename=args.filename,
weight_path=args.weight_path,
config=args.config,
relative=args.relative,
......
......@@ -45,7 +45,8 @@ class FirstOrderPredictor(BasePredictor):
adapt_scale=False,
find_best_frame=False,
best_frame=None,
ratio=1.0):
ratio=1.0,
filename='result.mp4'):
if config is not None and isinstance(config, str):
self.cfg = yaml.load(config, Loader=yaml.SafeLoader)
elif isinstance(config, dict):
......@@ -88,6 +89,7 @@ class FirstOrderPredictor(BasePredictor):
if not os.path.exists(output):
os.makedirs(output)
self.output = output
self.filename = filename
self.relative = relative
self.adapt_scale = adapt_scale
self.find_best_frame = find_best_frame
......@@ -170,7 +172,7 @@ class FirstOrderPredictor(BasePredictor):
frame = cv2.copyTo(patch, mask, frame)
out_frame.append(frame)
imageio.mimsave(os.path.join(self.output, 'result.mp4'),
imageio.mimsave(os.path.join(self.output, self.filename),
[frame for frame in out_frame],
fps=fps)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册