User/xianz/enable batch tests (#3914)

* enable batch tests in winml_image_test

* copy batchGroundTruth folder

* skip GPU tests when GPU is unavailable
This commit is contained in:
Xiang Zhang 2020-05-12 15:46:46 -07:00 committed by GitHub
parent 18dc0ec39f
commit bccbdd03f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 1 deletions

View file

@ -272,6 +272,8 @@ add_winml_collateral("${WINML_TEST_SRC_DIR}/image/images/*.jpg")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/images/*.png")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/groundTruth/*.jpg")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/groundTruth/*.png")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/batchGroundTruth/*.jpg")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/batchGroundTruth/*.png")
add_winml_collateral("${WINML_TEST_SRC_DIR}/image/models/*.onnx")
add_winml_collateral("${WINML_TEST_SRC_DIR}/scenario/cppwinrt/*.onnx")
add_winml_collateral("${WINML_TEST_SRC_DIR}/scenario/models/*.onnx")

View file

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 230 KiB

View file

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View file

Before

Width:  |  Height:  |  Size: 237 KiB

After

Width:  |  Height:  |  Size: 237 KiB

View file

Before

Width:  |  Height:  |  Size: 180 KiB

After

Width:  |  Height:  |  Size: 180 KiB

View file

@ -451,6 +451,12 @@ TEST_P(BatchTest, BatchSupport) {
if (VideoFrameSource::FromDirect3DSurface == param.video_frame_source && LearningModelDeviceKind::Cpu == param.device_kind) {
return;
}
if (LearningModelDeviceKind::Cpu != param.device_kind ||
VideoFrameSource::FromDirect3DSurface == param.video_frame_source ||
VideoFrameSource::FromDirect3DSurface == param.output_video_frame_source ||
VideoFrameSource::FromUnsupportedD3DSurface == param.output_video_frame_source) {
GPUTEST;
}
// create model, device and session
PrepareModelSessionBinding(param.model_file_name, param.device_kind, optimized_batch_size);
@ -526,7 +532,24 @@ TEST_P(BatchTest, BatchSupport) {
}
}
}
INSTANTIATE_TEST_SUITE_P(BatchTest, BatchTest,
testing::Combine(
testing::Values(
std::make_tuple(L"fns-candy_Bgr8_Batch2.onnx", Image, std::vector<std::wstring>({L"fish_720.png", L"fish_720.png"}), 2, false),
std::make_tuple(L"fns-candy_Bgr8_Batch2.onnx", Image, std::vector<std::wstring>({L"1080.jpg", L"fish_720.png"}), 2, false),
std::make_tuple(L"fns-candy_Bgr8_Batch2.onnx", Image, std::vector<std::wstring>({L"fish_720_Gray.png", L"fish_720.png"}), 2, false),
std::make_tuple(L"fns-candy_Bgr8_Batch3.onnx", Image, std::vector<std::wstring>({L"1080.jpg", L"fish_720_Gray.png", L"fish_720.png"}), 3, false),
std::make_tuple(L"fns-candy_Bgr8_Batch3.onnx", Image, std::vector<std::wstring>({L"1080.jpg", L"kitten_224.png", L"fish_720.png"}), 3, false),
std::make_tuple(L"fns-candy_Bgr8_tensor_Batch3.onnx", Tensor, std::vector<std::wstring>({L"1080.jpg", L"fish_720_Gray.png", L"fish_720.png"}), 3, false),
std::make_tuple(L"fns-candy_Bgr8_freeDimInput_Batch10.onnx", Image, std::vector<std::wstring>({}), 10, false),
std::make_tuple(L"fns-candy_Bgr8.onnx", Image, std::vector<std::wstring>({L"1080.jpg", L"fish_720_Gray.png", L"fish_720.png"}), 3, false),
std::make_tuple(L"fns-candy_Bgr8.onnx", Image, std::vector<std::wstring>({L"1080.jpg", L"fish_720_Gray.png", L"fish_720.png"}), 3, true)),
testing::Values(Bound, Unbound),
testing::Values(Async, Sync),
testing::Values(FromSoftwareBitmap, FromDirect3DSurface),
testing::Values(FromSoftwareBitmap, FromDirect3DSurface, FromUnsupportedD3DSurface),
testing::Values(LearningModelDeviceKind::DirectX, LearningModelDeviceKind::Cpu)
));
TEST_F(ImageTests, LoadBindEvalModelWithoutImageMetadata) {
GPUTEST;