FANet from scratch: polyp segmentation, with transfer to leaf-disease spots
Weights for a from-scratch PyTorch implementation of FANet: A Feedback Attention Network for Improved Biomedical Image Segmentation (N. K. Tomar et al., IEEE Transactions on Neural Networks and Learning Systems, 2023, DOI 10.1109/TNNLS.2022.3159394).
Deep Learning mini-project, B.Tech Computer Engineering, Sem VII (2026β27). Chaitanya Shinde, 231070066.
No pretrained weights were used: every layer, the loss, training loop, metrics and test-time refinement are written with plain PyTorch primitives. 7,720,266 parameters. Input 256Γ256 RGB.
Files
| File | Trained on | Test result (Dice) |
|---|---|---|
fanet_kvasir_seg_256.pt |
Kvasir-SEG, 880 train images, 256Γ256 | 0.842 on 120 Kvasir-SEG test images (paper's protocol: 10 refinement rounds from an Otsu mask); 0.900 from an empty start. Paper: 0.880 at 512Γ512 |
fanet_roboflow_leaf_finetuned.pt |
My Roboflow dataset: 30 leaf photos labelled by hand (24 train Γ 5 augmented copies + 6 valid), fine-tuned from the Kvasir weights, constant lr 5e-5, 100 epochs | 0.517 on 118 LDSD test photos (0.520 from an empty start) |
fanet_roboflow_leaf_scratch.pt |
The same Roboflow dataset, from random weights, constant lr 1e-4, 100 epochs | 0.467 (0.461 from an empty start) |
fanet_ldsd470_finetuned.pt |
470 LDSD photos with LDSD's masks, fine-tuned from the Kvasir weights | 0.670 (0.681 from an empty start) |
Own dataset on Roboflow Universe: universe.roboflow.com/chaitanyadl/leaf-disease-seg-ib5ne.
Loading
Each file holds the model's state_dict under "model" plus the training arguments under "args".
The model code (src/model.py) is part of the project package.
import torch
from src.model import FANet
ckpt = torch.load("fanet_kvasir_seg_256.pt", map_location="cpu")
model = FANet()
model.load_state_dict(ckpt["model"])
model.eval()
Evaluate with the project's script (10 refinement rounds):
python -m src.evaluate --ckpt fanet_kvasir_seg_256.pt --data data/Kvasir-SEG --split test --iters 10
Limitations
- Trained once per setting (no repeated seeds), so differences of about 0.01β0.02 Dice are within noise.
- As in the authors' code, the Kvasir checkpoint was selected on the test images, which is slightly optimistic.
- The Roboflow models were selected on only 6 validation photos.
- For research and coursework only. Not a medical device and not validated for clinical use.