Skip to content

fix(streampetr) sampler always skips first element of sequence#196

Merged
jacoblambert merged 1 commit intomainfrom
pr/streampetr-sampler
Mar 18, 2026
Merged

fix(streampetr) sampler always skips first element of sequence#196
jacoblambert merged 1 commit intomainfrom
pr/streampetr-sampler

Conversation

@jacoblambert
Copy link
Copy Markdown
Collaborator

@jacoblambert jacoblambert commented Mar 17, 2026

Summary

This PR fixes a bug in StreamPETR’s GroupStreamingSampler where the first frame of each sequence was always dropped, despite the sampler intending to preserve it according to the comment:

# Randomly drop some elements from the group based on the random_drop_probability, to simulate camera drop. But never drop the first element because it might cause the value of prev_exists to be wrong in the inputs.

This was a logic fault is because this list comprehension deciding which frame to KEEP, not which frame to drop so

if np.random.rand() > self.random_drop_probability and position > 0

makes it impossible to keep frame0. I changed the condition to match the intention of the comment.

For fusion use cases like in auto_labeling_3d, this caused StreamPETR predictions to become temporally misaligned with lidar frames during ensemble/tracking. The change affects StreamPETR training/inference, but is limited to StreamPETR and does not affect non-StreamPETR pipelines.

Copy link
Copy Markdown
Collaborator

@KSeangTan KSeangTan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the fix

@jacoblambert jacoblambert merged commit 0cb8d28 into main Mar 18, 2026
2 checks passed
@jacoblambert jacoblambert deleted the pr/streampetr-sampler branch March 18, 2026 01:26
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

Successfully merging this pull request may close these issues.

2 participants