Unsupervised with no label

Hi everybody.
I’m doing the master thesis on anomaly detection in videos and I would like to try some unsupervised loss for the task. Until now I’ve been using the supervised contrastive loss (https://arxiv.org/abs/2004.11362) using the implementation by HobbitLong (https://github.com/HobbitLong/SupContrast/commits?author=HobbitLong), to whom I’m extremely grateful for sharing with us such a simple and flexible implementation of both supervised contrastive loss and contrastive loss (https://arxiv.org/pdf/2002.05709.pdf).

Since I’ve already tried the supervised contrastive loss, I would like to use the unsupervised one, but in order to do that I need to pass None as labels to my objects.

I tried to:

  • pass an empty Tfmslist in the pipeline for the label, but the dataloader complains that it cannot do one pass

  • I tried to create a callback that set self.yb =(), the problem is that for some reason the learner doesn’t even pass the predictions to the loss_fn.

Somebody could help me to pass a None object as label to the learner so that I can use the loss?

Maybe this is a stupid question, but why do you need to pass in “None” as a label?
Why don’t you just copy the loss-function, or just wrap it into another function, and then calculate the loss without using the label that is passed into it?

def orig_loss(x,y):
return (x-y)**2

def none_loss(x,y):
return orig_loss(x, None)

1 Like