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

Some ambiguities in RTDETRPostProcessor forward()? #551

Open
minhhotboy9x opened this issue Feb 17, 2025 · 0 comments
Open

Some ambiguities in RTDETRPostProcessor forward()? #551

minhhotboy9x opened this issue Feb 17, 2025 · 0 comments
Assignees

Comments

@minhhotboy9x
Copy link

Hi, I'm trying to understand your eval code. In class RTDETRPostProcessor in RTDETR_PYTORCH\src\zoo\rtdetr\rtdetr_postprocessor.py, I see these lines:

if self.use_focal_loss:
   scores = F.sigmoid(logits)
   scores, index = torch.topk(scores.flatten(1), self.num_top_queries, axis=-1)
   labels = index % self.num_classes
   index = index // self.num_classes
   boxes = bbox_pred.gather(dim=1, index=index.unsqueeze(-1).repeat(1, 1, bbox_pred.shape[-1]))

scores = F.sigmoid(logits) has the shape of (b, queries, cls) but you take the top prediction: torch.topk(scores.flatten(1), self.num_top_queries, axis=-1). As I understand, you change the cls score from different queries into a dim (b, queries*cls) then you just take the topk highest cls scores. However, there would be the case that some cls in the same original queries (the score's shape (b, queries, cls)) would be taken.
Can you explain more about this?

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

2 participants