From c864fbb665895689bdac3ccdf882f5eca04f3b20 Mon Sep 17 00:00:00 2001 From: Kiriti Gowda Date: Thu, 23 Feb 2023 15:45:15 -0800 Subject: [PATCH] rocAL - run.sh Fix (#1045) * Fix Video Reader Resize Python end * Fix Video Reader Resize Python end * Adjust spacing --------- Co-authored-by: root Co-authored-by: Swetha B S --- rocAL/rocAL_pybind/amd/rocal/readers.py | 10 ++++++++-- rocAL/rocAL_pybind/rocal_pybind.cpp | 16 +--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/rocAL/rocAL_pybind/amd/rocal/readers.py b/rocAL/rocAL_pybind/amd/rocal/readers.py index 440c168d09..e1e3b04199 100644 --- a/rocAL/rocAL_pybind/amd/rocal/readers.py +++ b/rocAL/rocAL_pybind/amd/rocal/readers.py @@ -148,14 +148,20 @@ def video_resize(*inputs, sequence_length, resize_width, resize_height, addition file_root="", filenames=[], image_type=types.RGB, initial_fill=1024, labels="", lazy_init=False, normalized=False, num_shards=1, pad_last_batch=False, pad_sequences=False, prefetch_queue_depth=1, preserve=False, random_shuffle=False, read_ahead=False, seed=-1, shard_id=0, skip_cached_images=False, skip_vfr_check=False, step=3, stick_to_shard=False, - stride=3, tensor_init_bytes=1048576, decoder_mode=types.SOFTWARE_DECODE, device=None, name=None): + stride=3, tensor_init_bytes=1048576, decoder_mode=types.SOFTWARE_DECODE, device=None, name=None, + scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, + resize_longer=0, resize_shorter=0, max_size=[]): Pipeline._current_pipeline._reader = "VideoDecoderResize" #Output videos = [] kwargs_pybind_reader = {"source_path": file_root,"sequence_length":sequence_length,"frame_step":step,"frame_stride":stride,"file_list_frame_num":file_list_frame_num} #VideoMetaDataReader meta_data = b.VideoMetaDataReader(Pipeline._current_pipeline._handle ,*(kwargs_pybind_reader.values())) - kwargs_pybind_decoder = {"source_path": file_root,"color_format":image_type,"decoder_mode":decoder_mode,"shard_count":num_shards,"sequence_length":sequence_length,"resize_width":resize_width, "resize_height":resize_height,"shuffle":random_shuffle ,"is_output":False,"loop":False, "frame_step":step,"frame_stride":stride, "file_list_frame_num":file_list_frame_num } #VideoDecoder + kwargs_pybind_decoder = {"source_path": file_root, "color_format":image_type, "decoder_mode":decoder_mode, "shard_count":num_shards, + "sequence_length":sequence_length, "resize_width":resize_width, "resize_height":resize_height, + "shuffle":random_shuffle , "is_output":False, "loop":False, "frame_step":step,"frame_stride":stride, + "file_list_frame_num":file_list_frame_num, "scaling_mode":scaling_mode ,"max_size":max_size, + "resize_shorter": resize_shorter, "resize_longer": resize_longer,"interpolation_type": interpolation_type } videos = b.VideoDecoderResize(Pipeline._current_pipeline._handle ,*(kwargs_pybind_decoder.values())) return (videos, meta_data) diff --git a/rocAL/rocAL_pybind/rocal_pybind.cpp b/rocAL/rocAL_pybind/rocal_pybind.cpp index 933aea329e..ce59b67173 100644 --- a/rocAL/rocAL_pybind/rocal_pybind.cpp +++ b/rocAL/rocAL_pybind/rocal_pybind.cpp @@ -424,21 +424,7 @@ namespace rocal{ m.def("VideoDecoder",&rocalVideoFileSource,"Reads videos from the source given and decodes it according to the policy only for Videos as inputs", py::return_value_policy::reference); m.def("VideoDecoderResize",&rocalVideoFileResize,"Reads videos from the source given and decodes it according to the policy only for Videos as inputs. Resizes the decoded frames to the dest width and height.", - py::return_value_policy::reference, - py::arg("p_context"), - py::arg("source_path"), - py::arg("color_format"), - py::arg("decoder_mode"), - py::arg("shard_count"), - py::arg("sequence_length"), - py::arg("dest_width"), - py::arg("dest_height"), - py::arg("shuffle") = false, - py::arg("is_output"), - py::arg("loop") = false, - py::arg("frame_step"), - py::arg("frame_stride"), - py::arg("file_list_frame_num") = false); + py::return_value_policy::reference); m.def("SequenceReader",&rocalSequenceReader,"Creates JPEG image reader and decoder. Reads [Frames] sequences from a directory representing a collection of streams.", py::return_value_policy::reference, py::arg("context"),