From 87fbc3d239ef7fd2833537ee5217cf261c3736cf Mon Sep 17 00:00:00 2001 From: John Wesley Abe <68657618+Frieya@users.noreply.github.com> Date: Sun, 25 Aug 2024 19:01:41 +0800 Subject: [PATCH] Fix IndexError in sortedAP() when image_average=True This pull request fixes an IndexError that occurs when calling e_done.sortedAP() with the image_average parameter set to True. The error is triggered during the printing of the metric in the decorated function due to attempting to index a scalar variable after applying the np.mean operation. --- evaluation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evaluation.py b/evaluation.py index 352a284..b656946 100644 --- a/evaluation.py +++ b/evaluation.py @@ -358,7 +358,7 @@ def decorated(*args,**kwargs): for k, value in signature.parameters.items(): if k not in kwargs and value.default != inspect.Signature.empty: kwargs_default[k] = value.default - if args[0].image_average: + if args[0].image_average and metric_name not in ['sortedAP']: kwargs_ps = kwargs.copy() if 'verbose' in kwargs_ps.keys(): del kwargs_ps['verbose']