Skip to content

Add support for NumPy 1.24.* #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions install.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
import launch
import platform
import sys

if sys.version_info < (3, 8):
launch.run_pip("install importlib-metadata", "importlib-metadata for depthmap script")
import importlib_metadata
else:
import importlib.metadata as importlib_metadata
if not launch.is_installed('packaging'):
launch.run_pip("install packaging", "packaging requirement for depthmap script")
from packaging.version import Version

if not launch.is_installed("timm"): #0.6.7
launch.run_pip("install --force-reinstall timm==0.6.12", "timm requirement for depthmap script")
launch.run_pip('install --force-reinstall "timm==0.6.12"', "timm requirement for depthmap script")

if not launch.is_installed("matplotlib"):
launch.run_pip("install matplotlib", "matplotlib requirement for depthmap script")

if not launch.is_installed("trimesh"):
launch.run_pip("install trimesh", "requirements for depthmap script")

if not launch.is_installed("numba"):
launch.run_pip("install numba", "numba requirement for depthmap script")
if not launch.is_installed("numba") or Version(importlib_metadata.version("numba")) < Version("0.57.0"):
launch.run_pip('install "numba>=0.57.0"', "numba requirement for depthmap script")
if not launch.is_installed("vispy"):
launch.run_pip("install vispy", "vispy requirement for depthmap script")

if not launch.is_installed("rembg"):
launch.run_pip("install rembg", "rembg requirement for depthmap script")

if not launch.is_installed("moviepy"):
launch.run_pip("install moviepy==1.0.2", "moviepy requirement for depthmap script")
launch.run_pip('install "moviepy==1.0.2"', "moviepy requirement for depthmap script")
if not launch.is_installed("transforms3d"):
launch.run_pip("install transforms3d", "transforms3d requirement for depthmap script")
if not launch.is_installed("imageio"): #2.4.1
launch.run_pip("install imageio", "imageio-ffmpeg requirement for depthmap script")
launch.run_pip("install imageio", "imageio requirement for depthmap script")
if not launch.is_installed("imageio-ffmpeg"):
launch.run_pip("install imageio-ffmpeg", "imageio-ffmpeg requirement for depthmap script")
if not launch.is_installed("networkx"):
launch.run_pip("install install networkx==2.5", "networkx requirement for depthmap script")
launch.run_pip('install install "networkx==2.5"', "networkx requirement for depthmap script")
if platform.system() == 'Windows':
if not launch.is_installed("pyqt5"):
launch.run_pip("install pyqt5", "pyqt5 requirement for depthmap script")

if platform.system() == 'Darwin':
if not launch.is_installed("pyqt6"):
launch.run_pip("install pyqt6", "pyqt6 requirement for depthmap script")
launch.run_pip("install pyqt6", "pyqt6 requirement for depthmap script")
4 changes: 2 additions & 2 deletions scripts/depthmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,10 +1582,10 @@ def calculateprocessingres(img, basesize, confidence=0.1, scale_threshold=3, who
grad[grad >= middle] = 1

# dilation kernel with size of the receptive field
kernel = np.ones((int(basesize/speed_scale), int(basesize/speed_scale)), np.float)
kernel = np.ones((int(basesize/speed_scale), int(basesize/speed_scale)), float)
# dilation kernel with size of the a quarter of receptive field used to compute k
# as described in section 6 of main paper
kernel2 = np.ones((int(basesize / (4*speed_scale)), int(basesize / (4*speed_scale))), np.float)
kernel2 = np.ones((int(basesize / (4*speed_scale)), int(basesize / (4*speed_scale))), float)

# Output resolution limit set by the whole_size_threshold and scale_threshold.
threshold = min(whole_size_threshold, scale_threshold * max(img.shape[:2]))
Expand Down