nerfstudio icon indicating copy to clipboard operation
nerfstudio copied to clipboard

Colmap to Nerfstudio

Open frasiolas opened this issue 1 year ago • 6 comments

I extract cameras.bin and images.bin from colmap. I use from colmap_utils colmap_to_json to get the transforms.json file and then i run the ns train command. The problem is that the images are not in the same position and orientation that they are in the colmap GUI. Do you know why this is happening?

frasiolas avatar Jan 18 '24 07:01 frasiolas

This might be because of frame conventions, see https://docs.nerf.studio/quickstart/data_conventions.html You can also use ns-process-data directly to call colmap and have it generate the transforms for you

kerrj avatar Jan 18 '24 18:01 kerrj

You can try to set this variable to True https://github.com/nerfstudio-project/nerfstudio/blob/main/nerfstudio/process_data/colmap_utils.py#L394 or utilizing json["applied_transform"] in the transform.json

jb-ye avatar Jan 19 '24 05:01 jb-ye

I think i found it if you want to keep the same orientation you call colmap dataparser instead of nerfstudio dataparser in ns-train and put the arguments [--method none --center_method none]

frasiolas avatar Jan 19 '24 08:01 frasiolas

I think you need to call --orientation_method=none --center_method=none --assume_colmap_world_coordinate_convention=False in colmap parser after this change ( https://github.com/nerfstudio-project/nerfstudio/pull/2793 ). This is to keep the exactly same world coordinate as input colmap project up to a scale.

jb-ye avatar Jan 19 '24 11:01 jb-ye

I extract cameras.bin and images.bin from colmap. I use from colmap_utils colmap_to_json to get the transforms.json file and then i run the ns train command. The problem is that the images are not in the same position and orientation that they are in the colmap GUI. Do you know why this is happening?

May be you can try this file colmap2nerf.zip

Nas-Azzam avatar Feb 01 '24 04:02 Nas-Azzam

Each NeRF model's are has different form when processing image. So it's natural. I suggest you try using this.

https://github.com/NVlabs/instant-ngp/blob/master/scripts/colmap2nerf.py

than

python colmap2nerf.py

tersite1 avatar Apr 17 '24 12:04 tersite1

I think you need to call --orientation_method=none --center_method=none --assume_colmap_world_coordinate_convention=False in colmap parser after this change ( #2793 ). This is to keep the exactly same world coordinate as input colmap project up to a scale.

@jb-ye Thank you very much for your guidance. But when I follow like this ns-train splatfacto --data {data_dir} --viewer.quit-on-train-completion False --max-num-iterations 10000 --pipeline.model.sh-degree 0 colmap --colmap_path sparse/0 --downscale_factor=1 --orientation_method=none --center_method=none --assume_colmap_world_coordinate_convention=False --auto-scale-poses=False and after I run ns-export, I get a splat.py whose many vertices are NaN. I think it is weird since I have nice results in web viewer, could you give me some hints for debugging?

LuckyOne09 avatar May 26 '24 16:05 LuckyOne09

I think you need to call --orientation_method=none --center_method=none --assume_colmap_world_coordinate_convention=False in colmap parser after this change ( #2793 ). This is to keep the exactly same world coordinate as input colmap project up to a scale.

@jb-ye Thank you very much for your guidance. But when I follow like this ns-train splatfacto --data {data_dir} --viewer.quit-on-train-completion False --max-num-iterations 10000 --pipeline.model.sh-degree 0 colmap --colmap_path sparse/0 --downscale_factor=1 --orientation_method=none --center_method=none --assume_colmap_world_coordinate_convention=False --auto-scale-poses=False and after I run ns-export, I get a splat.py whose many vertices are NaN. I think it is weird since I have nice results in web viewer, could you give me some hints for debugging?

Update: I found that if I set sh-degree back to 3, all things will be fine. I don't know why but it just happens, maybe it is a potential bug

LuckyOne09 avatar May 26 '24 17:05 LuckyOne09