Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,9 +48,9 @@ def process_image(image, categories_to_hide):
|
|
| 48 |
if "Clothes" in categories_to_hide:
|
| 49 |
clothing_mask = np.isin(mask_data, grouped_mapping["Clothes"]).astype(np.uint8)
|
| 50 |
|
| 51 |
-
# Determine kernel size (
|
| 52 |
height, width = clothing_mask.shape
|
| 53 |
-
kernel_size = max(1, int(0.
|
| 54 |
kernel = np.ones((kernel_size, kernel_size), np.uint8)
|
| 55 |
|
| 56 |
# Dilate the clothing mask
|
|
|
|
| 48 |
if "Clothes" in categories_to_hide:
|
| 49 |
clothing_mask = np.isin(mask_data, grouped_mapping["Clothes"]).astype(np.uint8)
|
| 50 |
|
| 51 |
+
# Determine kernel size (3% of the smaller image dimension)
|
| 52 |
height, width = clothing_mask.shape
|
| 53 |
+
kernel_size = max(1, int(0.03 * min(height, width))) # Ensure at least 1 pixel
|
| 54 |
kernel = np.ones((kernel_size, kernel_size), np.uint8)
|
| 55 |
|
| 56 |
# Dilate the clothing mask
|