__init__.pyi 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. __all__: list[str] = []
  2. import cv2
  3. import cv2.typing
  4. import numpy
  5. import sys
  6. import typing as _typing
  7. if sys.version_info >= (3, 8):
  8. from typing import Protocol
  9. else:
  10. from typing_extensions import Protocol
  11. # Enumerations
  12. DNN_BACKEND_DEFAULT: int
  13. DNN_BACKEND_HALIDE: int
  14. DNN_BACKEND_INFERENCE_ENGINE: int
  15. DNN_BACKEND_OPENCV: int
  16. DNN_BACKEND_VKCOM: int
  17. DNN_BACKEND_CUDA: int
  18. DNN_BACKEND_WEBNN: int
  19. DNN_BACKEND_TIMVX: int
  20. DNN_BACKEND_CANN: int
  21. Backend = int
  22. """One of [DNN_BACKEND_DEFAULT, DNN_BACKEND_HALIDE, DNN_BACKEND_INFERENCE_ENGINE, DNN_BACKEND_OPENCV, DNN_BACKEND_VKCOM, DNN_BACKEND_CUDA, DNN_BACKEND_WEBNN, DNN_BACKEND_TIMVX, DNN_BACKEND_CANN]"""
  23. DNN_TARGET_CPU: int
  24. DNN_TARGET_OPENCL: int
  25. DNN_TARGET_OPENCL_FP16: int
  26. DNN_TARGET_MYRIAD: int
  27. DNN_TARGET_VULKAN: int
  28. DNN_TARGET_FPGA: int
  29. DNN_TARGET_CUDA: int
  30. DNN_TARGET_CUDA_FP16: int
  31. DNN_TARGET_HDDL: int
  32. DNN_TARGET_NPU: int
  33. DNN_TARGET_CPU_FP16: int
  34. Target = int
  35. """One of [DNN_TARGET_CPU, DNN_TARGET_OPENCL, DNN_TARGET_OPENCL_FP16, DNN_TARGET_MYRIAD, DNN_TARGET_VULKAN, DNN_TARGET_FPGA, DNN_TARGET_CUDA, DNN_TARGET_CUDA_FP16, DNN_TARGET_HDDL, DNN_TARGET_NPU, DNN_TARGET_CPU_FP16]"""
  36. DNN_LAYOUT_UNKNOWN: int
  37. DNN_LAYOUT_ND: int
  38. DNN_LAYOUT_NCHW: int
  39. DNN_LAYOUT_NCDHW: int
  40. DNN_LAYOUT_NHWC: int
  41. DNN_LAYOUT_NDHWC: int
  42. DNN_LAYOUT_PLANAR: int
  43. DataLayout = int
  44. """One of [DNN_LAYOUT_UNKNOWN, DNN_LAYOUT_ND, DNN_LAYOUT_NCHW, DNN_LAYOUT_NCDHW, DNN_LAYOUT_NHWC, DNN_LAYOUT_NDHWC, DNN_LAYOUT_PLANAR]"""
  45. DNN_PMODE_NULL: int
  46. DNN_PMODE_CROP_CENTER: int
  47. DNN_PMODE_LETTERBOX: int
  48. ImagePaddingMode = int
  49. """One of [DNN_PMODE_NULL, DNN_PMODE_CROP_CENTER, DNN_PMODE_LETTERBOX]"""
  50. SoftNMSMethod_SOFTNMS_LINEAR: int
  51. SOFT_NMSMETHOD_SOFTNMS_LINEAR: int
  52. SoftNMSMethod_SOFTNMS_GAUSSIAN: int
  53. SOFT_NMSMETHOD_SOFTNMS_GAUSSIAN: int
  54. SoftNMSMethod = int
  55. """One of [SoftNMSMethod_SOFTNMS_LINEAR, SOFT_NMSMETHOD_SOFTNMS_LINEAR, SoftNMSMethod_SOFTNMS_GAUSSIAN, SOFT_NMSMETHOD_SOFTNMS_GAUSSIAN]"""
  56. # Classes
  57. class DictValue:
  58. # Functions
  59. @_typing.overload
  60. def __init__(self, i: int) -> None: ...
  61. @_typing.overload
  62. def __init__(self, p: float) -> None: ...
  63. @_typing.overload
  64. def __init__(self, s: str) -> None: ...
  65. def isInt(self) -> bool: ...
  66. def isString(self) -> bool: ...
  67. def isReal(self) -> bool: ...
  68. def getIntValue(self, idx: int = ...) -> int: ...
  69. def getRealValue(self, idx: int = ...) -> float: ...
  70. def getStringValue(self, idx: int = ...) -> str: ...
  71. class Layer(cv2.Algorithm):
  72. blobs: _typing.Sequence[cv2.typing.MatLike]
  73. @property
  74. def name(self) -> str: ...
  75. @property
  76. def type(self) -> str: ...
  77. @property
  78. def preferableTarget(self) -> int: ...
  79. # Functions
  80. @_typing.overload
  81. def finalize(self, inputs: _typing.Sequence[cv2.typing.MatLike], outputs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  82. @_typing.overload
  83. def finalize(self, inputs: _typing.Sequence[cv2.UMat], outputs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  84. def run(self, inputs: _typing.Sequence[cv2.typing.MatLike], internals: _typing.Sequence[cv2.typing.MatLike], outputs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], _typing.Sequence[cv2.typing.MatLike]]: ...
  85. def outputNameToIndex(self, outputName: str) -> int: ...
  86. class Net:
  87. # Functions
  88. def __init__(self) -> None: ...
  89. @classmethod
  90. @_typing.overload
  91. def readFromModelOptimizer(cls, xml: str, bin: str) -> Net: ...
  92. @classmethod
  93. @_typing.overload
  94. def readFromModelOptimizer(cls, bufferModelConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferWeights: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  95. def empty(self) -> bool: ...
  96. def dump(self) -> str: ...
  97. def dumpToFile(self, path: str) -> None: ...
  98. def dumpToPbtxt(self, path: str) -> None: ...
  99. def addLayer(self, name: str, type: str, dtype: int, params: cv2.typing.LayerParams) -> int: ...
  100. def addLayerToPrev(self, name: str, type: str, dtype: int, params: cv2.typing.LayerParams) -> int: ...
  101. def getLayerId(self, layer: str) -> int: ...
  102. def getLayerNames(self) -> _typing.Sequence[str]: ...
  103. @_typing.overload
  104. def getLayer(self, layerId: int) -> Layer: ...
  105. @_typing.overload
  106. def getLayer(self, layerName: str) -> Layer: ...
  107. @_typing.overload
  108. def getLayer(self, layerId: cv2.typing.LayerId) -> Layer: ...
  109. def connect(self, outPin: str, inpPin: str) -> None: ...
  110. def registerOutput(self, outputName: str, layerId: int, outputPort: int) -> int: ...
  111. def setInputsNames(self, inputBlobNames: _typing.Sequence[str]) -> None: ...
  112. def setInputShape(self, inputName: str, shape: cv2.typing.MatShape) -> None: ...
  113. @_typing.overload
  114. def forward(self, outputName: str = ...) -> cv2.typing.MatLike: ...
  115. @_typing.overload
  116. def forward(self, outputBlobs: _typing.Sequence[cv2.typing.MatLike] | None = ..., outputName: str = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  117. @_typing.overload
  118. def forward(self, outputBlobs: _typing.Sequence[cv2.UMat] | None = ..., outputName: str = ...) -> _typing.Sequence[cv2.UMat]: ...
  119. @_typing.overload
  120. def forward(self, outBlobNames: _typing.Sequence[str], outputBlobs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  121. @_typing.overload
  122. def forward(self, outBlobNames: _typing.Sequence[str], outputBlobs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  123. def forwardAsync(self, outputName: str = ...) -> cv2.AsyncArray: ...
  124. def forwardAndRetrieve(self, outBlobNames: _typing.Sequence[str]) -> _typing.Sequence[_typing.Sequence[cv2.typing.MatLike]]: ...
  125. @_typing.overload
  126. def quantize(self, calibData: _typing.Sequence[cv2.typing.MatLike], inputsDtype: int, outputsDtype: int, perChannel: bool = ...) -> Net: ...
  127. @_typing.overload
  128. def quantize(self, calibData: _typing.Sequence[cv2.UMat], inputsDtype: int, outputsDtype: int, perChannel: bool = ...) -> Net: ...
  129. def getInputDetails(self) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  130. def getOutputDetails(self) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  131. def setHalideScheduler(self, scheduler: str) -> None: ...
  132. def setPreferableBackend(self, backendId: int) -> None: ...
  133. def setPreferableTarget(self, targetId: int) -> None: ...
  134. @_typing.overload
  135. def setInput(self, blob: cv2.typing.MatLike, name: str = ..., scalefactor: float = ..., mean: cv2.typing.Scalar = ...) -> None: ...
  136. @_typing.overload
  137. def setInput(self, blob: cv2.UMat, name: str = ..., scalefactor: float = ..., mean: cv2.typing.Scalar = ...) -> None: ...
  138. @_typing.overload
  139. def setParam(self, layer: int, numParam: int, blob: cv2.typing.MatLike) -> None: ...
  140. @_typing.overload
  141. def setParam(self, layerName: str, numParam: int, blob: cv2.typing.MatLike) -> None: ...
  142. @_typing.overload
  143. def getParam(self, layer: int, numParam: int = ...) -> cv2.typing.MatLike: ...
  144. @_typing.overload
  145. def getParam(self, layerName: str, numParam: int = ...) -> cv2.typing.MatLike: ...
  146. def getUnconnectedOutLayers(self) -> _typing.Sequence[int]: ...
  147. def getUnconnectedOutLayersNames(self) -> _typing.Sequence[str]: ...
  148. @_typing.overload
  149. def getLayersShapes(self, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> tuple[_typing.Sequence[int], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]]]: ...
  150. @_typing.overload
  151. def getLayersShapes(self, netInputShape: cv2.typing.MatShape) -> tuple[_typing.Sequence[int], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]]]: ...
  152. @_typing.overload
  153. def getFLOPS(self, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> int: ...
  154. @_typing.overload
  155. def getFLOPS(self, netInputShape: cv2.typing.MatShape) -> int: ...
  156. @_typing.overload
  157. def getFLOPS(self, layerId: int, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> int: ...
  158. @_typing.overload
  159. def getFLOPS(self, layerId: int, netInputShape: cv2.typing.MatShape) -> int: ...
  160. def getLayerTypes(self) -> _typing.Sequence[str]: ...
  161. def getLayersCount(self, layerType: str) -> int: ...
  162. @_typing.overload
  163. def getMemoryConsumption(self, netInputShape: cv2.typing.MatShape) -> tuple[int, int]: ...
  164. @_typing.overload
  165. def getMemoryConsumption(self, layerId: int, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> tuple[int, int]: ...
  166. @_typing.overload
  167. def getMemoryConsumption(self, layerId: int, netInputShape: cv2.typing.MatShape) -> tuple[int, int]: ...
  168. def enableFusion(self, fusion: bool) -> None: ...
  169. def enableWinograd(self, useWinograd: bool) -> None: ...
  170. def getPerfProfile(self) -> tuple[int, _typing.Sequence[float]]: ...
  171. class Image2BlobParams:
  172. scalefactor: cv2.typing.Scalar
  173. size: cv2.typing.Size
  174. mean: cv2.typing.Scalar
  175. swapRB: bool
  176. ddepth: int
  177. datalayout: DataLayout
  178. paddingmode: ImagePaddingMode
  179. borderValue: cv2.typing.Scalar
  180. # Functions
  181. @_typing.overload
  182. def __init__(self) -> None: ...
  183. @_typing.overload
  184. def __init__(self, scalefactor: cv2.typing.Scalar, size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., ddepth: int = ..., datalayout: DataLayout = ..., mode: ImagePaddingMode = ..., borderValue: cv2.typing.Scalar = ...) -> None: ...
  185. def blobRectToImageRect(self, rBlob: cv2.typing.Rect, size: cv2.typing.Size) -> cv2.typing.Rect: ...
  186. def blobRectsToImageRects(self, rBlob: _typing.Sequence[cv2.typing.Rect], size: cv2.typing.Size) -> _typing.Sequence[cv2.typing.Rect]: ...
  187. class Model:
  188. # Functions
  189. @_typing.overload
  190. def __init__(self, model: str, config: str = ...) -> None: ...
  191. @_typing.overload
  192. def __init__(self, network: Net) -> None: ...
  193. @_typing.overload
  194. def setInputSize(self, size: cv2.typing.Size) -> Model: ...
  195. @_typing.overload
  196. def setInputSize(self, width: int, height: int) -> Model: ...
  197. def setInputMean(self, mean: cv2.typing.Scalar) -> Model: ...
  198. def setInputScale(self, scale: cv2.typing.Scalar) -> Model: ...
  199. def setInputCrop(self, crop: bool) -> Model: ...
  200. def setInputSwapRB(self, swapRB: bool) -> Model: ...
  201. def setOutputNames(self, outNames: _typing.Sequence[str]) -> Model: ...
  202. def setInputParams(self, scale: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ...) -> None: ...
  203. @_typing.overload
  204. def predict(self, frame: cv2.typing.MatLike, outs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  205. @_typing.overload
  206. def predict(self, frame: cv2.UMat, outs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  207. def setPreferableBackend(self, backendId: Backend) -> Model: ...
  208. def setPreferableTarget(self, targetId: Target) -> Model: ...
  209. def enableWinograd(self, useWinograd: bool) -> Model: ...
  210. class ClassificationModel(Model):
  211. # Functions
  212. @_typing.overload
  213. def __init__(self, model: str, config: str = ...) -> None: ...
  214. @_typing.overload
  215. def __init__(self, network: Net) -> None: ...
  216. def setEnableSoftmaxPostProcessing(self, enable: bool) -> ClassificationModel: ...
  217. def getEnableSoftmaxPostProcessing(self) -> bool: ...
  218. @_typing.overload
  219. def classify(self, frame: cv2.typing.MatLike) -> tuple[int, float]: ...
  220. @_typing.overload
  221. def classify(self, frame: cv2.UMat) -> tuple[int, float]: ...
  222. class KeypointsModel(Model):
  223. # Functions
  224. @_typing.overload
  225. def __init__(self, model: str, config: str = ...) -> None: ...
  226. @_typing.overload
  227. def __init__(self, network: Net) -> None: ...
  228. @_typing.overload
  229. def estimate(self, frame: cv2.typing.MatLike, thresh: float = ...) -> _typing.Sequence[cv2.typing.Point2f]: ...
  230. @_typing.overload
  231. def estimate(self, frame: cv2.UMat, thresh: float = ...) -> _typing.Sequence[cv2.typing.Point2f]: ...
  232. class SegmentationModel(Model):
  233. # Functions
  234. @_typing.overload
  235. def __init__(self, model: str, config: str = ...) -> None: ...
  236. @_typing.overload
  237. def __init__(self, network: Net) -> None: ...
  238. @_typing.overload
  239. def segment(self, frame: cv2.typing.MatLike, mask: cv2.typing.MatLike | None = ...) -> cv2.typing.MatLike: ...
  240. @_typing.overload
  241. def segment(self, frame: cv2.UMat, mask: cv2.UMat | None = ...) -> cv2.UMat: ...
  242. class DetectionModel(Model):
  243. # Functions
  244. @_typing.overload
  245. def __init__(self, model: str, config: str = ...) -> None: ...
  246. @_typing.overload
  247. def __init__(self, network: Net) -> None: ...
  248. def setNmsAcrossClasses(self, value: bool) -> DetectionModel: ...
  249. def getNmsAcrossClasses(self) -> bool: ...
  250. @_typing.overload
  251. def detect(self, frame: cv2.typing.MatLike, confThreshold: float = ..., nmsThreshold: float = ...) -> tuple[_typing.Sequence[int], _typing.Sequence[float], _typing.Sequence[cv2.typing.Rect]]: ...
  252. @_typing.overload
  253. def detect(self, frame: cv2.UMat, confThreshold: float = ..., nmsThreshold: float = ...) -> tuple[_typing.Sequence[int], _typing.Sequence[float], _typing.Sequence[cv2.typing.Rect]]: ...
  254. class TextRecognitionModel(Model):
  255. # Functions
  256. @_typing.overload
  257. def __init__(self, network: Net) -> None: ...
  258. @_typing.overload
  259. def __init__(self, model: str, config: str = ...) -> None: ...
  260. def setDecodeType(self, decodeType: str) -> TextRecognitionModel: ...
  261. def getDecodeType(self) -> str: ...
  262. def setDecodeOptsCTCPrefixBeamSearch(self, beamSize: int, vocPruneSize: int = ...) -> TextRecognitionModel: ...
  263. def setVocabulary(self, vocabulary: _typing.Sequence[str]) -> TextRecognitionModel: ...
  264. def getVocabulary(self) -> _typing.Sequence[str]: ...
  265. @_typing.overload
  266. def recognize(self, frame: cv2.typing.MatLike) -> str: ...
  267. @_typing.overload
  268. def recognize(self, frame: cv2.UMat) -> str: ...
  269. @_typing.overload
  270. def recognize(self, frame: cv2.typing.MatLike, roiRects: _typing.Sequence[cv2.typing.MatLike]) -> _typing.Sequence[str]: ...
  271. @_typing.overload
  272. def recognize(self, frame: cv2.UMat, roiRects: _typing.Sequence[cv2.UMat]) -> _typing.Sequence[str]: ...
  273. class TextDetectionModel(Model):
  274. # Functions
  275. @_typing.overload
  276. def detect(self, frame: cv2.typing.MatLike) -> tuple[_typing.Sequence[_typing.Sequence[cv2.typing.Point]], _typing.Sequence[float]]: ...
  277. @_typing.overload
  278. def detect(self, frame: cv2.UMat) -> tuple[_typing.Sequence[_typing.Sequence[cv2.typing.Point]], _typing.Sequence[float]]: ...
  279. @_typing.overload
  280. def detect(self, frame: cv2.typing.MatLike) -> _typing.Sequence[_typing.Sequence[cv2.typing.Point]]: ...
  281. @_typing.overload
  282. def detect(self, frame: cv2.UMat) -> _typing.Sequence[_typing.Sequence[cv2.typing.Point]]: ...
  283. @_typing.overload
  284. def detectTextRectangles(self, frame: cv2.typing.MatLike) -> tuple[_typing.Sequence[cv2.typing.RotatedRect], _typing.Sequence[float]]: ...
  285. @_typing.overload
  286. def detectTextRectangles(self, frame: cv2.UMat) -> tuple[_typing.Sequence[cv2.typing.RotatedRect], _typing.Sequence[float]]: ...
  287. @_typing.overload
  288. def detectTextRectangles(self, frame: cv2.typing.MatLike) -> _typing.Sequence[cv2.typing.RotatedRect]: ...
  289. @_typing.overload
  290. def detectTextRectangles(self, frame: cv2.UMat) -> _typing.Sequence[cv2.typing.RotatedRect]: ...
  291. class TextDetectionModel_EAST(TextDetectionModel):
  292. # Functions
  293. @_typing.overload
  294. def __init__(self, network: Net) -> None: ...
  295. @_typing.overload
  296. def __init__(self, model: str, config: str = ...) -> None: ...
  297. def setConfidenceThreshold(self, confThreshold: float) -> TextDetectionModel_EAST: ...
  298. def getConfidenceThreshold(self) -> float: ...
  299. def setNMSThreshold(self, nmsThreshold: float) -> TextDetectionModel_EAST: ...
  300. def getNMSThreshold(self) -> float: ...
  301. class TextDetectionModel_DB(TextDetectionModel):
  302. # Functions
  303. @_typing.overload
  304. def __init__(self, network: Net) -> None: ...
  305. @_typing.overload
  306. def __init__(self, model: str, config: str = ...) -> None: ...
  307. def setBinaryThreshold(self, binaryThreshold: float) -> TextDetectionModel_DB: ...
  308. def getBinaryThreshold(self) -> float: ...
  309. def setPolygonThreshold(self, polygonThreshold: float) -> TextDetectionModel_DB: ...
  310. def getPolygonThreshold(self) -> float: ...
  311. def setUnclipRatio(self, unclipRatio: float) -> TextDetectionModel_DB: ...
  312. def getUnclipRatio(self) -> float: ...
  313. def setMaxCandidates(self, maxCandidates: int) -> TextDetectionModel_DB: ...
  314. def getMaxCandidates(self) -> int: ...
  315. class LayerProtocol(Protocol):
  316. # Functions
  317. def __init__(self, params: dict[str, DictValue], blobs: _typing.Sequence[cv2.typing.MatLike]) -> None: ...
  318. def getMemoryShapes(self, inputs: _typing.Sequence[_typing.Sequence[int]]) -> _typing.Sequence[_typing.Sequence[int]]: ...
  319. def forward(self, inputs: _typing.Sequence[cv2.typing.MatLike]) -> _typing.Sequence[cv2.typing.MatLike]: ...
  320. # Functions
  321. def NMSBoxes(bboxes: _typing.Sequence[cv2.typing.Rect2d], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  322. def NMSBoxesBatched(bboxes: _typing.Sequence[cv2.typing.Rect2d], scores: _typing.Sequence[float], class_ids: _typing.Sequence[int], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  323. def NMSBoxesRotated(bboxes: _typing.Sequence[cv2.typing.RotatedRect], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  324. @_typing.overload
  325. def blobFromImage(image: cv2.typing.MatLike, scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  326. @_typing.overload
  327. def blobFromImage(image: cv2.UMat, scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  328. @_typing.overload
  329. def blobFromImageWithParams(image: cv2.typing.MatLike, param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  330. @_typing.overload
  331. def blobFromImageWithParams(image: cv2.UMat, param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  332. @_typing.overload
  333. def blobFromImageWithParams(image: cv2.typing.MatLike, blob: cv2.typing.MatLike | None = ..., param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  334. @_typing.overload
  335. def blobFromImageWithParams(image: cv2.UMat, blob: cv2.UMat | None = ..., param: Image2BlobParams = ...) -> cv2.UMat: ...
  336. @_typing.overload
  337. def blobFromImages(images: _typing.Sequence[cv2.typing.MatLike], scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  338. @_typing.overload
  339. def blobFromImages(images: _typing.Sequence[cv2.UMat], scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  340. @_typing.overload
  341. def blobFromImagesWithParams(images: _typing.Sequence[cv2.typing.MatLike], param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  342. @_typing.overload
  343. def blobFromImagesWithParams(images: _typing.Sequence[cv2.UMat], param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  344. @_typing.overload
  345. def blobFromImagesWithParams(images: _typing.Sequence[cv2.typing.MatLike], blob: cv2.typing.MatLike | None = ..., param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  346. @_typing.overload
  347. def blobFromImagesWithParams(images: _typing.Sequence[cv2.UMat], blob: cv2.UMat | None = ..., param: Image2BlobParams = ...) -> cv2.UMat: ...
  348. def getAvailableTargets(be: Backend) -> _typing.Sequence[Target]: ...
  349. @_typing.overload
  350. def imagesFromBlob(blob_: cv2.typing.MatLike, images_: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  351. @_typing.overload
  352. def imagesFromBlob(blob_: cv2.typing.MatLike, images_: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  353. @_typing.overload
  354. def readNet(model: str, config: str = ..., framework: str = ...) -> Net: ...
  355. @_typing.overload
  356. def readNet(framework: str, bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  357. @_typing.overload
  358. def readNetFromCaffe(prototxt: str, caffeModel: str = ...) -> Net: ...
  359. @_typing.overload
  360. def readNetFromCaffe(bufferProto: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  361. @_typing.overload
  362. def readNetFromDarknet(cfgFile: str, darknetModel: str = ...) -> Net: ...
  363. @_typing.overload
  364. def readNetFromDarknet(bufferCfg: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  365. @_typing.overload
  366. def readNetFromModelOptimizer(xml: str, bin: str = ...) -> Net: ...
  367. @_typing.overload
  368. def readNetFromModelOptimizer(bufferModelConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferWeights: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  369. @_typing.overload
  370. def readNetFromONNX(onnxFile: str) -> Net: ...
  371. @_typing.overload
  372. def readNetFromONNX(buffer: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  373. @_typing.overload
  374. def readNetFromTFLite(model: str) -> Net: ...
  375. @_typing.overload
  376. def readNetFromTFLite(bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  377. @_typing.overload
  378. def readNetFromTensorflow(model: str, config: str = ...) -> Net: ...
  379. @_typing.overload
  380. def readNetFromTensorflow(bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  381. def readNetFromTorch(model: str, isBinary: bool = ..., evaluate: bool = ...) -> Net: ...
  382. def readTensorFromONNX(path: str) -> cv2.typing.MatLike: ...
  383. def readTorchBlob(filename: str, isBinary: bool = ...) -> cv2.typing.MatLike: ...
  384. def shrinkCaffeModel(src: str, dst: str, layersTypes: _typing.Sequence[str] = ...) -> None: ...
  385. def softNMSBoxes(bboxes: _typing.Sequence[cv2.typing.Rect], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, top_k: int = ..., sigma: float = ..., method: SoftNMSMethod = ...) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  386. def writeTextGraph(model: str, output: str) -> None: ...