(boxes,
                      anchors,
                      encode_angle_to_vector=False,
                      smooth_dim=False,
                      cylindrical=False)
box encode for VoxelNet in lidar
    Args:
        boxes ([N, 7 + ?] Tensor): normal boxes: x, y, z, w, l, h, r, custom values
        anchors ([N, 7] Tensor): anchors
box encode for VoxelNet in lidar
    Args:
        boxes ([N, 7 + ?] Tensor): normal boxes: x, y, z, w, l, h, r, custom values
        anchors ([N, 7] Tensor): anchors
box encode for VoxelNet in lidar Args : boxes ( [ N 7 + ? ] Tensor ) : normal boxes : x y z w l h r custom values anchors ( [ N 7 ] Tensor ) : anchors
def second_box_encode(boxes,
                      anchors,
                      encode_angle_to_vector=False,
                      smooth_dim=False,
                      cylindrical=False):
    """box encode for VoxelNet in lidar
    Args:
        boxes ([N, 7 + ?] Tensor): normal boxes: x, y, z, w, l, h, r, custom values
        anchors ([N, 7] Tensor): anchors
    """
    # need to convert boxes to z-center format
    box_ndim = anchors.shape[-1]
    cas, cgs = [], []
    if box_ndim > 7:
        xa, ya, za, wa, la, ha, ra, *cas = np.split(anchors, box_ndim, axis=1)
        xg, yg, zg, wg, lg, hg, rg, *cgs = np.split(boxes, box_ndim, axis=1)
    else:
        xa, ya, za, wa, la, ha, ra = np.split(anchors, box_ndim, axis=1)
        xg, yg, zg, wg, lg, hg, rg = np.split(boxes, box_ndim, axis=1)

    diagonal = np.sqrt(la**2 + wa**2)  # 4.3
    xt = (xg - xa) / diagonal
    yt = (yg - ya) / diagonal
    zt = (zg - za) / ha  # 1.6
    lt = np.log(lg / la)
    wt = np.log(wg / wa)
    ht = np.log(hg / ha)
    rt = rg - ra
    cts = [g - a for g, a in zip(cgs, cas)]
    if smooth_dim:
        lt = lg / la - 1
        wt = wg / wa - 1
        ht = hg / ha - 1
    else:
        lt = np.log(lg / la)
        wt = np.log(wg / wa)
        ht = np.log(hg / ha)
    if encode_angle_to_vector:
        rgx = np.cos(rg)
        rgy = np.sin(rg)
        rax = np.cos(ra)
        ray = np.sin(ra)
        rtx = rgx - rax
        rty = rgy - ray
        return np.concatenate([xt, yt, zt, wt, lt, ht, rtx, rty, *cts], axis=1)
    else:
        rt = rg - ra
        return np.concatenate([xt, yt, zt, wt, lt, ht, rt, *cts], axis=1)
def second_box_encode ( boxes , anchors , encode_angle_to_vector = False , smooth_dim = False , cylindrical = False ) : # need to convert boxes to z-center format box_ndim = anchors . shape [ - 1 ] cas , cgs = [ ] , [ ] if box_ndim > 7 : xa , ya , za , wa , la , ha , ra , * cas = np . split ( anchors , box_ndim , axis = 1 ) xg , yg , zg , wg , lg , hg , rg , * cgs = np . split ( boxes , box_ndim , axis = 1 ) else : xa , ya , za , wa , la , ha , ra = np . split ( anchors , box_ndim , axis = 1 ) xg , yg , zg , wg , lg , hg , rg = np . split ( boxes , box_ndim , axis = 1 ) diagonal = np . sqrt ( la ** 2 + wa ** 2 ) # 4.3 xt = ( xg - xa ) / diagonal yt = ( yg - ya ) / diagonal zt = ( zg - za ) / ha # 1.6 lt = np . log ( lg / la ) wt = np . log ( wg / wa ) ht = np . log ( hg / ha ) rt = rg - ra cts = [ g - a for g , a in zip ( cgs , cas ) ] if smooth_dim : lt = lg / la - 1 wt = wg / wa - 1 ht = hg / ha - 1 else : lt = np . log ( lg / la ) wt = np . log ( wg / wa ) ht = np . log ( hg / ha ) if encode_angle_to_vector : rgx = np . cos ( rg ) rgy = np . sin ( rg ) rax = np . cos ( ra ) ray = np . sin ( ra ) rtx = rgx - rax rty = rgy - ray return np . concatenate ( [ xt , yt , zt , wt , lt , ht , rtx , rty , * cts ] , axis = 1 ) else : rt = rg - ra return np . concatenate ( [ xt , yt , zt , wt , lt , ht , rt , * cts ] , axis = 1 )