mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-13 11:24:00 +08:00
* start of mesh PR * point cloud export mvp * start of mesh PR * point cloud export mvp * Save out mesh. Poor quality atm * reorganized mesh algorithms and specified CLI * CLI reorg * tsdf algorithm in progress * debugging * tsdf functional but camera distortion params not in * playing with distortion params * TSDF works but texture looks bad * added trimesh * moved to exporter * removed files * saving progress * save texture image * seems to work w/o barycentric * barycentric start * gap between triangles * blocking out diagonal * new barcentric and scaling * meshing working. need to remove extra rows * fixed triangle packing * gitignore changes * removed package * fix Literal import * comments * update .mtl file * poisson mesh with model output normals & resolved some PR comments on git * starting docs. breaking up big function. todo: add xatlas * xatlas and nvdiffrast working * triangle_id * progress on expensive texture coordinates method * pytorch meshing works * removing nvdiffrast * remove trimesh * cleanup * few changes * pred normals by default and add minimum additions to viewer * fix cli in viewer * add xatlas as dependency * make point cloud more dense * reverted viewer changes * turn off normals by default * fix docs * finished todos on github * remove xatlas * xatlas * black Co-authored-by: Matt Tancik <tancik@berkeley.edu>
69 lines
2.3 KiB
Python
69 lines
2.3 KiB
Python
# Copyright 2022 The Nerfstudio Team. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
"""Additional rich ui components"""
|
|
|
|
from contextlib import nullcontext
|
|
from typing import Optional
|
|
|
|
from rich.console import Console
|
|
from rich.progress import (
|
|
BarColumn,
|
|
Progress,
|
|
ProgressColumn,
|
|
TaskProgressColumn,
|
|
TextColumn,
|
|
TimeRemainingColumn,
|
|
)
|
|
from rich.text import Text
|
|
|
|
CONSOLE = Console(width=120)
|
|
|
|
|
|
class ItersPerSecColumn(ProgressColumn):
|
|
"""Renders the iterations per second for a progress bar."""
|
|
|
|
def __init__(self, suffix="it/s") -> None:
|
|
super().__init__()
|
|
self.suffix = suffix
|
|
|
|
def render(self, task: "Task") -> Text:
|
|
"""Show data transfer speed."""
|
|
speed = task.finished_speed or task.speed
|
|
if speed is None:
|
|
return Text("?", style="progress.data.speed")
|
|
return Text(f"{speed:.2f} {self.suffix}", style="progress.data.speed")
|
|
|
|
|
|
def status(msg: str, spinner: str = "bouncingBall", verbose: bool = False):
|
|
"""A context manager that does nothing is verbose is True. Otherwise it hides logs under a message.
|
|
|
|
Args:
|
|
msg: The message to log.
|
|
spinner: The spinner to use.
|
|
verbose: If True, print all logs, else hide them.
|
|
"""
|
|
if verbose:
|
|
return nullcontext()
|
|
return CONSOLE.status(msg, spinner=spinner)
|
|
|
|
|
|
def get_progress(description: str, suffix: Optional[str] = None):
|
|
"""Helper function to return a rich Progress object."""
|
|
progress_list = [TextColumn(description), BarColumn(), TaskProgressColumn(show_speed=True)]
|
|
progress_list += [ItersPerSecColumn(suffix=suffix)] if suffix else []
|
|
progress_list += [TimeRemainingColumn(elapsed_when_finished=True, compact=True)]
|
|
progress = Progress(*progress_list)
|
|
return progress
|