lllyasviel/Fooocus · error · FaceWarpException
Not (0 <= inner_padding_factor <= 1.0)
Error message
Not (0 <= inner_padding_factor <= 1.0)
What it means
get_reference_facial_points validates that inner_padding_factor lies in [0, 1.0]; it controls how much margin is added inside the face crop, and values outside that range produce nonsensical geometry, so the function raises FaceWarpException before computing points.
Source
Thrown at extras/facexlib/detection/align_trans.py:77
# 0) make the inner region a square
if default_square:
size_diff = max(tmp_crop_size) - tmp_crop_size
tmp_5pts += size_diff / 2
tmp_crop_size += size_diff
if (output_size and output_size[0] == tmp_crop_size[0] and output_size[1] == tmp_crop_size[1]):
return tmp_5pts
if (inner_padding_factor == 0 and outer_padding == (0, 0)):
if output_size is None:
return tmp_5pts
else:
raise FaceWarpException('No paddings to do, output_size must be None or {}'.format(tmp_crop_size))
# check output size
if not (0 <= inner_padding_factor <= 1.0):
raise FaceWarpException('Not (0 <= inner_padding_factor <= 1.0)')
if ((inner_padding_factor > 0 or outer_padding[0] > 0 or outer_padding[1] > 0) and output_size is None):
output_size = tmp_crop_size * \
(1 + inner_padding_factor * 2).astype(np.int32)
output_size += np.array(outer_padding)
if not (outer_padding[0] < output_size[0] and outer_padding[1] < output_size[1]):
raise FaceWarpException('Not (outer_padding[0] < output_size[0] and outer_padding[1] < output_size[1])')
# 1) pad the inner region according inner_padding_factor
if inner_padding_factor > 0:
size_diff = tmp_crop_size * inner_padding_factor * 2
tmp_5pts += size_diff / 2
tmp_crop_size += np.round(size_diff).astype(np.int32)
# 2) resize the padded inner region
size_bf_outer_pad = np.array(output_size) - np.array(outer_padding) * 2
if size_bf_outer_pad[0] * tmp_crop_size[1] != size_bf_outer_pad[1] * tmp_crop_size[0]:View on GitHub (pinned to ae05379cc9)
Solutions
- Clamp/set inner_padding_factor to a value in [0.0, 1.0] (typical usage: 0.25 for 512x512 crops)
- Validate config values at load time: assert 0 <= inner_padding_factor <= 1
Example fix
// before get_reference_facial_points((512,512), inner_padding_factor=25, outer_padding=(0,0)) // after get_reference_facial_points((512,512), inner_padding_factor=0.25, outer_padding=(0,0))
Defensive patterns
Strategy: validation
Validate before calling
assert 0 <= inner_padding_factor <= 1.0, 'inner_padding_factor must be in [0, 1]'
Prevention
- Validate padding factors at config load
- Use fractions (0.25) not percentages (25)
- Reuse known-good presets (e.g. 0.25 for 512 crops)
When it happens
Trigger: Calling get_reference_facial_points with inner_padding_factor=-0.1 or 1.5; e.g. from a config where padding was specified as a percentage (25) instead of a fraction (0.25).
Common situations: Config units confusion (percent vs fraction); hand-tuning alignment margins; misreading GFPGAN example values.
Related errors
- No paddings to do, output_size must be None or {}
- Not (outer_padding[0] < output_size[0] and outer_padding[1]
- Must have (output_size - outer_padding)= some_scale * (crop_
- reference_pts.shape must be (K,2) or (2,K) and K>2
- facial_pts.shape must be (K,2) or (2,K) and K>2
AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15).
Data as JSON: /api/errors/696ec3d5936b8c8f.
Report an issue: GitHub.