ubc-vision/COTR

[Request for help] How to setup the prepare_nn_distance_mat.py ... --scene, --seq ?

Closed this issue · 1 comments

Hi! Firstly, thank you very much for releasing the code, and thank you very much for producing this research works. I enjoy reading your paper. It is awesome!
Here, I would like to try to train COTR.
So far I have tried to follow the steps in https://github.com/ubc-vision/COTR/blob/master/prepare_data.md...
From those steps, I have successfully generated rectify.sh, megadepth_test.json, megadepth_train.json, megadepth_val.json, and megadepth_valid_list.json...

However, at the last step, that is, to generate the distance matrix...

  • I am stuck on how to provide the input for --scene, --seq which are the required input parameters...

  • The reason for my confusion is that I am not sure how many and which scenes and sequences are needed for training COTR ?

In other words, how should I run python3 prepare_nn_distance_mat.py such that it will prepare the data for training COTR?

Hi! Thanks for your interest in our work!
Here is a dummy run from my side:

python prepare_nn_distance_mat.py --scene=0001 --seq=0
---------------------- OPTIONS ----------------------

                    cells  10000
                  confirm  True
                 crop_cam  no_crop
             dataset_name  megadepth
               info_level  rgbd
                 num_cpus  6
                  out_dir  /home/jiangwei/dataset/megadepth/MegaDepth_v1/phoenix/S6/zl548/MegaDepth_v1/0001/dense0/dist_mat
                 out_path  /home/jiangwei/dataset/megadepth/MegaDepth_v1/phoenix/S6/zl548/MegaDepth_v1/0001/dense0/dist_mat/dist_mat.npy
                    scene  0001
         scenes_name_list  [{'scene_dir': '/home/jiangwei/dataset/megadepth/MegaDepth_v1_SfM/0001/sparse/manhattan/0_rectified/sparse', 'image_dir': '/home/jiangwei/dataset/megadepth/MegaDepth_v1/phoenix/S6/zl548/MegaDepth_v1/0001/dense0/imgs', 'depth_dir': '/home/jiangwei/dataset/megadepth/MegaDepth_v1/phoenix/S6/zl548/MegaDepth_v1/0001/dense0/depths'}]
                      seq  0
                   use_cc  False
                 use_cuda  True
                  use_ram  False

----------------------------------------------------
OK to continue? [y/n] y
'NoneType' object cannot be interpreted as an integer
first time start working
reading cameras: 100%|█████████████████████████████████████████████████████████████████████████| 3409/3409 [00:00<00:00, 122429.19it/s]
reading images meta: 100%|███████████████████████████████████████████████████████████████████████| 3409/3409 [00:00<00:00, 3442.22it/s]
reading point cloud: 100%|█████████████████████████████████████████████████████████████████| 134678/134678 [00:01<00:00, 105808.42it/s]
calculating distance matrix:   4%|██▌                                                              | 390/10000 [00:34<13:42, 11.68it/s]

One thing to notice is that this script is designed for ComputeCanada, therefore we need to cut a large job into multiple small jobs, each small job will compute cells number of pairs for the distance matrix. You can set cells to a huge value if you want to finish the distance matrix in one run.
Before you start the job, please modify dataset_config.json, so the script can find the dataset.
Inside the megadepth dataset, we call each 4 digits folder a scene, for example, 0007, and inside each scene folder, there may be multiple reconstructions that COLMAP couldn't register into one single model, for example, the inside and outside of a church, we call these sub-models as seq, like 0, 1.
Just fixed a dependency bug in the code