From d434218d9ff378e73e399eaf6dc4e5689156dab2 Mon Sep 17 00:00:00 2001 From: Arjun Suresh Date: Fri, 21 Oct 2022 17:45:27 +0100 Subject: [PATCH] Fix issue with python API --- PythonAPI/pycocotools/cocoeval.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/PythonAPI/pycocotools/cocoeval.py b/PythonAPI/pycocotools/cocoeval.py index 8ba7ad7e..7c08e789 100755 --- a/PythonAPI/pycocotools/cocoeval.py +++ b/PythonAPI/pycocotools/cocoeval.py @@ -465,15 +465,27 @@ def _summarize( ap=1, iouThr=None, areaRng='all', maxDets=100 ): # IoU if iouThr is not None: t = np.where(iouThr == p.iouThrs)[0] - s = s[:,:,:,t,:] - s = s[:,aind,mind,:,:] + if self.use_ext: + s = s[:,:,:,t,:] + else: + s = s[t] + if self.use_ext: + s = s[:,aind,mind,:,:] + else: + s = s[:,:,:,aind,mind] else: # dimension of recall: [TxKxAxM] s = self.eval['recall'] if iouThr is not None: t = np.where(iouThr == p.iouThrs)[0] - s = s[:,:,:,t] - s = s[:,aind,mind,:] + if self.use_ext: + s = s[:,:,:,t] + else: + s = s[t] + if self.use_ext: + s = s[:,aind,mind,:] + else: + s = s[:,:,aind,mind] if len(s[s>-1])==0: mean_s = -1 else: