Hello,
I’m a new user of Fastai and while trying to follow some tutorials I get stuck right after “building” the Dataloaders.
For example, following the walkwithfastai vision Lesson 1 - PETS
After executing this line
dls.show_batch(max_n=9, figsize=(6,7))
I get:
…
/usr/lib/python3/dist-packages/matplotlib/image.py in _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification, unsampled, round_to_pixel_border)
466 A, output, t, interpd[self.get_interpolation()],
467 self.get_resample(), alpha,
→ 468 self.get_filternorm() or 0.0, self.get_filterrad() or 0.0)
469
470 # at this point output is either a 2D array of normed data
ValueError: 3-dimensional arrays must be of dtype unsigned byte, unsigned short, float32 or float64
<matplotlib.figure.Figure at 0x7ef1c954a8>
Am I missing something? Is it a problem with my FastAI installation? I used mamba to install it.
Thank you for your help.
From the error msg that you received, I believe you were using torch.float16dtype. So except that you may use torch.float32 or float64. That should work, or at least should not give this error. You may want to preformat your error msg while posting. This looks neat and easy to read. Just select the code part and press Ctrl+ E
Please post your code from the start to the point where it is showing an error. that way it will be easy to comment on your query. Also please mention the platform that you are using. As a side note update the fastai to the latest version if not done so yet.
The code seems OK to me. Try running this on a Google colab platform. See if the error reproduces. Before that update the libraries and fastai version. I hope this should run fine.