lllyasviel/Fooocus · error · FaceWarpException
Not (outer_padding[0] < output_size[0] and outer_padding[1]
Error message
Not (outer_padding[0] < output_size[0] and outer_padding[1] < output_size[1])
What it means
After optional auto-computation of output_size, get_reference_facial_points requires each outer_padding component to be strictly smaller than the corresponding output_size component, otherwise the crop region would be empty or negative. Violating this raises FaceWarpException.
Source
Thrown at extras/facexlib/detection/align_trans.py:84
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]:
raise FaceWarpException('Must have (output_size - outer_padding)'
'= some_scale * (crop_size * (1.0 + inner_padding_factor)')
scale_factor = size_bf_outer_pad[0].astype(np.float32) / tmp_crop_size[0]
tmp_5pts = tmp_5pts * scale_factor
# size_diff = tmp_crop_size * (scale_factor - min(scale_factor))
# tmp_5pts = tmp_5pts + size_diff / 2View on GitHub (pinned to ae05379cc9)
Solutions
- Reduce outer_padding so each component is strictly less than the corresponding output_size component
- Scale padding proportionally when changing crop/output size
- Or set output_size explicitly large enough: output_size > 2*outer_padding + padded crop
Example fix
// before get_reference_facial_points((256,256), 0.25, (200,200), False, output_size=(256,256)) // after get_reference_facial_points((256,256), 0.25, (16,16), False, output_size=(320,320))
Defensive patterns
Strategy: validation
Validate before calling
assert outer_padding[0] < output_size[0] and outer_padding[1] < output_size[1], \
'outer_padding must be strictly smaller than output_size' Prevention
- Scale padding when changing crop/output sizes
- Keep outer padding small relative to output (e.g. < 10%)
- Leave output_size None to auto-derive a consistent value
When it happens
Trigger: Calling with outer_padding=(400,400) and output_size=(512,512) — padding is not less than the size; or a small crop_size with zero inner padding that auto-computes an output_size smaller than the requested outer padding.
Common situations: Scaling alignment parameters from a 512-crop pipeline down to smaller crops (e.g. 256) without scaling the outer padding; typo'd padding values; mixing up (x,y) vs (y,x) conventions leading to oversized padding.
Related errors
- No paddings to do, output_size must be None or {}
- Not (0 <= inner_padding_factor <= 1.0)
- 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/27202e20caeda4b4.
Report an issue: GitHub.