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)
评论列表
文章目录