GAN D ISSECTION : V ISUALIZING AND U NDERSTANDING G ENERATIVE A DVERSARIAL N ETWORKS
A BSTRACT
Generative Adversarial Networks (GANs) have recently achieved impressive results for many real world applications, and many GAN variants have emerged with improvements in sample quality and training stability.
However, they have not been well visualized or understood.
How does a GAN represent our visual world internally
What causes the artifacts in GAN results?
How do architectural choices affect GAN learning?
Answering such questions could enable us to develop new insights and better models.
In this work, we present an analytic framework to visualize and understand GANs at the unit- object- and scene-level
We ﬁrst identify a group of interpretable units that are closely related to object concepts using a segmentation based network dissection method
Then , we quantify the causal effect of interpretable units by measuring the ability of interventions to control objects in the output
We examine the contextual relationship between these units and their surroundings by inserting the discovered object concepts into new images.
We show several practical applications enabled by our framework from comparing internal representations across different layers , models and datasets to improving GANs by locating and removing artifact-causing units , to interactively manipulating objects in a scene
We provide open source interpretation tools to help researchers and practitioners better understand their GAN models.
I NTRODUCTION
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) have been able to produce photorealistic images, often indistinguishable from real images.
This remarkable ability has powered many real-world applications ranging from visual recognition (Wang et al., 2017), to image manipulation (Isola et al., 2017; Zhu et al., 2017), to video prediction (Mathieu et al., 2016).
Since their invention in 2014, many GAN variants have been proposed (Radford et al., 2016; Zhang et al., 2018a), often producing more realistic and diverse samples with better training stability.
Despite this tremendous success, many questions remain to be answered.
For example, to produce a church image (Figure 1a), what knowledge does a GAN need to learn?
Alternatively, when a GAN sometimes produces terribly unrealistic images (Figure 1f), what causes the mistakes?
Why does one
GAN variant work better than another?
What fundamental differences are encoded in their weights?
In this work, we study the internal representations of GANs.
To a human observer, a well-trained
GAN appears to have learned facts about the objects in the image: for example, a door can appear on a building but not on a tree.
We wish to understand how a GAN represents such structure.
Do the objects emerge as pure pixel patterns without any explicit representation of objects such as doors and trees, or does the GAN contain internal variables that correspond to the objects that humans perceive?
If the GAN does contain variables for doors and trees, do those variables cause the generation of those objects, or do they merely correlate?
How are relationships between objects represented?
[Figure]
We present a general method for visualizing and understanding GANs at different levels of abstraction, from each neuron, to each object, to the contextual relationship between different objects.
We ﬁrst identify a group of interpretable units that are related to object concepts (Figure 1b).
These units’ featuremaps closely match the semantic segmentation of a particular object class (e.g., trees).
Second, we directly intervene within the network to identify sets of units that cause a type of objects to disappear (Figure 1c) or appear (Figure 1d).
We quantify the causal effect of these units using a standard causality metric.
Finally, we examine the contextual relationship between these causal object units and the background.
We study where we can insert object concepts in new images and how this intervention interacts with other objects in the image (Figure 1d).
To our knowledge, our work provides the ﬁrst systematic analysis for understanding the internal representations of GANs.
Finally, we show several practical applications enabled by this analytic framework, from comparing internal representations across different layers, GAN variants and datasets; to debugging and improving GANs by locating and ablating “artifact” units (Figure 1e); to understanding contextual relationships between objects in scenes; to manipulating images with interactive object-level control.
R ELATED W ORK
Generative Adversarial Networks.
The quality and diversity of results from GANs (Goodfellow et al., 2014) has continued to improve, from generating simple digits and faces (Goodfellow et al., 2014), to synthesizing natural scene images (Radford et al., 2016; Denton et al., 2015), to generating 1k photorealistic portraits (Karras et al., 2018), to producing one thousand object classes (Miyato et al., 2018; Zhang et al., 2018a).
GANs have also enabled applications such as visual recognition (Wang et al., 2017; Hoffman et al., 2018), image manipulation (Isola et al., 2017; Zhu et al., 2017), and video generation (Mathieu et al., 2016; Wang et al., 2018).
Despite the successes, little work has been done to visualize what GANs have learned.
Prior work (Radford et al., 2016; Zhu et al., 2016; Brock et al., 2017) manipulates latent vectors and observes how the results change accordingly.
z r u,P r x f h r u ↑ > t s c ( x )
G z h
IoU u,c r U,P r U,P f f δ U → c force U off force r U,P on x a x
i s c ( x i )
s c ( x a ) force r U,P off (a) (b) segment segment upsample generate single unit u segment featuremap thresholded generated image segmentation generator causal units U unforced units ablated image inserted image segmentation segmentation agreement causal effect
Visualizing deep neural networks.
A CNN can be visualized by reconstructing salient image features (Simonyan et al., 2014; Mahendran & Vedaldi, 2015) or by mining patches that maximize hidden layers’ activations (Zeiler & Fergus, 2014); or we can synthesize input images to invert a feature layer (Dosovitskiy & Brox, 2016).
Alternately, we can identify the semantics of each unit (Zhou et al., 2015;
Bau et al., 2017; Zhou et al., 2018a) by measuring agreement between unit activations and object segmentation masks, or by training a network to increase interpretability of such units (Zhang et al., 2018b).
Visualization of an RNN has also revealed interpretable units that track long-range dependencies (Karpathy et al., 2016; Strobelt et al., 2018).
Most previous work on network visualization has focused on networks trained for classiﬁcation; our work explores deep generative models trained for image generation.
Understanding neural representation in biology.
Studies of biological neural networks ﬁnd evidence of both local representations in which individual neurons are selective for meaningful concepts (Quiroga, 2012), as well as distributed representations in which individual neurons are essentially meaningless (Yuste, 2015).
Computational models of biological learning (Bowers et al., 2016;
Dasgupta et al., 2018)
ﬁnd sparse and local representations can aid generalization to novel stimuli.
Explaining the decisions of deep neural networks.
Individual network decisions can be explained using informative heatmaps (Zhou et al., 2018b; 2016; Selvaraju et al., 2017) or by scoring salience (Simonyan et al., 2014; Bach et al., 2015; Sundararajan et al., 2017; Lundberg & Lee, 2017).
Such analyses reveals which inputs contribute most to a categorical prediction by a network.
Recent work has also studied the contribution of feature vectors (Kim et al., 2017; Zhou et al., 2018b) or individual channels (Olah et al., 2018) to a ﬁnal prediction, and Morcos et al.
(2018) has examined the effect of individual units by ablating them.
Those methods explain discriminative classiﬁers.
Our method aims to explain how an image can be generated by a network, which is much less explored.
M ETHOD
Our goal is to analyze how objects such as trees are encoded by the internal representations of a
GAN generator G : z → x .
Here z ∈ R | z | denotes a latent vector sampled from a low-dimensional distribution, and
x ∈ R H
× W × 3 denotes an H × W generated image.
We use representation to describe the tensor r output from a particular layer of the generator G , where the generator creates an image x from random z through a composition of layers: r = h ( z ) and x = f ( r )
=
f ( h ( z )) =
G ( z ) .
Since r has all the data necessary to produce the image x = f ( r ) , r certainly contains the information to deduce the presence of any visible class c in the image.
Therefore the question we ask is not whether information about c is present in r — it is — but how such information is encoded in r .
In particular, for any class from a universe of concepts c ∈ C , we seek to understand whether r explicitly represents c in some way where it is possible to factor r at locations P into two components
[Equation]
where the generation of the object c at locations P depends mainly on the units r U , P , and is insensitive to the other units r U , P .
Here we refer to each channel of the featuremap as a unit: U denotes the set of unit indices of interest and U is its complement; we will write U and P to refer to the entire set of units and featuremap pixels in r .
We study the structure of r in two phases:
• Dissection: starting with a large dictionary of object classes, we identify the classes that have an explicit representation in r by measuring the agreement between individual units of r and every class
c (Figure 1b).
• Intervention: for the represented classes identiﬁed through dissection, we identify causal sets of units and measure causal effects between units and object classes by forcing sets of units on and off (Figure 1c ,d).
3. C HARACTERIZING UNITS BY DISSECTION
We ﬁrst focus on individual units of the representation.
Recall that r u, P is the one-channel h × w featuremap of unit u in a convolutional generator, where h × w is typically smaller than the image size.
We want to know if a speciﬁc unit r u, P encodes a semantic class such as a “tree”.
For image classiﬁcation networks, Bau et al.
(2017) has observed that many units can approximately locate emergent object classes when the units are upsampled and thresholded.
In that spirit, we select a universe of concepts c ∈ C for which we have a semantic segmentation s c ( x ) for each class.
Then we quantify the spatial agreement between the unit u ’s thresholded featuremap and a concept c ’s segmentation with the following intersection-over-union (IoU) measure: [Equation] , where t u,c = arg max t [Equation]
r
[Equation]
>
[Equation] s [Equation] where ∧ and ∨ denote intersection and union operations, and x = G ( z ) denotes the image generated from z .
The one-channel feature map r u, P slices the entire featuremap r = h ( z ) at unit u .
As shown in Figure 2a, we upsample r u, P to the output image resolution as r ↑ u, P .
( r ↑ u, P > t u,c ) produces a binary mask by thresholding the r ↑ u, P at a ﬁxed level t u,c .
s c ( x ) is a binary mask where each pixel indicates the presence of class c in the generated image x .
The threshold t u,c is chosen to be informative as possible by maximizing the information quality ratio I / H (using a separate validation set), that is, it maximizes the portion of the joint entropy H which is mutual information
I (Wijaya et al., 2017).
We can use IoU u,c to rank the concepts related to each unit and label each unit with the concept that matches it best.
Figure 3 shows examples of interpretable units with high IoU u,c .
They are not the [Figure] only units to match tables and sofas: layer3 of the dining room generator has 31 units (of 512 ) that match tables and table parts, and layer4 of the living room generator has 65 (of 512 ) sofa units.
Once we have identiﬁed an object class that a set of units match closely, we next ask: which units are responsible for triggering the rendering of that object?
A unit that correlates highly with an output object might not actually cause that output.
Furthermore, any output will jointly depend on several parts of the representation.
We need a way to identify combinations of units that cause an object.
3. M EASURING CAUSAL RELATIONSHIPS USING INTERVENTION
To answer the above question about causality, we probe the network using interventions: we test whether a set of units U in r cause the generation of c by forcing the units of U on and off.
Recall that r U , P denotes the featuremap r at units U and locations P. We ablate those units by forcing r U , P = 0 .
Similarly, we insert those units by forcing r U , P = k , where k is a per-class constant, as described in Section S-6.4.
We decompose the featuremap r into two parts ( r U , P , r U , P ) , where r U , P are unforced components of r : Original image :
[Equation]
Image with U ablated at pixels P :
[Equation]
Image with U inserted at pixels P :
[Equation]
An object is caused by U if the object appears in x i and disappears from x a .
Figure 1c demonstrates the ablation of units that remove trees, and Figure 1d demonstrates insertion of units at speciﬁc locations to make trees appear.
This causality can be quantiﬁed by comparing the presence of trees in x i and x a and averaging effects over all locations and images.
Following prior work (Holland, 1988;
Pearl, 2009), we deﬁne the average causal effect (ACE) of units U on the generation of on class c as:
[Equation]
where s c ( x ) denotes a segmentation indicating the presence of class c in the image x at P. To permit comparisons of δ U → c between classes c which are rare, we normalize our segmentation s c by E z , P [ s c ( x )] .
While these measures can be applied to a single unit, we have found that objects tend to depend on more than one unit.
Thus we wish to identify a set of units U that maximize the average causal effect δ U
→ c for an object class c .
Finding sets of units with high ACE.
Given a representation r with d units, exhaustively searching for a ﬁxed-size set U with high δ U → c is prohibitive as it has (cid:0) d | U | (cid:1) subsets.
Instead, we optimize a continuous intervention α ∈ [0 , 1] d , where each dimension α u indicates the degree of intervention for a unit u .
We maximize the following average causal effect formulation δ α → c :
Image with partial ablation at pixels P :
[Equation]
Image with partial insertion at pixels P :
[Equation]
Objective :
[Equation]
a )] , where r U , P denotes the all-channel featuremap at locations P, r U , P denotes the all-channel featuremap at other locations P, and (cid:12) applies a per-channel scaling vector α to the featuremap r U , P .
We optimize α over the following loss with an L2 regularization:
[Equation]
where λ controls the relative importance of each term.
We add the L2 loss as we seek a minimal set of casual units.
We optimize using stochastic gradient descent, sampling over both z and featuremap locations P and clamping the coefﬁcient α within the range [0 , 1] d at each step (d is the total number of units).
More details of this optimization are discussed in Section S-6.4.
Finally, we can rank units by α ∗ u and achieve a stronger causal effect (i.e., removing trees) when ablating successively larger sets of tree-causing units as shown in Figure 4.
R ESULTS
We study three variants of Progressive GANs (Karras et al., 2018) trained on LSUN scene datasets (Yu et al., 2015).
To segment the generated images, we use a recent model (Xiao et al., 2018) trained on the ADE20K scene dataset (Zhou et al., 2017).
The model can segment the input image intoobject classes, 29 parts of large objects, and 25 materials.
To further identify units that specialize in object parts, we expand each object class c into additional object part classes c-t , c-b , c-l , and c-r , which denote the top, bottom, left, or right half of the bounding box of a connected component.
Below, we use dissection for analyzing and comparing units across datasets, layers, and models (Section 4.1), and locating artifact units (Section 4.2).
Then, we start with a set of dominant object classes and use intervention to locate causal units that can remove and insert objects in different images (Section 4.3 and 4.4).
In addition, our video demonstrates our interactive tool.
4. C OMPARING UNITS ACROSS DATASETS , LAYERS , AND MODELS
Emergence of individual unit object detectors We are particularly interested in any units that are correlated with instances of an object class with diverse visual appearances; these would suggest that GANs generate those objects using similar abstractions as humans.
Figure 3 illustrates two such units.
In the dining room dataset, a unit emerges to match dining table regions.
More interestingly, the matched tables have different colors, materials, geometry, viewpoints, and levels of clutter: the only obvious commonality among these regions is the concept of a table.
This unit’s featuremap correlates to the fully supervised segmentation model (Xiao et al., 2018) with a high IoU of 0 .
Interpretable units for different scene categories The set of all object classes matched by the units of a GAN provides a map of what a GAN has learned about the data.
Figure 5 examines units from GANs trained on four LSUN scene categories (Yu et al., 2015).
The units that emerge are object classes appropriate to the scene type: for example, when we examine a GAN trained on kitchen scenes, we ﬁnd units that match stoves, cabinets, and the legs of tall kitchen stools.
Another striking phenomenon is that many units represent parts of objects: for example, the conference room GAN contains separate units for the body and head of a person.
Interpretable units for different network layers.
In classiﬁer networks, the type of information explicitly represented changes from layer to layer (Zeiler & Fergus, 2014).
We ﬁnd a similar phenomenon in a GAN.
Figure 6 compares early, middle, and late layers of a progressive GAN with 14 internal convolutional layers.
The output of the ﬁrst convolutional layer, one step away from the input z , remains entangled: individual units do not correlate well with any object classes except for two units that are biased towards the ceiling of the room.
Mid-level layers 4 to 7 have many units that match semantic objects and object parts.
Units in layers 10 and beyond match local pixel patterns such as materials, edges and colors.
All layers are shown in Section S-6.7.
Interpretable units for different GAN models.
Interpretable units can provide insights about how
GAN architecture choices affect the structures learned inside a GAN.
Figure 7 compares three models from Karras et al.
(2018): a baseline Progressive GANs, a modiﬁcation that introduces minibatch stddev statistics, and a further modiﬁcation that adds pixelwise normalization.
By examining unit semantics, we conﬁrm that providing minibatch stddev statistics to the discriminator increases not only the realism of results, but also the diversity of concepts represented by units: the number of
[Table]
m
[Table]
i
[Table]
k i t
[Table]
hen   un i t s
[Table]
- t s t o v e - b w o r k s u r f a c e
-r r e f r i ge r a t o r-
t m i c
r o w a v e - l g l a ss t il e 6 ob j e c t s 34 pa r t s 2 m a t e r i a l s c hu r c h / ou t doo r   un i t
s g r
a ss t r ee sky doo rr oad w i ndo w s t ep bu il d i ng - t sky - b sky -r c l oud sky - t sky - l t r ee - b t r ee - t bu il d
i ng - l do m e m oun t
a i n - l g r a ss - t s ea - b s t one w ood 7 ob j e c t s 13 pa r t s 2 m a t e r i a l s
[Figure] [Table]
pe t g l a ss w ood 13 ob j e c t s 18 pa r t s 3 m a t e r i a l s 1 un i t s c e ili
ng w i ndo w p l an t sky pa i n t
i ng c u r t a i n ﬂ oo r w i ndo w - t ﬂ oo r-
b w a ll - b c e ili ng - t w i ndo w - b w oodg
l a ssc a r pe t 7 ob j e c t s 5 pa r t s 3 m a t e r i a l s
The output of the ﬁrst convolutional layer has almost no units that match semantic objects, but many objects emerge at layers 4-7.
Later layers are dominated by low-level materials, edges and colors.
types of objects, parts, and materials matching units increases by more than 40% . The pixelwise normalization increases the number of units that match semantic classes by 19% .
4. D IAGNOSING AND I MPROVING GAN S
While our framework can reveal how GANs succeed in producing realistic images, it can also analyze the causes of failures in their results. Figure 8a shows several annotated units that are responsible for typical artifacts consistently appearing across different images. We can identify these units efﬁciently by human annotation: out of a sample of 1000 images, we visualize the top ten highest activating images for each unit, and we manually identify units with noticeable artifacts in this set.
It typically takes 10 minutes to locate 20 artifact-causing units out of 512 units in layer4 . More importantly, we can ﬁx these errors by ablating the above 20 artifact-causing units. Figure 8b shows that artifacts are successfully removed, and the artifact-free pixels stay the same, improving the generated results. In Table 1 we report two standard metrics, comparing our improved images
[Figure]
l ﬂ oo r- t pa i n t i ng - t pa i n t i ng -r c u r t a i n - b w ood c a r pe t 9 ob j e c t s 23 pa r t s 2 m a t e r i a l s
[Figure]
[Figure]
un i t s w i ndo w bed
c e ili ng ﬂ oo r c u r t a i n pa i n t
i ngp ill o ww a t e r c u s h
i onbed - bbed - t bed - l bed -r w a ll - b
c
e ili ng - t c e ili
ng - l w i ndo w - t
w i ndo w -r w i ndo w - b ﬂ oo r-
t ﬂ oo r-
l ﬂ oo r-r c u r t a i n - b c e ili ng -r ﬂ oo r-
b w i ndo w - l sky - t c e ili ng - b c u r t a i n - t c u r t a i n -r pa i n t
i ng - bg l a ssc a r pe t 9 ob j e c t s 22 pa r t s 2 m a t e r i a l s
[Figure]
[Figure]
ablating these units, we can ﬁx the artifacts in (b) and signiﬁcantly improve the visual quality as shown in (c).
to both the original artifact images and a simple baseline that ablates 20 randomly chosen units.
First, we compute the widely used Fr ´ echet Inception Distance (Heusel et al., 2017) between the generated images and real images.
We use 50 , 000 real images and generate 10 , 000 images with high activations on these units.
Second, we score 1 , 000 images per method on Amazon MTurk, collecting 20 , 000 human annotations regarding whether the modiﬁed image looks more realistic compared to the original.
Both metrics show signiﬁcant improvements.
Strikingly, this simple manual change to a network beats state-of-the-art GANs models.
The manual identiﬁcation of “artifact” units can be approximated by an automatic scoring of the realism of each unit, as detailed in Section S-6.1.
4. L OCATING C AUSAL U NITS WITH ABLATION
Errors are not the only type of output that can be affected by directly intervening in a GAN.
A variety of speciﬁc object types can also be removed from GAN output by ablating a set of units in a GAN.
In
Figure 9 we apply the method in Section 3.2 to identify sets of 20 units that have causal effects on common object classes in conference rooms scenes.
We ﬁnd that, by turning off these small sets of units, most of the output of people, curtains, and windows can be removed from the generated scenes.
However, not every object can be erased: tables and chairs cannot be removed.
Ablating those units will reduce the size and density of these objects, but will rarely eliminate them.
The ease of object removal depends on the scene type.
Figure 10 shows that, while windows can be removed well from conference rooms, they are more difﬁcult to remove from other scenes.
In particular, windows are just as difﬁcult to remove from a bedroom as tables and chairs from a conference room.
We hypothesize that the difﬁculty of removal reﬂects the level of choice
that a
[Table] [Figure]
GAN has learned for a concept: a conference room is deﬁned by the presence of chairs, so they cannot be altered.
And modern building codes mandate that all bedrooms must have windows;
the
GAN seems to have caught on to that pattern.
4. C HARACTERIZING CONTEXTUAL RELATIONSHIPS VIA INSERTION
We can also learn about the operation of a GAN by forcing units on and inserting these features into speciﬁc locations in scenes.
Figure 11 shows the effect of inserting 20 layer4 causal door units in church scenes.
In this experiment, we insert these units by setting their activation to the ﬁxed mean value for doors (further details in Section S-6.4).
Although this intervention is the same in each case, the effects vary widely depending on the objects’ surrounding context.
For example, the doors added to the ﬁve buildings in Figure 11 appear with a diversity of visual attributes, each with an orientation, size, material, and style that matches the building.
We also observe that doors cannot be added in most locations.
The locations where a door can be added are highlighted by a yellow box.
The bar chart in Figure 11 shows average causal effects of insertions of door units, conditioned on the background object class at the location of the intervention.
We ﬁnd that the GAN allows doors to be added in buildings, particularly in plausible locations such as where a window is present, or where bricks are present.
Conversely, it is not possible to trigger a door in the sky or on trees.
Interventions provide insight on how a GAN enforces relationships between objects.
Even if we try to add a door in layer4 , that choice can be vetoed later if the object is not appropriate for the context.
These downstream effects are further explored in Section S-6.5.
D ISCUSSION
By carefully examining representation units, we have found that many parts of GAN representations can be interpreted, not only as signals that correlate with object concepts but as variables that have a causal effect on the synthesis of objects in the output.
These interpretable effects can be used to compare, debug, modify, and reason about a GAN model.
Our method can be potentially applied to other generative models such as VAEs (Kingma & Welling, 2014) and
RealNVP (Dinh et al., 2017).
[Figure]
[Figure]
Emphasizing a door that is already present results in a larger door (d).
The chart summarizes the causal effect of inserting door units at one pixel with different contexts.
We have focused on the generator rather than the discriminator (as did in Radford et al.
because the generator must represent all the information necessary to approximate the target distribution, while the discriminator only learns to capture the difference between real and fake images.
Alternatively, we can train an encoder to invert the generator (Donahue et al., 2017; Dumoulin et al., 2017).
However, this incurs additional complexity and errors.
Many GANs also do not have an encoder.
Our method is not designed to compare the quality of GANs to one another, and it is not intended as a replacement for well-studied GAN metrics such as FID, which estimate realism by measuring the distance between the generated distribution of images and the true distribution (Borji (2018) surveys these methods).
Instead, our goal has been to identify the interpretable structure and provide a window into the internal mechanisms of a GAN.
Prior visualization methods (Zeiler & Fergus, 2014; Bau et al., 2017; Karpathy et al., 2016) have brought new insights into CNN and RNN research.
Motivated by that, in this work we have taken a small step towards understanding the internal representations of a GAN, and we have uncovered many questions that we cannot yet answer with the current method.
For example: why can a door not be inserted in the sky?
How does the GAN suppress the signal in the later layers?
Further work will be needed to understand the relationships between layers of a GAN.
Nevertheless, we hope that our work can help researchers and practitioners better analyze and develop their own GANs.
SS UPPLEMENTARY M ATERIAL S-6. A UTOMATIC IDENTIFICATION OF ARTIFACT UNITS
In Section 4.2, we have improved GANs by manually identifying and ablating artifact-causing units.
Now we describe an automatic procedure to identify artifact units using unit-speciﬁc FID scores.
To compute the FID score (Heusel et al., 2017) for a unit u , we generate 200 , 000 images and select the 10 , 000 images that maximize the activation of unit u , and this subset of 10 , 000 images is compared to the true distribution ( 50 , 000 real images) using FID.
Although every such unit-maximizing subset of images represents a skewed distribution, we ﬁnd that the per-unit FID scores fall in a wide range, with most units scoring well in FID while a few units stand out with bad FID scores: many of them were also manually ﬂagged by humans, as they tend to activate on images with clear visible artifacts.
Figure 12 shows the performance of FID scores as a predictor of manually ﬂagged artifact units.
The per-unit FID scores can achieve 50% precision and 50% recall.
That is, of the 20 worst-FID units, 10 are also among the 20 units manually judged to have the most noticeable artifacts.
Furthermore, repairing the model by ablating the highest-FID units works: qualitative results are shown in Figureand quantitative results are shown in Table 2.
[Table]
[Figure]
case, our method many ceiling method label prediction even though the consistently triggers on white letterbox shapes the
The segmentation model we use has no label such abstract shapes
S-6. H UMAN EVALUATION OF DISSECTION
As a sanity check, we evaluate the gap between human labeling of object concepts correlated with units and our automatic segmentation-based labeling, for one model, as follows.
For each of 512 units of layer4 of a “living room” Progressive GAN, 5 to 9 human annotations were collected (3728 labels in total).
In each case, an AMT worker is asked to provide one or two words describing the highlighted patches in a set of top-activating images for a unit.
Of the 512 units, 201 units were described by the same consistent word (such as ”sofa”, ”ﬁreplace” or ”wicker”) in 50% or more of the human labels.
These units are interpretable to humans.
Applying our segmentation-based dissection method, 154/201 of these units are also labeled with a conﬁdent label with IoU > 0.05 by dissection.
In 104/154 cases, the segmentation-based model gave the same label word as the human annotators, and most others are slight shifts in speciﬁcity.
For example, the segmentation labels “ottoman” or “curtain” or “painting” when a person labels “sofa” or “window” or “picture,” respectively.
A second AMT evaluation was done to rate the accuracy of both segmentation-derived and human-derived labels.
Human-derived labels scored 100% (of the 201 human-labeled units, all of the labels were rated as consistent by most raters).
Of thesegmentation-generated labels, 149 (96%) were rated by most AMT raters as accurate as well.
The ﬁve failure cases (where the segmentation is conﬁdent but rated as inaccurate by humans) arise from situations in which human evaluators saw one concept after observing only 20 top-activating images, while the algorithm, in evaluating 1000 images, counted a different concept as dominant.
Figure 14a shows one example: in the top images, mostly sofas are highlighted and few ceilings, whereas in the larger sample, mostly ceilings are triggered.
There are also 47/201 cases where the segmenter is not conﬁdent while humans have consensus.
Some of these are due to missing concepts in the segmenter.
Figure 14b shows a typical example, where a unit is devoted to letterboxing (white stripes at the top and bottom of images), but the segmentation has no conﬁdent label to assign to these.
We expect that as future semantic segmentation models are developed to be able to identify more concepts such as abstract shapes, more of these units can be automatically identiﬁed.
[Figure] [Figure]
FID scores removes spurious detected concepts such as ‘sky’, ‘ground’, and ‘building’.
S-6. P ROTECTING SEGMENTATION MODEL AGAINST UNREALISTIC IMAGES
Our method relies on having a segmentation function s c ( x ) that identiﬁes pixels of class c in the output x .
However, the segmentation model s c can perform poorly in the cases where x does not resemble the original training set of s c .
This phenomenon is visible when analyzing earlier GAN models.
For example, Figure 15 visualizes two units from a WGAN-GP model (Gulrajani et al., 2017) for LSUN bedrooms (this model was trained by Karras et al.
(2018) as a baseline in the original paper).
For these two units, the segmentation network seems to be confused by the distorted images.
To protect against such spurious segmentation labels, we can use a technique similar to that described in Section S-6.1: automatically identify units that produce unrealistic images, and omit those “unrealistic” units from semantic segmentation.
An appropriate threshold to apply will depend on the distribution being modeled: in Figure 16, we show how applying a ﬁlter, ignoring segmentation on units with FID 55 or higher, affects the analysis of this base WGAN model.
In general, fewer irrelevant labels are associated with units.
S-6. C OMPUTING CAUSAL UNITS
In this section we provide more details about the ACE optimization described in Section 3.2.
Specifying the per-class positive intervention constant k .
In Eqn. 3, the negative intervention is deﬁned as zeroing the intervened units, and a positive intervention is deﬁned as setting the intervened units to some big class-speciﬁc constant k .
For interventions for class c , we set k to be mean featuremap activation conditioned on the presence of class c at that location in the output, with each pixel weighted by the portion of the featuremap locations that are covered by the class c .
Setting all units at a pixel to k will tend to strongly cause the target class.
The goal of the optimization is to ﬁnd the subset of units that is causal for c .
Sampling c -relevant locations P. When optimizing the causal objective (Eqn. 5), the intervention locations P are sampled from individual featuremap locations.
When the class c is rare, most featuremap locations are uninformative: for example, when class c is a door in church scenes, most regions of the sky, grass, and trees are locations where doors will not appear.
Therefore, we focus the optimization as follows: during training, minibatches are formed by sampling locations P that are
layer after intervention 0.
n o r m a li
z
e
d f e a t u r e
d
i ff effect not relevant to class c by including locations where the class c is present in the output (and are therefore candidates for removal by ablating a subset of units), and an equal portion of locations where class c is not present at P, but it would be present if all the units are set to the constant k (candidate locations for insertion with a subset of units).
During the evaluation, causal effects are evaluated using uniform samples: the region P is set to the entire image when measuring ablations, and to uniformly sampled pixels P when measuring single-pixel insertions.
Initializing α with IoU. When optimizing causal α for class c , we initialize with
[Equation]
[Equation]
That is, we set the initial α so that the largest component corresponds to the unit with the largest IoU for class c , and we normalize the components so that this largest component is 1 .
Applying a learned intervention α When applying the interventions, we clip α by keeping only its top n components and zeroing the remainder.
To compare the interventions of different classes an different models on an equal basis, we examine interventions where we set n = 20 .
S-6. T RACING THE EFFECT OF AN INTERVENTION
To investigate the mechanism for suppressing the visible effects of some interventions seen in
Section 4.4, in this section we insert 20 door-causal units on a sample of individual featuremap locations at layer4 and measure the changes caused in later layers.
To quantify effects on downstream features, the change in each feature channel is normalized by that channel’s mean L1 magnitude, and we examine the mean change in these normalized featuremaps at each layer.
In Figure 17, these effects that propagate to layer14 are visualized as a heatmap: brighter colors indicate a stronger effect on the ﬁnal feature layer when the door intervention is in the neighborhood of a building instead of trees or sky.
Furthermore, we plot the average effect on every layer at right in Figure 17, separating interventions that have a visible effect from those that do not.
A small identical intervention at layer4 is ampliﬁed to larger changes up to a peak at layer12 .
S-6. M ONITORING GAN UNITS DURING TRAINING
Dissection can also be used to monitor the progress of training by quantifying the emergence, diversity, and quality of interpretable units.
For example, in Figure 18 we show dissections of layer4 representations of a Progressive GAN model trained on bedrooms, captured at a sequence of checkpoints during training.
As training proceeds, the number of units matching objects increases, as does the number of object classes with matching units, and the quality of object detectors as
[Figure]
[Table]
[Figure]
s
[Figure]
s
[Figure]
r t s
[Figure]
m a t
e
r
i a l s measured by average IoU over units increases.
During this successful training, dissection suggests that the model is gradually learning the structure of a bedroom, as increasingly units converge to meaningful bedroom concepts.
S- 6. A LL LAYERS OF A GAN
In Section 4.1 we show a small selection of layers of a GAN; in Figure 19 we show a complete listing of all the internal convolutional layers of that model (a Progressive GAN trained on LSUN living room images).
As can be seen, the diversity of units matching high-level object concepts peaks at layer4 - layer6 , then declines in later layers, with the later layers dominated by textures, colors, and shapes.
[Figure]
[Table]
t s 1 m a t e r i a l   un i t s c e ili
ng w i ndo w s o f a pa i n t i ng ﬂ oo r c u r t a i n c o ff ee t ab l e boo kc a s e ﬁ r ep l a c e s he l f skys o f a - t s o f a - b ﬂ oo r-
b w i ndo w - t c e ili ng - t w a ll - b s o f a - l ﬂ oo r-r c
e
ili
ng - b w i ndo w - b ﬂ oo r-
l w a ll - t c e ili
ng -r w i ndo w -r w a ll - l c e ili ng - l s o f a -r w a ll -r pa i n t
i ng - b ﬁ r ep l a c e -r ﬁ r ep l a c e - t w i ndo w - l s he l f - t c u r t a i n - t pa i n t
i ng -r c o ff ee t ab l e -r c o ff ee t ab l e - t pa i n t
i ng - l c a r pe t g l a ss 11 ob j e c t s 28 pa r t s 2 m a t
e
r
i a l s   un i t s c e ili
ng s o f a w i ndo w pa i n t
i ng boo kc a s e c u r t a i n ﬂ oo r ﬁ r ep l a c e c o ff ee t ab l e c hande li e r ﬂ oo r-
b c e ili ng - t s o f a - b
s o f a - t c e ili ng - b w a ll - b w a ll - t pa i n t i ng -
[Table]
w i ndo w - t pa i n t i
[Table]
- l s o f a -r w a ll - l ﬂ
[Table]
r-r ﬂ oo r-
l c e ili
ng - l w i ndo w -r ﬁ r ep
l
a c e - l ﬁ r ep l a c e - t w a ll -r c e ili
ng -r
[Table]
w - b c e ili ng - b c u s h i on - b pa i n t
i ng - b w ood c a r pe t g l a ss 7 ob j e c t s 11 pa r t s 3 m a t
e
r
i a l s 1 un i t s c e ili
ng w i ndo w p l an t sk y pa i n t
i ng c u r t a i n ﬂ oo r w i ndo w - t ﬂ oo r-
b w a ll - b c e ili ng - t w i ndo w - b w oodg
l a s s c a r pe t 7 ob j e c t s 5 pa r t s 3 m a t e r i a l s   un i t s c e ili
ng w i ndo w c u r t a
i np l an t sky w a ll - b w oodg l a ss 5 ob j e c t s 1 pa r t 2 m a t
e
r
i a l s  un i t s c e ili
ng w i ndo w c u r t a i n sky p l an t c e ili ng - t w oodg l a ss 5 ob j e c t s 1 pa r t 2 m a t
e
r
i a l s 1 u n i t s w i n d o w c e ili
ng c u r t a i n w oo d c a r p e t 3 o b
j e c t s 2 m a t
e
r
i a l s