diff --git a/ppcls/loss/deephashloss.py b/ppcls/loss/deephashloss.py new file mode 100644 index 0000000000000000000000000000000000000000..8f02a3ba0be482f67978b2499af8b416d7ada064 --- /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")