Add preprocessing warps for separate parameters

This commit is contained in:
Dmitry Kurtaev
2019-08-07 14:51:41 +03:00
parent 174b4ce29d
commit a9839af903
3 changed files with 36 additions and 19 deletions
+16 -4
View File
@@ -138,10 +138,7 @@ class dnn_test(NewOpenCVTests):
config = self.find_dnn_file("dnn/MobileNetSSD_deploy.prototxt")
frame = cv.imread(img_path)
model = cv.dnn_DetectionModel(weights, config)
size = (300, 300)
mean = (127.5, 127.5, 127.5)
scale = 1.0 / 127.5
model.setInputParams(size=size, mean=mean, scale=scale)
model.setInputParams(size=(300, 300), mean=(127.5, 127.5, 127.5), scale=1.0/127.5)
iouDiff = 0.05
confThreshold = 0.0001
@@ -164,6 +161,21 @@ class dnn_test(NewOpenCVTests):
cv.rectangle(frame, list(box), (0, 255, 0))
def test_classification_model(self):
img_path = self.find_dnn_file("dnn/googlenet_0.png")
weights = self.find_dnn_file("dnn/squeezenet_v1.1.caffemodel")
config = self.find_dnn_file("dnn/squeezenet_v1.1.prototxt")
ref = np.load(self.find_dnn_file("dnn/squeezenet_v1.1_prob.npy"))
frame = cv.imread(img_path)
model = cv.dnn_ClassificationModel(config, weights)
model.setInputSize(227, 227)
model.setInputCrop(True)
out = model.predict(frame)
normAssert(self, out, ref)
def test_face_detection(self):
testdata_required = bool(os.environ.get('OPENCV_DNN_TEST_REQUIRE_TESTDATA', False))
proto = self.find_dnn_file('dnn/opencv_face_detector.prototxt', required=testdata_required)