DeprecationWarning: BICUBIC is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.BICUBIC instead.的解决方法:

在处理图像任务的时候,遇到了这个报错。找到对应的使用了:pil_image.BICUBIC的地方。

比如我的代码是这样的:

image = image.resize((image.width *  scale, image.height * scale), resample=pil_image.BICUBIC)

然后把对应的位置进行修改。把pil_image.BICUBIC改成pil_image.Resampling.BICUBIC即可。

给出我的代码修改后的变更:

image = image.resize((image.width *  scale, image.height * scale), resample=pil_image.Resampling.BICUBIC)

再次运行即可解决警告问题。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