dmgan_memory_module
DM-GAN's key-value memory read: image features query word memories to refine a fuzzy image.
Diffusion and generative · 12 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
- Operations
- 12
- Framework
- PyTorch
- Recurrent
- No
- Published
- CVPR 2019
- Cited by
- 605 (as of 17 October 2026)
- Authors
- Minfeng Zhu, Pingbo Pan, Wei Chen, Yi Yang
- Source
- GitHub: MinfengZhu/DM-GAN
- 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
- m4354
- Graph hash
- d12cbd1a4139121a07c171b0616d2c5a99abce124edf921a8cc2b791d0c3db24
- Skeleton hash
- d12cbd1a4139121a07c171b0616d2c5a99abce124edf921a8cc2b791d0c3db24
- Architecture hash
- e2d5b64b169ea633e6316b2738d235a8d3e275de7f1c38d45279e64eda748ed3
- Diagram SHA-256
- 7409457f249c3fef68f0b6fc27cf2c03acda03f7be4fe987ae7dcba0da1b3aab
- 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
This is the dynamic memory module at the heart of DM-GAN, a text-to-image model that first generates a rough initial image and then refines it to a high-resolution one. The authors' complaint about earlier methods is that they depend heavily on the quality of the initial image and that every word is given the same unchanged text representation during refinement. Their answer is to add a key-value memory structure to the GAN framework, treating the fuzzy image features of initial images as queries that read features from memory.
The refinement stage has four components: Memory Writing, Key Addressing, Value Reading and Response. Key addressing weights each memory slot by a similarity probability between the slot and an image feature, with the key projection implemented as a 1 by 1 convolution. Value reading then returns the weighted summation of value memories according to those similarity probabilities. The traced member is exactly this addressing and reading core, taking image features plus memory keys and values and returning the read context and its attention weights, while the memory writing gate and the response gate live in the surrounding generator stage. That writing gate selects important text information based on the initial image content, and the response gate adaptively fuses what was read from memory with the image features.
The paper contrasts this with AttnGAN, which refines images with attention but takes all the words equally. By default the text, image and memory feature vectors have 256, 64 and 128 dimensions respectively. DM-GAN was evaluated on the Caltech-UCSD Birds 200 and Microsoft Common Objects in Context datasets, and the code is the authors' PyTorch implementation of the CVPR 2019 paper.
Key idea. DM-GAN replaces fixed word attention with a dynamic key-value memory that is written and read at each refinement step, so the words used to sharpen an image depend on what the initial image already contains.
- DM-GAN
- dynamic memory GAN
- Dynamic Memory Generative Adversarial Network
- memory module
- text-to-image
- key addressing
- value reading
- CUB birds
- COCO
- Zhu
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{zhu2019dmgandynamicmemorygenerative,
title={DM-GAN: Dynamic Memory Generative Adversarial Networks for Text-to-Image Synthesis},
author={Minfeng Zhu and Pingbo Pan and Wei Chen and Yi Yang},
year={2019},
eprint={1904.01310},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/1904.01310},
}