File size: 1,771 Bytes
93d4438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---

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.