{'fraction_non_alphanumeric': 0.036959669570584185, 'fraction_numerical': 0.014480024687255205, 'mean_word_length': 4.471168831168831, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 2, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Semantic Editing On Segmentation Map Via Multi-Expansion Loss

Semantic editing on segmentation map has been proposed as an intermediate interface for image generation, because it provides flexible and strong assistance in various image generation tasks. This paper aims to improve quality of edited segmentation map conditioned on semantic inputs. Even though recent studies apply global and local adversarial losses extensively to generate images for higher image quality, we find that they suffer from the misalignment of the boundary area in the mask area. To address this, we propose MExGAN for semantic editing on segmentation map, which uses a novel Multi-Expansion (MEx) loss implemented by adversarial losses on MEx areas. Each MEx area has the mask area of the generation as the majority and the boundary of original context as the minority. To boost convenience and stability of MEx loss, we further propose an Approximated MEx (A-MEx) loss. Besides, in contrast to previous model that builds training data for semantic editing on segmentation map with part of the whole image, which leads to model performance degradation, MExGAN applies the whole image to build the training data. Extensive experiments on semantic editing on segmentation map and natural image inpainting show competitive results on four datasets.


Introduction
Deep learning has achieved impressive results in image generation such as image manipulation. Editing content directly on segmentation map has been recently proposed as an intermediate interface for image generation (Hong et al. 2018) due to its versatile abilities and great potential to improve performance in various generation tasks.
This paper focuses on semantic editing on segmentation map, shown as Fig. 1. It performs the editing automatically, rather than manually, such as manual drawing by users. Plus, it generates manipulated results reflecting semantics defined by a target label, rather than only being consistent with the context, such as image inpainting (Yi et al. 2020). Our work improves the performance of semantic editing on segmentation map by solving a main challenge, explained below.  (Cordts et al. 2016). In the first row, we add a "car" in the masked area. And in the second row, we heterogeneously replace a car and a person with a "bus".
Challenge The current applications of global and local adversarial losses (Iizuka, Simo-Serra, and Ishikawa 2017;Wang et al. 2018b), which aim to improve quality of generated images, tend to result in misalignment of the boundary area in the mask area. Previous works show applying both global and local losses achieves better results, in comparison with applying the global loss alone. We conjecture this is caused by the inability to penalize all fake parts by the global adversarial loss alone, due to the small percentage of pixels composing image fine details. On the other hand, the local adversarial loss is too weak to boost the perceptual quality in areas near the boundary of the mask area (abbreviated as Boundary Area, shown in Fig. 2(c)), because it has no knowledge of the context near Boundary Area (see Fig. 2(b)) in the original context. These drawbacks cause the misalignment of the Boundary Area (abbreviated as misalignment issue, shown in Fig. 2(d)). Explicitly, even if we apply both the global and local adversarial losses, the Boundary Area might still be a blind spot. Thus, the Boundary Area in the initial generated result (abbreviated as initial result, shown as Fig. 2(c)) might cause misalignment with the groundtruth (shown as Fig. 2(a)). Additionally, our task fuses the mask area (shown as Fig. 2(b)) of the initial result with the original context to obtain the manipulated result ( Fig. 2(d)).  Figure 2: Given a ground-truth (a), the misalignment issue in manipulated result (d) is caused by misalignment between the initial result (c) and original context from (b). Green border shows original context, red one shows generated context.

Ground-Truth
Together, these cause artifacts in Boundary Area of the manipulated result. We also improve data preparation used in the state-of-theart model of our task. Because human annotation is difficult, (Hong et al. 2018) proposes self-supervised learning to prepare the training data. However, they only use part of the whole image as a conditional input, which causes information loss due to the removed context, the difference between the chosen area and the full image. We believe the removed context includes the structure and semantic information that can guide the generation of mask area.
Thus, we propose Multi-Expansion GAN (MExGAN). MExGAN applies full images as a conditional input to improve data preparation. It can also flexibly replace basic generators for other applications, such as in natural image inpainting. To tackle the misalignment issue, MExGAN applies a novel Multi-Expansion (MEx) loss using adversarial losses on the MEx areas. Specifically, MExGAN constructs manipulated segmentation map by fusing the initial result and original context. Then, it chooses multiple MEx areas by expanding mask areas multiple times in the manipulated segmentation map. Due to the expansion operations, each MEx area has mask area from the initial result as a principal component and the partially original context as an assisting component. To boost convenience and stability of MEx loss, we further propose an Approximated MEx (A-MEx) loss.
We set interactive image translation (Wang et al. 2018a) as a downstream task, which translates the manipulated segmentation maps into natural images. This is different from the semantic image inpainting used in (Hong et al. 2018). The results demonstrate diverse abilities of our model.
To summarize, the following are our main contributions: • Improvement and flexibility in MExGAN. We propose a framework MExGAN for our task, which improves data preparation using the whole images directly. MExGAN can also flexibly replace basic structure generator in other applications such as image inpainting.
• Propose MEx loss. To address the misalignment issue in image generation with global and local adversarial losses, we propose MEx loss, implemented by adversarial losses on MEx areas. Each MEx area has the mask area of initial result as the majority part and the partial original context as the minority part.
• Propose A-MEx losses. An approximation of MEx loss, A-MEx Loss, is proposed to boost convenience and stability of MEx loss.
• Extensive experiments on two tasks. Extensive experiments are conducted on four datasets. We show competitive results and demonstrate the beneficial effects of MEx loss on two tasks, semantic editing on segmentation map and image inpainting on natural images.

Related Work
Image manipulation has made tremendous progress by recent rapid development of GAN (Goodfellow et al. 2014), and Variational Auto Encoder (VAE) (Kingma and Welling 2013). Based on the types of input domain, these methods can be divided into four categories, i.e., directly on natural images (Zhu et al. 2016;Yu et al. 2018;Zhu et al. 2017), indirectly on sketches (Chen and Hays 2018;Qiu et al. 2019), segmentation maps (Wang et al. 2018a;Isola et al. 2017;Chen and Koltun 2017;Park et al. 2019), and scene graphs (Johnson, Gupta, and Fei-Fei 2018;Mittal et al. 2019). In terms of the tasks and functions, it can be divided into two categories, manipulation on content, such as adding (Yu et al. 2018;Wang et al. 2018a;Yao et al. 2018) or removing objects (Shetty, Fritz, and Schiele 2018); and manipulation on attributes (Mo, Cho, and Shin 2018;Park et al. 2019;Qiu et al. 2019;Yao et al. 2018), such as altering styles (Wang and Gupta 2016). Our work focuses on semantically editing content of the segmentation maps. Segmentation map editing for image manipulation has recently been applied. For examples, (Ding et al. 2019), (Ntavelis et al. 2020) and (Hong et al. 2018) generate the segmentation maps of target objects, which are later translated to natural images for semantic image editing. Similar to the framework used in above studies, (Liao et al. 2020) and (Song et al. 2018) focus on image inpainting. And (Mo, Cho, and Shin 2018) transfers object shapes in the segmentation maps for attribute editing in natural images.
Difference between MEx Loss and other common techniques is obvious. Attention mechanism, generally, learns weighted scores in pixel-level  or feature-level (Zhou and Shen 2020), so that the model can have different attention in the inputs. Partial convolution (Liu et al. 2018) filters the information from mask areas in the convolution operation to reduce noises from mask areas. Multi-scale resizes the full images into various sizes for hierarchical feature representation . In contrast, MEx loss focuses on solving the misalignment issue in Boundary Area using MEx areas. Also, MEx loss is dynamic through changing the radius for each expansion, rather than static, such as conventional attention mechanism and partial convolution. Importantly, MEx loss provides multiple mid-level views, which are ignored in global and local views. For example, in multi-scale, it still focuses on the global view.

Model
Given a complete segmentation map S c ∈ R H×W ×1 and its colorful version Y c ∈ R H×W ×3 , where S, Y, H and W represent the single-channel segmentation map, RGBchannel segmentation map, height and width respectively. We aim to synthesize the manipulated segmentation map Y ∈ R H×W ×3 with semantics defined by a target label l t .
We choose an object bounding box B, which guides us to generate A u by the area of B on A c , where A can be S or Y. Specifically, we define an object bounding box B = {b, l t }, as a combination of box corner b ∈ R 4 and a target label l t . A user can semantically edit a segmentation map by setting an arbitrary bounding box and a target label. Fig. 3 shows the overall pipeline for MExGAN. First, MExGAN constructs an incomplete segmentation map S u ∈ R H×W ×1 by copying S c and masking all pixels in the bounding box B as l t , which informs the model about the location and semantics to generate. It is important to point out that the way we use S c is different from (Hong et al. 2018): we apply the global observation of S c , while (Hong et al. 2018) applies only a local squared observation of S c , which omits much of the removed context that belongs to the same image. Removing the contexts will therefore reduce the quality of the generated results. Second, MExGAN generates its initial segmentation map Y by Y = G Y (S u , B), conditioned on S u and B. Specifically, G Y is a learnable structure generator and Y is supervised by Y c . Next, we fuse the structure generator output Y and Y u to derive the manipulated segmentation mapŶ. Finally,Ŷ is sent to a downstream model to perform a subsequent specific task such as generating a natural image. In this paper, to demonstrate the flexibility of our pipeline, we apply image translation as our downstream task, rather than semantic image inpainting shown in (Hong et al. 2018).
In the next subsections, we begin by introducing a basic structure generator G 0 without the MEx loss. We then describe MEx loss and add the loss to the basic structure generator, so that we have MEx structure generator G Y . We also propose an Approximated MEx (A-MEx) loss to boost convenience and stability of MEx loss. We end by briefly describing a pre-trained downstream task model G I .

Basic Structure Generator
The goal of the basic structure generator G 0 is to infer the segmentation map of the masked region M in S u , where M ∈ R H×W is a binary matrix specified by B = {b, l t }: M ij = 1 for all pixels (i, j) inside the bounding box B. The output Y of structure generator G 0 , which is an initial output for our task, should reflect the class-specific structure of the object defined by l t . The output Y should achieve consistency in context between generated object and its surrounded context. Considering the two requirements, the basic structure generator is conditioned on S u and B, so that we have G 0 by Y = G 0 (S u , B).
Our design principles for the basic structure generator are motivated by an image translation model, Pix2PixHD (Wang et al. 2018a), which translates segmentation maps to natural images. Based on the Pix2PixHD and our requirements, the objective function for our basic model is given by, where the complete segmentation map Y c in color format is the ground-truth. L adv ( Y, Y c ) is the conditional adversarial loss defined on S u and Y c ensuring the perceptual quality of predicted segmentation map, which is shown as, where D Y is a learnable conditional discriminator. In Eq. 1, L fea ( Y, Y c ) is the feature matching loss (Wang et al. 2018a), which computes the difference between the initial output and ground-truth using the intermediate feature from (3) where t is the total number of layers in D Y and N i denotes the number of elements in each layer. The L pec ( Y, Y c ) in Eq. 1 is the perception loss, which can further boost the perceptual quality of the initial output by, where r is the number of chosen layers, w i is a pre-set weight for difference from each chosen layer, E i is i-th chosen layer in a pre-trained encoder. We set r = 5 and E as VGG19 (Simonyan and Zisserman 2014) in our experiment. With loss function defined in Eq. 1, we can train G 0 . During the inference, we construct the manipulated segmentation mapŶ by fusing Y and Y u . This is given by, where 1 ∈ R H×W is a matrix with all elements setting to 1. Based on Eq. 5, we haveŶ, which only replaces the mask area with the respective area in Y, but keeps the rest the same as Y u .

Multi-Expansion (MEx) Loss
The improvement by adding extra local adversarial loss in (Iizuka, Simo-Serra, and Ishikawa 2017) indicates that the global adversarial loss does not penalize all the fake parts in the generation (T1). Since the local adversarial loss improves the image quality and its input does not include context beyond the mask area, we assume that the drawback of global adversarial loss is caused by the huge difference in terms of number of pixels between context and the mask area, so that the loss from the mask area is not salient (T2). As for the losses described in Eq. 1, they are all designed for a global view ( Y). Motivated by (Iizuka, Simo-Serra, and Ishikawa 2017), it is intuitive to consider local adversarial loss or other losses for a local view. The local view in our  Figure 3: Diagram of the overall framework for MExGAN. With complete segmentation map S c , we can mask its all pixels in an object bounding box B = {b, l t } as l t to build an incomplete segmentation map S u . Conditioned on (S u , B) and supervised by complete segmentation map Y c in color, the basic structure generator outputs initial segmentation map Y, which is fused with S u to obtain manipulated segmentation mapŶ. Finally, theŶ is sent to a downstream task model. With MEx Loss (shown as Fig. 4) or A-MEx loss, the basic structure generator becomes MExGAN. The Y c and Y are not drawn in the figure.  Given a manipulated segmentation mapŶ, the red dotted arrow represents a process to obtain MEx areasẐ for the manipulated segmentation map. The green border and red border show ground-truth and generated area respectively. task is ( Y × M). However, the local view does not include the boundary of context, which is the inner boundary of Y u in our task, because they have no intersection (T3). A drawback of having no knowledge about the boundary of context is that the losses on the local view is too weak to boost the realism in the Boundary Area (T4).
Thus, based on (T1) and (T4), the Boundary Area is more likely to be a blind spot for both adversarial losses, compared with the other areas in the mask area (T5). Therefore, the perceptual quality of Boundary Area in the initial output Y is worse than other areas, even if we apply global and local adversarial losses together. Finally, based on Eq. 5, we can know that the Boundary Area has more chance to be misaligned with Y u (misalignment issue), due to (T5).
To solve the misalignment issue, we propose MEx loss, which calculates the adversarial losses for MEx areas. As shown in Fig. 4, it is achieved by (q+1) MEx discriminators, The key idea of the MEx loss is that we build MEx mask areas M E ∈ R H×W , multiple expanded mask areas calculated by the mask area M. Recall that M is constructed by box corners are coordinates of the left-top corner and the right-bottom corner for B. Then, at the j-th level expansion, we have j-level MEx mask area M E j con- , where α and β are step lengths in vertical and horizontal directions respectively. If any coordinate in b E j is smaller than 0 or greater than H − 1 or W − 1, it is set to 0 or H − 1 or W − 1 respectively. Based on M E j , we have j-level MEx area Z c j for ground-truth andẐ j for generation as, where Crop is an operator to crop the input and only keep the area with non-zero elements. From Fig. 4 and Eq. 6, we see that the j-level MEx areâ Z j consists of two parts, a local view for generation Y and its context from the ground-truth. Different from (T2), the losses from the mask area are more salient, because the mask area in each MEx Area is dominated by setting α and β as small values compared with H and W . Moreover, though the mask area is dominating, D E has knowledge of context of Y u by setting q greater than 0 (when q = 0, MEx Loss is equivalent to the local adversarial loss), which avoids (T3). Hence, with the MEx areas sent to D E , the MEx loss is more likely and able to penalize fake parts in the Boundary Area of Y. In this way, the misalignment issue is addressed.
The MEx loss function can be formulated as, where the condition (S u × M E j ) is also cropped. Finally, we define our MExGAN loss function as, which adds MEx loss to the basic structure generator (Eq. 1). where {C} is their original channel numbers. As a result of having same size inputs, the stability of MEx loss is improved. Though we can design D E simply by removing the Crop operation, the memory consumption is increased by enlarged input sizes. In addition, we find that MEx loss consumes much memory when q is huge. Thus, in A-MEx loss, we do not apply (q + 1) MEx discriminators D E , but apply only one D E to save memory. Specifically, the A-MEx loss function can be formulated as, (9) where theẐ j and the Z c j are calculated by Eq. 6 without Crop. Since the current inputs to D E still have mask area as the majority and original context as the minority, A-MEx loss also addresses the misalignment issue. For convenience and stability, we can use A-MEx loss in Eq. 8.

Multiple Mid-Level Views In MEx Loss
Besides improving image quality by solving misalignment issue, the improvement by MEx loss can be explained from another perspective. In short, MEx loss provides multiple mid-level views in image generation. Concretely, compared with (Iizuka, Simo-Serra, and Ishikawa 2017), which applies global and local views, the MEx loss provides multiple midlevel views by the MEx areas from the 1-th level to the q-th level. Then, similar to ensemble learning (Sagi and Rokach 2018), each view can be seen as a voter. MEx loss can improve the image quality by providing more voters via multiple mid-level views.

Downstream Task Model
Though there can be many choices for the downstream task, we apply image translation as our task, which interactively translates the manipulated segmentation mapŶ into natural image I. As for image translation model, we apply the pretrained model G I from Pix2pixHD (Wang et al. 2018a). This can be formulated as I = G I (Ŷ).

Experiment Setup
Datasets We conduct experiments on street scenes using Cityscape (Cordts et al. 2016), indoor scenes using NYU V2 (NYU) (Nathan Silberman and Fergus 2012), and face images using rectified Helen Face datasets (Lin et al. 2019) (Le et al. 2012). Specifically, we apply 2975 training images and 500 testing images for Cityscapes; 1200 training images and 249 testing images for NYU; and 1800 training images and 299 testing images for Helen Face. We choose 8 categories of objects ('person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle', and 'bicycle') to edit for Cityscapes from its 35 object categories. For NYU, which has 895 semantic labels, we choose 7 categories for editing. The Helen Face dataset has 11 categories, from which, we choose 8 categories. These categories are chosen based on the number of objects in each dataset. To demonstrate generality of MEx loss in natural images, we also perform image inpainting on architecture images from CMP Facade (Tyleček andŠára 2013) dataset, from which 598 images are used for training and 8 images are applied for testing. In the testing, each natural image will be randomly masked for 20 times. Evaluation Metrics For our task, we use four metrics for the semantics and perceptual quality of the edited results: (1) Target Intersection-Over-Union (tIOU) , which is the ratio of overlapped area for target object to union area for target object; (2) Hamming Distance (hamm) (Mun et al. 2017), which is the ratio of the number of pixels, having the same values as ground-truth, to the number of total pixels; (3) Frechet Inception Distance (FID) (Heusel et al. 2017), which computes the distribution difference between a group of natural images and a group of translated natural images from the manipulated segmentation maps by a pretrained model; (4) Human Evaluation (HuEv), which is the result of a two-alternative forced choices experiment, where users compare two model outputs and choose the better one in comparison with ground-truth. We measure performance by computing the percentage the counts of chosen model over total number of samples in a dataset averaging across observers.
For natural image inpainting, we apply two extra commonly-used metrics besides FID and HuEv: (1) Structural Similarity Index (SSIM) (Wang et al. 2004), which evaluates the similarity of the ground-truth and the generation based on low-level statistics; (2) L1 Distance (L1), which averages the reconstruction loss for each pixel.
Baselines and Ablation Setting We compare our model with three baselines: (1) Pix2PixHD (Wang et al. 2018a), which is our basic generator with adversarial loss, feature match loss and perception loss; (2) Global and Local model (GL) (Iizuka, Simo-Serra, and Ishikawa 2017), which applies global adversarial loss and local adversarial loss together; (3) Two-Stream Model (TwoSM) (Hong et al. 2018), which applies a double-stream model. Concretely, it has two outputs, a foreground map and a background map. The foreground map is a binary object mask defining the object shape tightly bounded by B. The background map defines both the object shape and its surrounded context in B. Since their two maps are generated based on shared embedding layers, each generation process effects each other. In contrast, Pix2PixHD and GL are both singlestream models, which have only one output including the target object shape and its surrounded context.
To demonstrate the effect of MEx loss, the ablation set- ting has been designed in our experiments. MExGAN is actually a combination of Pix2PixHD and MEx loss. Similarly, we have A-MExGAN as a combination of Pix2PixHD and A-MEx loss. We also combine GL and A-MEx loss as GL+A-MEx to show effect of A-MEx loss in natural image inpainting. We have improved the self-supervised learning of TwoSM by replacing its local observation with our global observation, which is represented by TwoSM+Full.
Implementation Details We train MExGAN and baselines for 200 epochs by default. We apply Adam (Kingma and Ba 2014) as our optimizer with initial learning rate as 0.0002 and momentum as 0.5, decaying the learning rate from the 100-th epoch to the last epoch ending with learning rate as 0. We set λ 1 = λ 2 = λ 3 = 1 for basic structure generator in MExGAN and Pix2PixHD; set λ 4 = 1 for MExGAN and A-MExGAN. In the training, the bounding box is randomly selected for each image at each epoch, while in the testing, we compare two methods by choosing the same bounding box for each image. We set q = 4 for both Cityscapes and Helen Face, while set q = 5 for NYU. We set α = β = 5 for all datasets by default. For image inpainting, we set λ 4 = 1, q = α = β = 4 for GL+A-MEx, and train both GL and GL+A-MEx for 2000 epochs.

Experimental Results
Quantitative Results Tab. 1, 2 and 4 report quantitative results of our task by tIOU, hamm, and FID. Tab. 3 reports quantitative results of natural image inpainting by SSIM, LI and FID. From these tables, we can conclude as below, (1) MEx loss is effective on segmentation map based on Pix2PixHD. From Tab. 1, MEx loss improves each metric result in each dataset. For the manipulated segmentation map, the hamm has improved 24.45% in NYU by MEx loss, and the tIOU has improved 32.71% in Helen face by MEx loss. For the translated natural image, we also see the slight improvement in FID, which shows that our manipulated segmentation maps are closer to the ground-truth.
(2) MEx loss improves image inpainting over GL. From Tab. 3, we see improvement in SSID, L1 and FID on CMP Facade. Especially, the FID of generated images decreases 13.13%, which is a great improvement in image quality.
( Cityscapes. The first column shows ground-truth and mask area (by grey box). The two right columns show the results from TwoSM+Full, and TwoSM+Full+A-MEx respectively. obviously improves over TwoSM. For examples, the tIOU improves 17.28% and hamm improves 13.22%. These demonstrate that the removed context, which has been kept in the global observation, is meaningful to improve the performance of semantic editing on segmentation map.
(4) MEx loss is not effective in TwoSM due to its double-stream structure. From Tab. 2, introducing MEx loss or A-MEx loss into TwoSM+Full leads to negligible decrease in tIOU and hamm, which means MEx loss is not effective in TwoSM. We apply MEx loss in TwoSM by adding it to the stream that generates background map, which includes both object shape and its surrounded context. The reason for negligible decrease might be that its two output maps cause noises for the shared embedding layers, if the object shape in foreground and object shape in background map do not overlap perfectly. In other word, the shared embedding layers of background map generation process with MEx loss are overwritten by foreground map generation process, which has no effect from MEx loss.
(5) A-MEx loss improves performance compared with MEx loss, while MEx loss saves more memory. From Tab. 4, MExGAN performs better in tIOU and hamm comapred with A-MExGAN. For example, A-MExGAN improves 2.12% in tIOU compared with MExGAN. For the GPU memory average consumption (Mem), the Mem for MExGAN is 2.42% less than A-MExGAN. Though A-MExGAN has only 1 MEx discriminator compared with MExGAN, which has q MEx discriminators, the MEx areas for MExGAN have smaller size because of Crop operation. The Mem shows that the Crop operation saves more GPU memory compared with less MEx discriminators.

Qualitative Results and Human Evaluations
The qualitative results are shown by Fig. 1, 5 ,6,7,8 and HuEv. Image examples in semantic editing on segmentation map. The Fig. 1 demonstrates the results our model adding or replacing an object on the segmentation map. Fig. 5 shows the manipulated segmentation maps and their translated natural images on the Cityscapes. From the Fig. 5, MExGAN generates objects with diverse but reasonably looking shapes compared with ground-truth segmentation maps. Though the translated results might not reach state-of-the-art, the image translation is not our main task, which can be improved by other downstream modules. From the Fig. 6, we can see that the generated left eye on a face by MExGAN in a natural image appears more natural in comparison with that generated by Pix2PixHD. These results show the effectiveness of MEx loss in Pix2PixHD. As shown in Fig. 8, A-MEx loss generates more reasonable details in the left tires of the car, which shows that A-MEx loss is still effective on TwoSM+Full in some cases.
Image examples in image inpainting. Fig. 7 shows examples of natural image inpainting on CMP Facade. Fig. 7 shows that the image quality , especially"seamless", is significantly boosted by A-MEx loss, which demonstrates the effect of A-MEx loss in natural image inpainting.
Human Evaluation. To measure the image quality more accurately, we conduct experiments for human evaluation, where the results are reported as HuEv in Tab. 1, 2 and 3. For HuEv (by 11 users) in Tab. 1, MExGAN generates better manipulated segmentation maps by having 12.59% more users preferring MExGAN generation. For HuEv (by 12 users) in Tab. 3, an improvement (11.55%) is achieved by A-MEx loss. For HuEv (by 5 users) in Tab. 2, a slight decrease (5.37%) in MEx loss is observed, where the reason has been explained in (4) of Sec. "Quantitative Results".

Methods
Cityscapes

Discussion Based On Experimental Results
Ubiquity: Though we propose a basic structure generator based on Pix2PixHD, the generator can be replaced with other models for other applications, where the replaced generator should not overwrite the output, such as natural image inpainting with GL. Limitation: The MEx loss is not effective in a two-stream model, if we only add MEx loss to one stream, such as our usage of MEx loss in TwoSM.
A framework to improve performance of semantic editing on segmentation map, called MExGAN, is proposed in this paper. To address misalignment issue, MExGAN applies a novel MEx loss implemented by adversarial losses on MEx areas. To boost convenience and stability, we approximate MEx loss as A-MEx loss. Besides, MExGAN applies global observation to improve current data preparation, and can flexibly replace the basic structure generator in other applications. Extensive experiments on four datasets demonstrate effectiveness of global observation and MEx loss. In the future, we will generate diverse outputs for each condition.

Appendix 5.2 Organization of Technical Appendix
In this appendix, we show the Technical Appendix of the paper "Semantic Editing On Segmentation Map Via Multi-Expansion Loss". Firstly, we present additional quantitative and qualitative experiment results as well as more experiment setup, which provides further details about our experiments. Secondly, we clarify the items required in reproducibility checklist in details.

Appendix of Experiments
Additional Experiment Setup Besides the experiment setup introduced in Sec. 4.1 of main script, we introduce more experiment setup as below.
Image size The training and generated image resolutions are 256 × 128, 192 × 144 and 256 × 256 respectively for Cityscapes, NYU and Helen Face. As for the natural image inpainting task, we set 248 × 242 as the training and generated image resolutions.
Excluding mechanism We exclude the object bounding boxes that are too small to carry significant scene content. For Cityscapes and NYU datasets in MExGAN (Pix2PixHD + MEx loss), we set the size threshold as 0.02, which filters bounding boxes that are smaller than 2% of the size of inputted images. The filter threshold for Helen Face is 0.0003, which is much smaller compared with 0.02, because the 'left eye' and 'right eye' are quite tiny areas compared with inputted images. As for TwoSM+Full+MEx and TwoSM+Full+A-MEx in Cityscapes, we set the filter threshold as 0.01. For the images that include no object bounding box satisfying the size threshold, we skip the images in both the training and testing processes.
Details about user evaluation We do not conduct user evaluation by Amazon Mechanical Turk (AMT), but by anonymous and unknown users from other organizations to finish the two-alternative forced choices experiments. The users are provided with a website for each experiments. A screen shot of the website is shown as Fig. 9, where the users know the complete segmentation map, and incomplete segmentation map, which shows the object bounding box in certain color respecting to the target label. For the right part of the website, the random arranged results (choices A and B) from the models are provided for comparison. In other words, the choices A and B in each turn randomly represent different model results. Figure 9: A screenshot for the website used for user evaluation. In the top, we show the task question as "Task: Which synthetic image (A or B) match the ground-truth better in terms of filling the missing region?" In the left part, the complete segmentation map, and incomplete segmentation map with object bounding box in certain color respecting to the target label are shown. For each turn, we provide random arranged results by choices A and B in the right part.
Additional Quantitative Results Parameter sensitive analysis for q by MExGAN on Cityscapes Besides the quantitative results shown in Sec. 4.2 of main script, we also conduct experiments for the MEx times q applied in Eq. 6 and Eq. 7 of main script. Concretely, we compare tIOU and hamm for different q by MExGAN on Cityscapes, where the q values are set as 0, 1, 2, 4, 8. Plus, the α and β are both fixed as 5 in the analysis. The result of sensitive analysis is shown in Fig. 10. From the figure, we can conclude as follows, (1) The tIOU and hamm in q = 0 is much lower by obvious difference compared with those in q > 0. Since q = 0 is equivalent to GL, this shows our proposed multiple midlevel views are effectively complementary views for global and local views.
(2) The tIOU and hamm are both fluctuated by the increase of q. In our setting, when q = 2, we have the highest tIOU and hamm, while the tIOU and hamm in q = 4 decrease around 1% compared with those in q = 2. However, when q = 8, the tIOU and hamm increase obviously compared those in q = 4. The fluctuation shows that tIOU and hamm are sensitive to the q.
Though the tIOU and hamm in q = 2 achieve more competitive results, we still report those in q = 4, which leads to the lowest performance when q > 1, in the main script. The reason is that we do not have validation dataset, which is same as Pix2PixHD (Wang et al. 2018a) and TwoSM (Hong et al. 2018), and it is unfair to choose the parameters resulting in the best performance in test dataset. Thus, we choose q = 4 on Cityscapes, which still beats performance in q = 0 obviously. The Fig. 11, Fig. 12, Fig. 13  semantic editing on segmentation map. In the Fig. 15, we show extra qualitative results of image inpainting.

Additional Qualitative Results
Application of semantic editing on segmentation map with downstream task as image translation In the Fig. 11 and Fig. 12, which are results from Cityscapes and NYU respectively, we show the results of semantic editing on segmentation maps and the translated natural images from the manipulated segmentation maps. From the two figures, one can see that though we only add the objects by semantics, we can also implement removal and substitution by the "add" operation. For examples, we can replace a car with a bus by masking an area including the car and giving a target label "bus", shown in the third row in Fig. 11. As for the removal, we can add the background in a mask area, such as adding floor in a mask area, shown in the first row of Fig. 12.
Additional manipulated segmentation maps of Pix2PixHD affected by MEx loss Fig. 13 shows additional qualitative results, which demonstrates effectiveness of MEx loss on Pix2PixHD. For examples, its second row shows MEx loss can help generate more competitive bicycle. The person in the last row is generated more reasonably by MEx loss.
Additional manipulated segmentation maps of TwoSM affected by MEx loss Due to the two-stream structure of TwoSM, our proposed MEx loss is not effective from view of quantitative results. However, Fig. 14 shows additional cases where TwoSM+Full+A-MEx has better qualitative performance than TwoSM+Full in different semantics. For examples, its first row shows better generation in bicycle from TwoSM+Full+A-MEx, because of its more pronounced contour of the bicycle. Its last row shows better car, because the car generated by TwoSM+Full+A-MEx has more clear tires compared with the one in TwoSM+Full.
Additional natural images of GL affected by MEx loss From the Fig. 15, GL+A-MEx shows obviously improvement in image quality by A-MEx loss. For examples, the first row in left part shows more details about the generated window, which is more consistent with its context. The last row in left part shows a very seamless results by GL+A-MEx. In addition, we also observe that the results of GL+A-MEx have less noise compared with those of GL. The reason might be that the MEx loss provides more multiple mid-level views, besides global and local views, so that it is more robust compared with GL.

Reproducibility Checklist
We emphasize on the reproducibility checklist in terms of two parts, datasets and computational experiments. Besides, we have attached our data samples and project code with its ReadMe in the data code appendix. Plus, we will release our project code with ReadMe to GitHub, if our paper is accepted.
Dataset Reproducibility We do not have any novel datasets in our experiments. And we show the reproducibility of all datasets applied in our experiments in this section. Concretely, we introduce more information about the four commonly-used datasets, Cityscapes, NYU V2, rectified Helen Face and CMP Facade datasets.
NYU V2 It is downloaded from "https://cs.nyu.edu/ silberman/datasets/nyu depth v2.html", where we only download "Labeled dataset (2.8 GB)", which provides us both segmentation maps and natural images. However, different from Cityscapes, which provides segmentation maps and natural images by various images, NYU V2 saves all data by a ".mat" file.
Rectified Helen Face We download it from "https://github.com/JPlin/Relabeled-HELEN-Dataset". Instead of applying originally natural images for training, same to Pix2PixHD, we mask the background information of the originally natural images by their respective segmentation maps.
As for the division of training dataset and testing dataset, the first three datasets provide default training and testing datasets, which are applied in our experiments. Since the CMP Facade does not provide default training and testing datasets, we follow the setting in "https://github.com/sevmardi/gl Image Inapinting pytorch".
Computational Experiment Reproducibility We further answer reproducibility questions about computational experiments in this section.
Randomness Since in the both training and testing processes, our work randomly mask an object bounding box to prepare data. In the training process, we do not set a random seed, because we wish the randomness between dif-ferent epochs is different, so that we can mask more object bounding boxes for training. However, in the testing process, we set a fixed random seed and only run 1 epoch, because we wish all comparison experiments mask the same object bounding box for each image. We set random seed as "679" for all datasets. However, we find that even though the TwoSM and Pix2PixHD have been set same random seed, their masked object bounding boxes are still different, this is one of the reasons why we do not compare them in one table.
Computing infrastructure We do all experiments on two GPUs, which both are GTX 1080Ti. The RAM in our machine is 64 GB. The key versions of relevant software libraries are available by GitHub of the basic structure generators. For MExGAN, which has basic structure generator as Pix2PixHD, we can find the key versions from "https://github.com/NVIDIA/pix2pixHD". For TwoSM+Full+MEx, they are available at "https://github.com/xcyan/neurips18 hierchical image mani pulation". As for GL+A-MEx, we can find them from "https://github.com/sevmardi/gl Image Inapinting pytorch".
Motivation choosing the metrics Though we have explained calculation of the metrics in Sec. 4.1 of main script, we explain the reasons for choosing these metrics as below.
We have four evaluation metrics for semantic editing on segmentation map. We choose tIOU because it can scale the overlapping degree between the generated target object and ground-truth target object. However, if we only evaluate by tIOU, then the bias situations will be that the generated target object is extremely huge and the tIOU is very high. Thus, we choose hamm, which scale the correctness for each pixel in the mask area. A better generation should have both higher tIOU and hamm. Since the downstream task in our work is image generation, we assume the better translated natural images we have, the better manipulated segmentation maps we generate. Thus, we apply FID to scale the image quality of translated natural images.
Besides, we have two extra evaluation metrics for natural image inpainting. We choose SSIM and L1, because these two both scale the difference between the original images and the generation in statistics-level and pixel-level respectively. The less difference we have, the better image generation we have. Plus, FID as a common method to scale the image quality with a pretrained model, which shows the difference between distribution of generated images and distribution of real images. The smaller FID we have, the more natural images we generate.
Considering the generation is a subjective task and quantitative results might not represent human evaluations, we also have users to evaluate the results.
Number of algorithm runs The number of algorithm runs used to compute each reported result is 1, because we have set random seed in the testing process. As a result, the mask areas are fixed. Then, we also observe that the quantitative results will keep unchanged in different trials, if we keep random seed unchanged.
Number and range of values tried per (hyper-)parameter We try the 5 different values for q by MExGAN on Cityscapes, which is reported in Sec 2.2 in Appendix.