SySu
SySu

Reputation: 619

name 'ImageDataBunch' is not defined

I'm getting this error "name 'ImageDataBunch' is not defined" and am not able to find a solution on the Internet.

The full code can be found here: https://dzlab.github.io/jekyll/update/2018/11/13/audio-classification/.

np.random.seed(42)
data = ImageDataBunch.from_lists(path, fnames, labels, ds_tfms=None, size=224, bs=bs)
data.normalize(imagenet_stats)
data.show_batch(rows=5, figsize=(8,8))

I'm running this code on Google Colab and Python 3.6.

Upvotes: 2

Views: 8476

Answers (2)

Avijit Chowdhury
Avijit Chowdhury

Reputation: 1

Use this

from fastai.vision.data import ImageDataBunch

this code will solve the problem

Upvotes: 0

Turtalicious
Turtalicious

Reputation: 430

You just need to import the ImageDataBunch class from the fast.ai library. Here's the docs for it. Just add the following to the top of your code to import the entirety of the vision library classes:

from fastai.vision import *

Upvotes: 1

Related Questions