Numpy 在Deepnote中运行ImageDataBunch时出现的问题
我在Deepnote中运行这行代码时遇到问题,有人知道原因吗Numpy 在Deepnote中运行ImageDataBunch时出现的问题,numpy,deepnote,Numpy,Deepnote,我在Deepnote中运行这行代码时遇到问题,有人知道原因吗 data = ImageDataBunch.from_folder(path, train="train", valid ="test",ds_tfms=get_transforms(), size=(256,256), bs=32, num_workers=4).normalize() 错误显示: NameError: name 'ImageDataBunch' is not defined
data = ImageDataBunch.from_folder(path, train="train", valid ="test",ds_tfms=get_transforms(), size=(256,256), bs=32, num_workers=4).normalize()
错误显示:
NameError: name 'ImageDataBunch' is not defined
在此之前,我已经导入了Fastai库。所以我不明白 Deepnote中的FastAI设置并没有那么简单。最好使用一个文件夹,在那里你可以在
Dockerfile
中设置内容,然后一切都可以在笔记本中运行。我不确定在FastAI v1和v2中,ImageDataBunch
或您尝试执行的任何操作是否以相同的方式工作,但下面是v1的详细信息
这是一个Dockerfile,通过conda设置FastAI环境:
#这是Dockerfile
来自deepnote/python:3.9
运行wgethttps://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O~/miniconda.sh
运行bash~/miniconda.sh-b-p$HOME/miniconda
环境路径$HOME/miniconda/bin:$PATH
环境PYTONPATH$HOME/miniconda
运行$HOME/miniconda/bin/conda install python=3.9 ipykernel-y
运行$HOME/miniconda/bin/conda安装-c fastai-c pytorch fastai-y
运行$HOME/miniconda/bin/python-m ipykernel安装--user--name=conda
环境默认\u内核\u名称“conda”
之后,您可以在笔记本中测试fastai
导入:
导入fastai
来自fastai.vision import*
打印(fastai.\uuuuuuuuuuuuuuuuuuuuuuuuu版本)
ImageDataBunch
如果您下载并解包,您应该能够按照建议加载数据:
data=ImageDataBunch.从_文件夹(path,train=“train”,valid=“test”,ds_-tfms=get_-transforms(),size=(256256),bs=32,num_-workers=4)。normalize()
请随时签出或克隆以继续处理此问题