Fix uint8 input data for Async mode of dnn

This commit is contained in:
Dmitry Kurtaev
2019-05-05 12:49:38 +03:00
parent fc57129300
commit adc1ef9308
2 changed files with 23 additions and 9 deletions
+13 -8
View File
@@ -343,11 +343,12 @@ TEST(Net, forwardAndRetrieve)
#ifdef HAVE_INF_ENGINE
// This test runs network in synchronous mode for different inputs and then
// runs the same model asynchronously for the same inputs.
typedef testing::TestWithParam<Target> Async;
typedef testing::TestWithParam<tuple<int, Target> > Async;
TEST_P(Async, set_and_forward_single)
{
static const int kTimeout = 5000; // in milliseconds.
const int target = GetParam();
const int dtype = get<0>(GetParam());
const int target = get<1>(GetParam());
const std::string suffix = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? "_fp16" : "";
const std::string& model = findDataFile("dnn/layers/layer_convolution" + suffix + ".bin");
@@ -365,8 +366,8 @@ TEST_P(Async, set_and_forward_single)
int blobSize[] = {2, 6, 75, 113};
for (int i = 0; i < numInputs; ++i)
{
inputs[i].create(4, &blobSize[0], CV_32FC1);
randu(inputs[i], 0.0f, 1.0f);
inputs[i].create(4, &blobSize[0], dtype);
randu(inputs[i], 0, 255);
}
// Run synchronously.
@@ -392,7 +393,8 @@ TEST_P(Async, set_and_forward_single)
TEST_P(Async, set_and_forward_all)
{
static const int kTimeout = 5000; // in milliseconds.
const int target = GetParam();
const int dtype = get<0>(GetParam());
const int target = get<1>(GetParam());
const std::string suffix = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? "_fp16" : "";
const std::string& model = findDataFile("dnn/layers/layer_convolution" + suffix + ".bin");
@@ -411,8 +413,8 @@ TEST_P(Async, set_and_forward_all)
int blobSize[] = {2, 6, 75, 113};
for (int i = 0; i < numInputs; ++i)
{
inputs[i].create(4, &blobSize[0], CV_32FC1);
randu(inputs[i], 0.0f, 1.0f);
inputs[i].create(4, &blobSize[0], dtype);
randu(inputs[i], 0, 255);
}
// Run synchronously.
@@ -439,7 +441,10 @@ TEST_P(Async, set_and_forward_all)
}
}
INSTANTIATE_TEST_CASE_P(/**/, Async, testing::ValuesIn(getAvailableTargets(DNN_BACKEND_INFERENCE_ENGINE)));
INSTANTIATE_TEST_CASE_P(/**/, Async, Combine(
Values(CV_32F, CV_8U),
testing::ValuesIn(getAvailableTargets(DNN_BACKEND_INFERENCE_ENGINE))
));
#endif // HAVE_INF_ENGINE
}} // namespace