From 9323b1478a07f0356682b447ea19d11285bf04ed Mon Sep 17 00:00:00 2001 From: Bin Lu Date: Wed, 25 Aug 2021 13:59:54 +0800 Subject: [PATCH] Create deephashloss.py --- ppcls/loss/deephashloss.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 ppcls/loss/deephashloss.py diff --git a/ppcls/loss/deephashloss.py b/ppcls/loss/deephashloss.py new file mode 100644 index 00000000..8f02a3ba --- /dev/null +++ b/ppcls/loss/deephashloss.py @@ -0,0 +1,6 @@ + # do binarize + if self.config["Global"].get("feature_binarize") == "round": + batch_feas = paddle.round(batch_feas).astype("float32") * 2.0 - 1.0 + + if self.config["Global"].get("feature_binarize") == "sign": + batch_feas = paddle.sign(batch_feas).astype("float32") -- GitLab