问题:UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
warn("The default mode, 'constant', will be changed to 'reflect' in "
skimage.transform.resize(image, output_shape, order=1, mode=None, cval=0, clip=True,
preserve_range=False)
这是一个图片重新塑造尺寸大小的函数,和OpenCV中的resize差不多。
mode参数解释:
mode : {'constant', 'edge', 'symmetric', 'reflect', 'wrap'}, optional
Points outside the boundaries of the input are filled according
to the given mode. Modes match the behaviour of `numpy.pad`. The
default mode is 'constant'.
输入边界之外的点按照所给定的模式进行填充,模式匹配“numpy.pad”的行为,默认模式是“constant”。
解决办法:
使用警告(userwarning)中说,默认模式将会被改变为“reflect”,所以,在函数进行参数设置时,直接将mode设置为constant就可以了。即:
将resize(ima, (IMG_SIZE, IMG_SIZE))改为
resize(ima, (IMG_SIZE, IMG_SIZE), mode='constant')
本文解析了skimage库中resize函数的默认模式从'constant'更改为'reflect'的警告信息,提供了如何在调用函数时设置mode参数以避免此警告的方法。

2078

被折叠的 条评论
为什么被折叠?



