匿名x-vector选择

def _select_gan_vector(self, spk_vec: torch.Tensor):
i = 0
limit = 20
while i < limit:
idx = np.random.choice(self.unused_indices)
anon_vec = self.gan_vectors[idx]
sim = 1 - cosine(spk_vec.cpu().numpy(), anon_vec.cpu().numpy())
if sim < self.sim_threshold:
break
i += 1
self.unused_indices = self.unused_indices[self.unused_indices != idx]
posted on 2024-12-07 22:39  独上兰舟1  阅读(14)  评论(0)    收藏  举报