mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 14:36:36 +08:00
Fix change step
This commit is contained in:
parent
f67b197d49
commit
9cbdb48d6d
@ -487,9 +487,7 @@ public:
|
||||
if (_explicitSizes)
|
||||
{
|
||||
InferenceEngine::Builder::PriorBoxClusteredLayer ieLayer(name);
|
||||
|
||||
CV_Assert(_stepX == _stepY);
|
||||
ieLayer.setStep(_stepX);
|
||||
ieLayer.setSteps({_stepY, _stepX});
|
||||
|
||||
CV_CheckEQ(_offsetsX.size(), (size_t)1, ""); CV_CheckEQ(_offsetsY.size(), (size_t)1, ""); CV_CheckEQ(_offsetsX[0], _offsetsY[0], "");
|
||||
ieLayer.setOffset(_offsetsX[0]);
|
||||
@ -516,9 +514,6 @@ public:
|
||||
if (_maxSize > 0)
|
||||
ieLayer.setMaxSize(_maxSize);
|
||||
|
||||
CV_Assert(_stepX == _stepY);
|
||||
ieLayer.setStep(_stepX);
|
||||
|
||||
CV_CheckEQ(_offsetsX.size(), (size_t)1, ""); CV_CheckEQ(_offsetsY.size(), (size_t)1, ""); CV_CheckEQ(_offsetsX[0], _offsetsY[0], "");
|
||||
ieLayer.setOffset(_offsetsX[0]);
|
||||
|
||||
@ -526,6 +521,18 @@ public:
|
||||
ieLayer.setFlip(false); // We already flipped aspect ratios.
|
||||
|
||||
InferenceEngine::Builder::Layer l = ieLayer;
|
||||
if (_stepX == _stepY)
|
||||
{
|
||||
l.getParameters()["step"] = _stepX;
|
||||
l.getParameters()["step_h"] = 0.0;
|
||||
l.getParameters()["step_w"] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
l.getParameters()["step"] = 0.0;
|
||||
l.getParameters()["step_h"] = _stepY;
|
||||
l.getParameters()["step_w"] = _stepX;
|
||||
}
|
||||
if (!_aspectRatios.empty())
|
||||
{
|
||||
l.getParameters()["aspect_ratio"] = _aspectRatios;
|
||||
|
@ -162,6 +162,18 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe)
|
||||
inp, "detection_out", "", diffScores);
|
||||
}
|
||||
|
||||
TEST_P(DNNTestNetwork, MobileNet_SSD_Caffe_Different_Width_Height)
|
||||
{
|
||||
if (backend == DNN_BACKEND_HALIDE)
|
||||
throw SkipTestException("");
|
||||
Mat sample = imread(findDataFile("dnn/street.png", false));
|
||||
Mat inp = blobFromImage(sample, 1.0f / 127.5, Size(300, 560), Scalar(127.5, 127.5, 127.5), false);
|
||||
float diffScores = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.029 : 0.0;
|
||||
float diffSquares = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.09 : 0.0;
|
||||
processNet("dnn/MobileNetSSD_deploy.caffemodel", "dnn/MobileNetSSD_deploy.prototxt",
|
||||
inp, "detection_out", "", diffScores, diffSquares);
|
||||
}
|
||||
|
||||
TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
|
||||
{
|
||||
if (backend == DNN_BACKEND_HALIDE)
|
||||
@ -174,6 +186,18 @@ TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow)
|
||||
inp, "detection_out", "", l1, lInf);
|
||||
}
|
||||
|
||||
TEST_P(DNNTestNetwork, MobileNet_SSD_v1_TensorFlow_Different_Width_Height)
|
||||
{
|
||||
if (backend == DNN_BACKEND_HALIDE)
|
||||
throw SkipTestException("");
|
||||
Mat sample = imread(findDataFile("dnn/street.png", false));
|
||||
Mat inp = blobFromImage(sample, 1.0f, Size(300, 560), Scalar(), false);
|
||||
float l1 = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.012 : 0.0;
|
||||
float lInf = (target == DNN_TARGET_OPENCL_FP16 || target == DNN_TARGET_MYRIAD) ? 0.06 : 0.0;
|
||||
processNet("dnn/ssd_mobilenet_v1_coco_2017_11_17.pb", "dnn/ssd_mobilenet_v1_coco_2017_11_17.pbtxt",
|
||||
inp, "detection_out", "", l1, lInf);
|
||||
}
|
||||
|
||||
TEST_P(DNNTestNetwork, MobileNet_SSD_v2_TensorFlow)
|
||||
{
|
||||
if (backend == DNN_BACKEND_HALIDE)
|
||||
|
Loading…
Reference in New Issue
Block a user