deepfakes/faceswap · error · FaceswapError
No faces were found in any of the frames passed in. Make sur
Error message
No faces were found in any of the frames passed in. Make sure you are passing in a frames source rather than extracted faces, and that you have provided the correct alignments file.
What it means
Preview tool filter failure: after filtering the input file list to frames whose basename appears in the alignments file with at least one face, the result is empty (an `assert retval` fails and is converted to FaceswapError). The tool needs frames with detected faces to build preview samples.
Source
Thrown at tools/preview/preview.py:368
"""Get a list of files for the input, filtering out those frames which do
not contain faces.
Returns
-------
list
A list of filenames of frames that contain faces.
"""
logger.debug("Filtering file list to frames with faces")
retval = [filename for filename in self._images.file_list
if self._alignments.frame_has_faces(os.path.basename(filename))]
logger.debug("Filtered out frames: %s", self._images.count - len(retval))
try:
assert retval
except AssertionError as err:
msg = ("No faces were found in any of the frames passed in. Make sure you are passing "
"in a frames source rather than extracted faces, and that you have provided "
"the correct alignments file.")
raise FaceswapError(msg) from err
return retval
def _get_indices(self) -> list[list[int]]:
"""Get indices for each sample group.
Obtain :attr:`self.sample_size` evenly sized groups of indices
pertaining to the filtered :attr:`self._file_list`
Returns
-------
list of indices relating to the filtered file list, split into groups
"""
# Remove start and end values to get a list divisible by self.sample_size
no_files = len(self._filelist)
self._sample_size = min(self._sample_size, no_files)
crop = no_files % self._sample_size
top_tail = list(range(no_files))[
crop // 2:no_files - (crop - (crop // 2))]View on GitHub (pinned to f530cb7508)
Solutions
- Point -i at the original frames folder that was extracted, and -a at the matching alignments file.
- If you renamed/moved frames, re-extract or restore original filenames so they match alignments keys.
- Confirm the alignments actually contain faces: `python tools.py alignments -j spans -a <file>` or open it in the Alignment tool.
Example fix
# before python tools.py preview -i aligned_faces/ -a alignments.fsa # faces dir has no matching frame keys # after python tools.py preview -i original_frames/ -a alignments.fsa
Defensive patterns
Strategy: validation
Validate before calling
import os
from lib.align import Alignments
def frames_have_faces(input_dir: str, alignments_file: str) -> bool:
al = Alignments(alignments_file)
return any(
al.frame_has_faces(os.path.basename(f))
for f in os.listdir(input_dir)
) Try / catch
from lib.exceptions import FaceswapError
try:
preview.run()
except FaceswapError as err:
if "No faces were found" in str(err):
raise SystemExit("Use the frames folder and matching alignments file") from err
raise Prevention
- Only run preview with the original frames directory plus the alignments file generated from it.
- Don't rename frames between extract and preview — preview matches by basename.
When it happens
Trigger: Running `python tools.py preview -i <frames_or_faces> -a <alignments>` where no input filename matches a frame key with faces in the alignments — classically when -i points at the extracted faces folder instead of the frames folder, or the alignments file belongs to a different video/folder than the images supplied.
Common situations: Passing the aligned-faces directory as input; using an alignments file from another video (filename mismatch); alignments generated before any faces were detected; renaming frames after extraction.
Related errors
- You have selected the mask type '{mask_type}' but at least o
- There is a mismatch between the number of frames found in th
- The given shape {shape} is not valid. Valid shapes: {list(sh
- Dictionary keys {sorted(inbound)} should be a subset of data
- '{method}' is not a valid clipping method. Select from {list
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/a16315c85e10a5c4.
Report an issue: GitHub.