Skip to content

Commit

Permalink
better results with multiple reference images
Browse files Browse the repository at this point in the history
  • Loading branch information
matt3o committed Feb 12, 2024
1 parent 3182da9 commit 4872805
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions InstantID.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ def apply_instantid(self, instantid, insightface, image_features, model, positiv
raise Exception('Feature Extractor: No face detected.')

clip_embed = face_embed
# InstantID works better with averaged embeds (TODO:needs testing)
if clip_embed.shape[0] > 1:
clip_embed = torch.mean(clip_embed, dim=0).unsqueeze(0)

clip_embed_zeroed = torch.zeros_like(clip_embed)

clip_embeddings_dim = face_embed.shape[-1]
Expand Down

0 comments on commit 4872805

Please sign in to comment.