12345678910111213141516171819202122232425262728293031 |
- # Copyright (c) OpenMMLab. All rights reserved.
- from mmdet.registry import MODELS
- from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
- from .two_stage import TwoStageDetector
- @MODELS.register_module()
- class SparseRCNN(TwoStageDetector):
- r"""Implementation of `Sparse R-CNN: End-to-End Object Detection with
- Learnable Proposals <https://arxiv.org/abs/2011.12450>`_"""
- def __init__(self,
- backbone: ConfigType,
- neck: OptConfigType = None,
- rpn_head: OptConfigType = None,
- roi_head: OptConfigType = None,
- train_cfg: OptConfigType = None,
- test_cfg: OptConfigType = None,
- data_preprocessor: OptConfigType = None,
- init_cfg: OptMultiConfig = None) -> None:
- super().__init__(
- backbone=backbone,
- neck=neck,
- rpn_head=rpn_head,
- roi_head=roi_head,
- train_cfg=train_cfg,
- test_cfg=test_cfg,
- data_preprocessor=data_preprocessor,
- init_cfg=init_cfg)
- assert self.with_rpn, 'Sparse R-CNN and QueryInst ' \
- 'do not support external proposals'
|