MCPcopy Create free account
hub / github.com/MIT-SPARK/Clio / process_and_encode_image

Method process_and_encode_image

clio_batch/helpers.py:44–50  ·  view source on GitHub ↗

Compute image CLIP embedding.

(self, rgb_img)

Source from the content-addressed store, hash-verified

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
53def compute_sim_to_tasks(v1, v2, canonical_features=None, use_lerf_canonical=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected