Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporating Historical Frame Points in StreamPETR #244

Open
Gigalomanicx opened this issue Nov 27, 2024 · 1 comment
Open

Incorporating Historical Frame Points in StreamPETR #244

Gigalomanicx opened this issue Nov 27, 2024 · 1 comment

Comments

@Gigalomanicx
Copy link

Gigalomanicx commented Nov 27, 2024

I am currently working on extending the LiDAR modality within the StreamPETR framework. However, I am unsure how to incorporate historical frame sweep points into the data{} during the forward_train process.
image
image
image

From my understanding, it seems that I need to modify the nuscenes_converter.py file and regenerate the PKL files. Could someone provide guidance on how to achieve this?
image

@Gigalomanicx
Copy link
Author

Gigalomanicx commented Nov 27, 2024

Also I'm confused about the variable names here, is the gradient being calculated here using the loss of two frames?

def obtain_history_memory(self,
gt_bboxes_3d=None,
gt_labels_3d=None,
gt_bboxes=None,
gt_labels=None,
img_metas=None,
centers2d=None,
depths=None,
gt_bboxes_ignore=None,
**data):
losses = dict()
T = data['img'].size(1)
num_nograd_frames = T - self.num_frame_head_grads
num_grad_losses = T - self.num_frame_losses
for i in range(T):
requires_grad = False
return_losses = False
data_t = dict()
for key in data:
data_t[key] = data[key][:, i]
data_t['img_feats'] = data_t['img_feats']
if i >= num_nograd_frames:
requires_grad = True
if i >= num_grad_losses:
return_losses = True
loss = self.forward_pts_train(gt_bboxes_3d[i],
gt_labels_3d[i], gt_bboxes[i],
gt_labels[i], img_metas[i], centers2d[i], depths[i], requires_grad=requires_grad,return_losses=return_losses,**data_t)
if loss is not None:
for key, value in loss.items():
losses['frame_'+str(i)+"_"+key] = value
return losses

if T-self.num_frame_backbone_grads > 0:
self.eval()
with torch.no_grad():
prev_img_feats = self.extract_feat(prev_img, T-self.num_frame_backbone_grads, True)
self.train()
data['img_feats'] = torch.cat([prev_img_feats, rec_img_feats], dim=1)
else:
data['img_feats'] = rec_img_feats

#232 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant