BRFound / README.md
Microgle's picture
Add compact teacher inference weights and updated BRFound overview
93d4438 verified
|
Raw History Blame Contribute Delete
1.77 kB
---
license: apache-2.0
tags:
- computational-pathology
- breast-cancer
- feature-extraction
---
# BRFound
A breast-specific slide-level foundation model for computational pathology.
Implementation and preprocessing examples:
[wyh196646/BRFound](https://github.com/wyh196646/BRFound).
![BRFound overview](Model_Overview.png)
## Weights
| File | Contents |
| --- | --- |
| `patch_encoder.pth` | Released BRFound patch encoder |
| `slide_encoder.pth` | Original epoch-161 slide training checkpoint |
| `slide_encoder_inference.pth` | Plain state dictionary of the same teacher backbone |
| `inference_config.json` | Epoch, dimensions and checkpoint checksums |
The October 2026 update adds a compact inference export and the current overview.
The numerical model parameters are unchanged. The existing patch and training weights
are retained for compatibility.
## Slide embedding
Use the repository's `inference.py` with `slide_encoder_inference.pth`. Input is an HDF5
file containing BRFound patch `features` of shape `[N, 768]` and matching `coords` of
shape `[N, 2]` on the training pipeline's 256-pixel coordinate grid.
```bash
python inference.py --features features.h5 --weights slide_encoder_inference.pth --output slide_embedding.npy --device cpu
```
The output has shape `[1, 768]`. The default sampler uses eight clusters, a 25% ratio,
a 4,000-token cap and seed 42. Full usage and preprocessing instructions are in the
[code repository](https://github.com/wyh196646/BRFound).
These are research representations; downstream clinical use requires task-specific
validation. The release checks cover CPU inference and equivalence of the compact
weights and positional encoding to the original implementation.