data_juicer.ops.mapper.video_camera_calibration_moge_mapper module#

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

Bases: 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)[source]#

Initialization method.

Parameters:
  • 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)[source]#

For sample level, sample โ€“> sample

Parameters:

sample โ€“ sample to process

Returns:

processed sample