Update README.md
Browse files
README.md
CHANGED
@@ -72,7 +72,7 @@ def forward_text_with_templates(text, templates=TEMPLATES, normalize=True):
|
|
72 |
def classifier_zero_shot_with_pil(img, classes):
|
73 |
classifiers = torch.cat([forward_text_with_templates(c).reshape([1, -1]) for c in classes], axis=0)
|
74 |
img_features = forward_image(img)
|
75 |
-
scores = torch.matmul(img_features, classifiers.T)[0].cpu().numpy()
|
76 |
out = classes[np.argmax(scores)]
|
77 |
return out
|
78 |
###############################################################
|
|
|
72 |
def classifier_zero_shot_with_pil(img, classes):
|
73 |
classifiers = torch.cat([forward_text_with_templates(c).reshape([1, -1]) for c in classes], axis=0)
|
74 |
img_features = forward_image(img)
|
75 |
+
scores = torch.matmul(img_features, classifiers.T)[0].detach().cpu().numpy()
|
76 |
out = classes[np.argmax(scores)]
|
77 |
return out
|
78 |
###############################################################
|