(boxes, anchors, encode_angle_to_vector=False, smooth_dim=False)
box encode for VoxelNet
    Args:
        boxes ([N, 7] Tensor): normal boxes: x, y, z, l, w, h, r
        anchors ([N, 7] Tensor): anchors
box encode for VoxelNet
    Args:
        boxes ([N, 7] Tensor): normal boxes: x, y, z, l, w, h, r
        anchors ([N, 7] Tensor): anchors
box encode for VoxelNet Args : boxes ( [ N 7 ] Tensor ) : normal boxes : x y z l w h r anchors ( [ N 7 ] Tensor ) : anchors
def bev_box_encode(boxes, anchors, encode_angle_to_vector=False, smooth_dim=False):
    """box encode for VoxelNet
    Args:
        boxes ([N, 7] Tensor): normal boxes: x, y, z, l, w, h, r
        anchors ([N, 7] Tensor): anchors
    """
    xa, ya, wa, la, ra = torch.split(anchors, 1, dim=-1)
    xg, yg, wg, lg, rg = torch.split(boxes, 1, dim=-1)
    diagonal = torch.sqrt(la**2 + wa**2 + eps)
    xt = (xg - xa) / diagonal
    yt = (yg - ya) / diagonal
    if smooth_dim:
        lt = lg / la - 1
        wt = wg / wa - 1
    else:
        lt = torch.log(lg / la + eps)
        wt = torch.log(wg / wa + eps)
    if encode_angle_to_vector:
        rgx = torch.cos(rg)
        rgy = torch.sin(rg)
        rax = torch.cos(ra)
        ray = torch.sin(ra)
        rtx = rgx - rax
        rty = rgy - ray
        return torch.cat([xt, yt, wt, lt, rtx, rty], dim=-1)
    else:
        rt = rg - ra
        return torch.cat([xt, yt, wt, lt, rt], dim=-1)
def bev_box_encode ( boxes , anchors , encode_angle_to_vector = False , smooth_dim = False ) : xa , ya , wa , la , ra = torch . split ( anchors , 1 , dim = - 1 ) xg , yg , wg , lg , rg = torch . split ( boxes , 1 , dim = - 1 ) diagonal = torch . sqrt ( la ** 2 + wa ** 2 + eps ) xt = ( xg - xa ) / diagonal yt = ( yg - ya ) / diagonal if smooth_dim : lt = lg / la - 1 wt = wg / wa - 1 else : lt = torch . log ( lg / la + eps ) wt = torch . log ( wg / wa + eps ) if encode_angle_to_vector : rgx = torch . cos ( rg ) rgy = torch . sin ( rg ) rax = torch . cos ( ra ) ray = torch . sin ( ra ) rtx = rgx - rax rty = rgy - ray return torch . cat ( [ xt , yt , wt , lt , rtx , rty ] , dim = - 1 ) else : rt = rg - ra return torch . cat ( [ xt , yt , wt , lt , rt ] , dim = - 1 )