From 6668bf0368b7ec6e88bc01aebdc281d2f79ef0cb Mon Sep 17 00:00:00 2001 From: Zhuliang Yao <yaozhuliang13@gmail.com> Date: Mon, 14 Oct 2019 23:27:23 +0800 Subject: [PATCH] fix a scale bug according to Non-Local papaer (#1528) --- mmdet/models/plugins/non_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmdet/models/plugins/non_local.py b/mmdet/models/plugins/non_local.py index cbec7a4..2e89c2f 100644 --- a/mmdet/models/plugins/non_local.py +++ b/mmdet/models/plugins/non_local.py @@ -76,7 +76,7 @@ class NonLocal2D(nn.Module): pairwise_weight = torch.matmul(theta_x, phi_x) if self.use_scale: # theta_x.shape[-1] is `self.inter_channels` - pairwise_weight /= theta_x.shape[-1]**-0.5 + pairwise_weight /= theta_x.shape[-1]**0.5 pairwise_weight = pairwise_weight.softmax(dim=-1) return pairwise_weight -- GitLab