data_juicer.ops.mapper.video_camera_calibration_static_moge_mapper module#

class data_juicer.ops.mapper.video_camera_calibration_static_moge_mapper.VideoCameraCalibrationStaticMogeMapper(*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', frame_num: Annotated[int, Gt(gt=0)] = 3, duration: float = 0, tag_field_name: str = 'static_camera_calibration_moge_tags', frame_dir: str = '/home/runner/.cache/data_juicer/assets', if_output_info: bool = True, output_info_dir: str = '/home/runner/.cache/data_juicer/assets', if_output_points_info: bool = True, if_output_depth_info: bool = True, if_output_mask_info: bool = True, *args, **kwargs)[source]#

Initialization method.

Parameters:
  • model_path – The path to the Moge-2 model.

  • frame_num – The number of frames to be extracted uniformly from the video. If it’s 1, only the middle frame will be extracted. If it’s 2, only the first and the last frames will be extracted. If it’s larger than 2, in addition to the first and the last frames, other frames will be extracted uniformly within the video duration. If “duration” > 0, frame_num is the number of frames per segment.

  • duration – The duration of each segment in seconds. If 0, frames are extracted from the entire video. If duration > 0, the video is segmented into multiple segments based on duration, and frames are extracted from each segment.

  • tag_field_name – The field name to store the tags. It’s “static_camera_calibration_moge_tags” in default.

  • frame_dir – Output directory to save extracted frames.

  • if_output_info – Whether to save the camera parameters results to an JSON file.

  • output_info_dir – Output directory for saving camera parameters.

  • if_output_points_info – 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.

  • if_output_depth_info – Determines whether to output depth maps.

  • if_output_mask_info – Determines whether to output a binary mask for valid pixels.

  • 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