def METHOD_NAME(cls, cfg, *args, **kwargs):
    backbone = create(cfg['backbone'])
    kwargs = {'input_shape': backbone.out_shape}
    neck = cfg['neck'] and create(cfg['neck'], **kwargs)
    out_shape = neck and neck.out_shape or backbone.out_shape
    kwargs = {'input_shape': out_shape}
    rpn_head = create(cfg['rpn_head'], **kwargs)
    bbox_head = create(cfg['bbox_head'], **kwargs)
    out_shape = neck and out_shape or bbox_head.get_head().out_shape
    kwargs = {'input_shape': out_shape}
    mask_head = cfg['mask_head'] and create(cfg['mask_head'], **kwargs)
    return {
        'backbone': backbone,
        'neck': neck,
        "rpn_head": rpn_head,
        "bbox_head": bbox_head,
        "mask_head": mask_head,
    }