Process input and estimate 2D keypoints. Args: inputs (Union[str, np.ndarray, List[np.ndarray]]): Input can be file path, single image array, or list of image arrays **kwargs: Additional arguments for processing Returns:
(self, inputs: Union[str, np.ndarray, List[np.ndarray]], return_image: bool = False, **kwargs)
| 384 | return images |
| 385 | |
| 386 | def __call__(self, inputs: Union[str, np.ndarray, List[np.ndarray]], return_image: bool = False, **kwargs): |
| 387 | """ |
| 388 | Process input and estimate 2D keypoints. |
| 389 | |
| 390 | Args: |
| 391 | inputs (Union[str, np.ndarray, List[np.ndarray]]): Input can be file path, |
| 392 | single image array, or list of image arrays |
| 393 | **kwargs: Additional arguments for processing |
| 394 | |
| 395 | Returns: |
| 396 | np.ndarray: Array of detected 2D keypoints for all input images |
| 397 | """ |
| 398 | images = self.load_images(inputs) |
| 399 | H, W = images[0].shape[:2] |
| 400 | if self.detector is not None: |
| 401 | bboxes = [] |
| 402 | for _image in images: |
| 403 | img, shape = self.detector.preprocess(_image) |
| 404 | bboxes.append(self.detector(img[None], shape[None])[0][0]["bbox"]) |
| 405 | else: |
| 406 | bboxes = [None] * len(images) |
| 407 | |
| 408 | kp2ds = [] |
| 409 | for _image, _bbox in zip(images, bboxes): |
| 410 | img, center, scale = self.model.preprocess(_image, _bbox) |
| 411 | kp2ds.append(self.model(img[None], center[None], scale[None])) |
| 412 | kp2ds = np.concatenate(kp2ds, 0) |
| 413 | metas = load_pose_metas_from_kp2ds_seq(kp2ds, width=W, height=H) |
| 414 | return metas |
nothing calls this directly
no test coverage detected