metric_base.py 464 B

12345678910111213141516171819202122
  1. # -*- coding:utf-8 -*-
  2. """
  3. @author: yq
  4. @time: 2024/1/2
  5. @desc: 指标计算基类
  6. """
  7. import abc
  8. import os
  9. from config import BaseConfig
  10. from entitys import MetricFucEntity
  11. class MetricBase(metaclass=abc.ABCMeta):
  12. def _get_image_path(self, file_name: str) -> str:
  13. image_path = os.path.join(BaseConfig.image_path, file_name)
  14. return image_path
  15. @abc.abstractmethod
  16. def calculate(self, *args, **kwargs) -> MetricFucEntity:
  17. pass