Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
JackLau1222 authored Sep 9, 2024
1 parent b683810 commit e398353
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 6 additions & 2 deletions bmf/demo/colorization_python/deoldify_demo.py
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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()
12 changes: 4 additions & 8 deletions bmf/demo/colorization_python/py_deoldify_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -111,4 +107,4 @@ def process(self, task):

output_queue.put(pkt)

return ProcessResult.OK
return ProcessResult.OK

0 comments on commit e398353

Please sign in to comment.