我正在尝试使用ImageDataBunch
fastai,它工作正常,但最近当我运行我的代码时,它显示了此错误ModuleNotFoundError: No module named 'fastai.vision'
然后,我升级了我的fastai版本pip install fastai --upgrade
。该错误已清除,但出现在NameError: name 'ImageDataBunch' is not defined
这是我的代码:
import warnings
import numpy as np
from fastai.vision import *
warnings.filterwarnings("ignore", category=UserWarning, module="torch.nn.functional")
np.random.seed(42)
data = ImageDataBunch.from_folder(path, train='.', valid_pct=0.2,
ds_tfms=get_transforms(), size=224, num_workers=4, no_check=True).normalize(imagenet_stats)
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?