Rewriting a Deep Generative Model

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 12346)


A deep generative model such as a GAN learns to model a rich set of semantic and physical rules about the target distribution, but up to now, it has been obscure how such rules are encoded in the network, or how a rule could be changed. In this paper, we introduce a new problem setting: manipulation of specific rules encoded by a deep generative model. To address the problem, we propose a formulation in which the desired rule is changed by manipulating a layer of a deep network as a linear associative memory. We derive an algorithm for modifying one entry of the associative memory, and we demonstrate that several interesting structural rules can be located and modified within the layers of state-of-the-art generative models. We present a user interface to enable users to interactively change the rules of a generative model to achieve desired effects, and we show several proof-of-concept applications. Finally, results on multiple datasets demonstrate the advantage of our method against standard fine-tuning methods and edit transfer algorithms.



We thank Jonas Wulff, Hendrik Strobelt, Aaron Hertzman, Taesung Park, William Peebles, Gerald Sussman, and William T. Freeman for their vision, encouragement, and many valuable discussions. We are grateful for the support of DARPA XAI FA8750-18-C-0004, DARPA SAIL-ON HR0011-20-C-0022, NSF 1524817 on Advancing Visual Recognition with Feature Visualizations, NSF BIGDATA 1447476, and a hardware donation from NVIDIA.

Supplementary material

Supplementary material 1 (mp4 96023 KB)

