def resize_img(img, opt):
"""
CNN predictions are made at the 36x36 pixel lvl and the test set needs to be at the 608x608
lvl. The function resizes.
Args:
numpy array 36x36 for test or 50x50 for train
Returns:
numpy array 608x608 for test or 400x400 for train
"""
#print(img.shape)
if opt == 'test':
img = resize(img, (conf.test_image_size, conf.test_image_size))
return img
elif opt == 'train':
size = conf.train_image_size
blocks = 8 #conf.gt_res # resolution of the gt is 8x8 pixels for one class
steps = 50 #conf.train_image_size // blocks # 50
dd = np.zeros((size, size))
for i in range(steps):
for j in range(steps):
dd[j*blocks:(j+1)*blocks,i*blocks:(i+1)*blocks] = img[j,i]
return dd
else:
raise ValueError('test or train plz')
denoise_autoencoder.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录