Request: show_batch in console

By far one of the hardest things to get used to in Fastai is handling data (data loaders, bunches, blocks…).

show_batch is a fantastic tool to make sure to understand how things are working. Sadly, if using Fastai outside of a Jupyter environment, this method returns None and shows nothing at print.

Would it be possible to address this? Returning the HTML element might be enough for some coarse visualization, by printing html_thing.data

We recommend using sixel to show the plots in console. Also that method has a return_fig argument that will return the figure and not None.

1 Like

Really? Sorry I missed that. I’ll get to explore your suggestions right away, thanks a lot!

Maybe it has changed with version 2? While return_fig=True did not work, show=False returns the information.

Quick question: the batch data has some kind of prefix in the data and labels. For example,

Labels: “(#7) [list of labels]”

What do these mean?

That’s the representation of an L object: length then list of elements.

1 Like

Just a note from the future: I’m not sure if this worked this way before as well, but it is possible to directly print Fastai images to file, using matplotlib. Example:

data_loader.show_batch()
plt.savefig("your_file_name")
2 Likes