1- from _typeshed import Incomplete
21from typing import Literal , TypedDict
32from typing_extensions import TypeAlias
43
5- from .coco import COCO
4+ import numpy as np
5+ import numpy .typing as npt
66
7- # TODO: Use numpy types when #5768 is resolved.
8- # import numpy as np
9- # import numpy.typing as npt
7+ from .coco import COCO
108
11- _NDArray : TypeAlias = Incomplete
9+ _NDFloatArray : TypeAlias = npt . NDArray [ np . float64 ]
1210_TIOU : TypeAlias = Literal ["segm" , "bbox" , "keypoints" ]
1311
1412class _ImageEvaluationResult (TypedDict ):
@@ -18,58 +16,46 @@ class _ImageEvaluationResult(TypedDict):
1816 maxDet : int
1917 dtIds : list [int ]
2018 gtIds : list [int ]
21- dtMatches : _NDArray
22- # dtMatches: npt.NDArray[np.float64]
23- gtMatches : _NDArray
24- # gtMatches: npt.NDArray[np.float64]
19+ dtMatches : _NDFloatArray
20+ gtMatches : _NDFloatArray
2521 dtScores : list [float ]
26- gtIgnore : _NDArray
27- # gtIgnore: npt.NDArray[np.float64]
28- dtIgnore : _NDArray
29- # dtIgnore: npt.NDArray[np.float64]
22+ gtIgnore : _NDFloatArray
23+ dtIgnore : _NDFloatArray
3024
3125class _EvaluationResult (TypedDict ):
3226 params : Params
3327 counts : list [int ]
3428 date : str
35- # precision: npt.NDArray[np.float64]
36- precision : _NDArray
37- # recall: npt.NDArray[np.float64]
38- recall : _NDArray
39- # scores: npt.NDArray[np.float64]
40- scores : _NDArray
29+ precision : _NDFloatArray
30+ recall : _NDFloatArray
31+ scores : _NDFloatArray
4132
4233class COCOeval :
4334 cocoGt : COCO
4435 cocoDt : COCO
4536 evalImgs : list [_ImageEvaluationResult ]
4637 eval : _EvaluationResult
4738 params : Params
48- stats : _NDArray
49- # stats: npt.NDArray[np.float64]
39+ stats : _NDFloatArray
5040 ious : dict [tuple [int , int ], list [float ]]
5141 def __init__ (self , cocoGt : COCO | None = None , cocoDt : COCO | None = None , iouType : _TIOU = "segm" ) -> None : ...
5242 def evaluate (self ) -> None : ...
5343 def computeIoU (self , imgId : int , catId : int ) -> list [float ]: ...
54- def computeOks (self , imgId : int , catId : int ) -> _NDArray : ...
55- # def computeOks(self, imgId: int, catId: int) -> npt.NDArray[np.float64]: ...
44+ def computeOks (self , imgId : int , catId : int ) -> _NDFloatArray : ...
5645 def evaluateImg (self , imgId : int , catId : int , aRng : list [int ], maxDet : int ) -> _ImageEvaluationResult : ...
5746 def accumulate (self , p : Params | None = None ) -> None : ...
5847 def summarize (self ) -> None : ...
5948
6049class Params :
6150 imgIds : list [int ]
6251 catIds : list [int ]
63- iouThrs : _NDArray
64- # iouThrs: npt.NDArray[np.float64]
65- recThrs : _NDArray
66- # recThrs: npt.NDArray[np.float64]
52+ iouThrs : _NDFloatArray
53+ recThrs : _NDFloatArray
6754 maxDets : list [int ]
6855 areaRng : list [list [float ]]
6956 areaRngLbl : list [str ]
7057 useCats : int
71- kpt_oks_sigmas : _NDArray
72- # kpt_oks_sigmas: npt.NDArray[np.float64]
58+ kpt_oks_sigmas : _NDFloatArray
7359 iouType : _TIOU
7460 useSegm : int | None
7561 def __init__ (self , iouType : _TIOU = "segm" ) -> None : ...
0 commit comments