__init__.py 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. from .yolof_head import YolofHead
  2. from .fcos_head import FcosHead
  3. # build head
  4. def build_head(cfg, in_dim, out_dim, num_classes):
  5. print('==============================')
  6. print('Head: {}'.format(cfg['head']))
  7. if cfg['head'] == 'fcos_head':
  8. model = FcosHead(cfg = cfg,
  9. in_dim = in_dim,
  10. out_dim = out_dim,
  11. num_classes = num_classes,
  12. num_cls_head = cfg['num_cls_head'],
  13. num_reg_head = cfg['num_reg_head'],
  14. act_type = cfg['head_act'],
  15. norm_type = cfg['head_norm']
  16. )
  17. elif cfg['head'] == 'yolof_head':
  18. model = YolofHead(cfg = cfg,
  19. in_dim = in_dim,
  20. out_dim = out_dim,
  21. num_classes = num_classes,
  22. num_cls_head = cfg['num_cls_head'],
  23. num_reg_head = cfg['num_reg_head'],
  24. act_type = cfg['head_act'],
  25. norm_type = cfg['head_norm']
  26. )
  27. return model