wudongming97 / TopoMLP

[ICLR2024] TopoMLP: A Simple yet Strong Pipeline for Driving Topology Reasoning
Apache License 2.0
159 stars 13 forks source link

About topo heads #9

Closed eeeric1 closed 9 months ago

eeeric1 commented 9 months ago

Hi, thanks for your work. I am a little confused about the topo head code, and I would like to ask you for advice. In line 133 of topo_lt_head, targets need to be operated according to the shape of xs. I'm not quite sure why this is done. I understand that we can do the same thing as line 157 of topo_ll_head. Looking forward to your reply!

wudongming97 commented 9 months ago

Hi, It means computing the LT loss for only positive samples. It can increase the loss weights of positive samples (they are not too much in all samples).

eeeric1 commented 9 months ago

Thanks for your reply! I understand the purpose of this, but I'm not sure why topo_lt_head and topo_ll_head do it differently. in topo_lt_head.py

if xs.size(0) != xs.size(1):
     targets = 1 - targets[0][xs_new].view(-1).long()
else:
     targets = 1 - targets[0][xs_new][:, ys_new].view(-1).long()

in topo_ll_head.py

targets = 1 - targets[0][xs_new][:, ys_new].view(-1).long()
wudongming97 commented 9 months ago

From my experience, the ll has more positive samples. Because each centerline has more than one connected centerline, most centerlines may not connect any traffic element.

eeeric1 commented 9 months ago

Hi, I'm still a bit confused about the code here The main problem lies in this code

if xs.size(0) != xs.size(1):

In my opinion, you can directly take targets[0][xs_new][:, ys_new], which is consistent with topo_ll_head, or in order to add some samples, take targets[0][xs_new]. But I don’t know why xs.shape is used to determine how to get the target.

wudongming97 commented 9 months ago

Oh. Sorry for that. In our initial code, the ll and lt heads are not separated, so use this judgment. It is not important.

Wolfybox commented 5 months ago

Thanks for your reply! I understand the purpose of this, but I'm not sure why topo_lt_head and topo_ll_head do it differently. in topo_lt_head.py

if xs.size(0) != xs.size(1):
     targets = 1 - targets[0][xs_new].view(-1).long()
else:
     targets = 1 - targets[0][xs_new][:, ys_new].view(-1).long()

in topo_ll_head.py

targets = 1 - targets[0][xs_new][:, ys_new].view(-1).long()

@wudongming97 I confused why there is a inverse operation here to make pos to 0 and neg to 1:

targets = 1 - targets[0][xs_new][:, ys_new].view(-1).long()