RepNet-Pytorch
RepNet-Pytorch copied to clipboard
calculate the count value by denominator with " + 1e-1" make the value less than target
https://github.com/confifu/RepNet-Pytorch/blob/b655b8090132499a29d2f4a595d174ba56ee033f/trainLoop.py#L149
raw:
countpred = torch.sum((y2pred > 0) / (y1pred + 1e-1), 1)
count = torch.sum((y2 > 0) / (y1 + 1e-1), 1)
changed:
countpred = torch.sum((y2pred > 0) / torch.nn.functional.threshold(y1pred, 1e-1, 1e-1), 1)
count = torch.sum((y2 > 0) / torch.nn.functional.threshold(y1, 1e-1, 1e-1), 1)
is it good?
Yes, although when y1 < 1e-1 gradient won't flow at all, because y2>0 is not differentiable and 1e-1 is constant. You want the loss to be a differentiable function of the predicted value.
https://github.com/confifu/RepNet-Pytorch/blob/b655b8090132499a29d2f4a595d174ba56ee033f/trainLoop.py#L149
raw:
countpred = torch.sum((y2pred > 0) / (y1pred + 1e-1), 1) count = torch.sum((y2 > 0) / (y1 + 1e-1), 1)
changed:
countpred = torch.sum((y2pred > 0) / torch.nn.functional.threshold(y1pred, 1e-1, 1e-1), 1) count = torch.sum((y2 > 0) / torch.nn.functional.threshold(y1, 1e-1, 1e-1), 1)
is it good?
Hi @qrsforever , Is there still an archive of the training data, jupyter book version of the test demo and pre-trained weights of this project, I am trying to reproduce this code but results are poor, hope I can get your help, appreciate it.