data_juicer.ops.mapper.video_camera_calibration_static_deepcalib_mapper module#

class data_juicer.ops.mapper.video_camera_calibration_static_deepcalib_mapper.VideoCameraCalibrationStaticDeepcalibMapper(*args, **kwargs)[source]#

Bases: Mapper

Compute the camera intrinsics and field of view (FOV) for a static camera using DeepCalib.

__init__(model_path: str = 'weights_10_0.02.h5', frame_num: Annotated[int, Gt(gt=0)] = 3, duration: float = 0, tag_field_name: str = 'static_camera_calibration_deepcalib_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', *args, **kwargs)[source]#

Initialization method.

Parameters:
  • model_path – The path to the DeepCalib Regression 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_deepcalib_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.

  • 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