MCPcopy Index your code
hub / github.com/amazon-science/patchcore-inspection / embed

Method embed

src/patchcore/patchcore.py:79–89  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

77 self.featuresampler = featuresampler
78
79 def embed(self, data):
80 if isinstance(data, torch.utils.data.DataLoader):
81 features = []
82 for image in data:
83 if isinstance(image, dict):
84 image = image["image"]
85 with torch.no_grad():
86 input_image = image.to(torch.float).to(self.device)
87 features.append(self._embed(input_image))
88 return features
89 return self._embed(data)
90
91 def _embed(self, images, detach=True, provide_patch_shapes=False):
92 """Returns feature embeddings for images."""

Callers

nothing calls this directly

Calls 1

_embedMethod · 0.95

Tested by

no test coverage detected