DAMSM
A paired text encoder and image encoder that score how well an image matches a sentence and its words.
Multimodal · 339 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
- Multimodal
- Parameters
- 24.6M
- Operations
- 339
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2018
- Paper
- AttnGAN: Fine-Grained Text to Image Generation with Attentional Generative Adversarial Networks
- Cited by
- 1,922 (as of 24 October 2026)
- Authors
- Tao Xu, Pengchuan Zhang, Qiuyuan Huang and others
- Source
- GitHub: taoxugit/AttnGAN
- 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
- m15532
- Graph hash
- 02966f74833f8b5aaa6ed0f410d0a84dae028fab2afe25e77e50226118b1887d
- Skeleton hash
- 9a0f863e99fabb393b5ad3aa9b74bbe099293d08c53ea4f3f3570a32f0322537
- Architecture hash
- fdb3cc14a687e8e36db3265f779d20cc789fac9b4f3b82ce2e38093f3f52ecf5
- Diagram SHA-256
- 857a986416d09d0fb3936ebd3c91a7d4e3556ec3edf8702d60d9b7c4072f6a2a
- 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
What it is
DAMSM, the Deep Attentional Multimodal Similarity Model, computes how well an image matches a sentence, using both the global sentence-level information and the fine-grained word-level information. It was proposed as part of AttnGAN, a network for text-to-image generation, where it provides a fine-grained image-text matching loss for training the generator.
The model learns two neural networks that map sub-regions of the image and words of the sentence to a common semantic space. The text encoder is a bi-directional LSTM that extracts semantic vectors from the text description. The image encoder is built on the Inception-v3 model pretrained on ImageNet and yields local feature vectors of dimension 768 for 289 sub-regions of the image. A perceptron layer then converts the image features to the common semantic space of the text features. The layers built from Inception-v3 are fixed, and the newly added layers are learned jointly with the rest of the network.
The DAMSM loss learns the attention model in a semi-supervised manner, where the only supervision is the matching between entire images and whole sentences. The model is pretrained on real image-text pairs, and its text encoder then provides word vectors for the attentional generative network. In the paper's ablation on the CUB dataset, replacing the DAMSM sub-network with a different text encoder dropped the inception score to 3.98 and R-precision to 10.37%.
Key idea. DAMSM learns a text encoder and an image encoder that place words and image sub-regions in a common space, giving a word-level image-text matching loss.
- DAMSM
- Deep Attentional Multimodal Similarity Model
- image-text matching
- text-to-image generation
- image-text similarity
- text encoder
- image encoder
- fine-grained matching loss
- word-level attention
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{xu2017attnganfinegrainedtextimage,
title={AttnGAN: Fine-Grained Text to Image Generation with Attentional Generative Adversarial Networks},
author={Tao Xu and Pengchuan Zhang and Qiuyuan Huang and Han Zhang and Zhe Gan and Xiaolei Huang and Xiaodong He},
year={2017},
eprint={1711.10485},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1711.10485},
}