Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/amazon-science/patchcore-inspection
/ functions
Functions
132 in github.com/amazon-science/patchcore-inspection
⨍
Functions
132
◇
Types & classes
22
↳
Endpoints
3
↓ 19 callers
Method
run
Returns distances and indices of nearest neighbour search. Args: query_features: Features to retrieve. index
src/patchcore/common.py:66
↓ 9 callers
Method
fit
Adds features to the FAISS search index. Args: features: Array of size NxD.
src/patchcore/common.py:50
↓ 9 callers
Method
merge
(self, features: list)
src/patchcore/common.py:124
↓ 8 callers
Method
predict
(self, data)
src/patchcore/patchcore.py:178
↓ 6 callers
Method
load
( self, backbone, layers_to_extract_from, device, input_shape,
src/patchcore/patchcore.py:25
↓ 5 callers
Function
_dummy_features
(feature_dimension)
test/test_sampler.py:8
↓ 4 callers
Method
__init__
FAISS Nearest neighbourhood search. Args: on_gpu: If set true, nearest neighbour searches are done on GPU. num_worker
src/patchcore/common.py:15
↓ 4 callers
Method
_embed
Returns feature embeddings for images.
src/patchcore/patchcore.py:91
↓ 4 callers
Function
_standard_patchcore
(image_dimension)
test/test_patchcore.py:43
↓ 4 callers
Method
load
(self, filename: str)
src/patchcore/common.py:91
↓ 3 callers
Method
__init__
(self, percentage: float)
src/patchcore/sampler.py:17
↓ 3 callers
Method
_compute_batchwise_differences
Computes batchwise Euclidean distances using PyTorch.
src/patchcore/sampler.py:81
↓ 3 callers
Method
_detection_file
(folder, prepend="")
src/patchcore/common.py:353
↓ 3 callers
Function
_dummy_constant_dataloader
(number_of_examples, shape_of_examples)
test/test_patchcore.py:15
↓ 3 callers
Method
load_from_path
( self, load_path: str, device: torch.device, nn_method: patchcore.common.Fais
src/patchcore/patchcore.py:256
↓ 3 callers
Method
save
(self, filename: str)
src/patchcore/common.py:88
↓ 2 callers
Method
_create_index
(self, dimension)
src/patchcore/common.py:43
↓ 2 callers
Function
_dummy_various_dataloader
(number_of_examples, shape_of_examples)
test/test_patchcore.py:28
↓ 2 callers
Method
_index_file
(folder, prepend="")
src/patchcore/common.py:357
↓ 2 callers
Method
_index_to_gpu
(self, index)
src/patchcore/common.py:29
↓ 2 callers
Method
_params_file
(filepath, prepend="")
src/patchcore/patchcore.py:231
↓ 2 callers
Method
_predict
Infer score and mask for a batch of images.
src/patchcore/patchcore.py:203
↓ 2 callers
Method
_train
(self, _index, _features)
src/patchcore/common.py:63
↓ 2 callers
Method
reset_index
(self)
src/patchcore/common.py:94
↓ 2 callers
Method
save_to_path
(self, save_path: str, prepend: str = "")
src/patchcore/patchcore.py:234
↓ 2 callers
Method
unpatch_scores
(self, x, batchsize)
src/patchcore/patchcore.py:310
↓ 1 callers
Function
_approximate_greedycoreset_sampler_with_reduction
( sampling_percentage, johnsonlindenstrauss_dim )
test/test_patchcore.py:72
↓ 1 callers
Method
_compute_greedy_coreset_indices
Runs iterative greedy coreset selection. Args: features: [NxD] input feature bank to sample.
src/patchcore/sampler.py:91
↓ 1 callers
Function
_dummy_constant_features
(number_of_examples, feature_dimension)
test/test_sampler.py:17
↓ 1 callers
Function
_dummy_features
(number_of_examples, shape_of_examples)
test/test_patchcore.py:9
↓ 1 callers
Function
_dummy_images
(number_of_examples, image_shape)
test/test_patchcore.py:33
↓ 1 callers
Function
_dummy_various_features
(number_of_examples, shape_of_examples)
test/test_patchcore.py:20
↓ 1 callers
Method
_fill_memory_bank
Computes and sets the support features for SPADE.
src/patchcore/patchcore.py:155
↓ 1 callers
Method
_gpu_cloner_options
(self)
src/patchcore/common.py:26
↓ 1 callers
Method
_index_to_cpu
(self, index)
src/patchcore/common.py:38
↓ 1 callers
Method
_load
(filename: str)
src/patchcore/common.py:368
↓ 1 callers
Method
_predict_dataloader
This function provides anomaly scores/maps for full dataloaders.
src/patchcore/patchcore.py:183
↓ 1 callers
Method
_reduce
(features)
src/patchcore/common.py:140
↓ 1 callers
Method
_reduce_features
(self, features)
src/patchcore/sampler.py:52
↓ 1 callers
Method
_restore_type
(self, features: torch.Tensor)
src/patchcore/sampler.py:33
↓ 1 callers
Method
_save
(filename, features)
src/patchcore/common.py:361
↓ 1 callers
Method
_store_type
(self, features: Union[torch.Tensor, np.ndarray])
src/patchcore/sampler.py:28
↓ 1 callers
Method
convert_to_segmentation
(self, patch_scores)
src/patchcore/common.py:192
↓ 1 callers
Method
feature_dimensions
Computes the feature dimensions for all layers given input_shape.
src/patchcore/common.py:270
↓ 1 callers
Method
fit
PatchCore training. This function computes the embeddings of the training data and fills the memory bank of SPADE.
src/patchcore/patchcore.py:147
↓ 1 callers
Method
get_image_data
(self)
src/patchcore/datasets/mvtec.py:115
↓ 1 callers
Function
image_transform
(image)
bin/run_patchcore.py:147
↓ 1 callers
Function
main
(**kwargs)
bin/load_and_evaluate_patchcore.py:27
↓ 1 callers
Function
main
(**kwargs)
bin/run_patchcore.py:30
↓ 1 callers
Function
mask_transform
(mask)
bin/run_patchcore.py:159
↓ 1 callers
Method
patchify
Convert a tensor into a tensor of respective patches. Args: x: [torch.Tensor, bs x c x w x h] Returns: x: [tor
src/patchcore/patchcore.py:282
↓ 1 callers
Method
run
Subsamples features using Greedy Coreset. Args: features: [N x D]
src/patchcore/sampler.py:62
↓ 1 callers
Method
run
Randomly samples input feature collection. Args: features: [N x D]
src/patchcore/sampler.py:178
↓ 1 callers
Method
save
( self, save_folder: str, save_features_separately: bool = False, prepend: str
src/patchcore/common.py:372
↓ 1 callers
Method
score
(self, x)
src/patchcore/patchcore.py:313
Method
__call__
(self, module, input, output)
src/patchcore/common.py:285
Method
__getitem__
(self, idx)
src/patchcore/datasets/mvtec.py:91
Method
__init__
PatchCore anomaly detection class.
src/patchcore/patchcore.py:20
Method
__init__
(self, patchsize, stride=None)
src/patchcore/patchcore.py:278
Method
__init__
Merges feature embedding by name.
src/patchcore/common.py:121
Method
__init__
(self, input_dims, output_dim)
src/patchcore/common.py:146
Method
__init__
(self, preprocessing_dim)
src/patchcore/common.py:164
Method
__init__
(self, target_dim)
src/patchcore/common.py:174
Method
__init__
(self, device, target_size=224)
src/patchcore/common.py:187
Method
__init__
(self, backbone, layers_to_extract_from, device)
src/patchcore/common.py:214
Method
__init__
(self, hook_dict, layer_name: str, last_layer_to_extract: str)
src/patchcore/common.py:278
Method
__init__
Neearest-Neighbourhood Anomaly Scorer class. Args: n_nearest_neighbours: [int] Number of nearest neighbours used to
src/patchcore/common.py:297
Method
__init__
Greedy Coreset sampling base class.
src/patchcore/sampler.py:40
Method
__init__
Approximate Greedy Coreset sampling base class.
src/patchcore/sampler.py:119
Method
__init__
(self, percentage: float)
src/patchcore/sampler.py:175
Method
__init__
Args: source: [str]. Path to the MVTec data folder. classname: [str or None]. Name of MVTec class that should be
src/patchcore/datasets/mvtec.py:41
Method
__len__
(self)
src/patchcore/datasets/mvtec.py:112
Method
_compute_greedy_coreset_indices
Runs approximate iterative greedy coreset selection. This greedy coreset implementation does not require computation of the full N x
src/patchcore/sampler.py:130
Method
_create_index
(self, dimension)
src/patchcore/common.py:109
Method
_detach
(features)
src/patchcore/patchcore.py:94
Function
_dummy_image_random_dataloader
(number_of_examples, image_shape)
test/test_patchcore.py:38
Method
_gpu_cloner_options
(self)
src/patchcore/common.py:104
Method
_image_to_features
(input_image)
src/patchcore/patchcore.py:159
Function
_load_patchcore_from_path
(load_path)
test/test_patchcore.py:61
Method
_reduce
(features)
src/patchcore/common.py:131
Method
_train
(self, index, features)
src/patchcore/common.py:101
Function
compute_and_store_final_results
Store computed results as CSV file. Args: results_path: [str] Where to store result csv. results: [List[List]] List of lists cont
src/patchcore/utils.py:127
Function
compute_imagewise_retrieval_metrics
Computes retrieval statistics (AUROC, FPR, TPR). Args: anomaly_prediction_weights: [np.array or list] [N] Assignment weights
src/patchcore/metrics.py:6
Function
compute_pixelwise_retrieval_metrics
Computes pixel-wise statistics (AUROC, FPR, TPR) for anomaly segmentations and ground truth segmentation masks. Args: anomaly_se
src/patchcore/metrics.py:28
Function
create_storage_folder
( main_folder_path, project_folder, group_folder, mode="iterate" )
src/patchcore/utils.py:77
Function
dataset
( name, data_path, subdatasets, batch_size, resize, imagesize, num_workers, augment )
bin/load_and_evaluate_patchcore.py:247
Function
dataset
( name, data_path, subdatasets, train_val_split, batch_size, resize, imagesize,
bin/run_patchcore.py:343
Method
embed
(self, data)
src/patchcore/patchcore.py:79
Method
fit
Calls the fit function of the nearest neighbour method. Args: detection_features: [list of np.arrays] [[bs x d_i]
src/patchcore/common.py:316
Function
fix_seeds
Fixed available seeds for reproducibility. Args: seed: [int] Seed value. with_torch: Flag. If true, torch-related seeds are fixed
src/patchcore/utils.py:109
Method
forward
(self, features)
src/patchcore/common.py:156
Method
forward
(self, features)
src/patchcore/common.py:168
Method
forward
Returns reshaped and average pooled features.
src/patchcore/common.py:178
Method
forward
(self, images)
src/patchcore/common.py:259
Function
get_dataloaders
(seed)
bin/run_patchcore.py:357
Function
get_dataloaders_iter
(seed)
bin/load_and_evaluate_patchcore.py:253
Function
get_patchcore
(input_shape, sampler, device)
bin/run_patchcore.py:284
Function
get_patchcore_iter
(device)
bin/load_and_evaluate_patchcore.py:205
Function
get_sampler
(device)
bin/run_patchcore.py:322
Function
image_transform
(image)
bin/load_and_evaluate_patchcore.py:122
next →
1–100 of 132, ranked by callers