MCPcopy Create free account
hub / github.com/amazon-science/patchcore-inspection / __init__

Method __init__

src/patchcore/common.py:15–24  ·  view source on GitHub ↗

FAISS Nearest neighbourhood search. Args: on_gpu: If set true, nearest neighbour searches are done on GPU. num_workers: Number of workers to use with FAISS for similarity search.

(self, on_gpu: bool = False, num_workers: int = 4)

Source from the content-addressed store, hash-verified

13
14class FaissNN(object):
15 def __init__(self, on_gpu: bool = False, num_workers: int = 4) -> None:
16 """FAISS Nearest neighbourhood search.
17
18 Args:
19 on_gpu: If set true, nearest neighbour searches are done on GPU.
20 num_workers: Number of workers to use with FAISS for similarity search.
21 """
22 faiss.omp_set_num_threads(num_workers)
23 self.on_gpu = on_gpu
24 self.search_index = None
25
26 def _gpu_cloner_options(self):
27 return faiss.GpuClonerOptions()

Callers 4

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected