-
Notifications
You must be signed in to change notification settings - Fork 622
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
Adds enable_frame_num
to the experimental video reader
#5628
Conversation
- adds an ability to output frame numbers in the experimental video reader - this allows making VideoReaderDecoderCpuTest.RandomShuffle_* test independent from the hardcoding of the expected frame order (in case random generator implementation changes) Signed-off-by: Janusz Lisiecki <[email protected]>
!build |
CI MESSAGE: [18262573]: BUILD STARTED |
CI MESSAGE: [18262564]: BUILD FAILED |
CI MESSAGE: [18262573]: BUILD FAILED |
int label_; | ||
int first_frame_; |
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.
Since VideoSample
already has a non-trivial constructor, some initialization (e.g. to invalid values, like -1) would be nice.
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.
Fixed
Signed-off-by: Janusz Lisiecki <[email protected]>
CI MESSAGE: [18262573]: BUILD PASSED |
int num_outputs = 1; | ||
if (spec.HasArgument("labels")) num_outputs++; | ||
bool enable_frame_num = spec.GetArgument<bool>("enable_frame_num"); | ||
if (enable_frame_num) num_outputs++; | ||
return num_outputs; |
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.
Perhaps clearer (?) Your call.
int num_outputs = 1; | |
if (spec.HasArgument("labels")) num_outputs++; | |
bool enable_frame_num = spec.GetArgument<bool>("enable_frame_num"); | |
if (enable_frame_num) num_outputs++; | |
return num_outputs; | |
bool has_label_output = spec.HasArgument("labels"); | |
bool has_frame_num_output = spec.GetArgument<bool>("enable_frame_num"); | |
return 1 + has_label_output + has_frame_num_output; |
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
R"code(If set, returns the first frame number in the decoded sequence | ||
as a separate output.)code", |
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.
R"code(If set, returns the first frame number in the decoded sequence | |
as a separate output.)code", | |
R"code(If set, returns the index of the first frame in the decoded sequence | |
as an additional output.)code", |
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
@@ -68,6 +81,10 @@ even in the variable frame rate scenario.)code") | |||
.AddArg("sequence_length", | |||
R"code(Frames to load per sequence.)code", | |||
DALI_INT32) | |||
.AddOptionalArg("enable_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.
.AddOptionalArg("enable_frame_num", | |
.AddOptionalArg("enable_frame_idx", |
?
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.
I want to keep it consistent with the video reader .
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.
I understand and agree - nonetheless, it's unfortunate.
@@ -168,6 +172,15 @@ void VideoReaderDecoderBaseTest::RunShuffleTest<dali::CPUBackend>() { | |||
RunShuffleTestImpl<dali::CPUBackend>("cpu", dali::CPU_ONLY_DEVICE_ID); | |||
} | |||
|
|||
template<> | |||
int VideoReaderDecoderBaseTest::GetFrameNo( |
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.
int VideoReaderDecoderBaseTest::GetFrameNo( | |
int VideoReaderDecoderBaseTest::GetFrameIdx( |
...if going with the idx
suggestion.
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
@@ -181,6 +194,15 @@ void VideoReaderDecoderBaseTest::RunShuffleTest<dali::GPUBackend>() { | |||
RunShuffleTestImpl<dali::GPUBackend>("gpu", 0); | |||
} | |||
|
|||
template<> | |||
int VideoReaderDecoderBaseTest::GetFrameNo( |
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.
int VideoReaderDecoderBaseTest::GetFrameNo( | |
int VideoReaderDecoderBaseTest::GetFrameIdx( |
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
@@ -40,6 +40,9 @@ class VideoReaderDecoderBaseTest : public VideoTestBase { | |||
virtual void AssertFrame( | |||
int frame_id, const uint8_t *frame, TestVideo &ground_truth) = 0; | |||
|
|||
template<typename Backend> | |||
int GetFrameNo(dali::TensorList<Backend> &device_frame_no); |
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.
int GetFrameNo(dali::TensorList<Backend> &device_frame_no); | |
int GetFrameIdx(dali::TensorList<Backend> &device_frame_idx); |
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
@@ -35,6 +35,7 @@ class VideoReaderDecoderGpu : public DataReader<GPUBackend, VideoSampleGpu, Vide | |||
|
|||
private: | |||
bool has_labels_ = false; | |||
bool has_frame_no_ = false; |
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.
bool has_frame_no_ = false; | |
bool has_frame_idx_ = false; |
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
Signed-off-by: Janusz Lisiecki <[email protected]>
e2afd19
to
ec7fa68
Compare
Signed-off-by: Janusz Lisiecki <[email protected]>
!build |
CI MESSAGE: [18290753]: BUILD FAILED |
CI MESSAGE: [18290753]: BUILD STARTED |
Signed-off-by: Janusz Lisiecki <[email protected]>
!build |
CI MESSAGE: [18302585]: BUILD STARTED |
CI MESSAGE: [18302585]: BUILD PASSED |
reader
independent from the hardcoding of the expected frame order (in case
random generator implementation changes)
Category:
New feature (non-breaking change which adds functionality)
Description:
reader
independent from the hardcoding of the expected frame order (in case
random generator implementation changes)
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: RDVID.13
JIRA TASK: N/A