mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-19 22:25:44 +08:00
Update docs (#65)
+ Clean up data setup docs + Clean up visualize data ipynb + Enable interactive ploty in docs
This commit is contained in:
1 parent
336d348345
commit
2bc6d9cc63
8 files changed
+5125
-5118
No files matched your search
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
requirejs.config({
|
||||
paths: {
|
||||
base: '/static/base',
|
||||
plotly: 'https://cdn.plot.ly/plotly-2.12.1.min.js?noext',
|
||||
},
|
||||
});
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
var requirejs,require,define;!function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.6",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(e,t){return t||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){var i;if(e)for(i=0;i<e.length&&(!e[i]||!t(e[i],i,e));i+=1);}function eachReverse(e,t){var i;if(e)for(i=e.length-1;-1<i&&(!e[i]||!t(e[i],i,e));i-=1);}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(i,e,r,n){return e&&eachProp(e,function(e,t){!r&&hasProp(i,t)||(!n||"object"!=typeof e||!e||isArray(e)||isFunction(e)||e instanceof RegExp?i[t]=e:(i[t]||(i[t]={}),mixin(i[t],e,r,n)))}),i}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,r){var n=new Error(t+"\nhttps://requirejs.org/docs/errors.html#"+e);return n.requireType=e,n.requireModules=r,i&&(n.originalError=i),n}if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,r){var n,o,a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=i,i=r):e=[]),o&&o.context&&(a=o.context),(n=getOwn(contexts,a))||(n=contexts[a]=req.s.newContext(a)),o&&n.configure(o),n.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick=void 0!==setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(t){req[t]=function(){var e=contexts[defContextName];return e.require[t].apply(e,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,i){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(t,i,r){var e,n=t&&t.config||{};if(isBrowser)return(e=req.createNode(n,i,r)).setAttribute("data-requirecontext",t.contextName),e.setAttribute("data-requiremodule",i),!e.attachEvent||e.attachEvent.toString&&e.attachEvent.toString().indexOf("[native code")<0||isOpera?(e.addEventListener("load",t.onScriptLoad,!1),e.addEventListener("error",t.onScriptError,!1)):(useInteractive=!0,e.attachEvent("onreadystatechange",t.onScriptLoad)),e.src=r,n.onNodeCreated&&n.onNodeCreated(e,n,i,r),currentlyAddingScript=e,baseElement?head.insertBefore(e,baseElement):head.appendChild(e),currentlyAddingScript=null,e;if(isWebWorker)try{setTimeout(function(){},0),importScripts(r),t.completeLoad(i)}catch(e){t.onError(makeError("importscripts","importScripts failed for "+i+" at "+r,e,[i]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){if(head||(head=e.parentNode),dataMain=e.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(mainScript=(src=mainScript.split("/")).pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,i,t){var r,n;"string"!=typeof e&&(t=i,i=e,e=null),isArray(i)||(t=i,i=null),!i&&isFunction(t)&&(i=[],t.length&&(t.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,t){i.push(t)}),i=(1===t.length?["require"]:["require","exports","module"]).concat(i))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript())&&(e||(e=r.getAttribute("data-requiremodule")),n=contexts[r.getAttribute("data-requirecontext")]),n?(n.defQueue.push([e,i,t]),n.defQueueMap[e]=!0):globalDefQueue.pushLine truncated
|
||||
Vendored
+108
@@ -0,0 +1,108 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" {% if language is not none %} lang="{{ language }}" {% endif %}>
|
||||
|
||||
<head>
|
||||
{%- block site_meta -%}
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<meta name="color-scheme" content="light dark">
|
||||
|
||||
{%- if metatags %}{{ metatags }}{% endif -%}
|
||||
|
||||
{%- block linktags %}
|
||||
{%- if hasdoc('about') -%}
|
||||
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
|
||||
{%- endif -%}
|
||||
{%- if hasdoc('genindex') -%}
|
||||
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
|
||||
{%- endif -%}
|
||||
{%- if hasdoc('search') -%}
|
||||
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
|
||||
{%- endif -%}
|
||||
{%- if hasdoc('copyright') -%}
|
||||
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
|
||||
{%- endif -%}
|
||||
{%- if next -%}
|
||||
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
|
||||
{%- endif -%}
|
||||
{%- if prev -%}
|
||||
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
|
||||
{%- endif -%}
|
||||
{#- rel="canonical" (set by html_baseurl) -#}
|
||||
{%- if pageurl %}
|
||||
<link rel="canonical" href="{{ pageurl|e }}" />
|
||||
{%- endif %}
|
||||
{%- endblock linktags %}
|
||||
|
||||
{# Favicon #}
|
||||
{%- if favicon_url -%}
|
||||
<link rel="shortcut icon" href="{{ favicon_url }}" />
|
||||
{%- endif -%}
|
||||
|
||||
{#- Generator banner -#}
|
||||
<meta name="generator" content="sphinx-{{ sphinx_version }}, furo {{ furo_version }}" />
|
||||
|
||||
{%- endblock site_meta -%}
|
||||
|
||||
{#- Site title -#}
|
||||
{%- block htmltitle -%}
|
||||
{% if not docstitle %}
|
||||
<title>{{ title|striptags|e }}</title>
|
||||
{% elif pagename == master_doc %}
|
||||
<title>{{ docstitle|striptags|e }}</title>
|
||||
{% else %}
|
||||
<title>{{ title|striptags|e }} - {{ docstitle|striptags|e }}</title>
|
||||
{% endif %}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block styles -%}
|
||||
|
||||
{# Custom stylesheets #}
|
||||
{%- block regular_styles -%}
|
||||
{%- for css in css_files -%}
|
||||
{% if css|attr("filename") -%}
|
||||
{{ css_tag(css) }}
|
||||
{%- else -%}
|
||||
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" />
|
||||
{%- endif %}
|
||||
{% endfor -%}
|
||||
{%- endblock regular_styles -%}
|
||||
|
||||
{#- Theme-related stylesheets -#}
|
||||
{%- block theme_styles %}
|
||||
{% include "partials/_head_css_variables.html" with context %}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block extra_styles %}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- endblock styles -%}
|
||||
|
||||
{#- Custom front matter #}
|
||||
{%- block extrahead -%}{%- endblock -%}
|
||||
|
||||
{# Custom JS #}
|
||||
{%- block regular_scripts -%}
|
||||
{% for path in script_files -%}
|
||||
{{ js_tag(path) }}
|
||||
{% endfor -%}
|
||||
{%- endblock regular_scripts -%}
|
||||
|
||||
{# Theme-related JavaScript code #}
|
||||
{%- block theme_scripts -%}
|
||||
{%- endblock -%}
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block body %}
|
||||
<script>
|
||||
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{%- block scripts -%}
|
||||
{%- endblock scripts -%}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -51,6 +51,25 @@ extensions = [
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
||||
suppress_warnings = ["myst.header"]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ["_templates"]
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ["_static"]
|
||||
|
||||
# Needed for interactive plotly in notebooks
|
||||
html_js_files = [
|
||||
"require.min.js",
|
||||
"custom.js",
|
||||
]
|
||||
|
||||
# -- MYST configs -----------------------------------------------------------
|
||||
|
||||
# To enable admonitions:
|
||||
myst_enable_extensions = ["colon_fence"]
|
||||
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Dataset configuration
|
||||
|
||||
#### Referring to a specific dataset
|
||||
#### Specifying dataset
|
||||
|
||||
Here is how we refer to a dataset. We have a `dataset_inputs_train` and a `dataset_inputs_eval` config. These live under the `data` directory. You can see `configs/graph_default.yaml` for more details on what a full config would look like.
|
||||
The dataset path and type is specified in the model config. Both `dataset_inputs_train` and a `dataset_inputs_eval` need to be set. You can see `configs/graph_default.yaml` for more details on what a full config would look like.
|
||||
|
||||
```yaml
|
||||
data:
|
||||
@@ -18,7 +18,7 @@ data:
|
||||
alpha_color: white
|
||||
```
|
||||
|
||||
#### Sanity check with a notebook
|
||||
#### Visualize dataset
|
||||
|
||||
You can use `notebooks/visualize_dataset.ipynb` to see how your formatted dataset looks. This code will load a dataset from a yaml config, show the camera poses, and visualize rays with the specified collider in the config. TODO: add a better visualization with images too
|
||||
|
||||
@@ -53,4 +53,16 @@ Download
|
||||
|
||||
```yaml
|
||||
dataset_format: instant_ngp
|
||||
```
|
||||
|
||||
###### MipNeRF 360
|
||||
|
||||
```{button-link} https://jonbarron.info/mipnerf360/
|
||||
:color: primary
|
||||
:outline:
|
||||
Download
|
||||
```
|
||||
|
||||
```yaml
|
||||
dataset_format: mipnerf_360
|
||||
```
|
||||
@@ -1,8 +1,18 @@
|
||||
# Using custom data
|
||||
|
||||
#### Running COLMAP on your own images
|
||||
Training model on existing datasets is only so fun. If you would like to train on self captured data you will need to process the data into an existing format. Specifically we need to know the camera poses for each image. [COLMAP](https://github.com/colmap/colmap) is a standard tool for extracting poses. It is possible to use other methods like [SLAM](https://en.wikipedia.org/wiki/Simultaneous_localization_and_mapping) or hardware recorded poses. We intend to add documentation for these other methods in the future.
|
||||
|
||||
Please download [this file](https://github.com/NVlabs/instant-ngp/blob/07d8e2ca7232f97397ab73af9b56c7db639d3445/scripts/colmap2nerf.py) and place it at `scripts/colmap2nerf.py` courtesy of the [Instant-NGP](https://github.com/NVlabs/instant-ngp) authors. This script will use [COLMAP](https://github.com/colmap/colmap) to process images of a video file into a reconstruction with camera poses. You can see their write-up [here](https://github.com/NVlabs/instant-ngp/blob/master/docs/nerf_dataset_tips.md) for instructions.
|
||||
#### Recover poses using COLMAP
|
||||
:::{admonition} Notes
|
||||
:class: warning
|
||||
|
||||
+ This method assumes the images were captured with a standard _pinhole-like_ camera. 360° captures will not work.
|
||||
+ COLMAP is notoriously finicky. Try your best to capture overlapping, non-blurry images.
|
||||
:::
|
||||
|
||||
These instructions will recover poses for your own images using [COLMAP](https://github.com/colmap/colmap) and save the data in the `instant_ngp` format.
|
||||
|
||||
Please download [this file](https://github.com/NVlabs/instant-ngp/blob/07d8e2ca7232f97397ab73af9b56c7db639d3445/scripts/colmap2nerf.py) and place it at `scripts/colmap2nerf.py` courtesy of the [Instant-NGP](https://github.com/NVlabs/instant-ngp) authors. This script will use COLMAP to process images of a video file into a reconstruction with camera poses. You can see their write-up [here](https://github.com/NVlabs/instant-ngp/blob/master/docs/nerf_dataset_tips.md) for instructions.
|
||||
|
||||
For example, maybe we have a video named `bear.mp4`. We can use the commands described in the Instant-NGP repo to create our dataset. We first create a a data folder. Then, we navigate to this folder. Finally, we run the colmap2nerf.py script with a specified `video_fps` and `aabb_scale`. The recommended number of frames is around 50-150 and the `aabb_scale` is the extent of the scene. The origin is the center of the aabb and `aabb_scale` is the length of each side of the box.
|
||||
|
||||
@@ -29,5 +39,7 @@ python $PYRAD_DIR/scripts/colmap2nerf.py \
|
||||
|
||||
In the config set:
|
||||
```yaml
|
||||
dataset_format: instant_ngp
|
||||
...
|
||||
data_directory: data/instant_ngp/bear
|
||||
dataset_format: instant_ngp
|
||||
```
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
# Custom Data Formats
|
||||
# Custom dataset formats
|
||||
|
||||
In this page, we explain how to use pyRad with your own data. We've implemented many common datasets inside the `pyrad/format/<dataset_format>.py` files. Each of these files implements a function called `load_<dataset_format>_data`. Each of these functions returns a `DatasetInputs` object. Furthermore, `get_dataset_inputs` in `pyrad/data/utils.py` will have to be updated to handle the new function.
|
||||
We've implemented many common datasets inside the `pyrad/format/<dataset_format>.py` files. If you have a posed image dataset that does not match these existing formats can create a custom dataset format.
|
||||
|
||||
1. Create a function `pyrad/format/<dataset_format>.py` and implements a function called `load_<dataset_format>_data` returns a `DatasetInputs` object.
|
||||
|
||||
```python
|
||||
# The DatasetInputs dataclass that is passed around to create datasets and initialize the graphs.
|
||||
@@ -29,7 +31,12 @@ def load_instant_ngp_data(
|
||||
split: str = "train", camera_translation_scalar=0.33
|
||||
) -> DatasetInputs:
|
||||
"""Returns a DatasetInputs struct."""
|
||||
```
|
||||
|
||||
|
||||
2. Add a new case to `get_dataset_inputs()` in `pyrad/data/utils.py` for the new dataset.
|
||||
|
||||
```python
|
||||
# The method signature for get_dataset_inputs.
|
||||
# Notice that the parameters match the yaml config parameters above.
|
||||
# See `pyrad/data/utils.py` for the code.
|
||||
@@ -41,4 +48,4 @@ def get_dataset_inputs(
|
||||
alpha_color: Optional[Union[str, list, ListConfig]] = None,
|
||||
) -> DatasetInputs:
|
||||
"""Makes a call to `load_<dataset_format>_data` and returns a DatasetInputs struct."""
|
||||
```
|
||||
```
|
||||
Reference in new issue
Block a user