1 MIN READ
conference · 2024 · PublishedNeighbourhood representation loss
Can 1,000 images be enough if the loss knows the feature space?
IN ONE SENTENCE
Summary
Extract self-supervised features once, look at each sample's nearest and farthest neighbours, and let that geometry decide which samples are hard and what the triplets should be.01 / THE QUESTION
Self-supervision wants data this domain does not have.
Contrast-enhanced spectral mammography is used when a mammogram is not enough — dense tissue, suspicious lesion management. The public data amount to about a thousand images.
SimCLR pretraining helps, but not by much at that scale — which left the loss function as the remaining place to find leverage.
02 / THE IDEA
Ask the feature space which samples are hard.
After pretraining, every training feature is banked once. For each sample, its nearest same-class and farthest different-class neighbours are found by L2 distance. If a sample's neighbours mostly carry a different label, it is a hard sample and gets more weight in the cross-entropy.
The same neighbours serve as triplet positives and negatives directly, so there is no Siamese network and no online mining — the whole thing is precomputed.
- 01SimCLR pretraining
- 02Feature bank
- 03Nearest / farthest neighbours
- 04Difficulty weights
- 05DWCE + triplet
- 06ROI classifier
03 / WHAT WE TESTED
Two initializations, four losses, one small dataset.
CDD-CESM: 1,003 subtracted CESM images from 326 patients at Cairo University, with pixel-level lesion annotations. ROIs were extracted for benign and malignant lesions, with a fixed 512 × 512 centre crop for normals, split at patient level into 745 / 130 / 116.
Cross-entropy, focal loss and DWNR were compared under both from-scratch and ImageNet-initialized SimCLR pretraining, five runs each.
04 / MAIN RESULT
Two and a half points of F1 from the loss alone.
In the ImageNet + SimCLR track, DWNR lifted F1 from 0.8159 to 0.8413 and AUC from 0.9278 to 0.9350 over cross-entropy, with focal loss landing below both. The gain concentrates on the benign class, where per-class F1 went from 0.6589 to 0.7058.
It also transferred: initializing a whole-image CESM classifier from the DWNR-trained ROI model beat ImageNet initialization by more than four points of F1 on both BI-RADS management and diagnosis.
| Loss | Accuracy | F1 | AUC |
|---|---|---|---|
| Cross-entropy (ImageNet only) | 0.8379 | 0.8130 | 0.9252 |
| Cross-entropy + SSL | 0.8448 | 0.8159 | 0.9278 |
| Focal loss + SSL | 0.8397 | 0.8083 | 0.9320 |
| DWNR + SSL | 0.8655 | 0.8413 | 0.9350 |
Standard deviations and the from-scratch SimCLR track are in the paper. Unpaired t-test, p < 0.0001 against cross-entropy and focal loss.
05 / WHY IT MATTERS
And why I rebuilt it two years later.
The result stands: geometry in a self-supervised feature space carries usable training signal in a small-data domain, and the improvement transfers to the whole-image task.
But three quantities here had to be swept per dataset — neighbour count, difficulty weights, triplet margin. That is exactly the limitation the later DITL framework removes by deriving all three from the data.
LIMITATION
What this does not show
A single public dataset with 116 test ROIs, and three hand-tuned hyperparameters that do not transfer between cohorts.
READ IT YOURSELF
Paper · DOI · Code · Citation
View original abstract + citation
Abstract
Self-supervised learning improves representation quality but normally needs large amounts of data, which the contrast-enhanced spectral mammography (CESM) domain does not have. This paper proposes the Difficulty-Weighted Neighborhood Representation (DWNR) loss for downstream ROI classification in a small-data setting. After SimCLR pretraining, features for the whole training set are extracted once and used to find each sample's nearest same-class and farthest different-class neighbours. Those neighbours drive two terms: a difficulty-weighted cross-entropy, where difficulty comes from the class labels of the nearest neighbours, and a triplet loss that uses the precomputed representations directly instead of training a Siamese network. On the public CDD-CESM dataset the combined loss improves accuracy, F1 and AUC over cross-entropy and focal loss.
Citation
A. Bhandary Panambur, P. Madhu, S. Bayer, A. Maier. Enhancing downstream classification of breast abnormalities in contrast enhanced spectral mammography using a neighborhood representation loss. Proc. SPIE Medical Imaging 2024: Computer-Aided Diagnosis, vol. 12927, 129270F. doi:10.1117/12.3004102