Anttwo / SuGaR

[CVPR 2024] Official PyTorch implementation of SuGaR: Surface-Aligned Gaussian Splatting for Efficient 3D Mesh Reconstruction and High-Quality Mesh Rendering
https://anttwo.github.io/sugar/
Other
2.36k stars 182 forks source link

encounter error, something about image loading. #50

Closed TxT1212 closed 11 months ago

TxT1212 commented 11 months ago

here is my error message, I have no clue what's wrong.

python train.py -s /home/ezxr/data/mapper_sanxdxgcjcs_002617 -c /home/ezxr/data/mapper_sanxdxgcjcs_002617/gaussain_model/ -r density Will export a UV-textured mesh as an .obj file. Changing sh_levels to match the loaded model: 4 -----Parsed parameters----- Source path: /home/ezxr/data/mapper_sanxdxgcjcs_002617

Content: 4 Gaussian Splatting checkpoint path: /home/ezxr/data/mapper_sanxdxgcjcs_002617/gaussain_model/ Content: 7 SUGAR checkpoint path: ./output/coarse/mapper_sanxdxgcjcs_002617/sugarcoarse_3Dgs7000_densityestim02_sdfnorm02/ Iteration to load: 7000 Output directory: ./output/coarse/mapper_sanxdxgcjcs_002617 SDF estimation factor: 0.2 SDF better normal factor: 0.2 Eval split: True

Using device: 0 =========================================================================== PyTorch CUDA memory summary, device ID 0
CUDA OOMs: 0 cudaMalloc retries: 0
===========================================================================
Metric Cur Usage Peak Usage Tot Alloc Tot Freed
---------------------------------------------------------------------------
Allocated memory 0 B 0 B 0 B 0 B
from large pool 0 B 0 B 0 B 0 B
from small pool 0 B 0 B 0 B 0 B
---------------------------------------------------------------------------
Active memory 0 B 0 B 0 B 0 B
from large pool 0 B 0 B 0 B 0 B
from small pool 0 B 0 B 0 B 0 B
---------------------------------------------------------------------------
GPU reserved memory 0 B 0 B 0 B 0 B
from large pool 0 B 0 B 0 B 0 B
from small pool 0 B 0 B 0 B 0 B
---------------------------------------------------------------------------
Non-releasable memory 0 B 0 B 0 B 0 B
from large pool 0 B 0 B 0 B 0 B
from small pool 0 B 0 B 0 B 0 B
---------------------------------------------------------------------------
Allocations 0 0 0 0
from large pool 0 0 0 0
from small pool 0 0 0 0
---------------------------------------------------------------------------
Active allocs 0 0 0 0
from large pool 0 0 0 0
from small pool 0 0 0 0
---------------------------------------------------------------------------
GPU reserved segments 0 0 0 0
from large pool 0 0 0 0
from small pool 0 0 0 0
---------------------------------------------------------------------------
Non-releasable allocs 0 0 0 0
from large pool 0 0 0 0
from small pool 0 0 0 0
---------------------------------------------------------------------------
Oversize allocations 0 0 0 0
---------------------------------------------------------------------------
Oversize GPU segments 0 0 0 0
===========================================================================

