Skip to content

size mismatch problem during rendering process #8

@HsiehTPE

Description

@HsiehTPE

Dear dev,

I encountered a problem while using the trained LGS model to render images. During the loading of the model weights, size mismatch errors between the parameters of the trained model and those in the current model.

Here is the error traceback I received:

Traceback (most recent call last):
File "render.py", line 183, in
args.skip_train, args.skip_test, args.skip_video, args.new_max_sh, args
File "render.py", line 109, in render_sets
scene = Scene(dataset, gaussians, load_iteration=iteration, shuffle=False)
File "/root/autodl-tmp/LGS/scene/init.py", line 87, in init
"iteration_" + str(self.loaded_iter),
File "/root/autodl-tmp/LGS/scene/gaussian_model.py", line 273, in load_model
self._deformation.load_state_dict(weight_dict)
File "/root/miniconda3/envs/lgs/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1672, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for deform_network:
size mismatch for deformation_net.grid.grids.0.0: copying a param with shape torch.Size([1, 64, 16, 16]) from checkpoint, the shape in current model is torch.Size([1, 64, 64, 64]).
size mismatch for deformation_net.grid.grids.0.1: copying a param with shape torch.Size([1, 64, 16, 16]) from checkpoint, the shape in current model is torch.Size([1, 64, 64, 64]).
size mismatch for deformation_net.grid.grids.0.2: copying a param with shape torch.Size([1, 64, 25, 16]) from checkpoint, the shape in current model is torch.Size([1, 64, 100, 64]).
......

This looks similar to the issue size mismatch problem#6 , but this occurs in the rendering process. How can I resolve this issue to successfully load and utilize the trained models? As a reference, I have succesfully finished the training process to get the LGS model. And I saved the EndoGaussian model and its checkpoints as following code:

            # Ensuring model has same pattern with checkpoint in LGS
            if (iteration == 3000):
                print("\n[ITER {}] Saving Gaussians for LGS".format(iteration))
                scene.save("lgs_deformation_model", stage)

            if (iteration in checkpoint_iterations):
                print("\n[ITER {}] Saving Checkpoint".format(iteration))
                torch.save((gaussians.capture(), iteration), scene.model_path + "/chkpnt" + str(iteration) + ".pth")

Thanks for your patience and reading!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions