def _context_for_ohem(): import sys from os.path import dirname sys.path.insert(0, dirname(dirname(dirname(__file__)))) from test_forward import _get_detector_cfg model = _get_detector_cfg( 'faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py') model['pretrained'] = None from mmdet.models import build_detector context = build_detector(model).roi_head return context
def _context_for_ohem(): try: from test_forward import _get_detector_cfg except ImportError: # Hack: grab testing utils from test_forward to make a context for ohem import sys from os.path import dirname sys.path.insert(0, dirname(__file__)) from test_forward import _get_detector_cfg model, train_cfg, test_cfg = _get_detector_cfg( 'faster_rcnn_ohem_r50_fpn_1x.py') model['pretrained'] = None # torchvision roi align supports CPU model['bbox_roi_extractor']['roi_layer']['use_torchvision'] = True from mmdet.models import build_detector context = build_detector(model, train_cfg=train_cfg, test_cfg=test_cfg) return context
def _context_for_ohem(): try: from test_forward import _get_detector_cfg except ImportError: # Hack: grab testing utils from test_forward to make a context for ohem import sys from os.path import dirname sys.path.insert(0, dirname(__file__)) from test_forward import _get_detector_cfg model, train_cfg, test_cfg = _get_detector_cfg( 'faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py') model['pretrained'] = None from mmdet.models import build_detector context = build_detector(model, train_cfg=train_cfg, test_cfg=test_cfg).roi_head return context