1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2020-02-10 19:40:29 +03:00
26 changed files with 1517 additions and 1313 deletions
+150 -47
View File
@@ -67,6 +67,7 @@
//M*/
#include "../precomp.hpp"
#include <opencv2/dnn/shape_utils.hpp>
#include <iostream>
#include <fstream>
@@ -109,6 +110,26 @@ namespace cv {
params.blobs = blobs;
}
void setBatchNorm()
{
cv::dnn::LayerParams bn_param;
bn_param.name = "BatchNorm-name";
bn_param.type = "BatchNorm";
bn_param.set<bool>("has_weight", true);
bn_param.set<bool>("has_bias", true);
bn_param.set<float>("eps", 1E-6); // .000001f in Darknet Yolo
darknet::LayerParameter lp;
std::string layer_name = cv::format("bn_%d", layer_id);
lp.layer_name = layer_name;
lp.layer_type = bn_param.type;
lp.layerParams = bn_param;
lp.bottom_indexes.push_back(last_layer);
last_layer = layer_name;
net->layers.push_back(lp);
}
cv::dnn::LayerParams getParamConvolution(int kernel, int pad,
int stride, int filters_num)
{
@@ -149,25 +170,47 @@ namespace cv {
net->layers.push_back(lp);
if (use_batch_normalize)
{
cv::dnn::LayerParams bn_param;
setBatchNorm();
bn_param.name = "BatchNorm-name";
bn_param.type = "BatchNorm";
bn_param.set<bool>("has_weight", true);
bn_param.set<bool>("has_bias", true);
bn_param.set<float>("eps", 1E-6); // .000001f in Darknet Yolo
layer_id++;
fused_layer_names.push_back(last_layer);
}
darknet::LayerParameter lp;
std::string layer_name = cv::format("bn_%d", layer_id);
lp.layer_name = layer_name;
lp.layer_type = bn_param.type;
lp.layerParams = bn_param;
lp.bottom_indexes.push_back(last_layer);
last_layer = layer_name;
net->layers.push_back(lp);
cv::dnn::LayerParams getParamFullyConnected(int output)
{
cv::dnn::LayerParams params;
params.name = "FullyConnected-name";
params.type = "InnerProduct";
params.set<bool>("bias_term", false); // true only if(BatchNorm == false)
params.set<int>("num_output", output);
return params;
}
void setFullyConnected(int output, int use_batch_normalize)
{
cv::dnn::LayerParams fullyconnected_param =
getParamFullyConnected(output);
darknet::LayerParameter lp;
std::string layer_name = cv::format("fullyConnected_%d", layer_id);
// use BIAS in any case
if (!use_batch_normalize) {
fullyconnected_param.set<bool>("bias_term", true);
}
lp.layer_name = layer_name;
lp.layer_type = fullyconnected_param.type;
lp.layerParams = fullyconnected_param;
lp.bottom_indexes.push_back(last_layer);
last_layer = layer_name;
net->layers.push_back(lp);
if (use_batch_normalize)
setBatchNorm();
layer_id++;
fused_layer_names.push_back(last_layer);
}
@@ -191,18 +234,21 @@ namespace cv {
fused_layer_names.back() = last_layer;
}
void setMaxpool(size_t kernel, size_t pad, size_t stride)
void setMaxpool(int kernel, int pad, int stride)
{
cv::dnn::LayerParams maxpool_param;
maxpool_param.set<cv::String>("pool", "max");
maxpool_param.set<int>("kernel_size", kernel);
maxpool_param.set<int>("pad", pad);
maxpool_param.set<int>("pad_l", floor((float)pad / 2));
maxpool_param.set<int>("pad_r", ceil((float)pad / 2));
maxpool_param.set<int>("pad_t", floor((float)pad / 2));
maxpool_param.set<int>("pad_b", ceil((float)pad / 2));
maxpool_param.set<bool>("ceil_mode", false);
maxpool_param.set<int>("stride", stride);
maxpool_param.set<cv::String>("pad_mode", "SAME");
maxpool_param.name = "Pooling-name";
maxpool_param.type = "Pooling";
darknet::LayerParameter lp;
darknet::LayerParameter lp;
std::string layer_name = cv::format("pool_%d", layer_id);
lp.layer_name = layer_name;
lp.layer_type = maxpool_param.type;
@@ -539,7 +585,10 @@ namespace cv {
net->channels = getParam(net_params, "channels", 3);
CV_Assert(net->width > 0 && net->height > 0 && net->channels > 0);
int current_channels = net->channels;
MatShape tensor_shape(3);
tensor_shape[0] = net->channels;
tensor_shape[1] = net->width;
tensor_shape[2] = net->height;
net->out_channels_vec.resize(net->layers_cfg.size());
layers_counter = -1;
@@ -568,23 +617,46 @@ namespace cv {
padding = kernel_size / 2;
CV_Assert(kernel_size > 0 && filters > 0);
CV_Assert(current_channels > 0);
CV_Assert(tensor_shape[0] > 0);
setParams.setConvolution(kernel_size, padding, stride, filters, current_channels,
setParams.setConvolution(kernel_size, padding, stride, filters, tensor_shape[0],
batch_normalize);
current_channels = filters;
tensor_shape[0] = filters;
tensor_shape[1] = (tensor_shape[1] - kernel_size + 2 * padding) / stride + 1;
tensor_shape[2] = (tensor_shape[2] - kernel_size + 2 * padding) / stride + 1;
}
else if (layer_type == "connected")
{
int output = getParam<int>(layer_params, "output", 1);
bool batch_normalize = getParam<int>(layer_params, "batch_normalize", 0) == 1;
CV_Assert(output > 0);
setParams.setFullyConnected(output, batch_normalize);
if(layers_counter && tensor_shape[1] > 1)
net->out_channels_vec[layers_counter-1] = total(tensor_shape);
tensor_shape[0] = output;
tensor_shape[1] = 1;
tensor_shape[2] = 1;
}
else if (layer_type == "maxpool")
{
int kernel_size = getParam<int>(layer_params, "size", 2);
int stride = getParam<int>(layer_params, "stride", 2);
int pad = getParam<int>(layer_params, "pad", 0);
setParams.setMaxpool(kernel_size, pad, stride);
int padding = getParam<int>(layer_params, "padding", kernel_size - 1);
setParams.setMaxpool(kernel_size, padding, stride);
tensor_shape[1] = (tensor_shape[1] - kernel_size + padding) / stride + 1;
tensor_shape[2] = (tensor_shape[2] - kernel_size + padding) / stride + 1;
}
else if (layer_type == "avgpool")
{
setParams.setAvgpool();
tensor_shape[1] = 1;
tensor_shape[2] = 1;
}
else if (layer_type == "softmax")
{
@@ -599,10 +671,10 @@ namespace cv {
CV_Assert(!bottom_layers.empty());
std::vector<int> layers_vec = getNumbers<int>(bottom_layers);
current_channels = 0;
tensor_shape[0] = 0;
for (size_t k = 0; k < layers_vec.size(); ++k) {
layers_vec[k] = layers_vec[k] >= 0 ? layers_vec[k] : (layers_vec[k] + layers_counter);
current_channels += net->out_channels_vec[layers_vec[k]];
tensor_shape[0] += net->out_channels_vec[layers_vec[k]];
}
if (layers_vec.size() == 1)
@@ -610,10 +682,16 @@ namespace cv {
else
setParams.setConcat(layers_vec.size(), layers_vec.data());
}
else if (layer_type == "dropout")
{
setParams.setIdentity(layers_counter-1);
}
else if (layer_type == "reorg")
{
int stride = getParam<int>(layer_params, "stride", 2);
current_channels = current_channels * (stride*stride);
tensor_shape[0] = tensor_shape[0] * (stride * stride);
tensor_shape[1] = tensor_shape[1] / stride;
tensor_shape[2] = tensor_shape[2] / stride;
setParams.setReorg(stride);
}
@@ -653,6 +731,8 @@ namespace cv {
{
int scaleFactor = getParam<int>(layer_params, "stride", 1);
setParams.setUpsample(scaleFactor);
tensor_shape[1] = tensor_shape[1] * scaleFactor;
tensor_shape[2] = tensor_shape[2] * scaleFactor;
}
else if (layer_type == "yolo")
{
@@ -686,7 +766,7 @@ namespace cv {
else if (activation != "linear")
CV_Error(cv::Error::StsParseError, "Unsupported activation: " + activation);
net->out_channels_vec[layers_counter] = current_channels;
net->out_channels_vec[layers_counter] = tensor_shape[0];
}
return true;
@@ -712,7 +792,10 @@ namespace cv {
if(transpose)
CV_Error(cv::Error::StsNotImplemented, "Transpose the weights (except for convolutional) is not implemented");
int current_channels = net->channels;
MatShape tensor_shape(3);
tensor_shape[0] = net->channels;
tensor_shape[1] = net->width;
tensor_shape[2] = net->height;
int cv_layers_counter = -1;
int darknet_layers_counter = -1;
@@ -725,19 +808,36 @@ namespace cv {
std::map<std::string, std::string> &layer_params = i->second;
std::string layer_type = layer_params["type"];
if (layer_type == "convolutional")
if (layer_type == "convolutional" || layer_type == "connected")
{
int kernel_size = getParam<int>(layer_params, "size", -1);
int filters = getParam<int>(layer_params, "filters", -1);
bool use_batch_normalize = getParam<int>(layer_params, "batch_normalize", 0) == 1;
CV_Assert(kernel_size > 0 && filters > 0);
CV_Assert(current_channels > 0);
size_t const weights_size = filters * current_channels * kernel_size * kernel_size;
int sizes_weights[] = { filters, current_channels, kernel_size, kernel_size };
size_t weights_size;
int filters;
bool use_batch_normalize;
cv::Mat weightsBlob;
weightsBlob.create(4, sizes_weights, CV_32F);
if(layer_type == "convolutional")
{
int kernel_size = getParam<int>(layer_params, "size", -1);
filters = getParam<int>(layer_params, "filters", -1);
use_batch_normalize = getParam<int>(layer_params, "batch_normalize", 0) == 1;
CV_Assert(kernel_size > 0 && filters > 0);
CV_Assert(tensor_shape[0] > 0);
weights_size = filters * tensor_shape[0] * kernel_size * kernel_size;
int sizes_weights[] = { filters, tensor_shape[0], kernel_size, kernel_size };
weightsBlob.create(4, sizes_weights, CV_32F);
}
else
{
filters = getParam<int>(layer_params, "output", 1);
use_batch_normalize = getParam<int>(layer_params, "batch_normalize", 0) == 1;
CV_Assert(filters>0);
weights_size = total(tensor_shape) * filters;
int sizes_weights[] = { filters, total(tensor_shape) };
weightsBlob.create(2, sizes_weights, CV_32F);
}
CV_Assert(weightsBlob.isContinuous());
cv::Mat meanData_mat(1, filters, CV_32F); // mean
@@ -753,14 +853,14 @@ namespace cv {
}
ifile.read(reinterpret_cast<char *>(weightsBlob.ptr<float>()), sizeof(float)*weights_size);
// set convolutional weights
std::vector<cv::Mat> conv_blobs;
conv_blobs.push_back(weightsBlob);
// set conv/connected weights
std::vector<cv::Mat> layer_blobs;
layer_blobs.push_back(weightsBlob);
if (!use_batch_normalize) {
// use BIAS in any case
conv_blobs.push_back(biasData_mat);
layer_blobs.push_back(biasData_mat);
}
setParams.setLayerBlobs(cv_layers_counter, conv_blobs);
setParams.setLayerBlobs(cv_layers_counter, layer_blobs);
// set batch normalize (mean, variance, scale, bias)
if (use_batch_normalize) {
@@ -782,7 +882,10 @@ namespace cv {
if(activation == "leaky")
++cv_layers_counter; // For ReLU
current_channels = net->out_channels_vec[darknet_layers_counter];
if(!darknet_layers_counter)
tensor_shape.resize(1);
tensor_shape[0] = net->out_channels_vec[darknet_layers_counter];
}
return true;
}
+8
View File
@@ -12,7 +12,15 @@
#ifdef HAVE_DNN_NGRAPH
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4245)
#pragma warning(disable : 4268)
#endif
#include <ngraph/ngraph.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // HAVE_DNN_NGRAPH
+2
View File
@@ -148,6 +148,7 @@ Mat getMatFromTensor(opencv_onnx::TensorProto& tensor_proto)
else
{
const char* val = tensor_proto.raw_data().c_str();
#if CV_STRONG_ALIGNMENT
// Aligned pointer is required: https://github.com/opencv/opencv/issues/16373
// this doesn't work: typedef int64_t CV_DECL_ALIGNED(1) unaligned_int64_t;
AutoBuffer<int64_t, 16> aligned_val;
@@ -158,6 +159,7 @@ Mat getMatFromTensor(opencv_onnx::TensorProto& tensor_proto)
memcpy(aligned_val.data(), val, sz);
val = (const char*)aligned_val.data();
}
#endif
const int64_t* src = reinterpret_cast<const int64_t*>(val);
convertInt64ToInt32(src, dst, blob.total());
}
@@ -1468,6 +1468,8 @@ void TFImporter::populateNet(Net dstNet)
int end_mask = getLayerAttr(layer, "end_mask").i();
for (int i = 0; i < num; ++i)
{
if (ends.at<int>(i) < 0)
ends.at<int>(i) -= 1;
if (end_mask & (1 << i))
ends.at<int>(i) = -1;
if (strides.at<int>(i) != 1)
+3 -1
View File
@@ -486,7 +486,9 @@ TEST_P(DNNTestNetwork, FastNeuralStyle_eccv16)
if (backend == DNN_BACKEND_HALIDE)
applyTestTag(CV_TEST_TAG_DNN_SKIP_HALIDE);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD);
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
#if defined(INF_ENGINE_RELEASE)
#if INF_ENGINE_VER_MAJOR_LE(2018050000)
+7 -2
View File
@@ -330,7 +330,9 @@ TEST_P(Reproducibility_MobileNet_SSD, Accuracy)
}
// There is something wrong with Reshape layer in Myriad plugin.
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019
|| backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH
)
{
if (targetId == DNN_TARGET_MYRIAD || targetId == DNN_TARGET_OPENCL_FP16)
return;
@@ -675,7 +677,10 @@ TEST_P(Test_Caffe_nets, FasterRCNN_vgg16)
if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && (target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16);
if ((backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 || backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH) && target == DNN_TARGET_MYRIAD)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD);
#endif
@@ -460,6 +460,9 @@ TEST_P(Test_Darknet_nets, YOLOv3)
{
applyTestTag(CV_TEST_TAG_LONG, (target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_1GB : CV_TEST_TAG_MEMORY_2GB));
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
// batchId, classId, confidence, left, top, right, bottom
Mat ref = (Mat_<float>(9, 7) << 0, 7, 0.952983f, 0.614622f, 0.150257f, 0.901369f, 0.289251f, // a truck
0, 1, 0.987908f, 0.150913f, 0.221933f, 0.742255f, 0.74626f, // a bicycle
@@ -554,6 +557,11 @@ TEST_P(Test_Darknet_layers, reorg)
testDarknetLayer("reorg");
}
TEST_P(Test_Darknet_layers, maxpool)
{
testDarknetLayer("maxpool");
}
TEST_P(Test_Darknet_layers, convolutional)
{
if (target == DNN_TARGET_MYRIAD)
@@ -563,6 +571,13 @@ TEST_P(Test_Darknet_layers, convolutional)
testDarknetLayer("convolutional", true);
}
TEST_P(Test_Darknet_layers, connected)
{
if (backend == DNN_BACKEND_OPENCV && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
testDarknetLayer("connected", true);
}
INSTANTIATE_TEST_CASE_P(/**/, Test_Darknet_layers, dnnBackendsAndTargets());
}} // namespace
+3
View File
@@ -503,6 +503,9 @@ TEST_P(Async, create_layer_pipeline_set_and_forward_all)
if (backendId != DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && backendId != DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
throw SkipTestException("No support for async forward");
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
setInferenceEngineBackendType(CV_DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_API);
else if (backendId == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
+49 -2
View File
@@ -196,20 +196,58 @@ TEST_P(Test_TensorFlow_layers, concat_axis_1)
runTensorFlowNet("concat_axis_1");
}
TEST_P(Test_TensorFlow_layers, batch_norm)
TEST_P(Test_TensorFlow_layers, batch_norm_1)
{
runTensorFlowNet("batch_norm");
}
TEST_P(Test_TensorFlow_layers, batch_norm_2)
{
runTensorFlowNet("batch_norm", false, 0.0, 0.0, true);
}
TEST_P(Test_TensorFlow_layers, batch_norm_3)
{
runTensorFlowNet("fused_batch_norm");
}
TEST_P(Test_TensorFlow_layers, batch_norm_4)
{
runTensorFlowNet("fused_batch_norm", false, 0.0, 0.0, true);
}
TEST_P(Test_TensorFlow_layers, batch_norm_5)
{
runTensorFlowNet("batch_norm_text", true);
}
TEST_P(Test_TensorFlow_layers, batch_norm_6)
{
runTensorFlowNet("batch_norm_text", true, 0.0, 0.0, true);
}
TEST_P(Test_TensorFlow_layers, batch_norm_7)
{
runTensorFlowNet("unfused_batch_norm");
}
TEST_P(Test_TensorFlow_layers, batch_norm_8)
{
runTensorFlowNet("fused_batch_norm_no_gamma");
}
TEST_P(Test_TensorFlow_layers, batch_norm_9)
{
runTensorFlowNet("unfused_batch_norm_no_gamma");
}
TEST_P(Test_TensorFlow_layers, batch_norm_10)
{
runTensorFlowNet("mvn_batch_norm");
}
TEST_P(Test_TensorFlow_layers, batch_norm_11)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
runTensorFlowNet("mvn_batch_norm_1x1");
}
TEST_P(Test_TensorFlow_layers, batch_norm_12)
{
runTensorFlowNet("switch_identity");
}
TEST_P(Test_TensorFlow_layers, batch_norm_13)
{
runTensorFlowNet("keras_batch_norm_training");
}
@@ -431,6 +469,8 @@ TEST_P(Test_TensorFlow_nets, MobileNet_SSD)
CV_TEST_TAG_DNN_SKIP_IE_NGRAPH,
CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
}
#endif
@@ -703,10 +743,15 @@ TEST_P(Test_TensorFlow_nets, EAST_text_detection)
#if defined(INF_ENGINE_RELEASE)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_OPENCL_FP16 &&
INF_ENGINE_VER_MAJOR_EQ(2019020000))
(INF_ENGINE_VER_MAJOR_EQ(2019020000) || INF_ENGINE_VER_MAJOR_GE(2020010000))
)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_OPENCL_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#endif
checkBackend();
@@ -843,6 +888,8 @@ TEST_P(Test_TensorFlow_layers, slice)
(target == DNN_TARGET_OPENCL || target == DNN_TARGET_OPENCL_FP16))
applyTestTag(target == DNN_TARGET_OPENCL ? CV_TEST_TAG_DNN_SKIP_IE_OPENCL : CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16,
CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
double l1 = target == DNN_TARGET_MYRIAD ? 4.9e-3 : default_l1;
runTensorFlowNet("crop2d", false, l1);
runTensorFlowNet("slice_4d");
runTensorFlowNet("strided_slice");
}
+13 -6
View File
@@ -229,9 +229,14 @@ TEST_P(Test_Torch_layers, net_logsoftmax)
runTorchNet("net_logsoftmax_spatial");
}
TEST_P(Test_Torch_layers, net_lp_pooling)
TEST_P(Test_Torch_layers, net_lp_pooling_square)
{
runTorchNet("net_lp_pooling_square", "", false, true);
}
TEST_P(Test_Torch_layers, net_lp_pooling_power)
{
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target == DNN_TARGET_MYRIAD)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
runTorchNet("net_lp_pooling_power", "", false, true);
}
@@ -393,6 +398,10 @@ TEST_P(Test_Torch_nets, ENet_accuracy)
throw SkipTestException("");
if (backend == DNN_BACKEND_CUDA && target == DNN_TARGET_CUDA_FP16)
applyTestTag(CV_TEST_TAG_DNN_SKIP_CUDA_FP16);
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020010000)
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER, CV_TEST_TAG_DNN_SKIP_IE_VERSION);
#else
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target != DNN_TARGET_CPU)
{
if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
@@ -400,12 +409,10 @@ TEST_P(Test_Torch_nets, ENet_accuracy)
if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NN_BUILDER);
throw SkipTestException("");
}
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH && target != DNN_TARGET_CPU)
#endif
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NGRAPH)
{
if (target == DNN_TARGET_OPENCL_FP16) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL_FP16, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
if (target == DNN_TARGET_OPENCL) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_OPENCL, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
if (target == DNN_TARGET_MYRIAD) applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_MYRIAD, CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
throw SkipTestException("");
applyTestTag(CV_TEST_TAG_DNN_SKIP_IE_NGRAPH);
}
Net net;