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

[Bug] Does not support reg_class_agnostic=True in cascade-rcnn #2838

Open
3 tasks done
cly234 opened this issue Nov 12, 2024 · 2 comments
Open
3 tasks done

[Bug] Does not support reg_class_agnostic=True in cascade-rcnn #2838

cly234 opened this issue Nov 12, 2024 · 2 comments

Comments

@cly234
Copy link

cly234 commented Nov 12, 2024

Checklist

  • I have searched related issues but cannot get the expected help.
  • 2. I have read the FAQ documentation but cannot get the expected help.
  • 3. The bug has not been fixed in the latest version.

Describe the bug

When deploying cascade-rcnn, I located that the deployment does not support this config:

bbox_head=[
            dict(
                type='Shared2FCBBoxHead',
                in_channels=256,
                fc_out_channels=1024,
                roi_feat_size=7,
                num_classes=12,
                bbox_coder=dict(
                    type='DeltaXYWHBBoxCoder',
                    target_means=[
                        0.0,
                        0.0,
                        0.0,
                        0.0,
                    ],
                    target_stds=[
                        0.1,
                        0.1,
                        0.2,
                        0.2,
                    ]),
                reg_class_agnostic=False,
                reg_decoded_bbox=True,
                norm_cfg=dict(type='SyncBN', requires_grad=True),
                loss_cls=dict(
                    type='CrossEntropyLoss',
                    use_sigmoid=False,
                    loss_weight=1.0),
                loss_bbox=dict(type='CIoULoss', loss_weight=12.0))

where the reg_class_agnostic is set to False. The reason is that the code in the deployment was like:

if i < self.num_stages - 1:
            assert self.bbox_head[i].reg_class_agnostic
            new_rois = self.bbox_head[i].bbox_coder.decode(
                rois[..., 1:], bbox_pred, max_shape=max_shape)
            new_rois = get_box_tensor(new_rois)
            rois = new_rois.reshape(-1, new_rois.shape[-1])
            # Add dummy batch index
            rois = torch.cat([batch_index.flatten(0, 1), rois], dim=-1)

Error traceback

results_list = self.predict_bbox(
  File "/usr/local/python/lib/python3.8/site-packages/mmdeploy/codebase/mmdet/models/roi_heads/cascade_roi_head.py", line 66, in cascade_roi_head__predict_bbox
    assert self.bbox_head[i].reg_class_agnostic
AssertionError
@cly234 cly234 changed the title [Bug] [Bug] Does not support reg_class_agnostic=True in cascade-rcnn Nov 12, 2024
@cly234
Copy link
Author

cly234 commented Nov 17, 2024

Update: Fix this by selecting the highest score among classes for each roi and enabling batch-level inference.

@cly234 cly234 closed this as completed Nov 17, 2024
@cly234 cly234 reopened this Nov 17, 2024
@makalsue
Copy link

Update: Fix this by selecting the highest score among classes for each roi and enabling batch-level inference.
Can you give the details how to solve this bug and revise it in which file, thanks a lot

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