mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-16 04:43:52 +08:00
Switch to ruff (#1939)
* `isort` -> `ruff` * `pylint` -> `ruff` * Remove line * More minor cleanup * Better documentation for rules we are enabling * Fix gitignore, run black * vscode settings --------- Co-authored-by: Matt Tancik <mattt4001@gmail.com>
This commit is contained in:
1 parent
814db32ec4
commit
d542646c72
79 files changed
+158
-237
No files matched your search
@@ -37,7 +37,7 @@ class BaseConverterToNerfstudioDataset(ABC):
|
||||
self.image_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@property
|
||||
def image_dir(self) -> Path: # pylint: disable=missing-function-docstring
|
||||
def image_dir(self) -> Path:
|
||||
return self.output_dir / "images"
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -98,15 +98,15 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset):
|
||||
"""If --use-sfm-depth and this flag is True, also export debug images showing Sf overlaid upon input images."""
|
||||
|
||||
@staticmethod
|
||||
def default_colmap_path() -> Path: # pylint: disable=missing-function-docstring
|
||||
def default_colmap_path() -> Path:
|
||||
return Path("colmap/sparse/0")
|
||||
|
||||
@property
|
||||
def absolute_colmap_model_path(self) -> Path: # pylint: disable=missing-function-docstring
|
||||
def absolute_colmap_model_path(self) -> Path:
|
||||
return self.output_dir / self.colmap_model_path
|
||||
|
||||
@property
|
||||
def absolute_colmap_path(self) -> Path: # pylint: disable=missing-function-docstring
|
||||
def absolute_colmap_path(self) -> Path:
|
||||
return self.output_dir / "colmap"
|
||||
|
||||
def _save_transforms(
|
||||
|
||||
@@ -176,7 +176,7 @@ def run_colmap(
|
||||
CONSOLE.log("[bold green]:tada: Done refining intrinsics.")
|
||||
|
||||
|
||||
def parse_colmap_camera_params(camera) -> Dict[str, Any]: # pylint: disable=too-many-statements
|
||||
def parse_colmap_camera_params(camera) -> Dict[str, Any]:
|
||||
"""
|
||||
Parses all currently supported COLMAP cameras into the transforms.json metadata
|
||||
|
||||
@@ -514,7 +514,7 @@ def create_sfm_depth(
|
||||
im_id_to_image = read_images_binary(recon_dir / "images.bin")
|
||||
|
||||
# Only support first camera
|
||||
CAMERA_ID = 1 # pylint: disable=invalid-name
|
||||
CAMERA_ID = 1
|
||||
W = cam_id_to_camera[CAMERA_ID].width
|
||||
H = cam_id_to_camera[CAMERA_ID].height
|
||||
|
||||
|
||||
@@ -110,9 +110,7 @@ def run_hloc(
|
||||
pairs_from_retrieval.main(retrieval_path, sfm_pairs, num_matched=num_matched)
|
||||
match_features.main(matcher_conf, sfm_pairs, features=features, matches=matches)
|
||||
|
||||
image_options = pycolmap.ImageReaderOptions( # pylint: disable=c-extension-no-member
|
||||
camera_model=camera_model.value
|
||||
)
|
||||
image_options = pycolmap.ImageReaderOptions(camera_model=camera_model.value)
|
||||
if refine_pixsfm:
|
||||
sfm = PixSfM(
|
||||
conf={
|
||||
@@ -128,7 +126,7 @@ def run_hloc(
|
||||
features,
|
||||
matches,
|
||||
image_list=references,
|
||||
camera_mode=pycolmap.CameraMode.SINGLE, # pylint: disable=c-extension-no-member
|
||||
camera_mode=pycolmap.CameraMode.SINGLE,
|
||||
image_options=image_options,
|
||||
verbose=verbose,
|
||||
)
|
||||
@@ -141,7 +139,7 @@ def run_hloc(
|
||||
sfm_pairs,
|
||||
features,
|
||||
matches,
|
||||
camera_mode=pycolmap.CameraMode.SINGLE, # pylint: disable=c-extension-no-member
|
||||
camera_mode=pycolmap.CameraMode.SINGLE,
|
||||
image_options=image_options,
|
||||
verbose=verbose,
|
||||
)
|
||||
@@ -32,10 +32,9 @@ class ImagesToNerfstudioDataset(ColmapConverterToNerfstudioDataset):
|
||||
2. Calculates the camera poses for each image using `COLMAP <https://colmap.github.io/>`_.
|
||||
"""
|
||||
|
||||
def main(self) -> None: # pylint: disable=R0915
|
||||
def main(self) -> None:
|
||||
"""Process images into a nerfstudio dataset."""
|
||||
|
||||
# pylint: disable=too-many-statements
|
||||
require_cameras_exist = False
|
||||
if self.colmap_model_path != ColmapConverterToNerfstudioDataset.default_colmap_path():
|
||||
if not self.skip_colmap:
|
||||
|
||||
@@ -32,7 +32,7 @@ def _find_param(calib_xml: ET.Element, param_name: str):
|
||||
return 0.0
|
||||
|
||||
|
||||
def metashape_to_json( # pylint: disable=too-many-statements
|
||||
def metashape_to_json(
|
||||
image_filename_map: Dict[str, Path],
|
||||
xml_filename: Path,
|
||||
output_dir: Path,
|
||||
|
||||
@@ -40,7 +40,7 @@ class VideoToNerfstudioDataset(ColmapConverterToNerfstudioDataset):
|
||||
percent_radius_crop: float = 1.0
|
||||
"""Create circle crop mask. The radius is the percent of the image diagonal."""
|
||||
|
||||
def main(self) -> None: # pylint: disable=R0915
|
||||
def main(self) -> None:
|
||||
"""Process video into a nerfstudio dataset."""
|
||||
|
||||
summary_log = []
|
||||
|
||||
Reference in new issue
Block a user