I have created a databunch using pytorch dataloaders and implemented my own network for forward pass to train an autoencoder. I want to find out several metrics and so I tried to follow the procedure mentioned here.
I haven’t implemented it completely, but look at this code.
class CustMetrics(Callback): _order = -20 def __init__(self, ks = [1, 2, 5, 10, 20], cutoff = len(query)): self.ks = ks self.cutoff = cutoff def on_epoch_begin(self, **kwargs): self.embeddings =  self.targets =  print("Begun Epoch") def on_batch_end(self, preds, targs, **kwargs): encodings = preds self.embeddings.append(encodings) self.targets.append(targs) def on_epoch_end(self, last_metrics, **kwargs): print(last_metrics) query_embeds = self.embeddings[:self.cutoff] gallery_embeds = self.embeddings[self.cutoff:] print(query_embeds.shape) print(query_embeds.shape) return add_metrics(last_metrics)
I just wanted to check if things are working out fine but on fitting my learner I get this error:
FYI, my forward function returns a tuple of 3 items:
Original Image, Reconstructed Image, Encoding of the image
My Dataset class returns
Image, Target class (i.e. a group/cluster to which the image belongs).
Can someone help me to resolve this issue please? Unfortunately, I can’t share the code however I would appreciate if someone looked into this and if you need any more info to solve the problem, let me know.