Spaces:
Running
on
Zero
Running
on
Zero
patrickligardes
commited on
Commit
β’
b38dc63
1
Parent(s):
1f866ad
Update utils_mask.py
Browse files- utils_mask.py +0 -9
utils_mask.py
CHANGED
@@ -77,7 +77,6 @@ def get_mask_location(model_type, category, model_parse: Image.Image, keypoint:
|
|
77 |
arms_left = (parse_array == 14).astype(np.float32)
|
78 |
arms_right = (parse_array == 15).astype(np.float32)
|
79 |
|
80 |
-
|
81 |
if category == 'dresses':
|
82 |
# Initial dress mask for the upper body
|
83 |
parse_mask_upper = (parse_array == 4).astype(np.float32) + (parse_array == 7).astype(np.float32)
|
@@ -91,14 +90,6 @@ def get_mask_location(model_type, category, model_parse: Image.Image, keypoint:
|
|
91 |
# Dilate the leg mask to ensure coverage and fill gaps
|
92 |
parse_mask_legs = cv2.dilate(parse_mask_legs.astype(np.uint8), np.ones((6, 6), np.uint8), iterations=6)
|
93 |
|
94 |
-
# Include legs mask in the fixed lower clothing mask
|
95 |
-
parser_mask_fixed_lower_cloth = np.logical_or(parse_mask_legs,
|
96 |
-
(parse_array == label_map["skirt"]).astype(np.float32) +
|
97 |
-
(parse_array == label_map["pants"]).astype(np.float32)).astype(np.float32)
|
98 |
-
|
99 |
-
# Add the fixed lower clothing mask to parser_mask_fixed
|
100 |
-
parser_mask_fixed += parser_mask_fixed_lower_cloth
|
101 |
-
|
102 |
# Combine the upper body mask with the leg mask
|
103 |
parse_mask = np.maximum(parse_mask_upper, parse_mask_legs)
|
104 |
|
|
|
77 |
arms_left = (parse_array == 14).astype(np.float32)
|
78 |
arms_right = (parse_array == 15).astype(np.float32)
|
79 |
|
|
|
80 |
if category == 'dresses':
|
81 |
# Initial dress mask for the upper body
|
82 |
parse_mask_upper = (parse_array == 4).astype(np.float32) + (parse_array == 7).astype(np.float32)
|
|
|
90 |
# Dilate the leg mask to ensure coverage and fill gaps
|
91 |
parse_mask_legs = cv2.dilate(parse_mask_legs.astype(np.uint8), np.ones((6, 6), np.uint8), iterations=6)
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
# Combine the upper body mask with the leg mask
|
94 |
parse_mask = np.maximum(parse_mask_upper, parse_mask_legs)
|
95 |
|