From ceb2f3df08ce47672e773189b964e836f6c94ff1 Mon Sep 17 00:00:00 2001 From: yancong Date: Tue, 13 Sep 2022 18:55:55 +0800 Subject: [PATCH] dev(BaseMetric): add docstring in self.add --- mmeval/core/base_metric.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mmeval/core/base_metric.py b/mmeval/core/base_metric.py index 0b53cd88..ce9b5fbc 100644 --- a/mmeval/core/base_metric.py +++ b/mmeval/core/base_metric.py @@ -126,8 +126,8 @@ def compute(self, size: Optional[int] = None) -> Dict: # NOTE: Needs discussion or investigation @yancong at 9/13/2022, 4:20:48 PM # noqa: E501 # If the intermediate results stored in ``self._results`` are not - # correspond one-to-one with samples (e.g. confusion matrix), the size - # here may not work anymore. + # correspond one-to-one with samples (e.g. a total confusion matrix), + # the size here may not work anymore. if size is not None: collected_results = collected_results[:size] @@ -145,8 +145,12 @@ def add(self, *args, **kwargs): """Override this method to add the intermediate results to ``self._results``. - For performance issue, what you add to the ``self._results`` should be - as simple as possible. + Note: + For performance issues, what you add to the ``self._results`` + should be as simple as possible. But be aware that the intermediate + result stored in ``self._results`` should correspond one-to-one + with the samples, in that we need to remove the padded samples for + the most accurate result. """ @abstractmethod