UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use

ITWYY

关注

阅读 136

2022-03-11

问题描述

UserWarning: Argument interpolation should be of type InterpolationMode instead of int. Please, use InterpolationMode enum.
  "Argument interpolation should be of type InterpolationMode instead of int. "

解决办法

第一步: 导入from torchvision.transforms import InterpolationMode
第二步:将Image替换成InterpolationMode
例如:

import torchvision.transforms.functional as F
F.resize(img, target_size, Image.BILINEAR), 
F.resize(img, target_size, Image.NEAREST)

改为:

import torchvision.transforms.functional as F
F.resize(img, target_size, InterpolationMode.BILINEAR), 
F.resize(img, target_size, InterpolationMode.NEAREST)

参考:https://blog.csdn.net/u014636245/article/details/118104938

精彩评论(0)

0 0 举报