@ -74,7 +74,7 @@ TEST(Test_TensorFlow, inception_accuracy)
static std : : string path ( const std : : string & file )
static std : : string path ( const std : : string & file )
{
{
return findDataFile ( " dnn/tensorflow/ " + file , false ) ;
return findDataFile ( " dnn/tensorflow/ " + file ) ;
}
}
class Test_TensorFlow_layers : public DNNTestLayer
class Test_TensorFlow_layers : public DNNTestLayer
@ -146,6 +146,7 @@ TEST_P(Test_TensorFlow_layers, padding)
runTensorFlowNet ( " padding_valid " ) ;
runTensorFlowNet ( " padding_valid " ) ;
runTensorFlowNet ( " spatial_padding " ) ;
runTensorFlowNet ( " spatial_padding " ) ;
runTensorFlowNet ( " keras_pad_concat " ) ;
runTensorFlowNet ( " keras_pad_concat " ) ;
runTensorFlowNet ( " mirror_pad " ) ;
}
}
TEST_P ( Test_TensorFlow_layers , padding_same )
TEST_P ( Test_TensorFlow_layers , padding_same )
@ -154,7 +155,7 @@ TEST_P(Test_TensorFlow_layers, padding_same)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
// Reference output values are in range [0.0006, 2.798]
// Reference output values are in range [0.0006, 2.798]
runTensorFlowNet ( " padding_same " ) ;
runTensorFlowNet ( " padding_same " ) ;
@ -196,14 +197,19 @@ TEST_P(Test_TensorFlow_layers, batch_norm)
TEST_P ( Test_TensorFlow_layers , batch_norm3D )
TEST_P ( Test_TensorFlow_layers , batch_norm3D )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target ! = DNN_TARGET_CPU )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target ! = DNN_TARGET_CPU )
{
if ( target = = DNN_TARGET_OPENCL_FP16 ) applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 ) ;
if ( target = = DNN_TARGET_OPENCL ) applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_OPENCL ) ;
if ( target = = DNN_TARGET_MYRIAD ) applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD ) ;
throw SkipTestException ( " " ) ;
throw SkipTestException ( " " ) ;
}
runTensorFlowNet ( " batch_norm3d " ) ;
runTensorFlowNet ( " batch_norm3d " ) ;
}
}
TEST_P ( Test_TensorFlow_layers , slim_batch_norm )
TEST_P ( Test_TensorFlow_layers , slim_batch_norm )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
throw SkipTestException ( " Test is disabled for DLIE " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
// Output values range: [-40.0597, 207.827]
// Output values range: [-40.0597, 207.827]
double l1 = ( target = = DNN_TARGET_OPENCL_FP16 | | target = = DNN_TARGET_MYRIAD ) ? 0.041 : default_l1 ;
double l1 = ( target = = DNN_TARGET_OPENCL_FP16 | | target = = DNN_TARGET_MYRIAD ) ? 0.041 : default_l1 ;
double lInf = ( target = = DNN_TARGET_OPENCL_FP16 | | target = = DNN_TARGET_MYRIAD ) ? 0.33 : default_lInf ;
double lInf = ( target = = DNN_TARGET_OPENCL_FP16 | | target = = DNN_TARGET_MYRIAD ) ? 0.33 : default_lInf ;
@ -226,7 +232,7 @@ TEST_P(Test_TensorFlow_layers, ave_pool_same)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
runTensorFlowNet ( " ave_pool_same " ) ;
runTensorFlowNet ( " ave_pool_same " ) ;
}
}
@ -266,7 +272,7 @@ TEST_P(Test_TensorFlow_layers, deconvolution)
TEST_P ( Test_TensorFlow_layers , matmul )
TEST_P ( Test_TensorFlow_layers , matmul )
{
{
if ( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 )
if ( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 )
throw SkipTestException ( " " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_OPENCL_FP16 ) ;
runTensorFlowNet ( " matmul " ) ;
runTensorFlowNet ( " matmul " ) ;
runTensorFlowNet ( " nhwc_transpose_reshape_matmul " ) ;
runTensorFlowNet ( " nhwc_transpose_reshape_matmul " ) ;
// Reference output values are in range [-5.688, 4.484]
// Reference output values are in range [-5.688, 4.484]
@ -278,7 +284,7 @@ TEST_P(Test_TensorFlow_layers, matmul)
TEST_P ( Test_TensorFlow_layers , reshape )
TEST_P ( Test_TensorFlow_layers , reshape )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
throw SkipTestException ( " " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
runTensorFlowNet ( " shift_reshape_no_reorder " ) ;
runTensorFlowNet ( " shift_reshape_no_reorder " ) ;
runTensorFlowNet ( " reshape_no_reorder " ) ;
runTensorFlowNet ( " reshape_no_reorder " ) ;
runTensorFlowNet ( " reshape_reduce " ) ;
runTensorFlowNet ( " reshape_reduce " ) ;
@ -291,7 +297,7 @@ TEST_P(Test_TensorFlow_layers, flatten)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
)
)
throw SkipTestException ( " Test is disabled for Myriad2 " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2 ) ;
# endif
# endif
runTensorFlowNet ( " flatten " , true ) ;
runTensorFlowNet ( " flatten " , true ) ;
@ -307,7 +313,7 @@ TEST_P(Test_TensorFlow_layers, leaky_relu)
{
{
# if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2018050000)
# if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2018050000)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_OPENCL )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_OPENCL )
throw SkipTestException ( " Test is disabled for DLIE/OCL target (OpenVINO 2018R5) " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_OPENCL , CV_TEST_TAG_DNN_SKIP_IE_2018R5 ) ;
# endif
# endif
runTensorFlowNet ( " leaky_relu_order1 " ) ;
runTensorFlowNet ( " leaky_relu_order1 " ) ;
runTensorFlowNet ( " leaky_relu_order2 " ) ;
runTensorFlowNet ( " leaky_relu_order2 " ) ;
@ -320,7 +326,7 @@ TEST_P(Test_TensorFlow_layers, l2_normalize)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
runTensorFlowNet ( " l2_normalize " ) ;
runTensorFlowNet ( " l2_normalize " ) ;
@ -333,11 +339,11 @@ TEST_P(Test_TensorFlow_layers, l2_normalize_3d)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE
& & ( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 )
& & ( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 )
)
)
throw SkipTestException ( " Test is disabled for DLIE for OpenCL targets " ) ;
applyTestTag ( target = = DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 ) ;
# endif
# endif
# if defined(INF_ENGINE_RELEASE)
# if defined(INF_ENGINE_RELEASE)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD )
throw SkipTestException ( " Test is disabled for Myriad targets " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD ) ;
# endif
# endif
runTensorFlowNet ( " l2_normalize_3d " ) ;
runTensorFlowNet ( " l2_normalize_3d " ) ;
@ -352,23 +358,23 @@ TEST_P(Test_TensorFlow_nets, MobileNet_SSD)
{
{
# if INF_ENGINE_VER_MAJOR_GE(2019010000)
# if INF_ENGINE_VER_MAJOR_GE(2019010000)
if ( getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X )
if ( getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X )
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# else
# else
throw SkipTestException ( " Test is disabled for Myriad " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD ) ;
# endif
# endif
}
}
# endif
# endif
checkBackend ( ) ;
checkBackend ( ) ;
std : : string imgPath = findDataFile ( " dnn/street.png " ) ;
std : : string netConfig = findDataFile ( " dnn/ssd_mobilenet_v1_coco.pbtxt " ) ;
std : : string netPath = findDataFile ( " dnn/ssd_mobilenet_v1_coco.pb " , false ) ;
std : : string netPath = findDataFile ( " dnn/ssd_mobilenet_v1_coco.pb " , false ) ;
std : : string netConfig = findDataFile ( " dnn/ssd_mobilenet_v1_coco.pbtxt " , false ) ;
std : : string imgPath = findDataFile ( " dnn/street.png " , false ) ;
Mat inp ;
Mat inp ;
resize ( imread ( imgPath ) , inp , Size ( 300 , 300 ) ) ;
resize ( imread ( imgPath ) , inp , Size ( 300 , 300 ) ) ;
inp = blobFromImage ( inp , 1.0f / 127.5 , Size ( ) , Scalar ( 127.5 , 127.5 , 127.5 ) , true ) ;
inp = blobFromImage ( inp , 1.0f / 127.5 , Size ( ) , Scalar ( 127.5 , 127.5 , 127.5 ) , true ) ;
Mat ref = blobFromNPY ( findDataFile ( " dnn/tensorflow/ssd_mobilenet_v1_coco.detection_out.npy " , false ) ) ;
Mat ref = blobFromNPY ( findDataFile ( " dnn/tensorflow/ssd_mobilenet_v1_coco.detection_out.npy " ) ) ;
Net net = readNetFromTensorflow ( netPath , netConfig ) ;
Net net = readNetFromTensorflow ( netPath , netConfig ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
@ -393,15 +399,15 @@ TEST_P(Test_TensorFlow_nets, Inception_v2_SSD)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
checkBackend ( ) ;
checkBackend ( ) ;
std : : string proto = findDataFile ( " dnn/ssd_inception_v2_coco_2017_11_17.pbtxt " , false ) ;
Mat img = imread ( findDataFile ( " dnn/street.png " ) ) ;
std : : string proto = findDataFile ( " dnn/ssd_inception_v2_coco_2017_11_17.pbtxt " ) ;
std : : string model = findDataFile ( " dnn/ssd_inception_v2_coco_2017_11_17.pb " , false ) ;
std : : string model = findDataFile ( " dnn/ssd_inception_v2_coco_2017_11_17.pb " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Mat img = imread ( findDataFile ( " dnn/street.png " , false ) ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
@ -431,14 +437,14 @@ TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
std : : string proto = findDataFile ( " dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt " ) ;
std : : string model = findDataFile ( " dnn/ssd_mobilenet_v1_coco_2017_11_17.pb " , false ) ;
std : : string model = findDataFile ( " dnn/ssd_mobilenet_v1_coco_2017_11_17.pb " , false ) ;
std : : string proto = findDataFile ( " dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " , false ) ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " ) ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
@ -466,20 +472,21 @@ TEST_P(Test_TensorFlow_nets, Faster_RCNN)
" faster_rcnn_resnet50_coco_2018_01_28 " } ;
" faster_rcnn_resnet50_coco_2018_01_28 " } ;
checkBackend ( ) ;
checkBackend ( ) ;
if ( ( backend = = DNN_BACKEND_INFERENCE_ENGINE ) | |
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 ) )
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
throw SkipTestException ( " " ) ;
if ( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 )
applyTestTag ( CV_TEST_TAG_DNN_SKIP_OPENCL_FP16 ) ;
double scoresDiff = backend = = DNN_BACKEND_INFERENCE_ENGINE ? 2.9e-5 : 1e-5 ;
double scoresDiff = backend = = DNN_BACKEND_INFERENCE_ENGINE ? 2.9e-5 : 1e-5 ;
for ( int i = 0 ; i < 2 ; + + i )
for ( int i = 0 ; i < 2 ; + + i )
{
{
std : : string proto = findDataFile ( " dnn/ " + names [ i ] + " .pbtxt " , false ) ;
std : : string proto = findDataFile ( " dnn/ " + names [ i ] + " .pbtxt " ) ;
std : : string model = findDataFile ( " dnn/ " + names [ i ] + " .pb " , false ) ;
std : : string model = findDataFile ( " dnn/ " + names [ i ] + " .pb " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableTarget ( target ) ;
net . setPreferableTarget ( target ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " , false ) ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " ) ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 800 , 600 ) , Scalar ( ) , true , false ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 800 , 600 ) , Scalar ( ) , true , false ) ;
net . setInput ( blob ) ;
net . setInput ( blob ) ;
@ -494,16 +501,16 @@ TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD_PPN)
{
{
# if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2018050000)
# if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2018050000)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & ( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 ) )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & ( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 ) )
throw SkipTestException ( " Test is disabled for DLIE OpenCL targets in OpenVINO 2018R5 " ) ;
applyTestTag ( target = = DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 ) ;
# endif
# endif
checkBackend ( ) ;
checkBackend ( ) ;
std : : string proto = findDataFile ( " dnn/ssd_mobilenet_v1_ppn_coco.pbtxt " , false ) ;
std : : string proto = findDataFile ( " dnn/ssd_mobilenet_v1_ppn_coco.pbtxt " ) ;
std : : string model = findDataFile ( " dnn/ssd_mobilenet_v1_ppn_coco.pb " , false ) ;
std : : string model = findDataFile ( " dnn/ssd_mobilenet_v1_ppn_coco.pb " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " , false ) ) ;
Mat img = imread ( findDataFile ( " dnn/dog416.png " ) ) ;
Mat ref = blobFromNPY ( findDataFile ( " dnn/tensorflow/ssd_mobilenet_v1_ppn_coco.detection_out.npy " , false ) ) ;
Mat ref = blobFromNPY ( findDataFile ( " dnn/tensorflow/ssd_mobilenet_v1_ppn_coco.detection_out.npy " ) ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 300 , 300 ) , Scalar ( ) , true , false ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
@ -521,11 +528,11 @@ TEST_P(Test_TensorFlow_nets, MobileNet_v1_SSD_PPN)
TEST_P ( Test_TensorFlow_nets , opencv_face_detector_uint8 )
TEST_P ( Test_TensorFlow_nets , opencv_face_detector_uint8 )
{
{
checkBackend ( ) ;
checkBackend ( ) ;
std : : string proto = findDataFile ( " dnn/opencv_face_detector.pbtxt " , false ) ;
std : : string proto = findDataFile ( " dnn/opencv_face_detector.pbtxt " ) ;
std : : string model = findDataFile ( " dnn/opencv_face_detector_uint8.pb " , false ) ;
std : : string model = findDataFile ( " dnn/opencv_face_detector_uint8.pb " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Mat img = imread ( findDataFile ( " gpu/lbpcascade/er.png " , false ) ) ;
Mat img = imread ( findDataFile ( " gpu/lbpcascade/er.png " ) ) ;
Mat blob = blobFromImage ( img , 1.0 , Size ( ) , Scalar ( 104.0 , 177.0 , 123.0 ) , false , false ) ;
Mat blob = blobFromImage ( img , 1.0 , Size ( ) , Scalar ( 104.0 , 177.0 , 123.0 ) , false , false ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
@ -566,17 +573,17 @@ TEST_P(Test_TensorFlow_nets, EAST_text_detection)
# if defined(INF_ENGINE_RELEASE)
# if defined(INF_ENGINE_RELEASE)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD )
throw SkipTestException ( " Test is disabled for Myriad targets " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD ) ;
# endif
# endif
checkBackend ( ) ;
checkBackend ( ) ;
std : : string netPath = findDataFile ( " dnn/frozen_east_text_detection.pb " , false ) ;
std : : string netPath = findDataFile ( " dnn/frozen_east_text_detection.pb " , false ) ;
std : : string imgPath = findDataFile ( " cv/ximgproc/sources/08.png " , false ) ;
std : : string imgPath = findDataFile ( " cv/ximgproc/sources/08.png " ) ;
std : : string refScoresPath = findDataFile ( " dnn/east_text_detection.scores.npy " , false ) ;
std : : string refScoresPath = findDataFile ( " dnn/east_text_detection.scores.npy " ) ;
std : : string refGeometryPath = findDataFile ( " dnn/east_text_detection.geometry.npy " , false ) ;
std : : string refGeometryPath = findDataFile ( " dnn/east_text_detection.geometry.npy " ) ;
Net net = readNet ( findDataFile ( " dnn/frozen_east_text_detection.pb " , false ) ) ;
Net net = readNet ( netPath ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableBackend ( backend ) ;
net . setPreferableTarget ( target ) ;
net . setPreferableTarget ( target ) ;
@ -645,7 +652,7 @@ TEST_P(Test_TensorFlow_layers, fp16_padding_same)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X
)
)
throw SkipTestException ( " Test is disabled for MyriadX " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_X ) ;
# endif
# endif
// Reference output values are in range [-3.504, -0.002]
// Reference output values are in range [-3.504, -0.002]
@ -664,9 +671,10 @@ TEST_P(Test_TensorFlow_layers, quantized)
TEST_P ( Test_TensorFlow_layers , lstm )
TEST_P ( Test_TensorFlow_layers , lstm )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE | |
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 ) )
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
throw SkipTestException ( " " ) ;
if ( backend = = DNN_BACKEND_OPENCV & & target = = DNN_TARGET_OPENCL_FP16 )
applyTestTag ( CV_TEST_TAG_DNN_SKIP_OPENCL_FP16 ) ;
runTensorFlowNet ( " lstm " , true ) ;
runTensorFlowNet ( " lstm " , true ) ;
runTensorFlowNet ( " lstm " , true , 0.0 , 0.0 , true ) ;
runTensorFlowNet ( " lstm " , true , 0.0 , 0.0 , true ) ;
}
}
@ -674,7 +682,7 @@ TEST_P(Test_TensorFlow_layers, lstm)
TEST_P ( Test_TensorFlow_layers , split )
TEST_P ( Test_TensorFlow_layers , split )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
throw SkipTestException ( " " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
runTensorFlowNet ( " split_equals " ) ;
runTensorFlowNet ( " split_equals " ) ;
}
}
@ -688,7 +696,7 @@ TEST_P(Test_TensorFlow_layers, slice)
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & &
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & &
( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 ) )
( target = = DNN_TARGET_OPENCL | | target = = DNN_TARGET_OPENCL_FP16 ) )
throw SkipTestException ( " " ) ;
applyTestTag ( target = = DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16 ) ;
runTensorFlowNet ( " slice_4d " ) ;
runTensorFlowNet ( " slice_4d " ) ;
runTensorFlowNet ( " strided_slice " ) ;
runTensorFlowNet ( " strided_slice " ) ;
}
}
@ -705,7 +713,7 @@ TEST_P(Test_TensorFlow_layers, slim_softmax_v2)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD & &
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD & &
getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
)
)
throw SkipTestException ( " Test is disabled for Myriad2 " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2 ) ;
# endif
# endif
runTensorFlowNet ( " slim_softmax_v2 " ) ;
runTensorFlowNet ( " slim_softmax_v2 " ) ;
}
}
@ -719,7 +727,7 @@ TEST_P(Test_TensorFlow_layers, relu6)
TEST_P ( Test_TensorFlow_layers , subpixel )
TEST_P ( Test_TensorFlow_layers , subpixel )
{
{
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE )
throw SkipTestException ( " " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE ) ;
runTensorFlowNet ( " subpixel " ) ;
runTensorFlowNet ( " subpixel " ) ;
}
}
@ -740,7 +748,7 @@ TEST_P(Test_TensorFlow_layers, squeeze)
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
if ( backend = = DNN_BACKEND_INFERENCE_ENGINE & & target = = DNN_TARGET_MYRIAD
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
& & getInferenceEngineVPUType ( ) = = CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2
)
)
throw SkipTestException ( " Test is disabled for Myriad2 " ) ;
applyTestTag ( CV_TEST_TAG_DNN_SKIP_IE_MYRIAD_2 ) ;
# endif
# endif
int inpShapes [ ] [ 4 ] = { { 1 , 3 , 4 , 2 } , { 1 , 3 , 1 , 2 } , { 1 , 3 , 4 , 1 } , { 1 , 3 , 4 , 1 } } ; // TensorFlow's shape (NHWC)
int inpShapes [ ] [ 4 ] = { { 1 , 3 , 4 , 2 } , { 1 , 3 , 1 , 2 } , { 1 , 3 , 4 , 1 } , { 1 , 3 , 4 , 1 } } ; // TensorFlow's shape (NHWC)
int outShapes [ ] [ 3 ] = { { 3 , 4 , 2 } , { 1 , 3 , 2 } , { 1 , 3 , 4 } , { 1 , 3 , 4 } } ;
int outShapes [ ] [ 3 ] = { { 3 , 4 , 2 } , { 1 , 3 , 2 } , { 1 , 3 , 4 } , { 1 , 3 , 4 } } ;
@ -793,11 +801,11 @@ TEST(Test_TensorFlow, two_inputs)
TEST ( Test_TensorFlow , Mask_RCNN )
TEST ( Test_TensorFlow , Mask_RCNN )
{
{
applyTestTag ( CV_TEST_TAG_MEMORY_1GB , CV_TEST_TAG_DEBUG_VERYLONG ) ;
applyTestTag ( CV_TEST_TAG_MEMORY_1GB , CV_TEST_TAG_DEBUG_VERYLONG ) ;
std : : string proto = findDataFile ( " dnn/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt " , false ) ;
Mat img = imread ( findDataFile ( " dnn/street.png " ) ) ;
std : : string proto = findDataFile ( " dnn/mask_rcnn_inception_v2_coco_2018_01_28.pbtxt " ) ;
std : : string model = findDataFile ( " dnn/mask_rcnn_inception_v2_coco_2018_01_28.pb " , false ) ;
std : : string model = findDataFile ( " dnn/mask_rcnn_inception_v2_coco_2018_01_28.pb " , false ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Net net = readNetFromTensorflow ( model , proto ) ;
Mat img = imread ( findDataFile ( " dnn/street.png " , false ) ) ;
Mat refDetections = blobFromNPY ( path ( " mask_rcnn_inception_v2_coco_2018_01_28.detection_out.npy " ) ) ;
Mat refDetections = blobFromNPY ( path ( " mask_rcnn_inception_v2_coco_2018_01_28.detection_out.npy " ) ) ;
Mat refMasks = blobFromNPY ( path ( " mask_rcnn_inception_v2_coco_2018_01_28.detection_masks.npy " ) ) ;
Mat refMasks = blobFromNPY ( path ( " mask_rcnn_inception_v2_coco_2018_01_28.detection_masks.npy " ) ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 800 , 800 ) , Scalar ( ) , true , false ) ;
Mat blob = blobFromImage ( img , 1.0f , Size ( 800 , 800 ) , Scalar ( ) , true , false ) ;