From 5ffc5bca7cd8cce093c62678b1ea20cea84fc068 Mon Sep 17 00:00:00 2001 From: Liubov Batanina Date: Thu, 4 Jun 2020 09:36:52 +0300 Subject: [PATCH] Fixed virtual try on sample --- modules/dnn/src/onnx/onnx_importer.cpp | 4 ++++ samples/dnn/virtual_try_on.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 2b0d846721..682418bffa 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -806,6 +806,10 @@ void ONNXImporter::populateNet(Net dstNet) { layerParams.type = "ELU"; } + else if (layer_type == "Tanh") + { + layerParams.type = "TanH"; + } else if (layer_type == "PRelu") { layerParams.type = "PReLU"; diff --git a/samples/dnn/virtual_try_on.py b/samples/dnn/virtual_try_on.py index bbc655a276..e4f2e518ec 100644 --- a/samples/dnn/virtual_try_on.py +++ b/samples/dnn/virtual_try_on.py @@ -185,7 +185,7 @@ class CpVton(object): agnostic = np.concatenate((res_shape, img_head, pose_map), axis=0) agnostic = np.expand_dims(agnostic, axis=0) - return agnostic + return agnostic.astype(np.float32) def get_warped_cloth(self, cloth_img, agnostic, height=256, width=192): cloth = cv.dnn.blobFromImage(cloth_img, 1.0 / 127.5, (width, height), mean=(127.5, 127.5, 127.5), swapRB=True)