deeplabcut.pose_estimation_pytorch.modelzoo.fmpose_3d.fmpose3d
DeepLabCut2.0-3.0 Toolbox (deeplabcut.org) © A. & M. Mathis Labs https://github.com/DeepLabCut/DeepLabCut Please see AUTHORS for contributors. https://github.com/DeepLabCut/DeepLabCut/blob/main/AUTHORS Licensed under GNU Lesser General Public License v3.0
Classes:
| Name | Description |
|---|---|
FMPose3DModelMetadata |
Metadata for an FMPose3D model variant. |
Functions:
| Name | Description |
|---|---|
get_fmpose3d_inference_api |
Get a FMPose3DInference API for a given model type and snapshot path. |
FMPose3DModelMetadata
dataclass
Metadata for an FMPose3D model variant.
Methods:
| Name | Description |
|---|---|
build_model_cfg |
Build a DLC-compatible model_cfg dict for create_df_from_prediction. |
Source code in deeplabcut/pose_estimation_pytorch/modelzoo/fmpose_3d/fmpose3d.py
build_model_cfg
Build a DLC-compatible model_cfg dict for create_df_from_prediction.
Source code in deeplabcut/pose_estimation_pytorch/modelzoo/fmpose_3d/fmpose3d.py
get_fmpose3d_inference_api
get_fmpose3d_inference_api(
model_type: SupportedModel = "fmpose3d_humans",
snapshot_path: str | None = None,
device: str | None = None,
config_kwargs: dict = None,
) -> FMPose3DInference
Get a FMPose3DInference API for a given model type and snapshot path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
SupportedModel
|
one of the supported model types: "fmpose3d_humans", "fmpose3d_animals", |
'fmpose3d_humans'
|
|
str | None
|
The path to the snapshot file. If None, FMPose3D will download the default snapshot. |
None
|
|
str | None
|
The device to use. If None, the device will be inferred from the environment. |
None
|
|
dict
|
Additional keyword arguments to pass to the FMPose3DConfig. |
None
|
Returns: FMPose3DInference: An FMPose3DInference API runner.
Example Usages
# Initialize the API (downloads the default weights automatically from huggingface)
fmpose = get_fmpose3d_inference_api(
model_type="fmpose3d_animals",
device="cuda:0",
)
# Run inference on an image
predictions_3d = fmpose.predict(source="path/to/image.jpg") # or (H, W, 3) numpy array
# Lift 2d predictions to 3d
keypoints_2d = np.random.rand(num_frames, num_joints, 2)
predictions_3d = fmpose.pose_3d(keypoints_2d=keypoints_2d)