-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rocAL Video Reader : Support to pass filenames and labels as list #89
Conversation
fiona-gladwin
commented
Jan 16, 2024
- Add support to pass filenames and labels as list in Video reader
- Add changes in rocalVideo iterator to return labels
- Add new python example which demonstrates passing filenames and labels as input to the reader
- Add C++ test case for the filenames case
Add this for VideoLabelReader
@@ -627,6 +629,7 @@ extern "C" RocalImage ROCAL_API_CALL rocalVideoFileSource(RocalContext context, | |||
RocalDecodeDevice rocal_decode_device, | |||
unsigned internal_shard_count, | |||
unsigned sequence_length, | |||
std::vector<std::string> file_names_list = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass as a reference instead and remove the default initialition. Applies to all others. If it is read_only, please make it const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* False : when the inputs from text file is to considered as timestamps. | ||
* \return RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors | ||
*/ | ||
extern "C" RocalMetaData ROCAL_API_CALL rocalCreateVideoLabelReader(RocalContext rocal_context, const char *source_path, unsigned sequence_length, unsigned frame_step, unsigned frame_stride, bool file_list_frame_num = true); | ||
extern "C" RocalMetaData ROCAL_API_CALL rocalCreateVideoLabelReader(RocalContext rocal_context, const char *source_path, unsigned sequence_length, unsigned frame_step, unsigned frame_stride, bool file_list_frame_num = true, | ||
std::vector<std::string> file_names_list = {}, std::vector<int> labels = {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please pass those as reference instead like const std::vectorstd::string&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -67,12 +67,13 @@ ROCAL_API_CALL rocalCreateLabelReader(RocalContext p_context, const char* source | |||
} | |||
|
|||
RocalMetaData | |||
ROCAL_API_CALL rocalCreateVideoLabelReader(RocalContext p_context, const char* source_path, unsigned sequence_length, unsigned frame_step, unsigned frame_stride, bool file_list_frame_num) { | |||
ROCAL_API_CALL rocalCreateVideoLabelReader(RocalContext p_context, const char* source_path, unsigned sequence_length, unsigned frame_step, unsigned frame_stride, bool file_list_frame_num, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before please pass vectors by reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
self.w = self.loader.getOutputWidth() | ||
self.h = self.loader.getOutputHeight() | ||
self.n = self.loader.getOutputImageCount() | ||
self.rim = self.loader.getRemainingImages() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is remaining images means to video? Please change the name to describe correctly (Is it same as dataset_size?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to self.remaining_sequences = self.loader.getRemainingImages()
@@ -189,7 +210,7 @@ int main(int argc, const char **argv) | |||
default: | |||
{ | |||
std::cout << "\n>>>> VIDEO READER\n"; | |||
input1 = rocalVideoFileSource(handle, source_path, color_format, decoder_mode, shard_count, sequence_length, shuffle, is_output, false, frame_step, frame_stride, file_list_frame_num); | |||
input1 = rocalVideoFileSource(handle, source_path, color_format, decoder_mode, shard_count, sequence_length, {}, shuffle, is_output, false, frame_step, frame_stride, file_list_frame_num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of passing an empty structure, please pass 0 or nullptr which can be used if passed as reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will not be able to pass 0 or nullptr to vector argument hence passing as empty vector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please address review comments
@rrawther Addressed all review comments, Please check |
@fiona-gladwin @rrawther why is this PR going to master? We have develop for all the tensor work. |
@LakshmiKumar23 We have added these changes to master since this was requested by a user, The develop branch has tensor related changes and is not yet merged with master branch. |
@rrawther - let me know if we can merge to master |
@@ -80,6 +82,10 @@ struct MetaDataConfig | |||
unsigned out_img_height() const { return _out_img_height; } | |||
void set_out_img_width(unsigned out_img_width) { _out_img_width = out_img_width; } | |||
void set_out_img_height(unsigned out_img_height) { _out_img_height = out_img_height; } | |||
std::vector<std::string> file_names() const { return _file_names; } | |||
std::vector<int> labels() const { return _labels; } | |||
void set_file_names(std::vector<std::string> file_names) { _file_names = file_names; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take these arguments by reference instead since it is passed by reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fiona-gladwin : added comment in passing vectors. Also please merge tot
Addressed review comments and merged with TOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hansely: Can you please test this PR?
@rrawther |
@kiritigowda : this PR can be merged . But it uses ROCAL_DATA and we don't have that in ROCm. We can merge it and create the DATA repo and update readme afterwards |
593d2bc
to
d32cfaf
Compare
@kiritigowda : I think the PR was meant for develop branch for tensor. So it has to be merged to develop |
@rrawther We have added these changes to master branch since this was requested by a user, Please let me know if this needs to be added to the develop branch and I can issue a different PR for the same |