autonomousvision / sdfstudio

A Unified Framework for Surface Reconstruction
Apache License 2.0
1.99k stars 185 forks source link

Loading trained models in downstream applications #162

Open justachetan opened 1 year ago

justachetan commented 1 year ago

Hi,

Is there a way to load the models trained with sdfstudio in downstream custom applications?

For instance, I want to perform inference using the trained models in a downstream pipeline with my own code. Is it possible to import the classes for various model architectures directly into my own script?

I tried the following in order to achieve this:

from nerfstudio.models.instant_ngp import InstantNGPModel

However, I got the following error:

ImportError: cannot import name 'TrainingCallback' from partially initialized module 'nerfstudio.engine.callbacks' (most likely due to a circular import) (~/sdfstudio/nerfstudio/engine/callbacks.py)

Just wanted to check if there is a different way of achieving this or whether the current code base does not support it at all. Thanks!

niujinshuchong commented 1 year ago

Hi, you might need to import the config similar to here: https://github.com/autonomousvision/sdfstudio/blob/master/scripts/render_mesh.py#L29

justachetan commented 1 year ago

Hi @niujinshuchong ! Thanks for the hint! If possible, could you please point me to a full-fledged example (if any) of downstream inference? I am trying to load a saved model so that I can perform inference in my own script. However, I am not sure if there is an API to load the saved config and use it to load the model weights themselves. Would really appreciate any pointers on this!