From e3983534aaba87fd93a3e237743dd1b28868ae4e Mon Sep 17 00:00:00 2001 From: Jack Lau <131463945+JackLau1222@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:46:38 +0800 Subject: [PATCH] resolve conflict --- bmf/demo/colorization_python/deoldify_demo.py | 8 ++++++-- bmf/demo/colorization_python/py_deoldify_module.py | 12 ++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bmf/demo/colorization_python/deoldify_demo.py b/bmf/demo/colorization_python/deoldify_demo.py index 260abcaa..897c5af0 100644 --- a/bmf/demo/colorization_python/deoldify_demo.py +++ b/bmf/demo/colorization_python/deoldify_demo.py @@ -1,5 +1,9 @@ import bmf -import py_deoldify_module + +# Add the DeOldify folder to the python search path +import sys +sys.path.insert(0, './DeOldify') +print(sys.path) input_video_path = './DeOldify/test_videos/test_video.mp4' output_video_path = 'colored_video.mp4' @@ -12,4 +16,4 @@ output_video = video['video'].module('py_deoldify_module', option={"model_path": model_weight_path}) -bmf.encode(output_video[0], None, {"output_path": output_video_path}).run() +bmf.encode(output_video[0], None, {"output_path": output_video_path}).run() \ No newline at end of file diff --git a/bmf/demo/colorization_python/py_deoldify_module.py b/bmf/demo/colorization_python/py_deoldify_module.py index ed8d3339..aea76c4e 100644 --- a/bmf/demo/colorization_python/py_deoldify_module.py +++ b/bmf/demo/colorization_python/py_deoldify_module.py @@ -4,11 +4,7 @@ import PIL import bmf.hml.hmp as mp -# Add the DeOldify folder to the python search path -import sys - -sys.path.insert(0, './DeOldify') -print(sys.path) +from bmf.lib._bmf import sdk from deoldify import device from deoldify.device_id import DeviceId @@ -73,8 +69,8 @@ def process(self, task): VideoFrame): vf = packet.get(VideoFrame) - rgb = mp.PixelInfo(mp.kPF_RGB24) - np_vf = vf.reformat(rgb).frame().plane(0).numpy() + dst_md = sdk.MediaDesc().pixel_format(mp.kPF_RGB24) + np_vf = sdk.bmf_convert(vf, sdk.MediaDesc(), dst_md).frame().plane(0).numpy() # numpy to PIL image = Image.fromarray(np_vf.astype('uint8'), 'RGB') @@ -111,4 +107,4 @@ def process(self, task): output_queue.put(pkt) - return ProcessResult.OK + return ProcessResult.OK \ No newline at end of file