Spaces:
Sleeping
Sleeping
Update faceless_processing.py
Browse files- faceless_processing.py +5 -2
faceless_processing.py
CHANGED
|
@@ -137,7 +137,7 @@ class LineartConfig:
|
|
| 137 |
lineart_threshold: int = 35
|
| 138 |
|
| 139 |
# AJUSTE DE CABELO E CORPO: Diminu铆do para capturar fios e dobras de roupa.
|
| 140 |
-
lineart_min_perimeter: float =
|
| 141 |
|
| 142 |
# Diminu铆do para manter os tra莽os mais pr贸ximos da borda.
|
| 143 |
interior_erode_size: int = 1
|
|
@@ -149,7 +149,7 @@ class LineartConfig:
|
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
-
|
| 153 |
|
| 154 |
# ---- Canny fallback parametros ----
|
| 155 |
canny_low: int = 35
|
|
@@ -264,6 +264,7 @@ def detect_faces(rgb: np.ndarray, cfg: LineartConfig) -> list:
|
|
| 264 |
faces = sorted(faces, key=lambda f: f[2] * f[3], reverse=True)[:max_faces]
|
| 265 |
return faces
|
| 266 |
|
|
|
|
| 267 |
|
| 268 |
def build_subject_mask(rgb: np.ndarray, cfg: LineartConfig, alpha_channel: Optional[np.ndarray] = None) -> np.ndarray:
|
| 269 |
if alpha_channel is not None:
|
|
@@ -291,6 +292,8 @@ def _smooth_contour_spline(cnt: np.ndarray, n_points: int = 400) -> Optional[np.
|
|
| 291 |
spline_pts = np.stack([x_new, y_new], axis=1).astype(np.int32)
|
| 292 |
return spline_pts.reshape((-1, 1, 2))
|
| 293 |
except Exception:
|
|
|
|
|
|
|
| 294 |
return None
|
| 295 |
|
| 296 |
|
|
|
|
| 137 |
lineart_threshold: int = 35
|
| 138 |
|
| 139 |
# AJUSTE DE CABELO E CORPO: Diminu铆do para capturar fios e dobras de roupa.
|
| 140 |
+
lineart_min_perimeter: float = 3.0
|
| 141 |
|
| 142 |
# Diminu铆do para manter os tra莽os mais pr贸ximos da borda.
|
| 143 |
interior_erode_size: int = 1
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
+
|
| 153 |
|
| 154 |
# ---- Canny fallback parametros ----
|
| 155 |
canny_low: int = 35
|
|
|
|
| 264 |
faces = sorted(faces, key=lambda f: f[2] * f[3], reverse=True)[:max_faces]
|
| 265 |
return faces
|
| 266 |
|
| 267 |
+
|
| 268 |
|
| 269 |
def build_subject_mask(rgb: np.ndarray, cfg: LineartConfig, alpha_channel: Optional[np.ndarray] = None) -> np.ndarray:
|
| 270 |
if alpha_channel is not None:
|
|
|
|
| 292 |
spline_pts = np.stack([x_new, y_new], axis=1).astype(np.int32)
|
| 293 |
return spline_pts.reshape((-1, 1, 2))
|
| 294 |
except Exception:
|
| 295 |
+
|
| 296 |
+
|
| 297 |
return None
|
| 298 |
|
| 299 |
|