Spaces:
Sleeping
Sleeping
Update faceless_processing.py
Browse files- faceless_processing.py +15 -19
faceless_processing.py
CHANGED
|
@@ -134,29 +134,25 @@ class LineartConfig:
|
|
| 134 |
lineart_detect_resolution: int = 1024
|
| 135 |
lineart_image_resolution: int = 1024
|
| 136 |
lineart_coarse: bool = False
|
|
|
|
| 137 |
|
| 138 |
-
# AJUSTE DE CABELO: Diminuído
|
| 139 |
-
|
| 140 |
-
lineart_min_perimeter: float = 4.0
|
| 141 |
|
| 142 |
-
#
|
| 143 |
-
# Preserva traços mais curtos que antes eram considerados "ruído".
|
| 144 |
-
lineart_min_perimeter: float = 2.5
|
| 145 |
-
|
| 146 |
-
# Diminuído de 3 para 2 para manter os traços mais próximos da borda.
|
| 147 |
interior_erode_size: int = 1
|
| 148 |
|
| 149 |
-
# AJUSTE GERAL: Afinado
|
| 150 |
interior_line_thickness: int = 1
|
| 151 |
|
| 152 |
# ---- Canny fallback params ----
|
| 153 |
-
canny_low: int =
|
| 154 |
-
canny_high: int =
|
| 155 |
bilateral_d: int = 11
|
| 156 |
bilateral_sigma_color: int = 110
|
| 157 |
bilateral_sigma_space: int = 110
|
| 158 |
gaussian_ksize: int = 11
|
| 159 |
-
min_contour_perimeter: float =
|
| 160 |
min_embroidery_stitch_px: int = 25
|
| 161 |
enable_detail_pass: bool = False
|
| 162 |
detail_canny_low: int = 15
|
|
@@ -176,9 +172,9 @@ class LineartConfig:
|
|
| 176 |
|
| 177 |
# Face erase ellipse
|
| 178 |
face_cx_ratio: float = 0.50
|
| 179 |
-
face_cy_ratio: float = 0.
|
| 180 |
-
face_rx_ratio: float = 0.
|
| 181 |
-
face_ry_ratio: float = 0.
|
| 182 |
face_erase_blur: int = 5
|
| 183 |
face_erase_threshold: int = 90
|
| 184 |
|
|
@@ -192,8 +188,8 @@ class LineartConfig:
|
|
| 192 |
eyebrow_dilate: int = 0
|
| 193 |
|
| 194 |
# Face shape
|
| 195 |
-
draw_face_oval: bool =
|
| 196 |
-
face_oval_thickness: int =
|
| 197 |
face_oval_skip_top_ratio: float = 0.18
|
| 198 |
|
| 199 |
|
|
@@ -484,7 +480,7 @@ def draw_eyebrows(rgb: np.ndarray, cfg: LineartConfig, faces: Optional[list] = N
|
|
| 484 |
172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109]
|
| 485 |
|
| 486 |
eyebrow_thickness = getattr(cfg, 'eyebrow_thickness', cfg.interior_line_thickness)
|
| 487 |
-
draw_oval =
|
| 488 |
oval_thickness = getattr(cfg, 'face_oval_thickness', 2)
|
| 489 |
oval_skip_top = getattr(cfg, 'face_oval_skip_top_ratio', 0.18)
|
| 490 |
drawn_centers_px: list = []
|
|
@@ -710,4 +706,4 @@ def build_faceless_embroidery_assets(img: Image.Image, cfg: Optional[LineartConf
|
|
| 710 |
cfg.negative_prompt = kwargs["negative_prompt"]
|
| 711 |
lineart = make_faceless_lineart(img, cfg)
|
| 712 |
cutout = make_faceless_cutout(img)
|
| 713 |
-
return lineart, cutout
|
|
|
|
| 134 |
lineart_detect_resolution: int = 1024
|
| 135 |
lineart_image_resolution: int = 1024
|
| 136 |
lineart_coarse: bool = False
|
| 137 |
+
lineart_threshold: int = 15
|
| 138 |
|
| 139 |
+
# AJUSTE DE CABELO E CORPO: Diminuído para capturar fios e dobras de roupa.
|
| 140 |
+
lineart_min_perimeter: float = 1.5
|
|
|
|
| 141 |
|
| 142 |
+
# Diminuído para manter os traços mais próximos da borda.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
interior_erode_size: int = 1
|
| 144 |
|
| 145 |
+
# AJUSTE GERAL: Afinado para traços internos mais delicados.
|
| 146 |
interior_line_thickness: int = 1
|
| 147 |
|
| 148 |
# ---- Canny fallback params ----
|
| 149 |
+
canny_low: int = 15
|
| 150 |
+
canny_high: int = 50
|
| 151 |
bilateral_d: int = 11
|
| 152 |
bilateral_sigma_color: int = 110
|
| 153 |
bilateral_sigma_space: int = 110
|
| 154 |
gaussian_ksize: int = 11
|
| 155 |
+
min_contour_perimeter: float = 15.0
|
| 156 |
min_embroidery_stitch_px: int = 25
|
| 157 |
enable_detail_pass: bool = False
|
| 158 |
detail_canny_low: int = 15
|
|
|
|
| 172 |
|
| 173 |
# Face erase ellipse
|
| 174 |
face_cx_ratio: float = 0.50
|
| 175 |
+
face_cy_ratio: float = 0.55
|
| 176 |
+
face_rx_ratio: float = 0.35
|
| 177 |
+
face_ry_ratio: float = 0.40
|
| 178 |
face_erase_blur: int = 5
|
| 179 |
face_erase_threshold: int = 90
|
| 180 |
|
|
|
|
| 188 |
eyebrow_dilate: int = 0
|
| 189 |
|
| 190 |
# Face shape
|
| 191 |
+
draw_face_oval: bool = True
|
| 192 |
+
face_oval_thickness: int = 1
|
| 193 |
face_oval_skip_top_ratio: float = 0.18
|
| 194 |
|
| 195 |
|
|
|
|
| 480 |
172, 58, 132, 93, 234, 127, 162, 21, 54, 103, 67, 109]
|
| 481 |
|
| 482 |
eyebrow_thickness = getattr(cfg, 'eyebrow_thickness', cfg.interior_line_thickness)
|
| 483 |
+
draw_oval = True
|
| 484 |
oval_thickness = getattr(cfg, 'face_oval_thickness', 2)
|
| 485 |
oval_skip_top = getattr(cfg, 'face_oval_skip_top_ratio', 0.18)
|
| 486 |
drawn_centers_px: list = []
|
|
|
|
| 706 |
cfg.negative_prompt = kwargs["negative_prompt"]
|
| 707 |
lineart = make_faceless_lineart(img, cfg)
|
| 708 |
cutout = make_faceless_cutout(img)
|
| 709 |
+
return lineart, cutout
|