Spaces:
Runtime error
Runtime error
test: full body added
Browse files- app.py +1 -1
- utils_mask.py +14 -0
app.py
CHANGED
|
@@ -270,7 +270,7 @@ with image_blocks as demo:
|
|
| 270 |
with gr.Row():
|
| 271 |
is_checked_crop = gr.Checkbox(label="Yes", info="Use auto-crop & resizing",value=False)
|
| 272 |
with gr.Row():
|
| 273 |
-
mask_area = gr.Radio(['upper_body', 'lower_body', 'dresses'], label="mask area", info="select what part to mask")
|
| 274 |
|
| 275 |
example = gr.Examples(
|
| 276 |
inputs=imgs,
|
|
|
|
| 270 |
with gr.Row():
|
| 271 |
is_checked_crop = gr.Checkbox(label="Yes", info="Use auto-crop & resizing",value=False)
|
| 272 |
with gr.Row():
|
| 273 |
+
mask_area = gr.Radio(['upper_body', 'lower_body', 'dresses','full_body'], label="mask area", info="select what part to mask")
|
| 274 |
|
| 275 |
example = gr.Examples(
|
| 276 |
inputs=imgs,
|
utils_mask.py
CHANGED
|
@@ -100,6 +100,20 @@ def get_mask_location(model_type, category, model_parse: Image.Image, keypoint:
|
|
| 100 |
(parse_array == 14).astype(np.float32) + \
|
| 101 |
(parse_array == 15).astype(np.float32)
|
| 102 |
parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
else:
|
| 104 |
raise NotImplementedError
|
| 105 |
|
|
|
|
| 100 |
(parse_array == 14).astype(np.float32) + \
|
| 101 |
(parse_array == 15).astype(np.float32)
|
| 102 |
parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed))
|
| 103 |
+
elif category == 'full_body':
|
| 104 |
+
parse_mask = (parse_array == 4).astype(np.float32) + \
|
| 105 |
+
(parse_array == 7).astype(np.float32)+ \
|
| 106 |
+
(parse_array == 6).astype(np.float32) + \
|
| 107 |
+
(parse_array == 12).astype(np.float32) + \
|
| 108 |
+
(parse_array == 13).astype(np.float32) + \
|
| 109 |
+
(parse_array == 5).astype(np.float32)
|
| 110 |
+
parser_mask_fixed += (parse_array == label_map["skirt"]).astype(np.float32) + \
|
| 111 |
+
(parse_array == label_map["pants"]).astype(np.float32) + \
|
| 112 |
+
(parse_array == label_map["upper_clothes"]).astype(np.float32) + \
|
| 113 |
+
(parse_array == 14).astype(np.float32) + \
|
| 114 |
+
(parse_array == 15).astype(np.float32)
|
| 115 |
+
parser_mask_changeable += np.logical_and(parse_array, np.logical_not(parser_mask_fixed))
|
| 116 |
+
|
| 117 |
else:
|
| 118 |
raise NotImplementedError
|
| 119 |
|