Spaces:
Runtime error
Runtime error
Update Amodal3R/pipelines/Amodal3R_image_to_3d.py
Browse files
Amodal3R/pipelines/Amodal3R_image_to_3d.py
CHANGED
@@ -128,9 +128,9 @@ class Amodal3RImageTo3DPipeline(Pipeline):
|
|
128 |
output = Image.fromarray((output * 255).astype(np.uint8))
|
129 |
return output
|
130 |
|
131 |
-
def preprocess_image_w_mask(self, input
|
132 |
-
image =
|
133 |
-
mask_ori =
|
134 |
mask = (mask_ori < 127).astype(np.uint8)
|
135 |
if kernel_size > 0:
|
136 |
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kernel_size, kernel_size))
|
@@ -396,8 +396,8 @@ class Amodal3RImageTo3DPipeline(Pipeline):
|
|
396 |
@torch.no_grad()
|
397 |
def run_multi_image(
|
398 |
self,
|
399 |
-
images: List[
|
400 |
-
masks: List[
|
401 |
num_samples: int = 1,
|
402 |
seed: int = 42,
|
403 |
sparse_structure_sampler_params: dict = {},
|
|
|
128 |
output = Image.fromarray((output * 255).astype(np.uint8))
|
129 |
return output
|
130 |
|
131 |
+
def preprocess_image_w_mask(self, input, mask, kernel_size=3) -> Image.Image:
|
132 |
+
image = input.astype(np.float32) / 255
|
133 |
+
mask_ori = mask.astype(np.float32)
|
134 |
mask = (mask_ori < 127).astype(np.uint8)
|
135 |
if kernel_size > 0:
|
136 |
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kernel_size, kernel_size))
|
|
|
396 |
@torch.no_grad()
|
397 |
def run_multi_image(
|
398 |
self,
|
399 |
+
images: List[np.ndarray],
|
400 |
+
masks: List[np.ndarray],
|
401 |
num_samples: int = 1,
|
402 |
seed: int = 42,
|
403 |
sparse_structure_sampler_params: dict = {},
|