This commit provides a more robust fix for the RuntimeWarning (invalid value encountered in divide/cast) that could occur in the `apply_mouth_area` function within `modules/processors/frame/face_swapper.py`. The previous check for `feathered_mask.max() == 0` was not sufficient for all floating point edge cases. The updated logic now: - Checks if `feathered_mask.max()` is less than a small epsilon (1e-6). - If true, it logs a warning and explicitly sets `feathered_mask` to an all-zero `uint8` array of the correct shape. - Otherwise, it proceeds with the normalization and casting to `uint8`. This ensures that division by zero or by extremely small numbers is prevented, and the `feathered_mask` is always in a valid state for subsequent blending operations. |
||
---|---|---|
.. | ||
frame | ||
__init__.py |