From 6c0590bc3c8c16f95a0cea55ab17c52eff462c55 Mon Sep 17 00:00:00 2001 From: Md Ibrahim Date: Mon, 27 Sep 2021 09:17:15 +0600 Subject: [PATCH] Solved https://github.com/zhou13/lcnn/issues/53#issue-1005072261 In PyTorch 1.4.x (index/128) at https://github.com/zhou13/lcnn/blob/88f281ab5421d51a62f1f84f97fea05afbf0c8d8/lcnn/models/line_vectorizer.py#L174 outputs integer values but in PyTorch 1.8.x it outputs float values. Updating it with (index//128) outputs integer values in both PyTorch versions and solves https://github.com/zhou13/lcnn/issues/53#issue-1005072261. --- lcnn/models/line_vectorizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lcnn/models/line_vectorizer.py b/lcnn/models/line_vectorizer.py index a40e922..b6a6eff 100644 --- a/lcnn/models/line_vectorizer.py +++ b/lcnn/models/line_vectorizer.py @@ -171,7 +171,7 @@ def sample_lines(self, meta, jmap, joff, mode): # index: [N_TYPE, K] score, index = torch.topk(jmap, k=K) - y = (index / 128).float() + torch.gather(joff[:, 0], 1, index) + 0.5 + y = (index // 128).float() + torch.gather(joff[:, 0], 1, index) + 0.5 x = (index % 128).float() + torch.gather(joff[:, 1], 1, index) + 0.5 # xy: [N_TYPE, K, 2]