I am running the 10_tutorial.pets notebook from the fastai2’s dev folder to understand the dataloaders. When I create the DataLoaders
from the TfmdLists
, I got the following error.
The error is attached below… Please enlighten me on this…
splits = RandomSplitter(seed=42)(items)
tls = TfmdLists(items, [Resize(224), PetTfm(), FlipItem(p=0.5), ToTensor()], splits=splits)
dls = tls.dataloaders(bs=64)
dls.show_batch()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-78-90634fcc3c9e> in <module>
----> 1 dls.show_batch()
~/.local/lib/python3.6/site-packages/fastai2/data/core.py in show_batch(self, b, max_n, ctxs, show, unique, **kwargs)
93 if b is None: b = self.one_batch()
94 if not show: return self._pre_show_batch(b, max_n=max_n)
---> 95 show_batch(*self._pre_show_batch(b, max_n=max_n), ctxs=ctxs, max_n=max_n, **kwargs)
96 if unique: self.get_idxs = old_get_idxs
97
~/.local/lib/python3.6/site-packages/fastcore/dispatch.py in __call__(self, *args, **kwargs)
96 if not f: return args[0]
97 if self.inst is not None: f = MethodType(f, self.inst)
---> 98 return f(*args, **kwargs)
99
100 def __get__(self, inst, owner):
~/.local/lib/python3.6/site-packages/fastai2/vision/data.py in show_batch(x, y, samples, ctxs, max_n, nrows, ncols, figsize, **kwargs)
43 def show_batch(x:TensorImage, y, samples, ctxs=None, max_n=10, nrows=None, ncols=None, figsize=None, **kwargs):
44 if ctxs is None: ctxs = get_grid(min(len(samples), max_n), nrows=nrows, ncols=ncols, figsize=figsize)
---> 45 ctxs = show_batch[object](x, y, samples, ctxs=ctxs, max_n=max_n, **kwargs)
46 return ctxs
47
~/.local/lib/python3.6/site-packages/fastai2/data/core.py in show_batch(x, y, samples, ctxs, max_n, **kwargs)
13 if ctxs is None: ctxs = Inf.nones
14 for i in range_of(samples[0]):
---> 15 ctxs = [b.show(ctx=c, **kwargs) for b,c,_ in zip(samples.itemgot(i),ctxs,range(max_n))]
16 return ctxs
17
~/.local/lib/python3.6/site-packages/fastai2/data/core.py in <listcomp>(.0)
13 if ctxs is None: ctxs = Inf.nones
14 for i in range_of(samples[0]):
---> 15 ctxs = [b.show(ctx=c, **kwargs) for b,c,_ in zip(samples.itemgot(i),ctxs,range(max_n))]
16 return ctxs
17
AttributeError: 'str' object has no attribute 'show'
Thanks in advance for the help…