Hey!
I’m using a custom ItemList
with a custom ItemBase
(inherited from ImageList
and Image
) with the not really creative names TensorList
and TensorImage
. Training and everything else works like expected, when I plot my DataBunch
I get:
ImageDataBunch;
Train: LabelList (1175 items)
x: TensorList
TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224)
y: CategoryList
NIO,NIO,NIO,NIO,NIO
Valid: LabelList (325 items)
x: TensorList
TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224),TensorImage (3, 224, 224)
y: CategoryList
NIO,NIO,NIO,NIO,NIO
Test: None
Those images need some exposure enhancement in order to have better visibility for the human eye so I also overloaded the show
function in my custom Image
class. That works if I directly call the function in my custom class. It is not working when I use show_batch
in my DataBunch
. The show_xys
function is called to plot the images and it seems to use the show
function I customized:
def show_xys(self, xs, ys, imgsize:int=4, figsize:Optional[Tuple[int,int]]=None, **kwargs):
"Show the `xs` (inputs) and `ys` (targets) on a figure of `figsize`."
rows = int(np.ceil(math.sqrt(len(xs))))
axs = subplots(rows, rows, imgsize=imgsize, figsize=figsize)
for x,y,ax in zip(xs, ys, axs.flatten()): x.show(ax=ax, y=y, **kwargs)
for ax in axs.flatten()[len(xs):]: ax.axis('off')
plt.tight_layout()
When I plot(type(x))
in this function it says x is an Image
and not my custom TensorImage
, which kind off confused me Does someone know whats going on?