-
Notifications
You must be signed in to change notification settings - Fork 873
Closed
Description
Your Question
Can you please tell me the specific training parameters that are officially used to train the MVTecAD dataset using patchcore?
The results I get when I use this code to train are way off compared to the official results, Patchcore Results. I would like to know what is the reason for this?
from anomalib.data import MVTecAD
from anomalib.engine import Engine
from anomalib.models import Patchcore
from pathlib import Path
from anomalib.data import Folder
# 1. Basic Usage
# Initialize with default settings
model = Patchcore()
# 2. Custom Configuration
# Configure model parameters
model = Patchcore(
backbone="wide_resnet50_2", # Feature extraction backbone
layers=["layer2", "layer3"], # Layers to extract features from
pre_trained=True, # Use pretrained weights
num_neighbors=9, # Number of nearest neighbors
)
# 3. Training Pipeline
datamodule = MVTecAD(
root="anomalib/datasets/MVTec",
category="bottle",
train_batch_size=16,
eval_batch_size=16, # Important for feature extraction
num_workers=0, # Number of workers for data loading
seed=42,
)
# Initialize training engine with specific settings
engine = Engine(
max_epochs=1, # Patchcore typically needs only one epoch
accelerator="auto", # Automatically detect GPU/CPU
devices=1, # Number of devices to use
)
# Train the model
# engine.fit(
# model=model,
# datamodule=datamodule,
# )
engine.train(
model=model,
datamodule=datamodule,
)┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Test metric ┃ DataLoader 0 ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ image_AUROC │ 1.0 │
│ image_F1Score │ 0.9919999837875366 │
│ pixel_AUROC │ 0.9855615496635437 │
│ pixel_F1Score │ 0.7266571521759033 │
└───────────────────────────┴───────────────────────────┘Forum Check
- I have searched the discussions forum for an answer to my question.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels