evaluator.py 1.1 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.evaluator import BaseEvaluator
  12. from .support_models import SUPPORT_MODELS
  13. class TextDetEvaluator(BaseEvaluator):
  14. """ Text Detection Model Evaluator """
  15. support_models = SUPPORT_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. "TextDetDataset")
  23. def get_eval_kwargs(self) -> dict:
  24. """get key-value arguments of model evalution function
  25. Returns:
  26. dict: the arguments of evaluation function.
  27. """
  28. return {
  29. "weight_path": self.eval_config.weight_path,
  30. "device": self.get_device()
  31. }