Skip to content

Commit c300070

Browse files
committed
Merge pull request opencv#14241 from alalek:openvino_2019R1
2 parents 4bb6edf + cafa010 commit c300070

13 files changed

+126
-48
lines changed

cmake/OpenCVDetectInferenceEngine.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ endif()
8787

8888
if(INF_ENGINE_TARGET)
8989
if(NOT INF_ENGINE_RELEASE)
90-
message(WARNING "InferenceEngine version have not been set, 2018R5 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
90+
message(WARNING "InferenceEngine version have not been set, 2019R1 will be used by default. Set INF_ENGINE_RELEASE variable if you experience build errors.")
9191
endif()
92-
set(INF_ENGINE_RELEASE "2018050000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
92+
set(INF_ENGINE_RELEASE "2019010000" CACHE STRING "Force IE version, should be in form YYYYAABBCC (e.g. 2018R2.0.2 -> 2018020002)")
9393
set_target_properties(${INF_ENGINE_TARGET} PROPERTIES
9494
INTERFACE_COMPILE_DEFINITIONS "HAVE_INF_ENGINE=1;INF_ENGINE_RELEASE=${INF_ENGINE_RELEASE}"
9595
)

modules/dnn/perf/perf_net.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ PERF_TEST_P_(DNNTestNetwork, FastNeuralStyle_eccv16)
222222

223223
PERF_TEST_P_(DNNTestNetwork, Inception_v2_Faster_RCNN)
224224
{
225+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019010000)
226+
if (backend == DNN_BACKEND_INFERENCE_ENGINE)
227+
throw SkipTestException("Test is disabled in OpenVINO 2019R1");
228+
#endif
225229
if (backend == DNN_BACKEND_HALIDE ||
226230
(backend == DNN_BACKEND_INFERENCE_ENGINE && target != DNN_TARGET_CPU) ||
227231
(backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16))

modules/dnn/src/dnn.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ struct Net::Impl
16361636
preferableTarget == DNN_TARGET_MYRIAD ||
16371637
preferableTarget == DNN_TARGET_FPGA) && !fused)
16381638
{
1639-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
1639+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
16401640
for (const std::string& name : {"weights", "biases"})
16411641
{
16421642
auto it = ieNode->layer.getParameters().find(name);

modules/dnn/src/layers/normalize_bbox_layer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ class NormalizeBBoxLayerImpl CV_FINAL : public NormalizeBBoxLayer
290290
weights = wrapToInfEngineBlob(blobs[0], {(size_t)numChannels}, InferenceEngine::Layout::C);
291291
l.getParameters()["channel_shared"] = blobs[0].total() == 1;
292292
}
293-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
293+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
294294
l.getParameters()["weights"] = weights;
295295
#else
296296
l.addConstantData("weights", weights);

modules/dnn/src/op_inf_engine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void InfEngineBackendNet::init(int targetId)
130130
for (int id : unconnectedLayersIds)
131131
{
132132
InferenceEngine::Builder::OutputLayer outLayer("myconv1");
133-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
133+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
134134
// Inference Engine determines network precision by ports.
135135
InferenceEngine::Precision p = (targetId == DNN_TARGET_MYRIAD ||
136136
targetId == DNN_TARGET_OPENCL_FP16) ?
@@ -188,7 +188,7 @@ void InfEngineBackendNet::init(int targetId)
188188

189189
void InfEngineBackendNet::addLayer(InferenceEngine::Builder::Layer& layer)
190190
{
191-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
191+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
192192
// Add weights to network and connect them after input blobs.
193193
std::map<std::string, InferenceEngine::Parameter>& params = layer.getParameters();
194194
std::vector<int> blobsIds;
@@ -229,7 +229,7 @@ void InfEngineBackendNet::addLayer(InferenceEngine::Builder::Layer& layer)
229229
CV_Assert(layers.insert({layerName, id}).second);
230230
unconnectedLayersIds.insert(id);
231231

232-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
232+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
233233
// By default, all the weights are connected to last ports ids.
234234
for (int i = 0; i < blobsIds.size(); ++i)
235235
{
@@ -903,7 +903,7 @@ InferenceEngine::Blob::Ptr convertFp16(const InferenceEngine::Blob::Ptr& blob)
903903
void addConstantData(const std::string& name, InferenceEngine::Blob::Ptr data,
904904
InferenceEngine::Builder::Layer& l)
905905
{
906-
#if INF_ENGINE_VER_MAJOR_GT(INF_ENGINE_RELEASE_2018R5)
906+
#if INF_ENGINE_VER_MAJOR_GE(INF_ENGINE_RELEASE_2019R1)
907907
l.getParameters()[name] = data;
908908
#else
909909
l.addConstantData(name, data);

modules/dnn/src/op_inf_engine.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
#define INF_ENGINE_RELEASE_2018R3 2018030000
2828
#define INF_ENGINE_RELEASE_2018R4 2018040000
2929
#define INF_ENGINE_RELEASE_2018R5 2018050000
30+
#define INF_ENGINE_RELEASE_2019R1 2019010000
3031

3132
#ifndef INF_ENGINE_RELEASE
32-
#warning("IE version have not been provided via command-line. Using 2018R5 by default")
33-
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2018R5
33+
#warning("IE version have not been provided via command-line. Using 2019R1 by default")
34+
#define INF_ENGINE_RELEASE INF_ENGINE_RELEASE_2019R1
3435
#endif
3536

3637
#define INF_ENGINE_VER_MAJOR_GT(ver) (((INF_ENGINE_RELEASE) / 10000) > ((ver) / 10000))

modules/dnn/test/test_backends.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ TEST_P(DNNTestNetwork, OpenFace)
289289
#if INF_ENGINE_VER_MAJOR_EQ(2018050000)
290290
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD)
291291
throw SkipTestException("Test is disabled for Myriad targets");
292-
#elif INF_ENGINE_VER_MAJOR_GT(2018050000)
292+
#elif INF_ENGINE_VER_MAJOR_GE(2019010000)
293293
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_MYRIAD
294294
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
295295
)

modules/dnn/test/test_darknet_importer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class Test_Darknet_nets : public DNNTestLayer
267267

268268
TEST_P(Test_Darknet_nets, YoloVoc)
269269
{
270-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
270+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
271271
if (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16)
272272
throw SkipTestException("Test is disabled");
273273
#endif

modules/dnn/test/test_halide_layers.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST_P(Deconvolution, Accuracy)
169169
throw SkipTestException("Test is disabled for OpenVINO 2018R4");
170170
#endif
171171

172-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
172+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
173173
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_MYRIAD
174174
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
175175
&& inChannels == 6 && outChannels == 4 && group == 1
@@ -351,7 +351,7 @@ TEST_P(MaxPooling, Accuracy)
351351
throw SkipTestException("Problems with output dimension in OpenVINO 2018R5");
352352
#endif
353353

354-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
354+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
355355
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_MYRIAD
356356
&& getInferenceEngineVPUType() == CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
357357
&& (stride == Size(1, 1) || stride == Size(2, 2))
@@ -561,7 +561,7 @@ TEST_P(ReLU, Accuracy)
561561
float negativeSlope = get<0>(GetParam());
562562
Backend backendId = get<0>(get<1>(GetParam()));
563563
Target targetId = get<1>(get<1>(GetParam()));
564-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
564+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
565565
if (backendId == DNN_BACKEND_INFERENCE_ENGINE
566566
&& negativeSlope < 0
567567
)
@@ -589,7 +589,7 @@ TEST_P(NoParamActivation, Accuracy)
589589
LayerParams lp;
590590
lp.type = get<0>(GetParam());
591591
lp.name = "testLayer";
592-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
592+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
593593
if (backendId == DNN_BACKEND_INFERENCE_ENGINE
594594
&& lp.type == "AbsVal"
595595
)
@@ -688,7 +688,7 @@ TEST_P(Concat, Accuracy)
688688
throw SkipTestException("Test is disabled for Myriad target"); // crash
689689
#endif
690690

691-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
691+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
692692
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && targetId == DNN_TARGET_CPU
693693
&& inSize == Vec3i(1, 4, 5) && numChannels == Vec3i(1, 6, 2)
694694
)
@@ -769,7 +769,7 @@ TEST_P(Eltwise, Accuracy)
769769
throw SkipTestException("Test is disabled for Myriad target");
770770
#endif
771771

772-
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GT(2018050000)
772+
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
773773
if (backendId == DNN_BACKEND_INFERENCE_ENGINE && numConv > 1)
774774
throw SkipTestException("Test is disabled for DLIE backend");
775775
#endif

modules/dnn/test/test_ie_models.cpp

Lines changed: 94 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ static void initDLDTDataPath()
2121
static bool initialized = false;
2222
if (!initialized)
2323
{
24+
#if INF_ENGINE_RELEASE <= 2018050000
2425
const char* dldtTestDataPath = getenv("INTEL_CVSDK_DIR");
2526
if (dldtTestDataPath)
26-
cvtest::addDataSearchPath(cv::utils::fs::join(dldtTestDataPath, "deployment_tools"));
27+
cvtest::addDataSearchPath(dldtTestDataPath);
28+
#else
29+
const char* omzDataPath = getenv("OPENCV_OPEN_MODEL_ZOO_DATA_PATH");
30+
if (omzDataPath)
31+
cvtest::addDataSearchPath(omzDataPath);
32+
const char* dnnDataPath = getenv("OPENCV_DNN_TEST_DATA_PATH");
33+
if (dnnDataPath)
34+
cvtest::addDataSearchPath(std::string(dnnDataPath) + "/omz_intel_models");
35+
#endif
2736
initialized = true;
2837
}
2938
#endif
@@ -33,6 +42,76 @@ using namespace cv;
3342
using namespace cv::dnn;
3443
using namespace InferenceEngine;
3544

45+
struct OpenVINOModelTestCaseInfo
46+
{
47+
const char* modelPathFP32;
48+
const char* modelPathFP16;
49+
};
50+
51+
static const std::map<std::string, OpenVINOModelTestCaseInfo>& getOpenVINOTestModels()
52+
{
53+
static std::map<std::string, OpenVINOModelTestCaseInfo> g_models {
54+
#if INF_ENGINE_RELEASE <= 2018050000
55+
{ "age-gender-recognition-retail-0013", {
56+
"deployment_tools/intel_models/age-gender-recognition-retail-0013/FP32/age-gender-recognition-retail-0013",
57+
"deployment_tools/intel_models/age-gender-recognition-retail-0013/FP16/age-gender-recognition-retail-0013"
58+
}},
59+
{ "face-person-detection-retail-0002", {
60+
"deployment_tools/intel_models/face-person-detection-retail-0002/FP32/face-person-detection-retail-0002",
61+
"deployment_tools/intel_models/face-person-detection-retail-0002/FP16/face-person-detection-retail-0002"
62+
}},
63+
{ "head-pose-estimation-adas-0001", {
64+
"deployment_tools/intel_models/head-pose-estimation-adas-0001/FP32/head-pose-estimation-adas-0001",
65+
"deployment_tools/intel_models/head-pose-estimation-adas-0001/FP16/head-pose-estimation-adas-0001"
66+
}},
67+
{ "person-detection-retail-0002", {
68+
"deployment_tools/intel_models/person-detection-retail-0002/FP32/person-detection-retail-0002",
69+
"deployment_tools/intel_models/person-detection-retail-0002/FP16/person-detection-retail-0002"
70+
}},
71+
{ "vehicle-detection-adas-0002", {
72+
"deployment_tools/intel_models/vehicle-detection-adas-0002/FP32/vehicle-detection-adas-0002",
73+
"deployment_tools/intel_models/vehicle-detection-adas-0002/FP16/vehicle-detection-adas-0002"
74+
}}
75+
#else
76+
// layout is defined by open_model_zoo/model_downloader
77+
// Downloaded using these parameters for Open Model Zoo downloader (2019R1):
78+
// ./downloader.py -o ${OPENCV_DNN_TEST_DATA_PATH}/omz_intel_models --cache_dir ${OPENCV_DNN_TEST_DATA_PATH}/.omz_cache/ \
79+
// --name face-person-detection-retail-0002,face-person-detection-retail-0002-fp16,age-gender-recognition-retail-0013,age-gender-recognition-retail-0013-fp16,head-pose-estimation-adas-0001,head-pose-estimation-adas-0001-fp16,person-detection-retail-0002,person-detection-retail-0002-fp16,vehicle-detection-adas-0002,vehicle-detection-adas-0002-fp16
80+
{ "age-gender-recognition-retail-0013", {
81+
"Retail/object_attributes/age_gender/dldt/age-gender-recognition-retail-0013",
82+
"Retail/object_attributes/age_gender/dldt/age-gender-recognition-retail-0013-fp16"
83+
}},
84+
{ "face-person-detection-retail-0002", {
85+
"Retail/object_detection/face_pedestrian/rmnet-ssssd-2heads/0002/dldt/face-person-detection-retail-0002",
86+
"Retail/object_detection/face_pedestrian/rmnet-ssssd-2heads/0002/dldt/face-person-detection-retail-0002-fp16"
87+
}},
88+
{ "head-pose-estimation-adas-0001", {
89+
"Transportation/object_attributes/headpose/vanilla_cnn/dldt/head-pose-estimation-adas-0001",
90+
"Transportation/object_attributes/headpose/vanilla_cnn/dldt/head-pose-estimation-adas-0001-fp16"
91+
}},
92+
{ "person-detection-retail-0002", {
93+
"Retail/object_detection/pedestrian/hypernet-rfcn/0026/dldt/person-detection-retail-0002",
94+
"Retail/object_detection/pedestrian/hypernet-rfcn/0026/dldt/person-detection-retail-0002-fp16"
95+
}},
96+
{ "vehicle-detection-adas-0002", {
97+
"Transportation/object_detection/vehicle/mobilenet-reduced-ssd/dldt/vehicle-detection-adas-0002",
98+
"Transportation/object_detection/vehicle/mobilenet-reduced-ssd/dldt/vehicle-detection-adas-0002-fp16"
99+
}}
100+
#endif
101+
};
102+
103+
return g_models;
104+
}
105+
106+
static const std::vector<std::string> getOpenVINOTestModelsList()
107+
{
108+
std::vector<std::string> result;
109+
const std::map<std::string, OpenVINOModelTestCaseInfo>& models = getOpenVINOTestModels();
110+
for (const auto& it : models)
111+
result.push_back(it.first);
112+
return result;
113+
}
114+
36115
static inline void genData(const std::vector<size_t>& dims, Mat& m, Blob::Ptr& dataPtr)
37116
{
38117
std::vector<int> reversedDims(dims.begin(), dims.end());
@@ -172,25 +251,23 @@ void runCV(Target target, const std::string& xmlPath, const std::string& binPath
172251
}
173252
}
174253

175-
typedef TestWithParam<tuple<Target, String> > DNNTestOpenVINO;
254+
typedef TestWithParam<tuple<Target, std::string> > DNNTestOpenVINO;
176255
TEST_P(DNNTestOpenVINO, models)
177256
{
257+
initDLDTDataPath();
258+
178259
Target target = (dnn::Target)(int)get<0>(GetParam());
179260
std::string modelName = get<1>(GetParam());
180-
std::string precision = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? "FP16" : "FP32";
181-
std::string prefix;
261+
bool isFP16 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD);
182262

183-
#ifdef INF_ENGINE_RELEASE
184-
#if INF_ENGINE_RELEASE <= 2018050000
185-
prefix = utils::fs::join("intel_models",
186-
utils::fs::join(modelName,
187-
utils::fs::join(precision, modelName)));
188-
#endif
189-
#endif
263+
const std::map<std::string, OpenVINOModelTestCaseInfo>& models = getOpenVINOTestModels();
264+
const auto it = models.find(modelName);
265+
ASSERT_TRUE(it != models.end()) << modelName;
266+
OpenVINOModelTestCaseInfo modelInfo = it->second;
267+
std::string modelPath = isFP16 ? modelInfo.modelPathFP16 : modelInfo.modelPathFP32;
190268

191-
initDLDTDataPath();
192-
std::string xmlPath = findDataFile(prefix + ".xml");
193-
std::string binPath = findDataFile(prefix + ".bin");
269+
std::string xmlPath = findDataFile(modelPath + ".xml");
270+
std::string binPath = findDataFile(modelPath + ".bin");
194271

195272
std::map<std::string, cv::Mat> inputsMap;
196273
std::map<std::string, cv::Mat> ieOutputsMap, cvOutputsMap;
@@ -210,16 +287,12 @@ TEST_P(DNNTestOpenVINO, models)
210287
}
211288
}
212289

290+
213291
INSTANTIATE_TEST_CASE_P(/**/,
214292
DNNTestOpenVINO,
215293
Combine(testing::ValuesIn(getAvailableTargets(DNN_BACKEND_INFERENCE_ENGINE)),
216-
testing::Values(
217-
"age-gender-recognition-retail-0013",
218-
"face-person-detection-retail-0002",
219-
"head-pose-estimation-adas-0001",
220-
"person-detection-retail-0002",
221-
"vehicle-detection-adas-0002"
222-
))
294+
testing::ValuesIn(getOpenVINOTestModelsList())
295+
)
223296
);
224297

225298
}}

0 commit comments

Comments
 (0)