Loading config /home/ezxr/data/mapper_sanxdxgcjcs_002617/gaussain_model/... Performing train/eval split... Loading camera 21907/1695894918480.jpeg Loading camera 21907/1695894919015.jpeg Loading camera 21907/1695894919681.jpeg Loading camera 21907/1695894920349.jpeg Loading camera 21907/1695894921016.jpeg Loading camera 21907/1695894922349.jpeg Loading camera 21907/1695894923682.jpeg Loading camera 21907/1695894924349.jpeg Loading camera 21907/1695894925016.jpeg Loading camera 21907/1695894925682.jpeg Loading camera 21907/1695894926349.jpeg Loading camera 21907/1695894927016.jpeg Loading camera 21907/1695894927684.jpeg Loading camera 21907/1695894928350.jpeg Loading camera 21907/1695894929016.jpeg Loading camera 21907/1695894929684.jpeg Loading camera 21907/1695894930349.jpeg Loading camera 21907/1695894931016.jpeg Loading camera 21907/1695894931684.jpeg Loading camera 21907/1695894932350.jpeg Loading camera 21907/1695894933016.jpeg Loading camera 21907/1695894933684.jpeg Loading camera 21907/1695894934350.jpeg Loading camera 21907/1695894935017.jpeg Loading camera 21907/1695894935684.jpeg Loading camera 21907/1695894937016.jpeg Loading camera 21907/1695894937684.jpeg Loading camera 21907/1695894938350.jpeg Loading camera 21907/1695894939016.jpeg Loading camera 21907/1695894939684.jpeg Loading camera 21907/1695894940350.jpeg Loading camera 21907/1695894941017.jpeg Loading camera 21907/1695894941687.jpeg Loading camera 21907/1695894942351.jpeg Loading camera 21907/1695894943017.jpeg Loading camera 21907/1695894943684.jpeg Loading camera 21907/1695894944351.jpeg Loading camera 21907/1695894945018.jpeg Loading camera 21907/1695894945686.jpeg Loading camera 21907/1695894946351.jpeg Loading camera 21907/1695894947018.jpeg Loading camera 21907/1695894947686.jpeg Loading camera 21907/1695894948351.jpeg Loading camera 21907/1695894949018.jpeg Loading camera 21907/1695894949686.jpeg Loading camera 21907/1695894950350.jpeg Loading camera 21907/1695894951018.jpeg Loading camera 21907/1695894951686.jpeg Loading camera 21907/1695894952351.jpeg Loading camera 21907/1695894953019.jpeg Loading camera 21907/1695894953686.jpeg Loading camera 21907/1695894954351.jpeg Loading camera 21907/1695894955018.jpeg Loading camera 21907/1695894955685.jpeg Loading camera 21907/1695894956352.jpeg Loading camera 21907/1695894957019.jpeg Loading camera 21907/1695894957687.jpeg Loading camera 21907/1695894958352.jpeg Loading camera 21907/1695894959019.jpeg Loading camera 21907/1695894959687.jpeg Loading camera 21907/1695894960352.jpeg Loading camera 21907/1695894961019.jpeg Loading camera 21907/1695894961687.jpeg Loading camera 21907/1695894962352.jpeg Loading camera 21907/1695894963019.jpeg Loading camera 21907/1695894963714.jpeg Loading camera 21907/1695894964352.jpeg Loading camera 21907/1695894965019.jpeg Loading camera 21907/1695894965687.jpeg Loading camera 21907/1695894966352.jpeg Loading camera 21907/1695894967019.jpeg Loading camera 21907/1695894967687.jpeg Loading camera 21907/1695894968352.jpeg Loading camera 21907/1695894969019.jpeg Loading camera 21907/1695894969687.jpeg Loading camera 21907/1695894970353.jpeg Loading camera 21907/1695894971020.jpeg Loading camera 21907/1695894971687.jpeg Loading camera 21907/1695894972353.jpeg Loading camera 21907/1695894973020.jpeg Loading camera 21907/1695894973687.jpeg Loading camera 21907/1695894974352.jpeg Loading camera 21907/1695894975020.jpeg Loading camera 21907/1695894975687.jpeg Loading camera 21907/1695894976353.jpeg Loading camera 21907/1695894977022.jpeg Loading camera 21907/1695894977687.jpeg Loading camera 21907/1695894978353.jpeg Loading camera 21907/1695894979020.jpeg Loading camera 21907/1695894979687.jpeg Loading camera 21907/1695894980354.jpeg Loading camera 21907/1695894981020.jpeg Loading camera 21907/1695894981690.jpeg Loading camera 21907/1695894982353.jpeg Loading camera 21907/1695894983020.jpeg Loading camera 21907/1695894983688.jpeg Loading camera 21907/1695894984354.jpeg Loading camera 21907/1695894985020.jpeg Loading camera 21907/1695894985689.jpeg Loading camera 21907/1695894986357.jpeg Loading camera 21907/1695894987020.jpeg Loading camera 21907/1695894987689.jpeg Loading camera 21907/1695894988353.jpeg Loading camera 21907/1695894989020.jpeg Loading camera 21907/1695894989687.jpeg Loading camera 21907/1695894990353.jpeg Loading camera 21907/1695894991021.jpeg 93 training images detected. The model has been trained for 7000 steps.

