iterators.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:kaggle-right-whale 作者: felixlaumon 项目源码 文件源码
def get_transformed_bbox(bbox, image_width, image_height, **kwargs):
    l, t, w, h = bbox
    r = l + w
    b = t + h
    y_heatmap = np.zeros((image_height, image_width)).astype(bool)
    y_heatmap[t:b, l:r] = True

    y_heatmap = im_affine_transform(y_heatmap[np.newaxis, ...], **kwargs)
    y_heatmap = y_heatmap[0].astype(bool)

    dets = find_objects(y_heatmap)

    if len(dets) == 1:
        t = dets[0][0].start
        b = dets[0][0].stop
        l = dets[0][1].start
        r = dets[0][1].stop
        w = r - l
        h = b - t
    else:
        l, t, w, h = 0, 0, 0, 0

    return l, t, w, h
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号