mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-23 08:05:28 +08:00
Fix core tests with Pillow>=10.3.0 (#3034)
This commit is contained in:
3 files changed
+4
-4
No files matched your search
@@ -30,7 +30,7 @@ def get_image_mask_tensor_from_path(filepath: Path, scale_factor: float = 1.0) -
|
||||
if scale_factor != 1.0:
|
||||
width, height = pil_mask.size
|
||||
newsize = (int(width * scale_factor), int(height * scale_factor))
|
||||
pil_mask = pil_mask.resize(newsize, resample=Image.NEAREST)
|
||||
pil_mask = pil_mask.resize(newsize, resample=Image.Resampling.NEAREST)
|
||||
mask_tensor = torch.from_numpy(np.array(pil_mask)).unsqueeze(-1).bool()
|
||||
if len(mask_tensor.shape) != 3:
|
||||
raise ValueError("The mask image should have 1 channel")
|
||||
@@ -50,7 +50,7 @@ def get_semantics_and_mask_tensors_from_path(
|
||||
if scale_factor != 1.0:
|
||||
width, height = pil_image.size
|
||||
newsize = (int(width * scale_factor), int(height * scale_factor))
|
||||
pil_image = pil_image.resize(newsize, resample=Image.NEAREST)
|
||||
pil_image = pil_image.resize(newsize, resample=Image.Resampling.NEAREST)
|
||||
semantics = torch.from_numpy(np.array(pil_image, dtype="int64"))[..., None]
|
||||
mask = torch.sum(semantics == mask_indices, dim=-1, keepdim=True) == 0
|
||||
return semantics, mask
|
||||
|
||||
Reference in new issue
Block a user