deepfakes/faceswap · error · FaceswapError
Too many identities: {num_identities}. Max: {len(identities)
Error message
Too many identities: {num_identities}. Max: {len(identities)} What it means
Identity labels are built from single characters: A-Z (26), then 0-9 (10), then a-z (26), capping at 62 concurrent identities. If the number of detected identities in the dataset exceeds 62, this FaceswapError aborts label assignment. It reflects a hard design limit of the labelling scheme, not a resource issue.
Source
Thrown at lib/training/data/data_set.py:72
----------
index
The index of the current label
num_identities
The number of identities that belong to the label set
next_identity
``True`` to return the next identity for the given index. Default: ``False``
Returns
-------
The current or next label. Labels go A-Z,0-9,a-z
"""
identities = [chr(i) for i in range(65, 65 + 26)]
if num_identities > len(identities):
identities += [chr(i) for i in range(48, 48 + 10)]
if num_identities > len(identities):
identities += [chr(i) for i in range(97, 97 + 26)]
if num_identities > len(identities):
raise FaceswapError(f"Too many identities: {num_identities}. Max: {len(identities)}")
identities = identities[:num_identities]
index = index % num_identities
if not next_identity:
return identities[index]
index += 1 if index + 1 < num_identities else -index
return identities[index]
def get_sorted_images(folder: str) -> list[str]:
"""For the given folder return the sorted list of potential training images
Parameters
----------
folder
The folder containing faceswap training images
Returns
-------View on GitHub (pinned to f530cb7508)
Solutions
- Reduce the number of identities: raise the clustering distance/threshold so nearby faces merge.
- Split the dataset into subsets of <=62 identities and process separately.
- Filter out low-face-count identity clusters (noise) before labelling.
Example fix
# identity plugin config # before identity_threshold = 0.3 # over-splits -> 80 identities -> FaceswapError # after identity_threshold = 0.6 # merges clusters under 62 identities
Defensive patterns
Strategy: validation
Validate before calling
MAX_IDENTITIES = 62
assert num_identities <= MAX_IDENTITIES, \
f'{num_identities} identities exceeds label limit {MAX_IDENTITIES}; raise threshold or split data' Type guard
def within_identity_limit(n: int) -> bool:
return isinstance(n, int) and 0 < n <= 62 Try / catch
try:
label = get_identity_label(num_identities, index)
except FaceswapError as err:
if 'Too many identities' in str(err):
raise SystemExit('raise identity_threshold or split the dataset')
raise Prevention
- Tune the identity clustering threshold so clusters stay under 62.
- Prune single-face noise clusters before labelling.
- Split very large multi-person datasets into per-group runs.
When it happens
Trigger: Running identity-aware training/sorting on a dataset clustering into more than 62 distinct identities; identity threshold set low enough that noise creates many small clusters.
Common situations: Large multi-person datasets (crowd footage, celebrity sets) in identity plugin usage; overly-sensitive clustering producing spurious extra identities.
Related errors
- Not enough RAM available to sort faces. Try reducing the siz
- No display detected. GUI mode has been disabled.
- Config file does not exist at: {ini_path}
- [{self._name}] List values should be set as a Str or List. G
- [{self._name}] Expected {self.datatype} got {type(value)} ({
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/d2af322650b1848d.
Report an issue: GitHub.