Skip to content

Instantly share code, notes, and snippets.

@sachadee
Created May 7, 2022 07:59
Show Gist options
  • Save sachadee/e1482b17e5487fea66df8e8479f00e75 to your computer and use it in GitHub Desktop.
Save sachadee/e1482b17e5487fea66df8e8479f00e75 to your computer and use it in GitHub Desktop.
arcfaceproblem
# get embedding for each face
embeddings = np.zeros([len(loader.dataset), embedding_size])
with torch.no_grad():
for idx, (image, _) in enumerate(
tqdm(loader, desc="Create embeddings matrix", total=len(loader)),
):
print(idx)
embeddings[idx, :] = F.normalize(backbone(image.to(device))).cpu()
tensor_to_pil = transforms.ToPILImage()(image.squeeze_(0)).convert('RGB')
tensor_to_pil.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment