FEARTracker icon indicating copy to clipboard operation
FEARTracker copied to clipboard

why do we need self.adjust and self.bias in BoxTower?

Open hajungong007 opened this issue 2 years ago • 0 comments

    # adjust scale
    self.adjust = nn.Parameter(0.1 * torch.ones(1))
    self.bias = nn.Parameter(torch.Tensor(1.0 * torch.ones(1, 4, 1, 1)))

def forward(self, search, kernel, update=None):
    # encode first
    if update is None:
        cls_z, cls_x = self.cls_encode(kernel, search)  # [z11, z12, z13]
    else:
        cls_z, cls_x = self.cls_encode(update, search)  # [z11, z12, z13]

    reg_z, reg_x = self.reg_encode(kernel, search)  # [x11, x12, x13]

    # cls and reg DW
    cls_dw = self.cls_dw(cls_z, cls_x)
    reg_dw = self.reg_dw(reg_z, reg_x)
    x_reg = self.bbox_tower(reg_dw)
    x = self.adjust * self.bbox_pred(x_reg) + self.bias
    x = torch.exp(x)

    # cls tower
    c = self.cls_tower(cls_dw)
    cls = 0.1 * self.cls_pred(c)

    return x, cls, cls_dw, x_reg

hajungong007 avatar Nov 27 '22 10:11 hajungong007