Spaces:
Running
Running
File size: 576 Bytes
9efad20 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import numpy as np
class FaceSet:
faces = []
ref_images = []
embedding_average = 'None'
embeddings_backup = None
def __init__(self):
self.faces = []
self.ref_images = []
self.embeddings_backup = None
def AverageEmbeddings(self):
if len(self.faces) > 1 and self.embeddings_backup is None:
self.embeddings_backup = self.faces[0]['embedding']
embeddings = [face.embedding for face in self.faces]
self.faces[0]['embedding'] = np.mean(embeddings, axis=0)
# try median too?
|