evaluator.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # !/usr/bin/env python3
  2. # -*- coding: UTF-8 -*-
  3. ################################################################################
  4. #
  5. # Copyright (c) 2024 Baidu.com, Inc. All Rights Reserved
  6. #
  7. ################################################################################
  8. """
  9. Author: PaddlePaddle Authors
  10. """
  11. from ..base import BaseEvaluator
  12. from .model_list import MODELS
  13. class DetEvaluator(BaseEvaluator):
  14. """ Object Detection Model Evaluator """
  15. entities = MODELS
  16. def update_config(self):
  17. """update evalution config
  18. """
  19. if self.eval_config.log_interval:
  20. self.pdx_config.update_log_interval(self.eval_config.log_interval)
  21. self.pdx_config.update_dataset(self.global_config.dataset_dir,
  22. "COCODetDataset")
  23. self.pdx_config.update_weights(self.eval_config.weight_path)
  24. def get_eval_kwargs(self) -> dict:
  25. """get key-value arguments of model evalution function
  26. Returns:
  27. dict: the arguments of evaluation function.
  28. """
  29. return {
  30. "weight_path": self.eval_config.weight_path,
  31. "device": self.get_device(using_device_number=1)
  32. }