metric_base.py 558 B

1234567891011121314151617181920212223242526
  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 MetricFucResultEntity
  11. class MetricBase(metaclass=abc.ABCMeta):
  12. _symbol = "MetricBase"
  13. def __init__(self, *args, **kwargs):
  14. pass
  15. def _get_image_path(self, file_name: str) -> str:
  16. image_path = os.path.join(BaseConfig.image_path, file_name)
  17. return image_path
  18. @abc.abstractmethod
  19. def calculate(self, *args, **kwargs) -> MetricFucResultEntity:
  20. pass