data_juicer.ops.mapper.image_sam_3d_body_mapper module#

class data_juicer.ops.mapper.image_sam_3d_body_mapper.ImageSAM3DBodyMapper(checkpoint_path: str = '', detector_name: str = 'vitdet', segmentor_name: str = 'sam2', fov_name: str = 'moge2', mhr_path: str = '', detector_path: str = '', segmentor_path: str = '', fov_path: str = '', bbox_thresh: float = 0.8, use_mask: bool = False, visualization_dir: str = None, tag_field_name: str = 'sam_3d_body_data', *args, **kwargs)[source]#

Bases: Mapper

SAM 3D Body (3DB) is a promptable model for single-image full-body 3D human mesh recovery (HMR).

__init__(checkpoint_path: str = '', detector_name: str = 'vitdet', segmentor_name: str = 'sam2', fov_name: str = 'moge2', mhr_path: str = '', detector_path: str = '', segmentor_path: str = '', fov_path: str = '', bbox_thresh: float = 0.8, use_mask: bool = False, visualization_dir: str = None, tag_field_name: str = 'sam_3d_body_data', *args, **kwargs)[source]#

Initialization method.

Parameters:
  • checkpoint_path – Path to SAM 3D Body model checkpoint.

  • mhr_path – Path to MoHR/assets folder (or set SAM3D_mhr_path).

  • detector_path – Path to human detection model folder (or set SAM3D_DETECTOR_PATH).

  • segmentor_path – Path to human segmentation model folder (or set SAM3D_SEGMENTOR_PATH).

  • fov_path – Path to fov estimation model folder (or set SAM3D_FOV_PATH).

  • detector_name – Human detection model for demo (Default vitdet, add your favorite detector if needed).

  • segmentor_name – Human segmentation model for demo (Default sam2, add your favorite segmentor if needed).

  • fov_name – FOV estimation model for demo (Default moge2, add your favorite fov estimator if needed).

  • bbox_thresh – Bounding box detection threshold.

:param use_mask:Use mask-conditioned prediction (segmentation mask is automatically generated from bbox). :param visualization_dir: Directory to save visualization results. If None, no visualization will be saved. :param tag_field_name: Field name for storing the results.

process_single(sample=None, rank=None)[source]#

For sample level, sample –> sample

Parameters:

sample – sample to process

Returns:

processed sample