Camera resolution scaled to 360 x 640 Initializing model from trained 3DGS... Point cloud generated. Number of points: 252966 Use min to initialize scales. Initialized radiuses for 3D Gauss Rasterizer Initializing 3D gaussians from 3D gaussians...

SuGaR model has been initialized. SuGaR() Number of parameters: 14924994 Checkpoints will be saved in ./output/coarse/mapper_sanxdxgcjcs_002617/sugarcoarse_3Dgs7000_densityestim02_sdfnorm02/

Model parameters: _points torch.Size([252966, 3]) True all_densities torch.Size([252966, 1]) True _scales torch.Size([252966, 3]) True _quaternions torch.Size([252966, 4]) True _sh_coordinates_dc torch.Size([252966, 1, 3]) True _sh_coordinates_rest torch.Size([252966, 15, 3]) True Using camera spatial extent as spatial_lr_scale: 7.771456003189088 Optimizer initialized. Optimization parameters: OptimizationParams( iterations=15000, position_lr_init=0.00016, position_lr_final=1.6e-06, position_lr_delay_mult=0.01, position_lr_max_steps=30000, feature_lr=0.0025, opacity_lr=0.05, scaling_lr=0.005, rotation_lr=0.001, ) Optimizable parameters: points 0.001243432960510254 sh_coordinates_dc 0.0025 sh_coordinates_rest 0.000125 all_densities 0.05 scales 0.005 quaternions 0.001 Densifier initialized. Using loss function: l1+dssim Starting regularization...


Iteration: 7000 loss: 0.030430 [ 7000/15000] computed in 0.0077037890752156574 minutes. ------Stats----- ---Min, Max, Mean, Std Points: -36.427547454833984 25.382139205932617 0.1579069197177887 4.527556419372559 Scaling factors: 1.8439502014189202e-07 0.9512976408004761 0.032854754477739334 0.05896857753396034 Quaternions: -0.9968045353889465 0.9999953508377075 0.22015613317489624 0.4489225745201111 Sh coordinates dc: -2.2877933979034424 4.295931339263916 -0.06274425983428955 1.2825195789337158 Sh coordinates rest: -0.7043451070785522 0.6325781345367432 0.0003956133150495589 0.049302585422992706 Opacities: 0.0008357342449016869 1.0 0.23739202320575714 0.2816372513771057

---INFO--- Starting entropy regularization.

---INFO--- Resetting neighbors... Traceback (most recent call last): File "/home/mm/ARWorkspace/SuGaR/train.py", line 120, in coarse_sugar_path = coarse_training_with_density_regularization(coarse_args) File "/home/mm/ARWorkspace/SuGaR/sugar_trainers/coarse_density.py", line 526, in coarse_training_with_density_regularization gt_rgb = gt_image.view(-1, sugar.image_height, sugar.image_width, 3) RuntimeError: shape '[-1, 360, 640, 3]' is invalid for input of size 689280

yuedajiong commented 11 months ago

your input image has 689280 float numbers, -1 means any integer, 689280 / 360 / 640 / 3 != integer.

so please check the image integrity firstly, maybe has incomplete image(s).

of course, maybe other cause.

Tao-11-chen commented 11 months ago

Or maybe you have images with different resolutions in your dataset which is not supported yet.

Dargonxzy commented 11 months ago

How to solve it?I also faced similar problem on dtu dataset

yuedajiong commented 11 months ago
  1. debug and fix. (if you can)
  2. keep same environment as official,just in 20 minutes: CUDA, Python,Pytorch,... (recommended: life is limited, do not waste time on non-core technology.)
TxT1212 commented 11 months ago

How to solve it?I also faced similar problem on dtu dataset

My dataset has slightly different image size because I use colmap to undistort images. Some of images are 640x360 and others are 640x359

yuedajiong commented 11 months ago

resize pls. (PIL.Image, CV2, or pytorch torchvision.transorms.Resize)