I understand if this issue is closed, as it is not directly related to solo_learn. However, I'm building a custom loss for SimCLR, inspired by https://arxiv.org/abs/2006.10511.
Essentially I'm using all of solo-learn code, but with a custom BatchSampler where I define my batch, and I've also created a custom loss function.
Essentially, I have an NxN matrix that I load, defining, for each pair of images, -1 if that pair (x_i, x_j) should be considered a negative pair for the loss calculation of that image (x_i). 0 if it should be ignored, and 1 if for that row we should consider more positive pairs (not only between x_i and its augmented version but also with other images x_n).
I know this is unusual, but, would anyone mind giving me some hint on why is my loss practically not chancing (ranging between 4.15 and 4.2)...?
Can it be because the backpropagation gradient is being broken somewhere?
Is there any issue with my loss function? Essentially I want to be the one defining what are the positive and negative pairs for the SimCLR loss calculation.
Hi!
I understand if this issue is closed, as it is not directly related to
solo_learn
. However, I'm building a custom loss for SimCLR, inspired by https://arxiv.org/abs/2006.10511. Essentially I'm using all ofsolo-learn
code, but with a customBatchSampler
where I define my batch, and I've also created a custom loss function.Essentially, I have an
NxN
matrix that I load, defining, for each pair of images,-1
if that pair (x_i, x_j) should be considered a negative pair for the loss calculation of that image (x_i).0
if it should be ignored, and1
if for that row we should consider more positive pairs (not only between x_i and its augmented version but also with other images x_n).Here's the modified
training_step
function:And the
simclr_loss_func
function:I know this is unusual, but, would anyone mind giving me some hint on why is my loss practically not chancing (ranging between 4.15 and 4.2)...?
Can it be because the backpropagation gradient is being broken somewhere? Is there any issue with my loss function? Essentially I want to be the one defining what are the positive and negative pairs for the SimCLR loss calculation.
My batch is of shape [80, 256].
Thank you for the help!