def get_pred()

in models/02_YoloV4/01_Pytorch/utils.py [0:0]


def get_pred(io, stride, anchors):
    '''
    Convert the anchors+grids into
    '''
    anchor_wh = (np.array(anchors) / stride).reshape(1, len(anchors), 1, 1, 2)
    bs, _, ny, nx,no = io.shape
    grid = create_grids((nx,ny))
    io[..., :2] = (io[..., :2] * 2. - 0.5 + grid)
    io[..., 2:4] = (io[..., 2:4] * 2) ** 2 * anchor_wh
    io[..., :4] *= stride
    return io.reshape(batch_size, -1, no)