pierotofy / OpenSplat

Production-grade 3D gaussian splatting with CPU/GPU support for Windows, Mac and Linux 🚀
https://antimatter15.com/splat/?url=https://splat.uav4geo.com/banana.splat
GNU Affero General Public License v3.0
924 stars 87 forks source link

Custom dataset issues #124

Closed l-fungus-l closed 3 months ago

l-fungus-l commented 3 months ago

My goal is to create a custom dataset trying replicating Colmap's format. I calculate my camera poses in terms of a rotation matrix, which I then convert to quaternion through scipy.spatial.transform.Rotation.as_quat() and write its center in the following format to create my images.bin (purposefully excluding the local camera coordinate system and only having an empty line instead):

{custom-id1} {q1w} {q1x} {q1y} {q1z} {c1x}{c1y} {c1z} 1 {name1}

{custom-id2} {q2w} {q2x} {q2y} {q2z} {c2x}{c2y} {c2z} 1 {name2}

...

The format for the custom points3D.bin is as follows(purposefully excluding the track information for each point after the error field):

{custom-id1} {pos_x1} {pos_y1} {pos_z1} {red1} {green1} {blue1} 0.612829
{custom-id2} {pos_x2} {pos_y2} {pos_z2} {red2} {green2} {blue2} 0.612829
{custom-id3} {pos_x3} {pos_y3} {pos_z3} {red3} {green3} {blue3} 0.612829
...

While OpenSplat should not need the information I have excluded, when I try to train a model on this dataset I get the following error:

element 0 of tensors does not require grad and does not have a grad_fn
Exception raised from run_backward at ../torch/csrc/autograd/autograd.cpp:105 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0xb0 (0x70786f01c7f0 in /home/mselveliev/libtorch/libtorch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 0xfa (0x70786efc4f7e in /home/mselveliev/libtorch/libtorch/lib/libc10.so)
frame #2: <unknown function> + 0x5825ce2 (0x70785b025ce2 in /home/mselveliev/libtorch/libtorch/lib/libtorch_cpu.so)
frame #3: torch::autograd::backward(std::vector<at::Tensor, std::allocator<at::Tensor> > const&, std::vector<at::Tensor, std::allocator<at::Tensor> > const&, std::optional<bool>, bool, std::vector<at::Tensor, std::allocator<at::Tensor> > const&) + 0x6a (0x70785b028cba in /home/mselveliev/libtorch/libtorch/lib/libtorch_cpu.so)
frame #4: <unknown function> + 0x5894b7d (0x70785b094b7d in /home/mselveliev/libtorch/libtorch/lib/libtorch_cpu.so)
frame #5: at::Tensor::_backward(c10::ArrayRef<at::Tensor>, std::optional<at::Tensor> const&, std::optional<bool>, bool) const + 0x4c (0x7078573d7d6c in /home/mselveliev/libtorch/libtorch/lib/libtorch_cpu.so)
frame #6: <unknown function> + 0x35c52 (0x6226ec8bcc52 in ./opensplat)
frame #7: <unknown function> + 0x29d90 (0x7077f6829d90 in /lib/x86_64-linux-gnu/libc.so.6)
frame #8: __libc_start_main + 0x80 (0x7077f6829e40 in /lib/x86_64-linux-gnu/libc.so.6)
frame #9: <unknown function> + 0x37d05 (0x6226ec8bed05 in ./opensplat)

Is this from the missing information or does it mean that my dataset's calculations are off?