yulequan/UA-MT

A small code detail problem

Closed this issue · 5 comments

Hi, @yulequan
Thank you for opening the source code, I viewed the code carefully and had a small question.
consistency_dist = torch.sum(mask*consistency_dist)/(2*torch.sum(mask)+1e-16) consistency_loss = consistency_weight * consistency_dist loss = supervised_loss + consistency_loss
You can see that, in calculating consistency_dist, the sum of mask needs to be multiplied by 2. I'm curious why do you multiply this by 2 here?

Looking forward to your reply.
Best,
Jianqiang Ma

We produce two channels for the prediction (foreground and background). Meanwhile, the mask is only one channel.

OK, I got it. Thank you.

Hi,
Thanks for your great work!
For a 5 classes task, could you tell me the number in front of "mask" should be 2 or 5 for a 5 classes task.

consistency_dist = torch.sum(maskconsistency_dist)/(2torch.sum(mask)+1e-16) consistency_loss = consistency_weight * consistency_dist loss = supervised_loss + consistency_loss

Best.

It should be 5.