img_utils.py 文件源码

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

项目:kaggle-carvana 作者: ematvey 项目源码 文件源码
def output_resized_mask():
    import pandas as pd
    os.makedirs('output/resize', exist_ok=True)
    imgs = [0, 10, 20, 30]
    df = pd.read_csv(TRAIN_INDEX)

    for i in imgs:
        fns = df.iloc[i]
        img_fn = fns['img']
        mask_fn = fns['mask']
        print('mask_fn', mask_fn)
        mask = carvana_pad_to_std(np.load(mask_fn))

        for downsample in [1.0, 1.5, 2.0, 4.0]:
            h = int(1280 / downsample)
            w = int(1920 / downsample)
            out_fn = os.path.join('output/resize/{}_{}x{}.png'.format(i, w, h))

            print(mask.shape)
            print((h, w))
            m = cv2.resize(mask, dsize=(w, h), interpolation=cv2.INTER_AREA)
            print(m.shape)

            draw_mask(out_fn, img_fn, mask_fn, m)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号