Skip to content

Commit

Permalink
rocAL - run.sh Fix (#1045)
Browse files Browse the repository at this point in the history
* Fix Video Reader Resize Python end

* Fix Video Reader Resize Python end

* Adjust spacing

---------

Co-authored-by: root <[email protected]>
Co-authored-by: Swetha B S <[email protected]>
  • Loading branch information
3 people authored Feb 23, 2023
1 parent f20252d commit c864fbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
10 changes: 8 additions & 2 deletions rocAL/rocAL_pybind/amd/rocal/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 1 addition & 15 deletions rocAL/rocAL_pybind/rocal_pybind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit c864fbb

Please sign in to comment.