Compute image CLIP embedding.
(self, rgb_img)
| 42 | return text_features.cpu().numpy() |
| 43 | |
| 44 | def process_and_encode_image(self, rgb_img): |
| 45 | """Compute image CLIP embedding.""" |
| 46 | pil_img = Image.fromarray(rgb_img) |
| 47 | image = self.preprocess(pil_img).unsqueeze(0).to(self.device) |
| 48 | |
| 49 | with torch.no_grad(): |
| 50 | return np.squeeze(self.model.encode_image(image).cpu().numpy()) |
| 51 | |
| 52 | |
| 53 | def compute_sim_to_tasks(v1, v2, canonical_features=None, use_lerf_canonical=True): |
nothing calls this directly
no outgoing calls
no test coverage detected