monai.MILModel
A bag classifier that pools ResNet50 instance features with learned attention weights.
Medical imaging · 184 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Medical imaging
- Parameters
- 27.7M
- Operations
- 184
- Framework
- PyTorch
- Recurrent
- No
- Published
- ICML 2018
- Cited by
- 1,234 (as of 19 October 2026)
- Authors
- Maximilian Ilse, Jakub M. Tomczak, Max Welling
- Source
- monai 1.5.2
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m7431
- Graph hash
- 2e592e5a4231cec66f8276d90b24ab4a34bfe678346b8bb743d0cc2695288e2f
- Skeleton hash
- a9e6346974010f440c082f5e6a2613d685769411608f9ced392d62b7ff054797
- Architecture hash
- f0696a842703d49255a2ef8dca4532e738d7ccaa4e4e278ea911b51fb9adffd1
- Diagram SHA-256
- 1bc322e34b70e04e01199476d7632456874c380041e2531936b275805f7217aa
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
How this diagram was made
monai.networks.nets.milmodel.MILModel(num_classes=5, mil_mode='att', pretrained=False)
What it is
Attention-based deep multiple instance learning (MIL) classifies a bag of instances, such as patches from one pathology slide, with one label for the whole bag. Ilse, Tomczak and Welling state the problem as learning the Bernoulli distribution of the bag label, with the bag label probability fully parameterized by neural networks. Their central piece is a permutation-invariant aggregation operator that corresponds to attention, so the network also shows how much each instance contributed to the bag label. On benchmark MIL datasets the paper reports performance comparable to the best MIL methods, and better results on an MNIST-based MIL dataset and two histopathology datasets.
This model is MONAI's MILModel: a ResNet50 backbone with its final linear layer removed turns every instance into a feature vector. In the attention mode used here, a two-layer network with a tanh in between scores each instance, the scores are softmax-normalized across the bag, the features are summed with those weights and one linear layer gives the class scores. Input is a batch of bags shaped [B, N, C, H, W], N being the instances extracted from each original image; the typical use is classifying digital pathology whole slide images. The same class also offers mean and max pooling and two transformer MIL modes, but this model uses the attention mode. The authors' own code trains a modified LeNet-5 on MNIST bags, with the attention-based MIL pooling placed before the last layer of the model.
Key idea. Ilse, Tomczak and Welling proposed a neural network-based, permutation-invariant aggregation operator corresponding to attention, which also reveals each instance's contribution to the bag label.
- attention mil
- ab-mil
- attention-based deep multiple instance learning
- multiple instance learning
- mil
- milmodel
- whole slide image
- histopathology
- bag classification
- monai
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{ilse2018attentionbaseddeepmultipleinstance,
title={Attention-based Deep Multiple Instance Learning},
author={Maximilian Ilse and Jakub M. Tomczak and Max Welling},
year={2018},
eprint={1802.04712},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1802.04712},
}