mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-11 18:44:21 +08:00
extract dataparser configs to a stand-alone file, support custom dataparsers (#1909)
* extract dataparser configs to a stand-alone file, support custom dataparsers * add license * fix pylint issues * fix type error issue * update naming; add documentations; * print f string * fix pylint issue --------- Co-authored-by: Matthew Tancik <tancik@berkeley.edu>
This commit is contained in:
1 parent
fe4586839a
commit
bc110d7bd9
5 files changed
+168
-49
No files matched your search
@@ -16,6 +16,7 @@ We recommend the following file structure:
|
||||
│ ├── custom_model.py [optional]
|
||||
│ ├── custom_field.py [optional]
|
||||
│ ├── custom_datamanger.py [optional]
|
||||
│ ├── custom_dataparser.py [optional]
|
||||
│ ├── ...
|
||||
├── pyproject.toml
|
||||
```
|
||||
@@ -76,6 +77,38 @@ Instead, you may use the `NERFSTUDIO_METHOD_CONFIGS` environment variable to tem
|
||||
export NERFSTUDIO_METHOD_CONFIGS="my-method=my_method.my_config:MyMethod"
|
||||
```
|
||||
|
||||
## Registering custom dataparser with nerfstudio
|
||||
We also support adding new dataparsers in a similar way. In order to extend the NeRFstudio and register a customized dataparser, you can register it with Nerfstudio as a `nerfstudio.dataparser_configs` entrypoint in the `pyproject.toml` file. Nerfstudio will automatically look for all registered dataparsers and will register them to be used by methods such as `ns-train`.
|
||||
|
||||
You can declare the dataparser in the same config file:
|
||||
```python
|
||||
"""my_method/my_config.py"""
|
||||
|
||||
from nerfstudio.plugins.registry_dataparser import DataParserSpecification
|
||||
from my_method.custom_dataparser import CustomDataparserConfig
|
||||
|
||||
MyDataparser = DataParserSpecification(config=CustomDataparserConfig)
|
||||
```
|
||||
|
||||
Then add the following lines in the `pyproject.toml` file, where the entrypoint to the new dataparser is set.
|
||||
|
||||
"""pyproject.toml"""
|
||||
|
||||
[project]
|
||||
name = "my_method"
|
||||
|
||||
# ...
|
||||
|
||||
[project.entry-points.'nerfstudio.dataparser_configs']
|
||||
custom-dataparser = 'my_method.my_config:MyDataparser'
|
||||
```
|
||||
|
||||
finally run the following to register the dataparser.
|
||||
|
||||
```
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Running custom method
|
||||
|
||||
After registering your method you should be able to run the method with,
|
||||
|
||||
Reference in new issue
Block a user