-
Notifications
You must be signed in to change notification settings - Fork 606
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
Refactor video tests #3864
Refactor video tests #3864
Conversation
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
!build |
CI MESSAGE: [4701610]: BUILD STARTED |
|
||
if (flush_state_) { | ||
flush_state_ = 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.
While improving tests coverage I found this small bug in the frames decoder - flush_state_
flag was not cleared while decoder was reset.
CI MESSAGE: [4701610]: BUILD PASSED |
|
||
TEST_F(FramesDecoderGpuTest, VariableFrameRateGpu) { | ||
class FramesDecoderGpuTest : public FramesDecoderTestBase { |
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.
Is it possible to unify this with FramesDecoderTest_CpuOnlyTests?
The main difference I see is the additional copy of the data from DeviceBuffer
to frame_cpu
, and the different method of validation compared to ground_truth
. I think these two things could be just a specialization of a method for the GPU test, but other steps could be common (the flow of the tests itself).
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.
Didn't want to over do it in the beginning but sure, done.
std::vector<std::vector<cv::Mat>> VideoTestBase::vfr_frames_; | ||
void CompareFrameAvgError( | ||
const uint8_t *ground_truth, const uint8_t *frame, int frame_size, double eps) { | ||
std::vector<double> sums(std::thread::hardware_concurrency(), 0.0); |
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 wonder if you can hide the fact that detail::parallel_for
uses std::thread::hardware_concurrency()
for the thread number it spawns?
Maybe it could be detail::parallel_for_threads_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.
Done
|
||
|
||
TEST_F(FramesDecoderTest_CpuOnlyTests, ConstantFrameRate) { | ||
RunTest("/db/video/cfr/test_1.mp4", cfr_videos_[0]); |
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 wonder if we can have the path to the video and frames in the same place. Like:
RunTest("cfr_videos_[0].video",cfr_videos_[0].ref_frames);
?
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. Now I keep all paths in VideoTestBase
in lists and match by index. I did to to be able to pass whole list to op specs in reader tests.
const int sequence_length = 6; | ||
const int stride = 3; | ||
const int step = 10; | ||
class VideoReaderDecoderGpuTest : public VideoReaderDecoderBaseTest { |
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.
Can we combine common parts with VideoReaderDecoderBaseTest
? Or it is too much?
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: Albert Wolant <awolant@nvidia.com>
} | ||
} | ||
private: | ||
std::vector<uint8_t> frame_buffer; |
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.
std::vector<uint8_t> frame_buffer; | |
std::vector<uint8_t> frame_buffer_; |
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
std::vector<uint8_t> frame_cpu_buffer; | ||
DeviceBuffer<uint8_t> frame_gpu_buffer; |
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.
std::vector<uint8_t> frame_cpu_buffer; | |
DeviceBuffer<uint8_t> frame_gpu_buffer; | |
std::vector<uint8_t> frame_cpu_buffer_; | |
DeviceBuffer<uint8_t> frame_gpu_buffer_; |
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: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
Signed-off-by: Albert Wolant <awolant@nvidia.com>
@@ -18,6 +18,7 @@ namespace dali { | |||
void VideoLoaderDecoderCpu::PrepareEmpty(VideoSample<CPUBackend> &sample) { | |||
sample = {}; | |||
sample.data_.set_pinned(false); | |||
sample.data_.SetLayout("FHWC"); |
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.
Another small bug fix I found during the tests rework - layout was not set in CPU reader.
Signed-off-by: Albert Wolant <awolant@nvidia.com>
!build |
CI MESSAGE: [4728585]: BUILD STARTED |
CI MESSAGE: [4728585]: BUILD FAILED |
!build |
CI MESSAGE: [4746024]: BUILD STARTED |
CI MESSAGE: [4746024]: BUILD PASSED |
* Refactor video tests Signed-off-by: Albert Wolant <awolant@nvidia.com>
* Refactor video tests Signed-off-by: Albert Wolant <awolant@nvidia.com>
Refactor video tests for new video readers to make it easier to add new tests for new formats in the future. Extend tests coverage.
Category:
Refactoring of the video tests.
Checklist
Tests
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A