@@ -168,6 +168,8 @@ TEST_P(DNNTestNetwork, ENet)
168
168
applyTestTag (CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
169
169
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
170
170
applyTestTag (CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
171
+ if (backend == DNN_BACKEND_CUDA && target == DNN_TARGET_CUDA_FP16)
172
+ applyTestTag (CV_TEST_TAG_DNN_SKIP_CUDA_FP16);
171
173
processNet (" dnn/Enet-model-best.net" , " " , Size (512 , 512 ), " l367_Deconvolution" ,
172
174
target == DNN_TARGET_OPENCL ? " dnn/halide_scheduler_opencl_enet.yml" :
173
175
" dnn/halide_scheduler_enet.yml" ,
@@ -182,11 +184,11 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe)
182
184
applyTestTag (CV_TEST_TAG_DNN_SKIP_HALIDE);
183
185
Mat sample = imread (findDataFile (" dnn/street.png" ));
184
186
Mat inp = blobFromImage (sample, 1 .0f / 127.5 , Size (300 , 300 ), Scalar (127.5 , 127.5 , 127.5 ), false );
185
- float diffScores = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 1.5e-2 : 0.0 ;
186
- float diffSquares = (target == DNN_TARGET_MYRIAD) ? 0.063 : 0.0 ;
187
+ float scoreDiff = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 1.5e-2 : 0.0 ;
188
+ float iouDiff = (target == DNN_TARGET_MYRIAD) ? 0.063 : 0.0 ;
187
189
float detectionConfThresh = (target == DNN_TARGET_MYRIAD) ? 0.252 : FLT_MIN;
188
190
processNet (" dnn/MobileNetSSD_deploy.caffemodel" , " dnn/MobileNetSSD_deploy.prototxt" ,
189
- inp, " detection_out" , " " , diffScores, diffSquares , detectionConfThresh);
191
+ inp, " detection_out" , " " , scoreDiff, iouDiff , detectionConfThresh);
190
192
expectNoFallbacksFromIE (net);
191
193
}
192
194
@@ -201,10 +203,19 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe_Different_Width_Height)
201
203
#endif
202
204
Mat sample = imread (findDataFile (" dnn/street.png" ));
203
205
Mat inp = blobFromImage (sample, 1 .0f / 127.5 , Size (300 , 560 ), Scalar (127.5 , 127.5 , 127.5 ), false );
204
- float diffScores = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.029 : 0.0 ;
205
- float diffSquares = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.09 : 0.0 ;
206
+ float scoreDiff = 0.0 , iouDiff = 0.0 ;
207
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
208
+ {
209
+ scoreDiff = 0.029 ;
210
+ iouDiff = 0.09 ;
211
+ }
212
+ else if (target == DNN_TARGET_CUDA_FP16)
213
+ {
214
+ scoreDiff = 0.03 ;
215
+ iouDiff = 0.08 ;
216
+ }
206
217
processNet (" dnn/MobileNetSSD_deploy.caffemodel" , " dnn/MobileNetSSD_deploy.prototxt" ,
207
- inp, " detection_out" , " " , diffScores, diffSquares );
218
+ inp, " detection_out" , " " , scoreDiff, iouDiff );
208
219
expectNoFallbacksFromIE (net);
209
220
}
210
221
@@ -216,11 +227,20 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
216
227
217
228
Mat sample = imread (findDataFile (" dnn/street.png" ));
218
229
Mat inp = blobFromImage (sample, 1 .0f , Size (300 , 300 ), Scalar (), false );
219
- float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.095 : 0.0 ;
220
- float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.09 : 0.0 ;
221
230
float detectionConfThresh = (target == DNN_TARGET_MYRIAD) ? 0.216 : 0.2 ;
231
+ float scoreDiff = 0.0 , iouDiff = 0.0 ;
232
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
233
+ {
234
+ scoreDiff = 0.095 ;
235
+ iouDiff = 0.09 ;
236
+ }
237
+ else if (target == DNN_TARGET_CUDA_FP16)
238
+ {
239
+ scoreDiff = 0.007 ;
240
+ iouDiff = 0.08 ;
241
+ }
222
242
processNet (" dnn/ssd_mobilenet_v1_coco_2017_11_17.pb" , " dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt" ,
223
- inp, " detection_out" , " " , l1, lInf , detectionConfThresh);
243
+ inp, " detection_out" , " " , scoreDiff, iouDiff , detectionConfThresh);
224
244
expectNoFallbacksFromIE (net);
225
245
}
226
246
@@ -240,10 +260,19 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow_Different_Width_Height)
240
260
241
261
Mat sample = imread (findDataFile (" dnn/street.png" ));
242
262
Mat inp = blobFromImage (sample, 1 .0f , Size (300 , 560 ), Scalar (), false );
243
- float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.012 : 0.0 ;
244
- float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.06 : 0.0 ;
263
+ float scoreDiff = 0.0 , iouDiff = 0.0 ;
264
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
265
+ {
266
+ scoreDiff = 0.012 ;
267
+ iouDiff = 0.06 ;
268
+ }
269
+ else if (target == DNN_TARGET_CUDA_FP16)
270
+ {
271
+ scoreDiff = 0.007 ;
272
+ iouDiff = 0.06 ;
273
+ }
245
274
processNet (" dnn/ssd_mobilenet_v1_coco_2017_11_17.pb" , " dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt" ,
246
- inp, " detection_out" , " " , l1, lInf );
275
+ inp, " detection_out" , " " , scoreDiff, iouDiff );
247
276
expectNoFallbacksFromIE (net);
248
277
}
249
278
@@ -255,10 +284,19 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
255
284
256
285
Mat sample = imread (findDataFile (" dnn/street.png" ));
257
286
Mat inp = blobFromImage (sample, 1 .0f , Size (300 , 300 ), Scalar (), false );
258
- float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.013 : 2e-5 ;
259
- float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.062 : 0.0 ;
287
+ float scoreDiff = 2e-5 , iouDiff = 0.0 ;
288
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
289
+ {
290
+ scoreDiff = 0.013 ;
291
+ iouDiff = 0.062 ;
292
+ }
293
+ else if (target == DNN_TARGET_CUDA_FP16)
294
+ {
295
+ scoreDiff = 0.02 ;
296
+ iouDiff = 0.07 ;
297
+ }
260
298
processNet (" dnn/ssd_mobilenet_v2_coco_2018_03_29.pb" , " dnn/ssd_mobilenet_v2_coco_2018_03_29.pbtxt" ,
261
- inp, " detection_out" , " " , l1, lInf , 0.25 );
299
+ inp, " detection_out" , " " , scoreDiff, iouDiff , 0.25 );
262
300
expectNoFallbacksFromIE (net);
263
301
}
264
302
@@ -268,12 +306,25 @@ TEST_P(DNNTestNetwork, SSD_VGG16)
268
306
CV_TEST_TAG_DEBUG_VERYLONG);
269
307
if (backend == DNN_BACKEND_HALIDE && target == DNN_TARGET_CPU)
270
308
applyTestTag (CV_TEST_TAG_DNN_SKIP_HALIDE); // TODO HALIDE_CPU
271
- double scoreThreshold = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.0325 : 0.0 ;
272
- const float lInf = (target == DNN_TARGET_MYRIAD) ? 0.032 : 0.0 ;
273
309
Mat sample = imread (findDataFile (" dnn/street.png" ));
274
310
Mat inp = blobFromImage (sample, 1 .0f , Size (300 , 300 ), Scalar (), false );
311
+ float scoreDiff = 0.0 , iouDiff = 0.0 ;
312
+ if (target == DNN_TARGET_OPENCL_FP16)
313
+ {
314
+ scoreDiff = 0.0325 ;
315
+ }
316
+ else if (target == DNN_TARGET_MYRIAD)
317
+ {
318
+ scoreDiff = 0.0325 ;
319
+ iouDiff = 0.032 ;
320
+ }
321
+ else if (target == DNN_TARGET_CUDA_FP16)
322
+ {
323
+ scoreDiff = 0.03 ;
324
+ }
325
+
275
326
processNet (" dnn/VGG_ILSVRC2016_SSD_300x300_iter_440000.caffemodel" ,
276
- " dnn/ssd_vgg16.prototxt" , inp, " detection_out" , " " , scoreThreshold, lInf );
327
+ " dnn/ssd_vgg16.prototxt" , inp, " detection_out" , " " , scoreDiff, iouDiff );
277
328
expectNoFallbacksFromIE (net);
278
329
}
279
330
@@ -384,10 +435,19 @@ TEST_P(DNNTestNetwork, Inception_v2_SSD_TensorFlow)
384
435
applyTestTag (CV_TEST_TAG_DNN_SKIP_HALIDE);
385
436
Mat sample = imread (findDataFile (" dnn/street.png" ));
386
437
Mat inp = blobFromImage (sample, 1 .0f , Size (300 , 300 ), Scalar (), false );
387
- float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.015 : 0.0 ;
388
- float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.0731 : 0.0 ;
438
+ float scoreDiff = 0.0 , iouDiff = 0.0 ;
439
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
440
+ {
441
+ scoreDiff = 0.015 ;
442
+ iouDiff = 0.0731 ;
443
+ }
444
+ else if (target == DNN_TARGET_CUDA_FP16)
445
+ {
446
+ scoreDiff = 0.015 ;
447
+ iouDiff = 0.08 ;
448
+ }
389
449
processNet (" dnn/ssd_inception_v2_coco_2017_11_17.pb" , " dnn/ssd_inception_v2_coco_2017_11_17.pbtxt" ,
390
- inp, " detection_out" , " " , l1, lInf );
450
+ inp, " detection_out" , " " , scoreDiff, iouDiff );
391
451
expectNoFallbacksFromIE (net);
392
452
}
393
453
@@ -400,11 +460,18 @@ TEST_P(DNNTestNetwork, DenseNet_121)
400
460
float l1 = 0.0 , lInf = 0.0 ;
401
461
if (target == DNN_TARGET_OPENCL_FP16)
402
462
{
403
- l1 = 2e-2 ; lInf = 9e-2 ;
463
+ l1 = 2e-2 ;
464
+ lInf = 9e-2 ;
404
465
}
405
466
else if (target == DNN_TARGET_MYRIAD)
406
467
{
407
- l1 = 0.1 ; lInf = 0.6 ;
468
+ l1 = 0.1 ;
469
+ lInf = 0.6 ;
470
+ }
471
+ else if (target == DNN_TARGET_CUDA_FP16)
472
+ {
473
+ l1 = 0.008 ;
474
+ lInf = 0.05 ;
408
475
}
409
476
processNet (" dnn/DenseNet_121.caffemodel" , " dnn/DenseNet_121.prototxt" , Size (224 , 224 ), " " , " " , l1, lInf);
410
477
if (target != DNN_TARGET_MYRIAD || getInferenceEngineVPUType () != CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X)
@@ -431,8 +498,17 @@ TEST_P(DNNTestNetwork, FastNeuralStyle_eccv16)
431
498
Mat img = imread (findDataFile (" dnn/googlenet_1.png" ));
432
499
Mat inp = blobFromImage (img, 1.0 , Size (320 , 240 ), Scalar (103.939 , 116.779 , 123.68 ), false , false );
433
500
// Output image has values in range [-143.526, 148.539].
434
- float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.4 : 4e-5 ;
435
- float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 7.45 : 2e-3 ;
501
+ float l1 = 4e-5 , lInf = 2e-3 ;
502
+ if (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD)
503
+ {
504
+ l1 = 0.4 ;
505
+ lInf = 7.45 ;
506
+ }
507
+ else if (target == DNN_TARGET_CUDA_FP16)
508
+ {
509
+ l1 = 0.3 ;
510
+ lInf = 7.2 ;
511
+ }
436
512
processNet (" dnn/fast_neural_style_eccv16_starry_night.t7" , " " , inp, " " , " " , l1, lInf);
437
513
#if defined(HAVE_INF_ENGINE) && INF_ENGINE_VER_MAJOR_GE(2019010000)
438
514
expectNoFallbacksFromIE (net);
0 commit comments