Skip to content

[Bug] fcos3d训练非标准分辨率,推理时结果不正确 #3126

@windmakeppcool

Description

@windmakeppcool

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

main branch https://github.com/open-mmlab/mmdetection3d

Environment

pytorch 1.13.1 + cu113 + mmdet3d v1.4

Reproduces the problem - code sample

在mmdet3d/models/dense_heads/fcos_mono3d_head.py文件内
class FCOSMono3DHead(AnchorFreeMono3DHead):
def __predict_by_feat_singel(self,....):
view = np.array(img_meta['cam2img'])
scale_factor = img_meta['scale_factor']
......
for cls_score, bbox_pred, dir_cls_pred, attr_pred, centerness,
points in zip(cls_score_list, bbox_pred_list,
dir_cls_pred_list, attr_pred_list,
centerness_pred_list, mlvl_points):
# change the offset to actual center predictions
bbox_pred[:, :2] = points - bbox_pred[:, :2]
if rescale:
bbox_pred[:, :2] /= bbox_pred[:, :2].new_tensor(scale_factor)
pred_center2d = bbox_pred[:, :3].clone()
bbox_pred[:, :3] = points_img2cam(bbox_pred[:, :3], view)

在上述这段代码中,如果你缩放了分辨率,例如scale_factor分辨率为0.5,则viewpad对应的内参也会缩放0.5倍,
当设置rescale=True的时候,预测的center_2d中心点会还原回到原始尺寸,这时候在代码最后一行做img2cam转换时候,内参并未被还原导致cam坐标系下的坐标不正确,从而降低了训练指标

Reproduces the problem - command or script

Reproduces the problem - error message

推理指标变低

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions