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

Fixed bugs about cascade_roi_head. #3244

Merged
merged 7 commits into from
Jul 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions mmdet/models/roi_heads/cascade_roi_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ def forward_train(self,
# bbox_targets is a tuple
roi_labels = bbox_results['bbox_targets'][0]
with torch.no_grad():
roi_labels = torch.where(
roi_labels == self.bbox_head[i].num_classes,
bbox_results['cls_score'][:, :-1].argmax(1),
roi_labels)
proposal_list = self.bbox_head[i].refine_bboxes(
bbox_results['rois'], roi_labels,
bbox_results['bbox_pred'], pos_is_gts, img_metas)
Expand All @@ -306,7 +310,7 @@ def simple_test(self, x, proposal_list, img_metas, rescale=False):
ms_scores.append(bbox_results['cls_score'])

if i < self.num_stages - 1:
bbox_label = bbox_results['cls_score'].argmax(dim=1)
bbox_label = bbox_results['cls_score'][:, :-1].argmax(dim=1)
rois = self.bbox_head[i].regress_by_class(
rois, bbox_label, bbox_results['bbox_pred'], img_metas[0])

Expand Down Expand Up @@ -380,7 +384,8 @@ def aug_test(self, features, proposal_list, img_metas, rescale=False):
ms_scores.append(bbox_results['cls_score'])

if i < self.num_stages - 1:
bbox_label = bbox_results['cls_score'].argmax(dim=1)
bbox_label = bbox_results['cls_score'][:, :-1].argmax(
dim=1)
rois = self.bbox_head[i].regress_by_class(
rois, bbox_label, bbox_results['bbox_pred'],
img_meta[0])
Expand Down