I'd like to use an image pyramid for deep learning as in Deep Multi-scale for Deblurring. How can I down scale images on the fly when using keras?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You could use an Average Pooling layer if the downscale rate is an integer.
o = AveragePooling2D(pooling_size=(2, 2))(i)
This will average a 2x2 window into a single pixel, which is a fairly accurate way of resizing an image by a factor of 2.
回答2:
You can find Gaussian pyramids using OpenCV.
cv2.pyrUp()
and cv2.pyrDown()
functions can be used to upsample and downsample the image respectively.
For more reference see: this link