MatthewMak commited on
Commit
e12d57f
·
verified ·
1 Parent(s): 9b3b112

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -0
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - medical
6
+ - histopathology
7
+ - breast-cancer
8
+ - vision
9
+ - multiple-instance-learning
10
+ - pytorch
11
+ - pathology
12
+ license: cc-by-nc-4.0
13
+ datasets:
14
+ - bracs
15
+ - bach
16
+ - breakhis
17
+ metrics:
18
+ - accuracy
19
+ - f1
20
+ - recall
21
+ ---
22
+
23
+ # OpenPink Core (Breast Cancer Histopathology AI)
24
+
25
+ OpenPink Core is a state-of-the-art Dual-Stream Multiple Instance Learning (MIL) model designed for the classification of Breast Cancer Whole Slide Images (WSIs) and Regions of Interest (ROIs). Built on top of the **Virchow2** foundation model, OpenPink classifies tissue into four clinical categories: **Atypical, Benign, Malignant, and Normal**, with a specific emphasis on identifying diagnostically challenging Atypical lesions.
26
+
27
+ ## Model Details
28
+
29
+ - **Architecture:** Dual-Stream Gated Attention MIL (processes global macroscopic thumbnails alongside high-resolution 224x224 patches).
30
+ - **Feature Extractor:** Virchow2 (1280-dimensional embeddings, SwiGLU MLP, SiLU).
31
+ - **Training Strategy:** 10-Fold Stratified Group Cross-Validation.
32
+ - **Domain Adaptation:** Multi-source training utilizing Hard Example Mining from South American (BreaKHis) and European (BRACS, BACH) datasets to decouple cellular density from malignancy.
33
+ - **Ensemble:** The repository provides 10 pre-trained checkpoints (folds) for robust ensemble inference.
34
+ - **License:** CC-BY-NC-4.0 (Strictly Non-Commercial & Research use only).
35
+
36
+ ## Intended Use & Limitations
37
+
38
+ **FOR ACADEMIC AND RESEARCH PURPOSES ONLY.**
39
+
40
+ - **Not for Clinical Use:** This tool has not been evaluated by the FDA, EMA, or any other regulatory body. It is not a medical device. It cannot be used for diagnostic, prognostic, or therapeutic purposes.
41
+ - **Limitations:** The model assumes H&E (Hematoxylin and Eosin) stained slides. Variations in extreme staining protocols may degrade performance. We strongly recommend applying Macenko Stain Normalization prior to feature extraction.
42
+
43
+ ## Training Data
44
+
45
+ The model was trained and internally validated on multi-centric European clinical cohorts:
46
+ - **BRACS (BReAst Carcinoma Subtyping):** Hematoxylin & Eosin (H&E) stained ROIs.
47
+ - **BACH (Breast Cancer Histology):** High-resolution microscopy images.
48
+
49
+ To ensure global generalization, the model was aggressively domain-adapted using "Hard Negative" injections from the **BreaKHis** dataset (Brazil), focusing on hyper-cellular benign tumors like Fibroadenomas to prevent False Positives in dense tissue structures.
50
+
51
+ ## Evaluation Results
52
+
53
+ ### Internal Validation (European Cohorts)
54
+ During 10-fold CV on BRACS and BACH, the model achieved:
55
+ - **Accuracy:** 93.33%
56
+ - **Macro F1-Score:** 90.18%
57
+ - **Atypical Recall (Sensitivity):** 95.65%
58
+ - **Malignant Recall:** 98.68%
59
+
60
+ ### Out-Of-Distribution (OOD) Domain Adaptation
61
+ Evaluated on **1,693 unseen images** from BreaKHis using a strict Clinical Thresholding constraint (Probability > 0.30 for Malignant).
62
+ - **Malignant Recall:** 82.46% (945 / 1146 cases)
63
+ - **Benign Specificity:** 66.73% (365 / 547 cases) - *Massive improvement over the 16.8% baseline.*
64
+ - **Perfect Separation:** Zero Atypical or Normal misclassifications in the entire OOD set.
65
+
66
+ ## How to Use
67
+
68
+ The checkpoints in this repository are designed to be loaded by the `OpenPink-Core` inference scripts.
69
+
70
+ ### 1. Download Checkpoints via Python
71
+ You can automatically download all 10 folds using the `huggingface_hub` library:
72
+
73
+ ```python
74
+ from huggingface_hub import snapshot_download
75
+
76
+ # Download the checkpoints folder
77
+ snapshot_download(
78
+ repo_id="MatthewMak/OpenPink-Core",
79
+ allow_patterns="*.pt",
80
+ local_dir="./checkpoints"
81
+ )
82
+ ```
83
+
84
+ ### 2. Feature Extraction & Inference
85
+ Clone the [OpenPink-Core GitHub/GitLab Repository](#) (link pending) and run the evaluation scripts using the downloaded checkpoints.
86
+
87
+ ```bash
88
+ # 1. Extract Virchow2 Features (Auto-Macenko enabled)
89
+ python extract_features.py --data_dir ./images --output_dir ./features --ref_image ref.png
90
+
91
+ # 2. Run Ensemble Inference with Clinical Thresholding
92
+ python evaluate_ood.py --features_dir ./features --checkpoints_dir ./checkpoints --malignant_threshold 0.30
93
+ ```
94
+
95
+ ## Citation & Credits
96
+ - **Author/Lead Researcher:** Matthaios Makrogiannis
97
+ - **Institution:** University of Ioannina
98
+ - **Year:** 2026