# Engineering Nabd Masr: Reaching 94.99% Mean AUROC on 14-Pathology Clinical Chest X-Rays with RAD-DINO & Platt Calibration

> Source: <https://dev.to/nbrain/engineering-nabd-masr-reaching-9499-mean-auroc-on-14-pathology-clinical-chest-x-rays-with-d7l>
> Published: 2026-12-05 19:41:58+00:00

**Recommendation:** Fit per-class calibration parameters on a calibration split disjoint from test data and report ECE alongside AUROC, since a single global threshold misrepresents risk across 14 pathologies.
More in the playbook "Evals and testing for LLM apps": <https://wpnews.pro/playbooks/evals-testing>

**Nabd Masr (Nadeem_CXR V8 SOTA)**, engineered by **Eng. Nadeem Mohamed Badr El-Din** ([nadeembadr.com](https://nadeembadr.com/about/) · [ORCID 0009-0005-5836-2631](https://orcid.org/0009-0005-5836-2631)) and **[NBrain (nbra.in)](https://nbra.in/brand)**, is a calibrated, explainable 14-pathology clinical Chest X-Ray AI system designed for hospital radiology triage in Egypt and MENA. Evaluated under strict held-out clinical protocols, Nabd Masr achieves **94.99% Mean AUROC** on VinDr-CXR (`n=1,463`), **86.86% Macro AUROC** across **50,525 held-out clinical scans**, and **87.52% conditional pointing-game localization accuracy**. The research monograph is archived under **CERN Zenodo DOI [10.5281/zenodo.24861741](https://doi.org/10.5281/zenodo.24861741)** and was spotlighted by the Egyptian Cabinet Education Development Fund and Ministry of Health.

Most open-source Chest X-Ray demos stop after printing a single validation AUROC score. In real clinical deployment across high-volume Egyptian and Gulf hospitals, three failure modes immediately break naive classifiers:

`0.82` from a deep vision backbone rarely corresponds to an 82% true clinical risk, misleading triage queues.
| Metric | Verified Result | Validation Scope | 
|---|---|---|
| **VinDr-CXR Mean AUROC** | **94.99%** | Held-out test set ( `n=1,463` , radiologist-adjudicated) | 
| **Cross-Cohort Macro AUROC** | **86.86%** | **50,525** held-out multi-cohort scans | 
| **Anatomical Pointing-Game** | **87.52%** | Conditional localization against ground-truth bounding boxes | 
| **Vision Backbone** | **RAD-DINO (518px)** | High-resolution medical ViT + Spatial Attention head | 
| **Calibration Layer** | **Per-Pathology Platt / Temp Scaling** | Expected Calibration Error (ECE) minimized per class | 
| **Permanent Research DOI** | **CERN Zenodo** | [doi.org/10.5281/zenodo.24861741](https://doi.org/10.5281/zenodo.24861741) | 

Instead of applying a single global threshold across all 14 thoracic pathologies (where *Pneumothorax* requires high sensitivity while *Cardiomegaly* tolerates balanced operating points), Nabd Masr fits per-class temperature/Platt parameters on a strictly disjoint calibration split:

``` python
import torch
import torch.nn as nn

class PerClassPlattCalibrator(nn.Module):
    """Per-pathology logit calibration for multi-label clinical CXR triage."""

    def __init__(self, num_classes: int = 14) -> None:
        super().__init__()
        self.scale = nn.Parameter(torch.ones(num_classes))
        self.bias = nn.Parameter(torch.zeros(num_classes))

    def forward(self, logits: torch.Tensor) -> torch.Tensor:
        return logits * self.scale + self.bias

def fit_calibrator(
    val_logits: torch.Tensor,
    val_targets: torch.Tensor,
    steps: int = 200,
) -> PerClassPlattCalibrator:
    cal = PerClassPlattCalibrator(val_logits.shape[1])
    opt = torch.optim.LBFGS(cal.parameters(), lr=0.1, max_iter=steps)
    bce = nn.BCEWithLogitsLoss()

    def closure() -> torch.Tensor:
        opt.zero_grad()
        loss = bce(cal(val_logits), val_targets.float())
        loss.backward()
        return loss

    opt.step(closure)
    return cal
```

To prove the model looks at the actual lesion rather than scanner artifacts, every positive pathology heatmap is evaluated via the **conditional pointing game**: the peak pixel `(y*, x*)` of the spatial attention / Grad-CAM map must land inside the radiologist's ground-truth bounding box. Reaching **87.52%** conditional pointing-game accuracy ensures radiologists receive trustworthy visual overlays alongside calibrated probabilities.
