data_juicer.ops.mapper.video_camera_calibration_moge_mapper module#

class data_juicer.ops.mapper.video_camera_calibration_moge_mapper.VideoCameraCalibrationMogeMapper(*args, **kwargs)[源代码]#

基类:Mapper

Compute the camera intrinsics and field of view (FOV) for a static camera using Moge-2 (more accurate than DeepCalib).

__init__(model_path: str = 'Ruicheng/moge-2-vitl', tag_field_name: str = 'camera_calibration_moge_tags', frame_field: str = 'video_frames', output_intrinsics: bool = True, output_hfov: bool = True, output_vfov: bool = True, output_points: bool = True, output_depth: bool = True, output_mask: bool = True, frame_batch_size: int = 8, save_dir: str = None, *args, **kwargs)[源代码]#

Initialization method.

参数:
  • model_path -- The path to the Moge-2 model.

  • tag_field_name -- The field name to store the tags. It's "camera_calibration_moge_tags" in default.

  • frame_field -- The field name where the video frames are stored.

  • output_intrinsics -- Determines whether to output camera intrinsics.

  • output_hfov -- Determines whether to output horizontal field of view.

  • output_vfov -- Determines whether to output vertical field of view.

  • output_points -- Determines whether to output point map in OpenCV camera coordinate system (x right, y down, z forward). For MoGe-2, the point map is in metric scale.

  • output_depth -- Determines whether to output depth maps.

  • output_mask -- Determines whether to output a binary mask for valid pixels.

  • frame_batch_size -- Number of frames to batch together for GPU inference. Larger values improve throughput but require more VRAM. Default: 8.

  • save_dir -- Directory to save large numpy arrays (depth, mask, points) as .npy files instead of storing them inline. When set, tag_dict stores file paths (strings) instead of numpy arrays, which avoids memory limit.

  • args -- extra args

  • kwargs -- extra args

process_single(sample=None, rank=None)[源代码]#

For sample level, sample --> sample

参数:

sample -- sample to process

返回:

processed sample