1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #20535 from SamFC10:onnx-q

dnn : int8 quantized layers support in onnx importer

* added quantized layers support in onnx importer

* added more cases in eltwise node, some more checks

* added tests for quantized nodes

* relax thresholds for failed tests, address review comments

* refactoring based on review comments

* added support for unsupported cases and pre-quantized resnet50 test

* relax thresholds due to int8 resize layer
This commit is contained in:
Jebastin Nadar
2021-10-04 23:37:38 +05:30
committed by GitHub
parent 9085b933d8
commit cce78cc5e2
9 changed files with 795 additions and 54 deletions
+4 -4
View File
@@ -583,7 +583,7 @@ TEST_P(Test_Int8_nets, ResNet50)
Mat blob = blobFromImage(inp, 1.0, Size(224, 224), Scalar(), false);
Mat ref = blobFromNPY(_tf("resnet50_prob.npy"));
float l1 = 3e-4, lInf = 0.035;
float l1 = 3e-4, lInf = 0.04;
testClassificationNet(net, blob, ref, l1, lInf);
}
@@ -714,7 +714,7 @@ TEST_P(Test_Int8_nets, MobileNet_v1_SSD_PPN)
Mat blob = blobFromImage(inp, 1.0, Size(300, 300), Scalar(), true, false);
Mat ref = blobFromNPY(_tf("tensorflow/ssd_mobilenet_v1_ppn_coco.detection_out.npy"));
float confThreshold = 0.51, scoreDiff = 0.04, iouDiff = 0.06;
float confThreshold = 0.51, scoreDiff = 0.05, iouDiff = 0.06;
testDetectionNet(net, blob, ref, confThreshold, scoreDiff, iouDiff);
}
@@ -815,7 +815,7 @@ TEST_P(Test_Int8_nets, FasterRCNN_resnet50)
Mat blob = blobFromImage(inp, 1.0, Size(800, 600), Scalar(), true, false);
Mat ref = blobFromNPY(_tf("tensorflow/faster_rcnn_resnet50_coco_2018_01_28.detection_out.npy"));
float confThreshold = 0.5, scoreDiff = 0.025, iouDiff = 0.15;
float confThreshold = 0.5, scoreDiff = 0.05, iouDiff = 0.15;
testDetectionNet(net, blob, ref, confThreshold, scoreDiff, iouDiff);
}
@@ -1127,7 +1127,7 @@ TEST_P(Test_Int8_nets, YOLOv4)
std::string config_file = "yolov4.cfg";
std::string weights_file = "yolov4.weights";
double scoreDiff = 0.1, iouDiff = 0.17;
double scoreDiff = 0.15, iouDiff = 0.2;
{
SCOPED_TRACE("batch size 1");
testDarknetModel(config_file, weights_file, ref.rowRange(0, N0), scoreDiff, iouDiff);