This project adapts PatchCore to run on a custom Kvasir-based anomaly-detection dataset arranged in an MVTec-like structure.
Added prepare_dataset.py to build a PatchCore-compatible folder layout from:
kvasir-dataset-v2 (healthy images)Kvasir-SEG (polyp images + masks)Configured paths in prepare_dataset.py:
KVASIR_V2_DIR = ../dataset/kvasir-dataset-v2KVASIR_SEG_DIR = ../dataset/Kvasir-SEGOUTPUT_DIR = ../dataset/kvasir_patchcoreHealthy classes used:
normal-cecumnormal-pylorusnormal-z-lineTrain/test split:
TRAIN_SPLIT = 0.80Generated output tree:
kvasir_patchcore/
train/
good/
test/
good/
defect/
ground_truth/
defect/
Behavior:
42) and split into train/good and test/good.test/defect.ground_truth/defect.Updated patchcore-inspection/src/patchcore/datasets/kvasir.py:
_CLASSNAMES = ["kvasir_patchcore"]self.transform_mean = IMAGENET_MEANself.transform_std = IMAGENET_STDPurpose:
After running preparation, the training/evaluation scripts should point to:
../dataset/kvasir_patchcoreInside that path, PatchCore expects one class folder:
kvasir_patchcore/
train, test, and ground_truth as shown above.python prepare_dataset.py
../dataset/kvasir_patchcorekvasir_patchcoregood = healthy endoscopy images; defect = polyp samples with masks.66 commits
32 commits
Python
77.6%
Shell
22.4%
This project adapts PatchCore to run on a custom Kvasir-based anomaly-detection dataset arranged in an MVTec-like structure.
Added prepare_dataset.py to build a PatchCore-compatible folder layout from:
kvasir-dataset-v2 (healthy images)Kvasir-SEG (polyp images + masks)Configured paths in prepare_dataset.py:
KVASIR_V2_DIR = ../dataset/kvasir-dataset-v2KVASIR_SEG_DIR = ../dataset/Kvasir-SEGOUTPUT_DIR = ../dataset/kvasir_patchcoreHealthy classes used:
normal-cecumnormal-pylorusnormal-z-lineTrain/test split:
TRAIN_SPLIT = 0.80Generated output tree:
kvasir_patchcore/
train/
good/
test/
good/
defect/
ground_truth/
defect/
Behavior:
42) and split into train/good and test/good.test/defect.ground_truth/defect.Updated patchcore-inspection/src/patchcore/datasets/kvasir.py:
_CLASSNAMES = ["kvasir_patchcore"]self.transform_mean = IMAGENET_MEANself.transform_std = IMAGENET_STDPurpose:
After running preparation, the training/evaluation scripts should point to:
../dataset/kvasir_patchcoreInside that path, PatchCore expects one class folder:
kvasir_patchcore/
train, test, and ground_truth as shown above.python prepare_dataset.py
../dataset/kvasir_patchcorekvasir_patchcoregood = healthy endoscopy images; defect = polyp samples with masks.66 commits
32 commits
Python
77.6%
Shell
22.4%