@@ -38,7 +38,7 @@ class DNNTestNetwork : public TestWithParam <tuple<DNNBackend, DNNTarget> >
38
38
void processNet (std::string weights, std::string proto,
39
39
Mat inp, const std::string& outputLayer = " " ,
40
40
std::string halideScheduler = " " ,
41
- double l1 = 0.0 , double lInf = 0.0 )
41
+ double l1 = 0.0 , double lInf = 0.0 , double detectionConfThresh = 0.2 )
42
42
{
43
43
if (backend == DNN_BACKEND_OPENCV && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
44
44
{
@@ -87,7 +87,7 @@ class DNNTestNetwork : public TestWithParam <tuple<DNNBackend, DNNTarget> >
87
87
}
88
88
Mat out = net.forward (outputLayer).clone ();
89
89
90
- check (outDefault, out, outputLayer, l1, lInf, " First run" );
90
+ check (outDefault, out, outputLayer, l1, lInf, detectionConfThresh, " First run" );
91
91
92
92
// Test 2: change input.
93
93
float * inpData = (float *)inp.data ;
@@ -101,10 +101,11 @@ class DNNTestNetwork : public TestWithParam <tuple<DNNBackend, DNNTarget> >
101
101
net.setInput (inp);
102
102
outDefault = netDefault.forward (outputLayer).clone ();
103
103
out = net.forward (outputLayer).clone ();
104
- check (outDefault, out, outputLayer, l1, lInf, " Second run" );
104
+ check (outDefault, out, outputLayer, l1, lInf, detectionConfThresh, " Second run" );
105
105
}
106
106
107
- void check (Mat& ref, Mat& out, const std::string& outputLayer, double l1, double lInf, const char * msg)
107
+ void check (Mat& ref, Mat& out, const std::string& outputLayer, double l1, double lInf,
108
+ double detectionConfThresh, const char * msg)
108
109
{
109
110
if (outputLayer == " detection_out" )
110
111
{
@@ -119,7 +120,7 @@ class DNNTestNetwork : public TestWithParam <tuple<DNNBackend, DNNTarget> >
119
120
}
120
121
out = out.rowRange (0 , numDetections);
121
122
}
122
- normAssertDetections (ref, out, msg, 0.2 , l1, lInf);
123
+ normAssertDetections (ref, out, msg, detectionConfThresh , l1, lInf);
123
124
}
124
125
else
125
126
normAssert (ref, out, msg, l1, lInf);
@@ -188,20 +189,30 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe)
188
189
inp, " detection_out" , " " , l1, lInf);
189
190
}
190
191
191
- // TODO: update MobileNet model.
192
- TEST_P (DNNTestNetwork, MobileNet_SSD_TensorFlow)
192
+ TEST_P (DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
193
193
{
194
- if (backend == DNN_BACKEND_HALIDE ||
195
- backend == DNN_BACKEND_INFERENCE_ENGINE)
194
+ if (backend == DNN_BACKEND_HALIDE)
196
195
throw SkipTestException (" " );
197
196
Mat sample = imread (findDataFile (" dnn/street.png" , false ));
198
197
Mat inp = blobFromImage (sample, 1 .0f / 127.5 , Size (300 , 300 ), Scalar (127.5 , 127.5 , 127.5 ), false );
199
- float l1 = (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 ) ? 0.008 : 0.0 ;
200
- float lInf = (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16 ) ? 0.06 : 0.0 ;
201
- processNet (" dnn/ssd_mobilenet_v1_coco .pb" , " dnn/ssd_mobilenet_v1_coco .pbtxt" ,
198
+ float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD ) ? 0.011 : 0.0 ;
199
+ float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD ) ? 0.06 : 0.0 ;
200
+ processNet (" dnn/ssd_mobilenet_v1_coco_2017_11_17 .pb" , " dnn/ssd_mobilenet_v1_coco_2017_11_17 .pbtxt" ,
202
201
inp, " detection_out" , " " , l1, lInf);
203
202
}
204
203
204
+ TEST_P (DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
205
+ {
206
+ if (backend == DNN_BACKEND_HALIDE)
207
+ throw SkipTestException (" " );
208
+ Mat sample = imread (findDataFile (" dnn/street.png" , false ));
209
+ Mat inp = blobFromImage (sample, 1 .0f / 127.5 , Size (300 , 300 ), Scalar (127.5 , 127.5 , 127.5 ), false );
210
+ float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.011 : 0.0 ;
211
+ float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.06 : 0.0 ;
212
+ processNet (" dnn/ssd_mobilenet_v2_coco_2018_03_29.pb" , " dnn/ssd_mobilenet_v2_coco_2018_03_29.pbtxt" ,
213
+ inp, " detection_out" , " " , l1, lInf, 0.25 );
214
+ }
215
+
205
216
TEST_P (DNNTestNetwork, SSD_VGG16)
206
217
{
207
218
if (backend == DNN_BACKEND_HALIDE && target == DNN_TARGET_CPU)
@@ -265,9 +276,7 @@ TEST_P(DNNTestNetwork, opencv_face_detector)
265
276
266
277
TEST_P (DNNTestNetwork, Inception_v2_SSD_TensorFlow)
267
278
{
268
- if (backend == DNN_BACKEND_HALIDE ||
269
- (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL) ||
270
- (backend == DNN_BACKEND_INFERENCE_ENGINE && target == DNN_TARGET_OPENCL_FP16))
279
+ if (backend == DNN_BACKEND_HALIDE)
271
280
throw SkipTestException (" " );
272
281
Mat sample = imread (findDataFile (" dnn/street.png" , false ));
273
282
Mat inp = blobFromImage (sample, 1 .0f / 127.5 , Size (300 , 300 ), Scalar (127.5 , 127.5 , 127.5 ), false );
0 commit comments