4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 10:34:29 +08:00

Update dependencies for M1 Macs (#2665)

* Update dependencies for M1 Macs

* import newrawpy as rawpy

* Comment

* Add back rawpy for Linux

* Run black
This commit is contained in:
Brent Yi 2023-12-11 18:08:17 +00:00 committed by GitHub
parent 390b63373d
commit 73fc3dcd63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -24,9 +24,13 @@ from typing import List, Literal, Optional, OrderedDict, Tuple, Union
import cv2
import imageio
import numpy as np
import rawpy
try:
import rawpy
except ImportError:
import newrawpy as rawpy # type: ignore
import numpy as np
from nerfstudio.utils.rich_utils import CONSOLE, status
from nerfstudio.utils.scripts import run_command
@ -352,7 +356,11 @@ def copy_and_upscale_polycam_depth_maps_list(
depth_dir.mkdir(parents=True, exist_ok=True)
# copy and upscale them to new directory
with status(msg="[bold yellow] Upscaling depth maps...", spinner="growVertical", verbose=verbose):
with status(
msg="[bold yellow] Upscaling depth maps...",
spinner="growVertical",
verbose=verbose,
):
upscale_factor = 2**POLYCAM_UPSCALING_TIMES
assert upscale_factor > 1
assert isinstance(upscale_factor, int)
@ -437,7 +445,11 @@ def downscale_images(
if num_downscales == 0:
return "No downscaling performed."
with status(msg="[bold yellow]Downscaling images...", spinner="growVertical", verbose=verbose):
with status(
msg="[bold yellow]Downscaling images...",
spinner="growVertical",
verbose=verbose,
):
downscale_factors = [2**i for i in range(num_downscales + 1)[1:]]
for downscale_factor in downscale_factors:
assert downscale_factor > 1
@ -600,7 +612,10 @@ def generate_crop_mask(height: int, width: int, crop_factor: Tuple[float, float,
def generate_mask(
height: int, width: int, crop_factor: Tuple[float, float, float, float], percent_radius: float
height: int,
width: int,
crop_factor: Tuple[float, float, float, float],
percent_radius: float,
) -> Optional[np.ndarray]:
"""generate a mask of the given size.

View File

@ -39,11 +39,14 @@ dependencies = [
"protobuf<=3.20.3,!=3.20.0",
# TODO(1480) enable when pycolmap windows wheels are available
# "pycolmap==0.3.0",
"pymeshlab>=2022.2.post2",
"pymeshlab>=2022.2.post2; platform_machine != 'arm64'",
"pyngrok>=5.1.0",
"python-socketio>=5.7.1",
"pyquaternion>=0.9.9",
"rawpy>=0.18.1",
# TODO we can switch back to (non-new) rawpy if they start releasing arm64
# wheels. https://github.com/letmaik/rawpy/issues/171#issuecomment-1572627747
"rawpy>=0.18.1; platform_machine != 'arm64'",
"newrawpy>=0.18.1; platform_machine == 'arm64'",
"requests",
"rich>=12.5.1",
"scikit-image>=0.19.3",