I’d like my neural network to output an ImageTuple as defined in the Siamese tutorial. This works fairly well, including the show
and show_batch
methods. However show_results
fails for the following reason.
Learner.show_results()
calls TfmDL.show_results()
, so let’s start there:
def show_results(self, b, out, max_n=9, ctxs=None, show=True, **kwargs):
x,y,its = self.show_batch(b, max_n=max_n, show=False)
b_out = type(b)(b[:self.n_inp] + (tuple(out) if is_listy(out) else (out,)))
x1,y1,outs = self.show_batch(b_out, max_n=max_n, show=False)
res = (x,x1,None,None) if its is None else (x, y, its, outs.itemgot(slice(self.n_inp,None)))
if not show: return res
show_results(*res, ctxs=ctxs, max_n=max_n, **kwargs)
Note that my input is of the form
(TensorImage, ImageTuple(TensorImage, TensorImage, ...))
and output is
ImageTuple(TensorImage, TensorImage, ...)
.
Consequently, since is_listy(ImageTuple(x, y,...))
evaluates to True,
tuple(ImageTuple(x, y,...)) = (x, y, ...)
we have that b_out = (img, x, y, ...)
(i.e. different structure than b
) and the call to self.show_batch
fails.
Unfortunately I don’t know how to fix this! Note that the issue is closely related to this one and may even share a similar resolution.