keras resize PIL Image.BICUBIC,PIL.Image.LANCZOS,PIL.Image.BILINEAR,PIL.Image.NEAREST

https://pillow.readthedocs.io/en/3.1.x/reference/Image.html

Image.resize(sizeresample=0)

Returns a resized copy of this image.

Parameters:
  • size – The requested size in pixels, as a 2-tuple: (width, height).
  • resample – An optional resampling filter. This can be one of PIL.Image.NEAREST (use nearest neighbour), PIL.Image.BILINEAR (linear interpolation), PIL.Image.BICUBIC (cubic spline interpolation), or PIL.Image.LANCZOS (a high-quality downsampling filter). If omitted, or if the image has mode “1” or “P”, it is set PIL.Image.NEAREST.

 

https://blog.csdn.net/weixin_42160653/article/details/80234856

  

im.resize(size【80,80】,param【Image.NEAREST/Image.BILINEAR/Image.BICUBIC/(Image.ANTIALIAS)】)

 

 

code: 

https://github.com/keras-team/keras

https://github.com/keras-team/keras/blob/master/keras/preprocessing/image.py

 

https://github.com/lim-anggun/Keras-ImageDataGenerator/blob/master/image.py

interpolation: Interpolation method used to resample the image if the
  target size is different from that of the loaded image.
  Supported methods are "nearest", "bilinear", and "bicubic".
  If PIL version 1.1.3 or newer is installed, "lanczos" is also
  supported. If PIL version 3.4.0 or newer is installed, "box" and
  "hamming" are also supported. By default, "nearest" is used.

 

http://www.mamicode.com/info-detail-2689442.html

size : 获取输出图像的大小

interpolation : 插值,默认的  PIL.Image.BILINEAR, 一共有4中的插值方法

Image.BICUBIC,PIL.Image.LANCZOS,PIL.Image.BILINEAR,PIL.Image.NEAREST





Reference: 

https://stackoverflow.com/questions/23113163/antialias-vs-bicubic-in-pilpython-image-library

https://blog.csdn.net/qq_41775810/article/details/82798906

可以看出,是用pil中nearest(默认)的模式resize的,所以只需要按照相同的方法resize就OK了

https://keras.io/zh/preprocessing/image/

https://forums.fast.ai/t/how-does-keras-resize-images/1743/12

https://jkjung-avt.github.io/keras-image-cropping/

posted on 2019-12-24 17:22  cdekelon  阅读(1196)  评论(0)    收藏  举报

导航