Created
May 7, 2022 07:59
-
-
Save sachadee/e1482b17e5487fea66df8e8479f00e75 to your computer and use it in GitHub Desktop.
arcfaceproblem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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