Safemotion Lib
Loading...
Searching...
No Matches
build.py
Go to the documentation of this file.
1# encoding: utf-8
2"""
3@author: liaoxingyu
4@contact: sherlockliao01@gmail.com
5"""
6
7from ...utils.registry import Registry
8
9BACKBONE_REGISTRY = Registry("BACKBONE")
10BACKBONE_REGISTRY.__doc__ = """
11Registry for backbones, which extract feature maps from images
12The registered object must be a callable that accepts two arguments:
131. A :class:`detectron2.config.CfgNode`
142. A :class:`detectron2.layers.ShapeSpec`, which contains the input shape specification.
15It must returns an instance of :class:`Backbone`.
16"""
17
18
20 """
21 Build a backbone from `cfg.MODEL.BACKBONE.NAME`.
22 Returns:
23 an instance of :class:`Backbone`
24 """
25
26 backbone_name = cfg.MODEL.BACKBONE.NAME
27 backbone = BACKBONE_REGISTRY.get(backbone_name)(cfg)
28 return backbone