From 51dabec5204cca7220b01204e53ca0a45a5711f4 Mon Sep 17 00:00:00 2001 From: VCasecnikovs Date: Tue, 21 Apr 2020 14:20:18 +0300 Subject: [PATCH] 4 here makes useless difficulty. 4 here makes an incorrect understanding of using this function. So, it would be much more flexible if you need overlap to increase size to 4. --- object_detection_fastai/helper/object_detection_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/object_detection_fastai/helper/object_detection_helper.py b/object_detection_fastai/helper/object_detection_helper.py index bfa3212..db1983f 100644 --- a/object_detection_fastai/helper/object_detection_helper.py +++ b/object_detection_fastai/helper/object_detection_helper.py @@ -10,7 +10,7 @@ def create_anchors(sizes, ratios, scales, flatten=True): anchors = [] for h,w in sizes: #4 here to have the anchors overlap. - sized_aspects = 4 * (aspects * torch.tensor([2/h,2/w])).unsqueeze(0) + sized_aspects = (aspects * torch.tensor([2/h,2/w])).unsqueeze(0) base_grid = create_grid((h,w)).unsqueeze(1) n,a = base_grid.size(0),aspects.size(0) ancs = torch.cat([base_grid.expand(n,a,2), sized_aspects.expand(n,a,2)], 2)