jhultman / vision3d

Research platform for 3D object detection in PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some problem in TargetAssigner

muzi2045 opened this issue · comments

I am trying to train my own lidar dataset(9 classes) on the repo.
And here seems something wrong in tensor shape mismatch which occured in ProposalTargetassigner part.

matches = torch.stack(matches).view(self.anchors.shape[:-1])
match_labels = torch.stack(match_labels).view(self.anchors.shape[:-1])

捕获

here is my log:
proposal_targets py - PV-RCNN  SSH_ udi tpddns cn  - Visual Studio Code 2020_3_4 14_33_36 (2)

what's the meaning of full_idx in get_matches func?
@jhultman

in multi-class training , the target assigner code have some problem.
https://github.com/jhultman/PV-RCNN/blob/ca40082be65531c03dfda7353f6eb2d6d47ebb64/pvrcnn/core/proposal_targets.py#L68

because per frame can't contain all class obstacle, so the matches and matches_label can't be just view as [class_num, yaw_num, x_range, y_range].

matches = torch.stack(matches).view(self.anchors.shape[:-1])
match_labels = torch.stack(match_labels).view(self.anchors.shape[:-1])

Hi, thanks for reporting this. I have just pushed a fix -- let me know if it works for you.

full_idx is an indexing trick which maps the masked ground truth boxes for class i back to the full set of ground truth boxes (containing all classes). Sorry the naming is poor. Here is an example which I hope explains it.

import torch
i = 2
class_idx = torch.LongTensor([0, 2, 1, 0, 2])
full_idx = torch.arange(class_idx.shape[0])
class_mask = class_idx == i
matches = torch.LongTensor([0, 1, 0])
matches = full_idx[class_mask][matches]
print(matches)
>>> tensor([1, 4, 1])

seems like the tensor are not in GPU
the full_idx tensor need to load in GPU, that can resolve this problem.
捕获
test

the newest repo code can works in my own dataset now.
thanks