500725_1_En_21_MOESM2_ESM.pdf (4.1 mb)
Supplementary material 2 (pdf 4234 KB)


  1. 1.
    Aberman, K., Liao, J., Shi, M., Lischinski, D., Chen, B., Cohen-Or, D.: Neural best-buddies: sparse cross-domain correspondence. ACM TOG 37(4), 69 (2018)CrossRefGoogle Scholar
  2. 2.
    An, X., Pellacini, F.: AppProp: all-pairs appearance-space edit propagation. ACM TOG 27(3), 40 (2008)CrossRefGoogle Scholar
  3. 3.
    Anderson, J.A.: A simple neural network generating an interactive memory. Math. Biosci. 14(3–4), 197–220 (1972)CrossRefGoogle Scholar
  4. 4.
    Andrychowicz, M., et al.: Learning to learn by gradient descent by gradient descent. In: NeurIPS, pp. 3981–3989 (2016)Google Scholar
  5. 5.
    Barnes, C., Shechtman, E., Finkelstein, A., Goldman, D.B.: PatchMatch: a randomized correspondence algorithm for structural image editing. ACM TOG 28(3), 24 (2009)CrossRefGoogle Scholar
  6. 6.
    Bau, D., et al.: Semantic photo manipulation with a generative image prior. ACM TOG 38(4), 1–11 (2019)CrossRefGoogle Scholar
  7. 7.
    Bau, D., et al.: Gan dissection: visualizing and understanding generative adversarial networks. In: ICLR (2019)Google Scholar
  8. 8.
    Bengio, S., Bengio, Y., Cloutier, J., Gecsei, J.: On the optimization of a synaptic learning rule. In: Optimality in Artificial and Biological Neural Networks, pp. 6–8. University of Texas (1992)Google Scholar
  9. 9.
    Bousmalis, K., Silberman, N., Dohan, D., Erhan, D., Krishnan, D.: Unsupervised pixel-level domain adaptation with generative adversarial networks. In: CVPR (2017)Google Scholar
  10. 10.
    Brown, T.B., et al.: Language models are few-shot learners. arXiv preprint arXiv:2005.14165 (2020)
  11. 11.
    Burt, P., Adelson, E.: The Laplacian pyramid as a compact image code. IEEE Trans. Commun. 31(4), 532–540 (1983)CrossRefGoogle Scholar
  12. 12.
    Chan, C., Ginosar, S., Zhou, T., Efros, A.A.: Everybody dance now. In: ICCV (2019)Google Scholar
  13. 13.
    Chen, X., Zou, D., Li, J., Cao, X., Zhao, Q., Zhang, H.: Sparse dictionary learning for edit propagation of high-resolution images. In: CVPR (2014)Google Scholar
  14. 14.
    Chen, X., Zou, D., Zhao, Q., Tan, P.: Manifold preserving edit propagation. ACM TOG 31(6), 1–7 (2012)Google Scholar
  15. 15.
    Cohn, D., Atlas, L., Ladner, R.: Improving generalization with active learning. Mach. Learn. 15(2), 201–221 (1994)Google Scholar
  16. 16.
    Donahue, J., et al.: DeCAF: a deep convolutional activation feature for generic visual recognition. In: ICML (2014)Google Scholar
  17. 17.
    Dosovitskiy, A., Brox, T.: Generating images with perceptual similarity metrics based on deep networks. In: NeurIPS (2016)Google Scholar
  18. 18.
    Dy, J.G., Brodley, C.E.: Visualization and interactive feature selection for unsupervised data. In: SIGKDD, pp. 360–364 (2000)Google Scholar
  19. 19.
    Efros, A.A., Freeman, W.T.: Image quilting for texture synthesis and transfer. In: SIGGRAPH. ACM (2001)Google Scholar
  20. 20.
    Endo, Y., Iizuka, S., Kanamori, Y., Mitani, J.: DeepProp: extracting deep features from a single image for edit propagation. Comput. Graph. Forum 35(2), 189–201 (2016)CrossRefGoogle Scholar
  21. 21.
    Fails, J.A., Olsen Jr, D.R.: Interactive machine learning. In: ACM IUI, pp. 39–45 (2003)Google Scholar
  22. 22.
    Finn, C., Abbeel, P., Levine, S.: Model-agnostic meta-learning for fast adaptation of deep networks. In: ICML, pp. 1126–1135 (2017).
  23. 23.
    Fried, O., et al.: Text-based editing of talking-head video. ACM TOG 38(4), 1–14 (2019)CrossRefGoogle Scholar
  24. 24.
    Gatys, L.A., Ecker, A.S., Bethge, M.: Image style transfer using convolutional neural networks. In: CVPR (2016)Google Scholar
  25. 25.
    Goodfellow, I., et al.: Generative adversarial nets. In: NeurIPS (2014)Google Scholar
  26. 26.
    Guo, D.: Coordinating computational and visual approaches for interactive feature selection and multivariate clustering. Inf. Vis. 2(4), 232–246 (2003)CrossRefGoogle Scholar
  27. 27.
    Hasinoff, S.W., Jóźwiak, M., Durand, F., Freeman, W.T.: Search-and-replace editing for personal photo collections. In: 2010 IEEE International Conference on Computational Photography (ICCP), pp. 1–8. IEEE (2010)Google Scholar
  28. 28.
    Hertzmann, A., Jacobs, C.E., Oliver, N., Curless, B., Salesin, D.H.: Image analogies. In: SIGGRAPH (2001)Google Scholar
  29. 29.
    Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., Hochreiter, S.: GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In: NeurIPS (2017)Google Scholar
  30. 30.
    Hinton, G.E., Osindero, S., Teh, Y.W.: A fast learning algorithm for deep belief nets. Neural Comput. 18, 1527–1554 (2006)MathSciNetCrossRefGoogle Scholar
  31. 31.
    Huang, X., Liu, M.-Y., Belongie, S., Kautz, J.: Multimodal unsupervised image-to-image translation. In: Ferrari, V., Hebert, M., Sminchisescu, C., Weiss, Y. (eds.) ECCV 2018. LNCS, vol. 11207, pp. 179–196. Springer, Cham (2018). Scholar
  32. 32.
    Huh, M., Zhang, R., Zhu, J.Y., Paris, S., Hertzmann, A.: Transforming and projecting images to class-conditional generative networks. In: ECCV (2020)Google Scholar
  33. 33.
    Iizuka, S., Simo-Serra, E., Ishikawa, H.: Let there be color!: Joint end-to-end learning of global and local image priors for automatic image colorization with simultaneous classification. ACM TOG 35(4), 1–11 (2016)CrossRefGoogle Scholar
  34. 34.
    Isola, P., Zhu, J.Y., Zhou, T., Efros, A.A.: Image-to-image translation with conditional adversarial networks. In: CVPR (2017)Google Scholar
  35. 35.
    Jiang, B., Canny, J.: Interactive machine learning via a gpu-accelerated toolkit. In: ACM IUI, pp. 535–546 (2017)Google Scholar
  36. 36.
    Johnson, J., Alahi, A., Fei-Fei, L.: Perceptual losses for real-time style transfer and super-resolution. In: Leibe, B., Matas, J., Sebe, N., Welling, M. (eds.) ECCV 2016. LNCS, vol. 9906, pp. 694–711. Springer, Cham (2016). Scholar
  37. 37.
    Karras, T.: FFHQ dataset (2019).
  38. 38.
    Karras, T., Aila, T., Laine, S., Lehtinen, J.: Progressive growing of GANs for improved quality, stability, and variation. In: ICLR (2018)Google Scholar
  39. 39.
    Karras, T., Laine, S., Aila, T.: A style-based generator architecture for generative adversarial networks. In: CVPR (2019)Google Scholar
  40. 40.
    Karras, T., Laine, S., Aittala, M., Hellsten, J., Lehtinen, J., Aila, T.: Analyzing and improving the image quality of styleGAN. In: CVPR (2020)Google Scholar
  41. 41.
    Kingma, D., Ba, J.: Adam: a method for stochastic optimization. In: ICLR (2015)Google Scholar
  42. 42.
    Kingma, D.P., Welling, M.: Auto-encoding variational Bayes. In: ICLR (2014)Google Scholar
  43. 43.
    Kohonen, T.: Correlation matrix memories. IEEE Trans. Comput. 100(4), 353–359 (1972)CrossRefGoogle Scholar
  44. 44.
    Kohonen, T.: Associative Memory: A System-Theoretical Approach, vol. 17. Springer, Heidelberg (2012). Scholar
  45. 45.
    Kohonen, T., Ruohonen, M.: Representation of associated data by matrix operators. IEEE Trans. Comput. 100(7), 701–702 (1973)CrossRefGoogle Scholar
  46. 46.
    Kokiopoulou, E., Chen, J., Saad, Y.: Trace optimization and eigenproblems in dimension reduction methods. Numer. Linear Algebra Appl. 18(3), 565–602 (2011)MathSciNetCrossRefGoogle Scholar
  47. 47.
    Krause, J., Perer, A., Bertini, E.: INFUSE: interactive feature selection for predictive modeling of high dimensional data. IEEE Trans. Vis. Comput. Graph. 20(12), 1614–1623 (2014)CrossRefGoogle Scholar
  48. 48.
    Lake, B.M., Salakhutdinov, R., Tenenbaum, J.B.: Human-level concept learning through probabilistic program induction. Science 350(6266), 1332–1338 (2015)MathSciNetCrossRefGoogle Scholar
  49. 49.
    Larsson, G., Maire, M., Shakhnarovich, G.: Learning representations for automatic colorization. In: Leibe, B., Matas, J., Sebe, N., Welling, M. (eds.) ECCV 2016. LNCS, vol. 9908, pp. 577–593. Springer, Cham (2016). Scholar
  50. 50.
    Levin, A., Lischinski, D., Weiss, Y.: Colorization using optimization. ACM TOG 23(3), 689–694 (2004)CrossRefGoogle Scholar
  51. 51.
    Liao, J., Yao, Y., Yuan, L., Hua, G., Kang, S.B.: Visual attribute transfer through deep image analogy. arXiv preprint arXiv:1705.01088 (2017)
  52. 52.
    Liu, M.Y., Breuel, T., Kautz, J.: Unsupervised image-to-image translation networks. In: NeurIPS (2017)Google Scholar
  53. 53.
    Luan, F., Paris, S., Shechtman, E., Bala, K.: Deep photo style transfer. In: CVPR, pp. 4990–4998 (2017)Google Scholar
  54. 54.
    Mathieu, M., Couprie, C., LeCun, Y.: Deep multi-scale video prediction beyond mean square error. In: ICLR (2016)Google Scholar
  55. 55.
    Nagano, K., et al.: paGAN: real-time avatars using dynamic textures. In: SIGGRAPH Asia, p. 258 (2018)Google Scholar
  56. 56.
    Oord, A.v.d., et al.: Wavenet: a generative model for raw audio. arXiv preprint arXiv:1609.03499 (2016)
  57. 57.
    Park, T., Liu, M.Y., Wang, T.C., Zhu, J.Y.: Semantic image synthesis with spatially-adaptive normalization. In: CVPR (2019)Google Scholar
  58. 58.
    Patel, K., Drucker, S.M., Fogarty, J., Kapoor, A., Tan, D.S.: Using multiple models to understand data. In: IJCAI (2011)Google Scholar
  59. 59.
    Pérez, P., Gangnet, M., Blake, A.: Poisson image editing. In: SIGGRAPH, pp. 313–318 (2003)Google Scholar
  60. 60.
    Portenier, T., Hu, Q., Szabó, A., Bigdeli, S.A., Favaro, P., Zwicker, M.: FaceShop: deep sketch-based face image editing. ACM Trans. Graph. (TOG) 37(4), 99:1–99:13 (2018)CrossRefGoogle Scholar
  61. 61.
    Raghavan, H., Madani, O., Jones, R.: Active learning with feedback on features and instances. JMLR 7(Aug), 1655–1686 (2006)MathSciNetzbMATHGoogle Scholar
  62. 62.
    Reinhard, E., Adhikhmin, M., Gooch, B., Shirley, P.: Color transfer between images. IEEE Comput. Graphics Appl. 21(5), 34–41 (2001)CrossRefGoogle Scholar
  63. 63.
    Saenko, K., Kulis, B., Fritz, M., Darrell, T.: Adapting visual category models to new domains. In: Daniilidis, K., Maragos, P., Paragios, N. (eds.) ECCV 2010. LNCS, vol. 6314, pp. 213–226. Springer, Heidelberg (2010). Scholar
  64. 64.
    Schaefer, S., McPhail, T., Warren, J.: Image deformation using moving least squares. ACM TOG 25(3), 533–540 (2006)CrossRefGoogle Scholar
  65. 65.
    Settles, B., Craven, M.: An analysis of active learning strategies for sequence labeling tasks. In: EMNLP, pp. 1070–1079 (2008)Google Scholar
  66. 66.
    Sharma, A., Foroosh, H.: Slim-CNN: a light-weight CNN for face attribute prediction. arXiv preprint arXiv:1907.02157 (2019)
  67. 67.
    Shocher, A., Cohen, N., Irani, M.: “zero-shot” super-resolution using deep internal learning. In: CVPR, pp. 3118–3126 (2018)Google Scholar
  68. 68.
    Socher, R., Ganjoo, M., Manning, C.D., Ng, A.: Zero-shot learning through cross-modal transfer. In: NeurIPS (2013)Google Scholar
  69. 69.
    Suzuki, R., Koyama, M., Miyato, T., Yonetsuji, T., Zhu, H.: Spatially controllable image synthesis with internal representation collaging. arXiv preprint arXiv:1811.10153 (2018)
  70. 70.
    Taigman, Y., Polyak, A., Wolf, L.: Unsupervised cross-domain image generation. In: ICLR (2017)Google Scholar
  71. 71.
    Ulyanov, D., Vedaldi, A., Lempitsky, V.: Deep image prior. In: CVPR (2018)Google Scholar
  72. 72.
    Wolberg, G.: Digital image warping. IEEE Computer Society Press, Los Alamitos (1990)Google Scholar
  73. 73.
    Xiao, T., Liu, Y., Zhou, B., Jiang, Y., Sun, J.: Unified perceptual parsing for scene understanding. In: Ferrari, V., Hebert, M., Sminchisescu, C., Weiss, Y. (eds.) ECCV 2018. LNCS, vol. 11209, pp. 432–448. Springer, Cham (2018). Scholar
  74. 74.
    Xu, K., Li, Y., Ju, T., Hu, S.M., Liu, T.Q.: Efficient affinity-based edit propagation using KD tree. ACM TOG 28(5), 1–6 (2009)Google Scholar
  75. 75.
    Yosinski, J., Clune, J., Bengio, Y., Lipson, H.: How transferable are features in deep neural networks? In: NeurIPS, pp. 3320–3328 (2014)Google Scholar
  76. 76.
    Yu, C., Wang, J., Peng, C., Gao, C., Yu, G., Sang, N.: BiSeNet: bilateral segmentation network for real-time semantic segmentation. In: Ferrari, V., Hebert, M., Sminchisescu, C., Weiss, Y. (eds.) ECCV 2018. LNCS, vol. 11217, pp. 334–349. Springer, Cham (2018). CrossRefGoogle Scholar
  77. 77.
    Yu, F., Seff, A., Zhang, Y., Song, S., Funkhouser, T., Xiao, J.: LSUN: construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365 (2015)
  78. 78.
    Yücer, K., Jacobson, A., Hornung, A., Sorkine, O.: Transfusive image manipulation. ACM TOG 31(6), 1–9 (2012)CrossRefGoogle Scholar
  79. 79.
    Zeiler, M.D., Fergus, R.: Visualizing and understanding convolutional networks. In: Fleet, D., Pajdla, T., Schiele, B., Tuytelaars, T. (eds.) ECCV 2014. LNCS, vol. 8689, pp. 818–833. Springer, Cham (2014). Scholar
  80. 80.
    Zhang, R., Isola, P., Efros, A.A.: Colorful image colorization. In: Leibe, B., Matas, J., Sebe, N., Welling, M. (eds.) ECCV 2016. LNCS, vol. 9907, pp. 649–666. Springer, Cham (2016). Scholar
  81. 81.
    Zhang, R., Isola, P., Efros, A.A., Shechtman, E., Wang, O.: The unreasonable effectiveness of deep features as a perceptual metric. In: CVPR (2018)Google Scholar
  82. 82.
    Zhang, R., et al.: Real-time user-guided image colorization with learned deep priors. ACM TOG 9(4), 11 (2017)Google Scholar
  83. 83.
    Zhu, J.Y., Park, T., Isola, P., Efros, A.A.: Unpaired image-to-image translation using cycle-consistent adversarial networks. In: ICCV (2017)Google Scholar
  84. 84.
    ZLL: Face-parsing PyTorch (2019).

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.MIT CSAILCambridgeUSA
  2. 2.Adobe ResearchSan JoseUSA

Personalised recommendations