fast-reid/fastreid/modeling/heads/build.py

25 lines
684 B
Python
Raw Normal View History

2020-02-10 07:38:56 +08:00
# encoding: utf-8
"""
@author: liaoxingyu
@contact: sherlockliao01@gmail.com
"""
from ...utils.registry import Registry
2020-02-10 22:13:04 +08:00
REID_HEADS_REGISTRY = Registry("HEADS")
2020-02-10 07:38:56 +08:00
REID_HEADS_REGISTRY.__doc__ = """
Registry for ROI heads in a generalized R-CNN model.
ROIHeads take feature maps and region proposals, and
perform per-region computation.
The registered object will be called with `obj(cfg, input_shape)`.
The call is expected to return an :class:`ROIHeads`.
"""
2020-03-25 10:58:26 +08:00
def build_reid_heads(cfg, in_feat, pool_layer):
2020-02-10 07:38:56 +08:00
"""
Build REIDHeads defined by `cfg.MODEL.REID_HEADS.NAME`.
"""
2020-02-10 22:13:04 +08:00
head = cfg.MODEL.HEADS.NAME
2020-03-25 10:58:26 +08:00
return REID_HEADS_REGISTRY.get(head)(cfg, in_feat, pool_layer)