build.py 736 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python3
  2. # -*- coding:utf-8 -*-
  3. from .criterion import SetCriterion
  4. from .yolof import YOLOF
  5. # build YOLOF
  6. def build_yolof(cfg, is_val=False):
  7. # -------------- Build YOLOF --------------
  8. model = YOLOF(cfg = cfg,
  9. conf_thresh = cfg.train_conf_thresh if is_val else cfg.test_conf_thresh,
  10. nms_thresh = cfg.train_nms_thresh if is_val else cfg.test_nms_thresh,
  11. topk = cfg.train_topk if is_val else cfg.test_topk,
  12. )
  13. # -------------- Build Criterion --------------
  14. criterion = None
  15. if is_val:
  16. # build criterion for training
  17. criterion = SetCriterion(cfg)
  18. return model, criterion