场景:
使用pytorch训练时,遇到警告:UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.
解决方案:
修改相应的代码,根据提示使用 use InterpolationMode enum. pytorch官网链接
1、导入InterpolationMode, from torchvision.transforms import InterpolationMode
2、将 interpolation
后的参数换成 InterpolationMode.BILINEAR
,具体可根据需求修改参数
# 举例 interpolation=2
transforms.Resize([width, height], interpolation=InterpolationMode.BILINEAR)