facebookresearch / consistent_depth

We estimate dense, flicker-free, geometrically consistent depth from monocular video, for example hand-held cell phone video.
MIT License
1.61k stars 236 forks source link

AssertionError during custom run with changed camera model #33

Closed mattbev closed 3 years ago

mattbev commented 3 years ago

During the Image Undistortion step of the process, I get the following error when attempting to use the simple pinhole camera model and the same camera parameters used in the demo:

Traceback (most recent call last):
  File "main.py", line 13, in <module>
    dp.process(params)
  File "<path to>/consistent_depth/process.py", line 117, in process
    return self.pipeline(params)
  File "<path to>/consistent_depth/process.py", line 62, in pipeline
    valid_frames = calibrate_scale(self.video, self.out_dir, frame_range, params)
  File "<path to>/consistent_depth/scale_calibration.py", line 184, in calibrate_scale
    video.path, colmap.sparse_dir(colmap_dir, 0)
  File "<path to>/consistent_depth/scale_calibration.py", line 79, in make_camera_params_from_colmap
    cameras, images, size_new
  File "<path to>/consistent_depth/utils/load_colmap.py", line 175, in convert_calibration
    intrinsics = cameras_to_intrinsics(cameras, sorted_cam_ids, size_new)
  File "<path to>/consistent_depth/utils/load_colmap.py", line 116, in cameras_to_intrinsics
    for c in cameras.values()))
AssertionError

All the line throwing the error is checking is if the model is:

assert all(
    (c.model == "SIMPLE_PINHOLE" or c.model == "PINHOLE"
        or c.model == "SIMPLE_RADIAL"
     for c in cameras.values()))

which it seems like I am complying to? my full command is sudo python3 main.py --video_file <path_to_avi> --path <path_to_results> --camera_model "SIMPLE_PINHOLE" --camera_params "1671.770118, 540, 960" --make_video where the video being used in my command is not the same video as the one in the demo. Am I missing something? I know the camera params are probably off for my use case, but I imagine it should run to completion regardless?

mattbev commented 3 years ago

turned out to be my mistake: an earlier checkpoint using an incorrect camera model (in the same output directory) was causing issues with the new run. solution was clearing the output directory