Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shijianjian committed Sep 8, 2024
1 parent 4b70885 commit 6790ed1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions kornia/contrib/object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,12 @@ def forward(self, imgs: Union[Tensor, list[Tensor]]) -> tuple[Tensor, Tensor]:
resized_imgs: list[Tensor] = []

iters = len(imgs) if isinstance(imgs, list) else imgs.shape[0]
original_sizes = imgs.new_zeros((iters, 2))
original_sizes = imgs[0].new_zeros((iters, 2))
for i in range(iters):
img = imgs[i]
original_sizes[i, 0] = img.shape[-2] # Height
original_sizes[i, 1] = img.shape[-1] # Width
resized_imgs.append(
# TODO: fix kornia resize warnings
resize(img[None], size=self.size, interpolation=self.interpolation_mode)
)
return concatenate(resized_imgs), original_sizes
Expand Down
6 changes: 3 additions & 3 deletions kornia/core/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, module_name: str) -> None:

def _install_package(self, module_name: str) -> None:
logger.info(f"Installing `{self.module_name}` ...")
subprocess.run(["pip", "install", "-U", self.module_name], check=False)
subprocess.run(["pip", "install", "-U", self.module_name], shell=False)

def _load(self) -> None:
"""Loads the module if it hasn't been loaded yet.
Expand All @@ -52,10 +52,10 @@ def _load(self) -> None:
"Do you wish to install the dependency? [Y]es, [N]o, [A]ll."
)
if if_install.lower() == "y":
subprocess.run(["pip", "install", "-U", self.module_name], check=False)
self._install_package(self.module_name)
elif if_install.lower() == "a":
subprocess.run(["pip", "install", "-U", self.module_name], check=False)
self.auto_install = True
self._install_package(self.module_name)
else:
raise ImportError(
f"Optional dependency '{self.module_name}' is not installed. "
Expand Down

0 comments on commit 6790ed1

Please sign in to comment.