Views
No views yet
| Metric | Value |
|---|---|
| LOOCV Mean F1 | 0.943 (8 folds with sufficient annotations) |
| 6nm (AMPA) F1 | 0.944 (100% recall) |
| 12nm (NR1) F1 | 0.909 (100% recall) |
| Parameters | 24.4M |
| Inference | ~10s per image (GPU) |
1import torch
2from src.model import ImmunogoldCenterNet
3from src.ensemble import sliding_window_inference
4from src.heatmap import extract_peaks
5from src.postprocess import cross_class_nms
6import tifffile
7
8# Load model
9model = ImmunogoldCenterNet(bifpn_channels=128, bifpn_rounds=2)
10ckpt = torch.load("checkpoints/final/final_model.pth", map_location="cpu")
11model.load_state_dict(ckpt["model_state_dict"])
12model.eval()
13
14# Run on any TEM image
15img = tifffile.imread("your_image.tif")
16if img.ndim == 3:
17 img = img[:, :, 0]
18
19with torch.no_grad():
20 hm, off = sliding_window_inference(model, img, patch_size=512, overlap=128)
21
22dets = extract_peaks(torch.from_numpy(hm), torch.from_numpy(off),
23 stride=2, conf_threshold=0.25)
24dets = cross_class_nms(dets, 8)
25
26for d in dets:
27 print(f"{d['class']} at ({d['x']:.1f}, {d['y']:.1f}) conf={d['conf']:.3f}")1pip install gradio
2python app.py --checkpoint checkpoints/final/final_model.pth
3# Opens at http://localhost:7860Raw TEM Image (any size)
|
[Sliding window: 512x512, 128px overlap]
|
ResNet-50 (CEM500K pretrained on 500K EM images)
|
BiFPN (bidirectional feature pyramid, 2 rounds, 128ch)
|
Transposed Conv → stride-2 output (H/2 x W/2)
|
+--Heatmap Head (2ch sigmoid: 6nm + 12nm)
+--Offset Head (2ch: sub-pixel x,y correction)
|
Peak extraction (max-pool NMS) → detectionspython train_final.py --config config/config.yaml --device cuda:0sbatch slurm/05_train_final.sh| Fold | Avg F1 | Best F1 | # Particles |
|---|---|---|---|
| S27 | 0.990 | 0.994 | 45 |
| S8 | 0.981 | 0.988 | 70 |
| S25 | 0.972 | 0.977 | 41 |
| S29 | 0.956 | 0.966 | 36 |
| S1 | 0.930 | 0.940 | 22 |
| S4 | 0.919 | 0.972 | 113 |
| S22 | 0.907 | 0.938 | 102 |
| S13 | 0.890 | 0.912 | 20 |
| S7* | 0.799 | 1.000 | 3 |
| S15* | 0.633 | 0.667 | 1 |
pos_mask = (gt == 1.0).__getitem__ call to prevent memorizing fixed patches.1@software{midasmap2026,
2 title={MidasMap: Automated Immunogold Particle Detection for TEM Synapse Images},
3 author={Sahai, Anik},
4 year={2026},
5 url={https://github.com/AnikS22/MidasMap}
6}python scripts/download_cem500k.py)