File size: 2,373 Bytes
c04bc97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os
import torch

# Global Configuration Dictionary
CONFIG = {
    # General Setup
    "seed": 42,
    "demo_mode": True,  # Set to True for fast testing/verification, False for full experiments
    "device": "cuda" if torch.cuda.is_available() else "cpu",
    
    # Directory Paths (Relative to project root)
    "data_dir": "data",
    "output_dir": "outputs",
    "checkpoint_dir": "checkpoints",
    
    # Task 1 - Classification (PathMNIST)
    "classification": {
        "dataset_name": "pathmnist",
        "image_size": 224,  # Size for ResNet-18 (MedMNIST+)
        "full": {
            "batch_size": 64,
            "epochs": 5,
            "lr": 1e-3,
            "weight_decay": 1e-4,
        },
        "demo": {
            "batch_size": 16,
            "epochs": 1,
            "lr": 1e-3,
            "weight_decay": 1e-4,
            "subset_size": 500,  # Number of samples to use in demo mode
        }
    },
    
    # Task 2 - Segmentation (TNBC Nuclei)
    "segmentation": {
        "dataset_url": "https://zenodo.org/record/1175282/files/TNBC_NucleiSegmentation.zip",
        "image_size": 256,
        "full": {
            "batch_size": 8,
            "epochs": 10,
            "lr": 1e-3,
        },
        "demo": {
            "batch_size": 4,
            "epochs": 1,
            "lr": 1e-3,
            "subset_size": 8,  # Number of slide folders to use
        }
    },
    
    # Task 3 - Detection (BCCD Smears)
    "detection": {
        "dataset_repo": "https://github.com/Shenggan/BCCD_Dataset.git",
        "image_size": (480, 640),  # Height, Width (Standard BCCD resolution)
        "classes": ["background", "WBC", "RBC", "Platelets"],  # 0 is always background
        "full": {
            "batch_size": 4,
            "epochs": 10,
            "lr": 5e-4,
            "weight_decay": 1e-5,
        },
        "demo": {
            "batch_size": 2,
            "epochs": 1,
            "lr": 5e-4,
            "weight_decay": 1e-5,
            "subset_size": 20,  # Number of images to use
        }
    }
}

# Ensure required directories exist
os.makedirs(CONFIG["data_dir"], exist_ok=True)
os.makedirs(CONFIG["checkpoint_dir"], exist_ok=True)
for sub in ["classification", "segmentation", "detection", "features", "explainability", "reports"]:
    os.makedirs(os.path.join(CONFIG["output_dir"], sub), exist_ok=True)