1
- from _typeshed import Incomplete
2
1
from typing import Literal , TypedDict
3
2
from typing_extensions import TypeAlias
4
3
5
- from .coco import COCO
4
+ import numpy as np
5
+ import numpy .typing as npt
6
6
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
10
8
11
- _NDArray : TypeAlias = Incomplete
9
+ _NDFloatArray : TypeAlias = npt . NDArray [ np . float64 ]
12
10
_TIOU : TypeAlias = Literal ["segm" , "bbox" , "keypoints" ]
13
11
14
12
class _ImageEvaluationResult (TypedDict ):
@@ -18,58 +16,46 @@ class _ImageEvaluationResult(TypedDict):
18
16
maxDet : int
19
17
dtIds : list [int ]
20
18
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
25
21
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
30
24
31
25
class _EvaluationResult (TypedDict ):
32
26
params : Params
33
27
counts : list [int ]
34
28
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
41
32
42
33
class COCOeval :
43
34
cocoGt : COCO
44
35
cocoDt : COCO
45
36
evalImgs : list [_ImageEvaluationResult ]
46
37
eval : _EvaluationResult
47
38
params : Params
48
- stats : _NDArray
49
- # stats: npt.NDArray[np.float64]
39
+ stats : _NDFloatArray
50
40
ious : dict [tuple [int , int ], list [float ]]
51
41
def __init__ (self , cocoGt : COCO | None = None , cocoDt : COCO | None = None , iouType : _TIOU = "segm" ) -> None : ...
52
42
def evaluate (self ) -> None : ...
53
43
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 : ...
56
45
def evaluateImg (self , imgId : int , catId : int , aRng : list [int ], maxDet : int ) -> _ImageEvaluationResult : ...
57
46
def accumulate (self , p : Params | None = None ) -> None : ...
58
47
def summarize (self ) -> None : ...
59
48
60
49
class Params :
61
50
imgIds : list [int ]
62
51
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
67
54
maxDets : list [int ]
68
55
areaRng : list [list [float ]]
69
56
areaRngLbl : list [str ]
70
57
useCats : int
71
- kpt_oks_sigmas : _NDArray
72
- # kpt_oks_sigmas: npt.NDArray[np.float64]
58
+ kpt_oks_sigmas : _NDFloatArray
73
59
iouType : _TIOU
74
60
useSegm : int | None
75
61
def __init__ (self , iouType : _TIOU = "segm" ) -> None : ...
0 commit comments