Upload config.yaml with huggingface_hub
Browse files- config.yaml +57 -0
config.yaml
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Problem A: Few-Shot Defect Classification - Configuration
|
| 2 |
+
# Intel contest: 8 defect classes, grayscale images up to ~7000x5600
|
| 3 |
+
# Uses ONLY official challenge data from challenge/dataset/Dataset/Data/
|
| 4 |
+
# Dataset: defect1(253), defect2(178), defect3(9), defect4(14),
|
| 5 |
+
# defect5(411), defect8(803), defect9(319), defect10(674), good(7135)
|
| 6 |
+
# Contest: classify into 8 DEFECT classes
|
| 7 |
+
#
|
| 8 |
+
# CRITICAL: defect3~defect9 (0.963 cosine sim) and defect4~defect8 (0.889)
|
| 9 |
+
# are nearly identical without training on them. ALL 8 classes must be in
|
| 10 |
+
# training so the backbone learns to separate these similar pairs.
|
| 11 |
+
|
| 12 |
+
data:
|
| 13 |
+
root: "../challenge/dataset/Dataset/Data/"
|
| 14 |
+
img_size: 518 # DINOv2 native resolution (37x14 patches)
|
| 15 |
+
defect_only: false
|
| 16 |
+
# ALL 8 defect classes + good (class 0) in training
|
| 17 |
+
train_classes: [0, 1, 2, 3, 4, 5, 8, 9, 10]
|
| 18 |
+
test_classes: [3, 4] # Monitor the hardest classes during validation
|
| 19 |
+
all_classes: [0, 1, 2, 3, 4, 5, 8, 9, 10]
|
| 20 |
+
|
| 21 |
+
model:
|
| 22 |
+
backbone: "dinov2"
|
| 23 |
+
backbone_size: "large" # DINOv2 ViT-L/14 (1024-dim, 304M params)
|
| 24 |
+
freeze_backbone: true
|
| 25 |
+
unfreeze_last_n: 6 # Fine-tune last 6 transformer blocks + norm
|
| 26 |
+
grad_checkpointing: true
|
| 27 |
+
proj_hidden: 768
|
| 28 |
+
proj_dim: 512
|
| 29 |
+
|
| 30 |
+
training:
|
| 31 |
+
n_way: 9 # ALL 9 classes per episode (8 defect + good)
|
| 32 |
+
k_shot: 5 # Higher shot count for better prototypes
|
| 33 |
+
n_query: 10 # More queries = stronger gradient signal
|
| 34 |
+
# Sampler uses replacement for rare classes (defect3=9, defect4=14)
|
| 35 |
+
n_episodes_train: 500 # Fewer but harder 8-way episodes
|
| 36 |
+
n_episodes_val: 100
|
| 37 |
+
epochs: 100
|
| 38 |
+
lr: 3.0e-4
|
| 39 |
+
lr_backbone: 5.0e-6
|
| 40 |
+
warmup_epochs: 5
|
| 41 |
+
weight_decay: 1.0e-4
|
| 42 |
+
use_amp: true
|
| 43 |
+
gradient_clip: 1.0
|
| 44 |
+
label_smoothing: 0.1 # Prevent overconfidence on easy classes
|
| 45 |
+
patience: 20
|
| 46 |
+
|
| 47 |
+
evaluation:
|
| 48 |
+
n_seeds: 5
|
| 49 |
+
max_examples: 50
|
| 50 |
+
kshot_values: [1, 3, 5, 10, 20]
|
| 51 |
+
target_accuracy: 0.85
|
| 52 |
+
|
| 53 |
+
output:
|
| 54 |
+
checkpoint_dir: "checkpoints/"
|
| 55 |
+
results_dir: "outputs/"
|
| 56 |
+
|
| 57 |
+
seed: 42
|