Skip to content

Commit c38eff6

Browse files
committed
Merge pull request opencv#24763 from opencv-pushbot:gitee/alalek/test_dnn_skip_update_debug
2 parents dba7186 + f49b261 commit c38eff6

10 files changed

+118
-41
lines changed

modules/dnn/perf/perf_convolution.cpp

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "perf_precomp.hpp"
66
#include <opencv2/dnn/shape_utils.hpp>
7+
#include <opencv2/core/utils/configuration.private.hpp>
78

89
namespace opencv_test {
910

@@ -773,16 +774,14 @@ struct ConvParamGenerator
773774

774775
::testing::internal::ParamGenerator<ConvParam_t> all() const
775776
{
776-
#if 1
777-
// default to 20 for each type of convolution
778-
const int NUM = 20;
779-
#else
780-
const int NUM = size;
781-
#endif
782-
783-
ConvParam_t v_[NUM];
777+
int NUM = size;
778+
static size_t DNN_LIMIT_CONV = utils::getConfigurationParameterSizeT("OPENCV_TEST_DNN_LIMIT_CONV", 0);
779+
if (DNN_LIMIT_CONV > 0)
780+
NUM = std::min(NUM, (int)DNN_LIMIT_CONV);
781+
782+
std::vector<ConvParam_t> v_(NUM);
784783
for (int i = 0; i < NUM; ++i) { v_[i] = testConfigs[i]; } // reduce generated code size
785-
return ::testing::ValuesIn(v_, v_ + NUM);
784+
return ::testing::ValuesIn(v_);
786785
}
787786
};
788787
static inline void PrintTo(const ConvParam_t& p, std::ostream* os)
@@ -807,9 +806,20 @@ static inline void PrintTo(const ConvParam_t& p, std::ostream* os)
807806
*os << ", BIAS";
808807
}
809808

810-
Net build_net(const ConvParam_t& params, Backend backendId, Target targetId)
809+
static
810+
Net build_net(
811+
const ConvParam_t& params, Backend backendId, Target targetId,
812+
const std::function<void(Net&)>& configure_network_cb = std::function<void(Net&)>(),
813+
double flops_limit_debug_long = 2e9, double flops_limit_debug_verylong = 6e9
814+
)
811815
{
812816
double declared_flops = params.declared_flops;
817+
818+
if (flops_limit_debug_verylong > 0 && declared_flops >= flops_limit_debug_verylong)
819+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
820+
if (flops_limit_debug_long > 0 && declared_flops >= flops_limit_debug_long)
821+
applyTestTag(CV_TEST_TAG_DEBUG_LONG);
822+
813823
Size kernel = params.kernel;
814824
MatShape inputShape = MatShape(params.shapeIn.dims, params.shapeIn.dims + 4);
815825
int outChannels = params.outCN;
@@ -863,9 +873,14 @@ Net build_net(const ConvParam_t& params, Backend backendId, Target targetId)
863873
Net net;
864874
net.addLayerToPrev(lp.name, lp.type, lp);
865875

866-
net.setInput(input);
867876
net.setPreferableBackend(backendId);
868877
net.setPreferableTarget(targetId);
878+
if (configure_network_cb)
879+
{
880+
configure_network_cb(net);
881+
}
882+
883+
net.setInput(input);
869884

870885
// warmup
871886
Mat output = net.forward();
@@ -928,11 +943,12 @@ PERF_TEST_P_(Conv_3x3S1D1, conv)
928943
Backend backendId = get<0>(get<1>(GetParam()));
929944
Target targetId = get<1>(get<1>(GetParam()));
930945
bool winograd = get<2>(GetParam());
931-
Net net = build_net(params, backendId, targetId);
932-
net.enableWinograd(winograd);
933-
934-
// warmup again since configuration is changed
935-
net.forward();
946+
Net net = build_net(params, backendId, targetId,
947+
[=](Net& net)
948+
{
949+
net.enableWinograd(winograd);
950+
}
951+
);
936952

937953
TEST_CYCLE()
938954
{
@@ -946,7 +962,8 @@ PERF_TEST_P_(Conv_Depthwise, conv)
946962
const ConvParam_t& params = get<0>(GetParam());
947963
Backend backendId = get<0>(get<1>(GetParam()));
948964
Target targetId = get<1>(get<1>(GetParam()));
949-
Net net = build_net(params, backendId, targetId);
965+
Net net = build_net(params, backendId, targetId, std::function<void(Net&)>(),
966+
0/*flops_limit_debug_long*/, 0/*flops_limit_debug_verylong*/);
950967

951968
TEST_CYCLE()
952969
{

modules/dnn/perf/perf_layer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,9 @@ PERF_TEST_P_(Layer_FullyConnected, fc)
829829
int backendId = get<0>(get<3>(GetParam()));
830830
int targetId = get<1>(get<3>(GetParam()));
831831

832+
if (inpShape.size() == 4 && inpShape[0] == 5 && inpShape[1] == 16 && inpShape[2] == 512 && inpShape[3] == 128 && outDims >= 512)
833+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
834+
832835
std::vector<int> weightShape;
833836
if (isMatMul) {
834837
weightShape = inpShape;

modules/dnn/perf/perf_net.cpp

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ PERF_TEST_P_(DNNTestNetwork, ENet)
140140

141141
PERF_TEST_P_(DNNTestNetwork, SSD)
142142
{
143+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
144+
143145
processNet("dnn/VGG_ILSVRC2016_SSD_300x300_iter_440000.caffemodel", "dnn/ssd_vgg16.prototxt", "disabled",
144146
cv::Size(300, 300));
145147
}
@@ -190,6 +192,8 @@ PERF_TEST_P_(DNNTestNetwork, DenseNet_121)
190192

191193
PERF_TEST_P_(DNNTestNetwork, OpenPose_pose_mpi_faster_4_stages)
192194
{
195+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
196+
193197
if (backend == DNN_BACKEND_HALIDE ||
194198
(backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && (target == DNN_TARGET_MYRIAD || target == DNN_TARGET_HDDL)))
195199
throw SkipTestException("");
@@ -209,6 +213,8 @@ PERF_TEST_P_(DNNTestNetwork, opencv_face_detector)
209213

210214
PERF_TEST_P_(DNNTestNetwork, Inception_v2_SSD_TensorFlow)
211215
{
216+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
217+
212218
if (backend == DNN_BACKEND_HALIDE)
213219
throw SkipTestException("");
214220
processNet("dnn/ssd_inception_v2_coco_2017_11_17.pb", "ssd_inception_v2_coco_2017_11_17.pbtxt", "",
@@ -217,7 +223,10 @@ PERF_TEST_P_(DNNTestNetwork, Inception_v2_SSD_TensorFlow)
217223

218224
PERF_TEST_P_(DNNTestNetwork, YOLOv3)
219225
{
220-
applyTestTag(CV_TEST_TAG_MEMORY_2GB);
226+
applyTestTag(
227+
CV_TEST_TAG_MEMORY_2GB,
228+
CV_TEST_TAG_DEBUG_VERYLONG
229+
);
221230
if (backend == DNN_BACKEND_HALIDE)
222231
throw SkipTestException("");
223232
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure
@@ -238,7 +247,10 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv3)
238247

239248
PERF_TEST_P_(DNNTestNetwork, YOLOv4)
240249
{
241-
applyTestTag(CV_TEST_TAG_MEMORY_2GB);
250+
applyTestTag(
251+
CV_TEST_TAG_MEMORY_2GB,
252+
CV_TEST_TAG_DEBUG_VERYLONG
253+
);
242254
if (backend == DNN_BACKEND_HALIDE)
243255
throw SkipTestException("");
244256
if (target == DNN_TARGET_MYRIAD) // not enough resources
@@ -274,36 +286,50 @@ PERF_TEST_P_(DNNTestNetwork, YOLOv5) {
274286
processNet("", "dnn/yolov5n.onnx", "", inp);
275287
}
276288

277-
PERF_TEST_P_(DNNTestNetwork, YOLOv8) {
278-
applyTestTag(CV_TEST_TAG_MEMORY_512MB);
289+
PERF_TEST_P_(DNNTestNetwork, YOLOv8)
290+
{
291+
applyTestTag(
292+
CV_TEST_TAG_MEMORY_512MB,
293+
CV_TEST_TAG_DEBUG_LONG
294+
);
295+
279296
Mat sample = imread(findDataFile("dnn/dog416.png"));
280297
Mat inp = blobFromImage(sample, 1.0 / 255.0, Size(640, 640), Scalar(), true);
281298
processNet("", "dnn/yolov8n.onnx", "", inp);
282299
}
283300

284301
PERF_TEST_P_(DNNTestNetwork, YOLOX) {
285-
applyTestTag(CV_TEST_TAG_MEMORY_512MB);
302+
applyTestTag(
303+
CV_TEST_TAG_MEMORY_512MB,
304+
CV_TEST_TAG_DEBUG_VERYLONG
305+
);
286306
Mat sample = imread(findDataFile("dnn/dog416.png"));
287307
Mat inp = blobFromImage(sample, 1.0 / 255.0, Size(640, 640), Scalar(), true);
288308
processNet("", "dnn/yolox_s.onnx", "", inp);
289309
}
290310

291311
PERF_TEST_P_(DNNTestNetwork, EAST_text_detection)
292312
{
313+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
314+
293315
if (backend == DNN_BACKEND_HALIDE)
294316
throw SkipTestException("");
295317
processNet("dnn/frozen_east_text_detection.pb", "", "", cv::Size(320, 320));
296318
}
297319

298320
PERF_TEST_P_(DNNTestNetwork, FastNeuralStyle_eccv16)
299321
{
322+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
323+
300324
if (backend == DNN_BACKEND_HALIDE)
301325
throw SkipTestException("");
302326
processNet("dnn/fast_neural_style_eccv16_starry_night.t7", "", "", cv::Size(320, 240));
303327
}
304328

305329
PERF_TEST_P_(DNNTestNetwork, Inception_v2_Faster_RCNN)
306330
{
331+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
332+
307333
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2019010000)
308334
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019)
309335
throw SkipTestException("Test is disabled in OpenVINO 2019R1");
@@ -411,7 +437,10 @@ PERF_TEST_P_(DNNTestNetwork, EfficientDet_int8)
411437
processNet("", "dnn/tflite/coco_efficientdet_lite0_v1_1.0_quant_2021_09_06.tflite", "", inp);
412438
}
413439

414-
PERF_TEST_P_(DNNTestNetwork, VIT_B_32) {
440+
PERF_TEST_P_(DNNTestNetwork, VIT_B_32)
441+
{
442+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
443+
415444
processNet("", "dnn/onnx/models/vit_b_32.onnx", "", cv::Size(224, 224));
416445
}
417446

modules/dnn/test/test_backends.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ TEST_P(DNNTestNetwork, ResNet_50)
117117
{
118118
applyTestTag(
119119
(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB),
120-
CV_TEST_TAG_DEBUG_LONG
120+
CV_TEST_TAG_DEBUG_VERYLONG
121121
);
122122

123123
processNet("dnn/ResNet-50-model.caffemodel", "dnn/ResNet-50-deploy.prototxt",
@@ -455,7 +455,7 @@ TEST_P(DNNTestNetwork, Inception_v2_SSD_TensorFlow)
455455
{
456456
applyTestTag(
457457
(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB),
458-
CV_TEST_TAG_DEBUG_LONG
458+
CV_TEST_TAG_DEBUG_VERYLONG
459459
);
460460
#if defined(INF_ENGINE_RELEASE)
461461
if (backend == DNN_BACKEND_INFERENCE_ENGINE_NN_BUILDER_2019 && target == DNN_TARGET_MYRIAD

modules/dnn/test/test_caffe_importer.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ TEST(Reproducibility_FCN, Accuracy)
270270

271271
TEST(Reproducibility_SSD, Accuracy)
272272
{
273-
applyTestTag(CV_TEST_TAG_MEMORY_512MB, CV_TEST_TAG_DEBUG_LONG);
273+
applyTestTag(
274+
CV_TEST_TAG_MEMORY_512MB,
275+
CV_TEST_TAG_DEBUG_VERYLONG
276+
);
277+
274278
Net net;
275279
{
276280
const string proto = findDataFile("dnn/ssd_vgg16.prototxt");
@@ -500,7 +504,10 @@ TEST(Reproducibility_GoogLeNet_fp16, Accuracy)
500504
// https://github.com/richzhang/colorization
501505
TEST_P(Test_Caffe_nets, Colorization)
502506
{
503-
applyTestTag(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB);
507+
applyTestTag(
508+
target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB,
509+
CV_TEST_TAG_DEBUG_VERYLONG
510+
);
504511
checkBackend();
505512

506513
Mat inp = blobFromNPY(_tf("colorization_inp.npy"));
@@ -777,7 +784,7 @@ TEST_P(Test_Caffe_nets, FasterRCNN_zf)
777784
#else
778785
(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB),
779786
#endif
780-
CV_TEST_TAG_DEBUG_LONG
787+
CV_TEST_TAG_DEBUG_VERYLONG
781788
);
782789
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
783790
// IE exception: Ngraph operation Reshape with name rpn_cls_score_reshape has dynamic output shape on 0 port, but CPU plug-in supports only static shape

modules/dnn/test/test_darknet_importer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ TEST_P(Test_Darknet_nets, YoloVoc)
357357
#else
358358
CV_TEST_TAG_MEMORY_1GB,
359359
#endif
360-
CV_TEST_TAG_LONG
360+
CV_TEST_TAG_LONG,
361+
CV_TEST_TAG_DEBUG_VERYLONG
361362
);
362363

363364
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2020040000) // nGraph compilation failure
@@ -919,10 +920,10 @@ TEST_P(Test_Darknet_nets, YOLOv4_tiny)
919920
TEST_P(Test_Darknet_nets, YOLOv4x_mish)
920921
{
921922
applyTestTag(
922-
CV_TEST_TAG_LONG,
923-
CV_TEST_TAG_MEMORY_2GB,
924-
CV_TEST_TAG_DEBUG_VERYLONG
925-
);
923+
CV_TEST_TAG_MEMORY_2GB,
924+
CV_TEST_TAG_LONG,
925+
CV_TEST_TAG_DEBUG_VERYLONG
926+
);
926927

927928
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2021040000)
928929
// IE exception: Ngraph operation Transpose with name permute_168 has dynamic output shape on 0 port, but CPU plug-in supports only static shape

modules/dnn/test/test_int8_layers.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,10 @@ TEST_P(Test_Int8_nets, GoogLeNet)
748748

749749
TEST_P(Test_Int8_nets, ResNet50)
750750
{
751-
applyTestTag(target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB);
751+
applyTestTag(
752+
target == DNN_TARGET_CPU ? CV_TEST_TAG_MEMORY_512MB : CV_TEST_TAG_MEMORY_1GB,
753+
CV_TEST_TAG_DEBUG_VERYLONG
754+
);
752755

753756
if (target == DNN_TARGET_OPENCL_FP16 && !ocl::Device::getDefault().isIntel())
754757
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
@@ -1200,7 +1203,10 @@ TEST_P(Test_Int8_nets, YoloVoc)
12001203

12011204
TEST_P(Test_Int8_nets, TinyYoloVoc)
12021205
{
1203-
applyTestTag(CV_TEST_TAG_MEMORY_512MB);
1206+
applyTestTag(
1207+
CV_TEST_TAG_MEMORY_512MB,
1208+
CV_TEST_TAG_DEBUG_VERYLONG
1209+
);
12041210

12051211
if (target == DNN_TARGET_OPENCL_FP16 && !ocl::Device::getDefault().isIntel())
12061212
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);

modules/dnn/test/test_model.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ TEST_P(Test_Model, Classify)
288288
TEST_P(Test_Model, DetectRegion)
289289
{
290290
applyTestTag(
291+
CV_TEST_TAG_MEMORY_2GB,
291292
CV_TEST_TAG_LONG,
292-
CV_TEST_TAG_MEMORY_2GB
293+
CV_TEST_TAG_DEBUG_VERYLONG
293294
);
294295

295296
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000)
@@ -348,8 +349,9 @@ TEST_P(Test_Model, DetectRegion)
348349
TEST_P(Test_Model, DetectRegionWithNmsAcrossClasses)
349350
{
350351
applyTestTag(
352+
CV_TEST_TAG_MEMORY_2GB,
351353
CV_TEST_TAG_LONG,
352-
CV_TEST_TAG_MEMORY_2GB
354+
CV_TEST_TAG_DEBUG_VERYLONG
353355
);
354356

355357
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000)
@@ -408,6 +410,8 @@ TEST_P(Test_Model, DetectRegionWithNmsAcrossClasses)
408410

409411
TEST_P(Test_Model, DetectionOutput)
410412
{
413+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
414+
411415
#if defined(INF_ENGINE_RELEASE) && INF_ENGINE_VER_MAJOR_EQ(2022010000)
412416
// Check 'backward_compatible_check || in_out_elements_equal' failed at core/src/op/reshape.cpp:427:
413417
// While validating node 'v1::Reshape bbox_pred_reshape (ave_bbox_pred_rois[0]:f32{1,8,1,1}, Constant_388[0]:i64{4}) -> (f32{?,?,?,?})' with friendly_name 'bbox_pred_reshape':
@@ -631,7 +635,8 @@ TEST_P(Test_Model, Detection_normalized)
631635
TEST_P(Test_Model, Segmentation)
632636
{
633637
applyTestTag(
634-
CV_TEST_TAG_MEMORY_2GB
638+
CV_TEST_TAG_MEMORY_2GB,
639+
CV_TEST_TAG_DEBUG_VERYLONG
635640
);
636641

637642
float norm = 0;
@@ -746,6 +751,8 @@ TEST_P(Test_Model, TextRecognitionWithCTCPrefixBeamSearch)
746751

747752
TEST_P(Test_Model, TextDetectionByDB)
748753
{
754+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
755+
749756
if (target == DNN_TARGET_OPENCL_FP16)
750757
applyTestTag(CV_TEST_TAG_DNN_SKIP_OPENCL_FP16);
751758
if (target == DNN_TARGET_CPU_FP16)
@@ -788,6 +795,8 @@ TEST_P(Test_Model, TextDetectionByDB)
788795

789796
TEST_P(Test_Model, TextDetectionByEAST)
790797
{
798+
applyTestTag(CV_TEST_TAG_DEBUG_VERYLONG);
799+
791800
std::string imgPath = _tf("text_det_test2.jpg");
792801
std::string weightPath = _tf("frozen_east_text_detection.pb", false);
793802

0 commit comments

Comments
 (0)