-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Georeferenced datasets processed on Metashape are loaded incorrectly/can't be loaded using splatfacto. #3255
Comments
Just want to confirm a few @gaigc : Q1: if you unselect the GPS data in metashape alignment, would you experience the same issue by converting xml/ply to nerfstudio format? Q2: Since you have colmap project exported, you can directly train splatfacto using the colmap parser without converting them to nerfstudio format after all. |
R1: R2: For anyone who faces a similar issue, you just have to use the script to create the colmap files, and simply move the "sparse" folder it creates into a new folder called "colmap". So it goes like this: [Dataset]/ And then run it like this:
and for masks simply add --masks-path: Speculating on the possible problem I've realized that the Metashape script has a default option called "Use localframe" and I believe that this is why colmap works, but nerfstudio doesn't with the ply. Description of the option and screenshot of the window:
Since nerfstudio worked with the camera coordinates, I assumed that this was a problem with the way splatfacto worked, but I believe it might be something related to having the 3d points so far away from origin. Here is a table I made to test this out:
As you can see, localframe seems to be the main solution to the problem. While it did go further than nerfstudio, colmap with no local frame gave off artifacts and the results seems to be pretty much useless. Here are some screenshots: No reference and no localframe Conclusion There might be a way to average out the coordinates of the camera and pointclouds to transform the coordinates with something that nerfstudio plays well with, but I can only guess that it would be quite complicated to deal with. For those who have Metashape Pro, colmap export seems to be the best solution that only requires very little finking, but for those using standard, I believe your best option is to not use gps in the reference tab when aligning and see if rotating by hand works. If you have any questions, please let me know. |
Describe the bug
I've noticed that, when trying to use a dataset that I've aligned using GPS reference in Metashape, it will not load, or it will load but produce no results. This has been an issue since nerfstudio implemented loading in point clouds (.ply) for splat seeding.
I thought that @simonbethke might have reported this problem when it first was being tested in pull #3122. When @jb-ye asked for sample data, I assumed that they had shared that somewhere, but I couldn't find any issue related to this, so I'm making one here.
On older (month ago) nerfstudio and gsplat versions, I was getting error:
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
On the ODM_mygla dataset on current versions, I'm getting this error after ~1000its:
CONSOLE.log(f"Splitting {split_mask.sum().item()/self.num_points} gaussians: {n_splits}/{self.num_points}") ZeroDivisionError: division by zero
If I do process the data without the gps reference, it does load correctly.
I'm able to use this data when exporting using the gaussian splatting metashape script on inria's and postshot implementation of gaussian splatting. The data is exported using colmap format.
Why use GPS reference
I've found that using GPS reference in metashape helps with alignment (speed and accuracy), and usually results in a consistent scale, orientation, and ground plane.
I'm not asking to somehow implement GPS data in splats/nerfstudio-data, but to simply accept data created with it.
To Reproduce
My workflow usually consists of:
ns-process-data metashape --data "e:/3D Datasets/[Dataset Name]" --xml "e:/3D Datasets/[Dataset Name]/db.xml" --ply "e:/3D Datasets/[Dataset Name]/PointCloud.ply" --output-dir e:/NerfStudio/data/[Dataset Name]/out
ns-train splatfacto --output-dir ./outputs/ODMlogs nerfstudio-data --data ./data/ODMlogs/out
I've tried exporting camera positions/point cloud with
local coordinates
andwgs84
as the coordinate system, both give the same error.Expected behavior
To be able to load the data that has been georeferenced.
Alternative solution
Using the colmap export script data to create the nerfstudio data, but this will only be an option with people who have Metashape pro, and in my opinion a workaround (maybe still useful for using data used in other programs).
I tried to simply copy and paste this data into the colmap structure in nerfstudio, but I failed. I'm sure that there is a command/script to convert this into something that nerfstudio can run, but I wasn't able to get something that works.
Here is how the folder is formatted in case it helps:
[Dataset]/
├─ node_modules/
├─ images/
│ ├─ Image1.jpg
│ ├─ Image2.jpg
│ ├─ Image3.jpg
├─ sparse/
│ ├─ 0/
│ │ ├─ cameras.bin
│ │ ├─ images.bin
│ │ ├─ points3D.bin
Screenshots
ODM_mygla processed using splatfacto georeferenced before it crashes:
The only notable detail is a small white dot at the bottom of the scene at possibly infinite distance. ODM_helenenschacht also displays similar results, but doesn't crash. Camera sometimes are obscured by the scene, so I need to disable
composite depth
to use the camera positions as reference.ODM_mygla processed using nerfacto on same dataset:
Additional context
Machines specs and info:
Pc 1- R9 5900X, 128gb ram, 3060 12gb, data on SSD. Windows 10, anaconda, Nerfstudio 1.1.2, Gsplat 1.0.0
Pc 2- i7 7700HQ, 16gb ram, 1060 6gb, data on SSD. Windows 10, anaconda, Nerfstudio 1.1.0, Gsplat 0.1.12
All latest nvidia drivers, also tested with drivers from 4 months ago.
(I'm aware that Pc 2 won't be able to run any future gsplats, still included this info since the old version was giving different errors that might help narrowing down the problem)
Data processed using Metashape 2.x
I capture my own data using a Mavic Air 2s, it often aligns a few meters below ground, but even when adjusting for that, there are errors. I'm not sure how to share my own dataset, so here are some datasets that I've tested and display the same errors:
Datasets for reference:
ODM_mygla 41 images ~5mb each. Captured on DJI phantom 3
Here are the export files as .txt, you'll need to change the extension:
db.xml.txt
PointCloud.ply.txt
ODM_helenenschacht 176 images ~12mb each. Captured on Autel Evo II Pro RTK
I've also tested, but pointcloud is too big. Here is the camera positions:
db.xml.txt
This is my first issue submitted, so apologies for any missing info, or bad etiquette.
Dump of Logs
Console error from trying to run
splatfacto
with ODM_mygla dataset on nerfstudio 1.1.2 with PC 1Console error from trying to run
splatfacto
with nerfstudio 1.1.0 with PC 2The text was updated successfully, but these errors were encountered: