--- license: cc-by-nc-sa-4.0 --- # RetCCL-based ABMIL models for metastasis detection These are weakly-supervised, attention-based multiple instance learning models for binary metastasis detection (normal versus metastasis). The models were trained on the [CAMELYON16](https://camelyon16.grand-challenge.org/Data/) dataset using RetCCL embeddings. # Data - Training set consisted of 243 whole slide images (WSIs). - 143 negative - 100 positive - 52 macrometastases - 48 micrometastases - Validation set consisted of 27 WSIs. - 16 negative - 11 positive - 6 macrometastases - 5 micrometastases - Test set consisted of 129 WSIs. - 80 negative - 49 positive - 22 macrometastases - 27 micrometastases # Evaluation Below are the classification results on the test set. | Seed | Sensitivity | Specificity | BA | Precision | F1 | |-------:|--------------:|--------------:|------:|------------:|------:| | 0 | 0.612 | 0.838 | 0.725 | 0.698 | 0.652 | | 1 | 0.531 | 0.950 | 0.740 | 0.867 | 0.658 | | 2 | 0.551 | 0.950 | 0.751 | 0.871 | 0.675 | | 3 | 0.612 | 0.925 | 0.769 | 0.833 | 0.706 | | 4 | 0.531 | 0.950 | 0.740 | 0.867 | 0.658 | # How to reuse the model The model expects 128 x 128 micrometer patches, embedded with the RetCCL model. ```python import torch from abmil import AttentionMILModel model = AttentionMILModel(in_features=2048, L=512, D=384, num_classes=2, gated_attention=True) model.eval() state_dict = torch.load("seed3/model_best.pt", map_location="cpu", weights_only=True) model.load_state_dict(state_dict) # Load a bag of features bag = torch.ones(1000, 2048) with torch.inference_mode(): logits, attention = model(bag) ```