CornerNet icon indicating copy to clipboard operation
CornerNet copied to clipboard

[Push loss] confuced

Open sycophant-stone opened this issue 4 years ago • 2 comments

sycophant-stone avatar Sep 09 '19 14:09 sycophant-stone

models/py_utils.py _ae_loss:

mask = mask.unsqueeze(1) + mask.unsqueeze(2) mask = mask.eq(2) dist = tag_mean.unsqueeze(1) - tag_mean.unsqueeze(2) dist = 1 - torch.abs(dist) dist = nn.functional.relu(dist, inplace=True) dist = dist - 1 / (num + 1e-4) dist = dist / (num2 + 1e-4) dist = dist[mask] push = dist.sum()

suppose mask = torch.Tensor([[1,1,0,0,0]]) mask = tensor([[[ 1, 1, 0, 0, 0], [ 1, 1, 0, 0, 0], [ 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0]]], dtype=torch.uint8)

simply, dist=ek-ej, aka: tensor([[[ 0., 0., -1., -1., -1.], [ 0., 0., -1., -1., -1.], [ 1., 1., 0., 0., 0.], [ 1., 1., 0., 0., 0.], [ 1., 1., 0., 0., 0.]]])

so the dist[mask], we get the True positions tensor([ 0., 0., 0., 0.]), which is ek -ek, not the ek-ej

sycophant-stone avatar Sep 09 '19 14:09 sycophant-stone

i got a problem with IndexError: The shape of the mask [2, 128, 128] at index 0does not match the shape of the indexed tensor [1, 2, 2, 128] at index 0 can you tell me the solution?thx

duanqipeng avatar Jan 09 '20 02:01 duanqipeng