小编i_a*_*lak的帖子

ModuleNotFoundError:没有名为“fastai.vision”的模块

我正在尝试使用ImageDataBunchfastai,它工作正常,但最近当我运行我的代码时,它显示了此错误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)

我怎样才能解决这个问题?

deep-learning google-colaboratory fast-ai

8
推荐指数
1
解决办法
9429
查看次数