Spaces:
Sleeping
Sleeping
Commit
·
eca4597
1
Parent(s):
7143bfc
changes
Browse files
soundimage/utils/image_processor.py
CHANGED
@@ -65,11 +65,11 @@ class ImageProcessor:
|
|
65 |
|
66 |
def load_fixed_mask(resolution: int, mask_path: str) -> torch.Tensor:
|
67 |
print(f"Loading fixed mask from {mask_path}")
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
return
|
73 |
|
74 |
def detect_facial_landmarks(self, image: np.ndarray):
|
75 |
height, width, _ = image.shape
|
|
|
65 |
|
66 |
def load_fixed_mask(resolution: int, mask_path: str) -> torch.Tensor:
|
67 |
print(f"Loading fixed mask from {mask_path}")
|
68 |
+
mask_loaded_image = cv2.imread(mask_path)
|
69 |
+
mask_loaded_image = cv2.cvtColor(mask_loaded_image, cv2.COLOR_BGR2RGB)
|
70 |
+
mask_loaded_image = cv2.resize(mask_loaded_image, (resolution, resolution), interpolation=cv2.INTER_AREA) / 255.0
|
71 |
+
mask_loaded_image = rearrange(torch.from_numpy(mask_loaded_image), "h w c -> c h w")
|
72 |
+
return mask_loaded_image
|
73 |
|
74 |
def detect_facial_landmarks(self, image: np.ndarray):
|
75 |
height, width, _ = image.shape
|