SlowGuess commited on
Commit
ce5a5bf
·
verified ·
1 Parent(s): 9a6162e

Add Batch 8d207274-7912-4983-9006-74b90843879e

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_content_list.json +3 -0
  2. generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_model.json +3 -0
  3. generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_origin.pdf +3 -0
  4. generalizedfewshotobjectdetectionwithoutforgetting/full.md +279 -0
  5. generalizedfewshotobjectdetectionwithoutforgetting/images.zip +3 -0
  6. generalizedfewshotobjectdetectionwithoutforgetting/layout.json +3 -0
  7. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_content_list.json +3 -0
  8. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_model.json +3 -0
  9. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_origin.pdf +3 -0
  10. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/full.md +281 -0
  11. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/images.zip +3 -0
  12. generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/layout.json +3 -0
  13. generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_content_list.json +3 -0
  14. generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_model.json +3 -0
  15. generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_origin.pdf +3 -0
  16. generalizingfaceforgerydetectionwithhighfrequencyfeatures/full.md +352 -0
  17. generalizingfaceforgerydetectionwithhighfrequencyfeatures/images.zip +3 -0
  18. generalizingfaceforgerydetectionwithhighfrequencyfeatures/layout.json +3 -0
  19. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_content_list.json +3 -0
  20. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_model.json +3 -0
  21. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_origin.pdf +3 -0
  22. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/full.md +387 -0
  23. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/images.zip +3 -0
  24. generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/layout.json +3 -0
  25. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_content_list.json +3 -0
  26. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_model.json +3 -0
  27. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_origin.pdf +3 -0
  28. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/full.md +296 -0
  29. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/images.zip +3 -0
  30. generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/layout.json +3 -0
  31. generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_content_list.json +3 -0
  32. generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_model.json +3 -0
  33. generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_origin.pdf +3 -0
  34. generatingmangafromillustrationsviamimickingmangacreationworkflow/full.md +403 -0
  35. generatingmangafromillustrationsviamimickingmangacreationworkflow/images.zip +3 -0
  36. generatingmangafromillustrationsviamimickingmangacreationworkflow/layout.json +3 -0
  37. generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_content_list.json +3 -0
  38. generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_model.json +3 -0
  39. generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_origin.pdf +3 -0
  40. generativeclassifiersasabasisfortrustworthyimageclassification/full.md +366 -0
  41. generativeclassifiersasabasisfortrustworthyimageclassification/images.zip +3 -0
  42. generativeclassifiersasabasisfortrustworthyimageclassification/layout.json +3 -0
  43. generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_content_list.json +3 -0
  44. generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_model.json +3 -0
  45. generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_origin.pdf +3 -0
  46. generativehierarchicalfeaturesfromsynthesizingimages/full.md +429 -0
  47. generativehierarchicalfeaturesfromsynthesizingimages/images.zip +3 -0
  48. generativehierarchicalfeaturesfromsynthesizingimages/layout.json +3 -0
  49. generativeinterventionsforcausallearning/c723740b-fba3-4566-b6b7-5e14a704e730_content_list.json +3 -0
  50. generativeinterventionsforcausallearning/c723740b-fba3-4566-b6b7-5e14a704e730_model.json +3 -0
generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb3ef88a7c16e10f5e56d2466608c33cf6faeb18f4bdfab1bafc2b0f563b1303
3
+ size 79038
generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e8af5c94b20f4e5b7474ed75aebe48705a0088f107b59c94568aa1e88703a4dd
3
+ size 96638
generalizedfewshotobjectdetectionwithoutforgetting/f7ebbc94-1ed4-4a35-8686-9919e1b21777_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a863a5e328bd2e5c835d5f0ac23aeadac4be0405e2e4bcb737aa64f74786e0e1
3
+ size 2484649
generalizedfewshotobjectdetectionwithoutforgetting/full.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generalized Few-Shot Object Detection without Forgetting
2
+
3
+ Zhibo Fan, Yuchen Ma, Zeming Li, Jian Sun Megvii Technology
4
+
5
+ {fanzhibo, mayuchen, lizeming, sunjian} @ megvii.com
6
+
7
+ # Abstract
8
+
9
+ Recently few-shot object detection is widely adopted to deal with data-limited situations. While most previous works merely focus on the performance on few-shot categories, we claim that detecting all classes is crucial as test samples may contain any instances in realistic applications, which requires the few-shot detector to learn new concepts without forgetting. Through analysis on transfer learning based methods, some neglected but beneficial properties are utilized to design a simple yet effective few-shot detector, Retentive R-CNN. It consists of Bias-Balanced RPN to debias the pretrained RPN and Re-detector to find few-shot class objects without forgetting previous knowledge. Extensive experiments on few-shot detection benchmarks show that Retentive R-CNN significantly outperforms state-of-the-art methods on overall performance among all settings as it can achieve competitive results on few-shot classes and does not degrade the base class performance at all. Our approach has demonstrated that the long desired never-forgetting learner is available in object detection.
10
+
11
+ # 1. Introduction
12
+
13
+ Computer vision community has seen significant progress by applying deep convolutional neural networks trained from a massive amount of data. However, sufficient training data is sometimes unavailable due to extensive human labor for annotation, especially for object detection, and the source data distribution may be long-tailed by nature such that certain object categories only contain limited examples. These circumstances raise the need to learn under a low-data regime effectively. Inspired by human's ability to learn new concepts rapidly from a handful of examples, few-shot learning[22, 19, 40, 37, 38, 30, 9, 8, 35, 3, 2, 42] is then proposed to mimic such generalization capability, with extensive research on image classification.
14
+
15
+ Several recent works[1, 17, 46, 18, 41, 44, 45, 14, 7, 6, 16, 43, 29] have attempted to apply few-shot learning techniques on instance-level tasks, such as object detection, where an extra localization task is included and more com
16
+
17
+ ![](images/321ad7a9c1d0ff7c2b0ecfc11985b08144ece45b0e636458232d37ad659a791f.jpg)
18
+ Figure 1. Performance of previous methods and ours on generalized few-shot objection on MS-COCO[25] under 10-shot settings, where base class AP and novel class AP are represented by x- and y-axis respectively. The red dashed line represents the base class AP of a base class detector. Our method does not degrade the base class AP while reaching state-of-the-art performance on novel categories.
19
+
20
+ plicated visual contexts and features encountered, making few-shot object detection way more challenging. However, the majority focus merely on the performance of few-shot categories and ignore the catastrophic forgetting of base classes, which is not realistic. Unlike image classification, the capability to detect the joint domain of both classes at once is even crucial for object detection since samples at test time may contain instances of both classes, which requires the detector to be computationally efficient and learn new concepts without catastrophic forgetting. The problem of detecting objects of both classes is called Generalized Few-Shot Detection (G-FSD).
21
+
22
+ A popular stream of few-shot object detection[17, 46, 45, 14, 6] falls under the umbrella of meta-learning by leveraging external exemplars to do a visual search within the image. As their computational complexity is proportional to the number of categories, these methods become rather slow or even unavailable when tackling both sets of classes of a dataset. A promising alternative is transfer learning based
23
+
24
+ approaches[1, 47, 41, 44], which can be trained incrementally to detect all classes in a single run. Wang et al.[41] share a similar interest in maintaining the overall performance on both classes and achieve competitive results by their two-stage finetuning approach (TFA), in which only the last layer of classification and box regression branch of RCNN[11, 10, 34] is finetuned while freezing backbone and RPN[34]. Nevertheless, there still exists a non-negligible base class performance gap with the pretrained model.
25
+
26
+ To diminish the gap, we first analyze the pretrained RCNN of TFA[41] and find advantageous but neglected properties: 1) pretrained base class detector does not predict many false positives on novel class instances despite their saliency 2) RPN is biased on its seen classes instead of being ideally class-agnostic, thus freezing it without exposure to new classes can be suboptimal. By utilizing these properties, we propose a simple yet effective transfer learning based method, Retentive R-CNN, to meet the demands of G-FSD to learn without forgetting and detect all categories efficiently. The name of Retentive R-CNN comes from its surprising ability to fully reserve the performance on base classes. Retentive R-CNN combines base and novel class detectors by Bias-Balanced RPN and Re-detector, introducing little extra cost. Bias-Balanced RPN can better adapt to novel class objects and remain powerful on the base class, thus provides better proposals for both training and inference. Re-detector utilizes a consistency loss to regularize the adaptation during finetuning and takes advantage of the base class detector's property to incrementally detect without forgetting. It is worth mentioning that our method does not degrade the base class performance at all while achieving competitive performance on novel classes as well, as shown in Figure1. Our contributions can be concluded as follows:
27
+
28
+ - We find properties of base class detectors neglected in few-shot detection literature, which can be utilized to improve both base and novel class performance for transfer learning based methods with little overhead.
29
+ - We propose a few-shot detector without forgetting, Retentive R-CNN, with Bias-Balanced RPN and Redetector to assist novel class adaptation with base class knowledge and ensemble base and novel class detectors.
30
+ - Our method achieves state-of-the-art overall performance on the few-shot detection benchmark[41, 17] across all settings, with leading base class metrics and competitive novel class metrics.
31
+
32
+ # 2. Related Work
33
+
34
+ Few-Shot Learning. Previous few-shot learning literature mainly focuses on the task of image classification. Two
35
+
36
+ popular approaches, metric learning[40, 37, 19, 38] and meta-learning[8, 35], have been widely adapted to avoid overfitting on the small data. Recent works[2, 42, 3] also demonstrate the effectiveness of a pretrained backbone as a strong feature extractor and outperform many previous methods. However, catastrophic forgetting[28, 27] on base classes may happen during finetuning. Gidaris et al.[9] stress that a good few-shot learning system should adapt to new tasks rapidly while maintaining the performance on previous knowledge without forgetting[28, 27], namely generalized few-shot learning, which is also the research interest of several other works[30, 31, 36, 21]. It is worth mentioning that such an ability is more critical for object detection since images may have instances of both sets of categories.
37
+
38
+ Object Detection. Modern object detection has seen tremendous progress by utilizing deep convolutional networks. One of the representative architectures is R-CNN[11, 10, 34, 12, 23], which generates object proposals upon the holistic image features, then classify and refine the proposals given the features within it. R-CNN is also the architecture mostly explored in the context of few-shot object detection and the one we extend for G-FSD in this paper. Impressive progress has also been made by single-stage methods[33, 26, 24] and recent anchor-free methods[20, 4, 39, 49, 32].
39
+
40
+ Few-Shot Object Detection. Exploration of few-shot object detection so far can be categorized into two streams: meta-learning[17, 46, 14, 29, 7, 6, 18, 45, 43, 16] based and transfer learning based[1, 41, 44, 47]. The majority of meta-learning stream predict detections conditioned on a set of support examples, which can be viewed as an exemplar-based visual search. For instance, Meta R-CNN[46] predicts upon ROI features reweighted by attentive vectors of each class, whose computational complexity grows linearly as the number of categories increases, making it hard to apply on large-scale datasets. On the contrary, transfer learning based methods can easily employ full class detection. Transfer learning methods thus far have explored various aspects: Chen et al.[1] apply regularizations during finetuning, Yang et al.[47] utilize a non-local structure to model global context, Wu et al.[44] augment training samples to mitigate scale bias due to limited data.
41
+
42
+ A handful of works share a similar focus on well detecting both classes: Juan-Manuel et al.[16] try to tackle it with a meta-learned CenterNet[4], though the performance is still limited with the linearly growing complexity issue; Wang et al.[41] propose TFA with a simple pretrainfinetune scheme for G-FSD. In TFA, adapting to novel classes with less degradation on base classes is achieved by two-stage finetuning: first finetune on novel classes, then use the weights of novel classes as initialization to finetune on both classes. The metrics on base classes are somewhat
43
+
44
+ reserved by this procedure and a slow learning schedule. Nevertheless, the performance drop in base classes still exists.
45
+
46
+ # 3. Approach
47
+
48
+ In this section, we start with the problem formulation of few-shot object detection. Next, we investigate the representative transfer learning based TFA[41] to reveal some neglected properties of the pretrained base detector. Then we describe our proposed model, which utilizes these properties, followed by training and inference details.
49
+
50
+ # 3.1. Problem Statement
51
+
52
+ Following previous literature[17, 41], we split the categories of a dataset into base classes $\mathcal{C}_b$ and novel classes $\mathcal{C}_n$ , with $\mathcal{D}_b$ and $\mathcal{D}_n$ denoting the corresponding sub-datasets, respectively. $\mathcal{D}_b$ contains abundant annotations for training, while only a few data in $\mathcal{D}_n$ is available. Our objective is to learn a detection model $f(\cdot)$ for both $\mathcal{C}_b$ and $\mathcal{C}_n$ from the few novel class samples without forgetting the learned capability from the abundant base class samples.
53
+
54
+ Such an objective can be easily achieved by meta training a model to perform an exemplar-based visual search on $\mathcal{D}_b$ , then directly deploy it without finetuning, as in one-shot detection literature [14, 29]. However, these methods do not perform as good as ordinary detection methods on $\mathcal{D}_b$ and require high time and space complexity. On the contrary, transfer learning based methods can efficiently deal with full-way detection and achieve competitive results on $\mathcal{C}_n$ , as demonstrated in previous works[41, 44]. Thus we propose to tackle the problem of G-FSD in a transfer learning paradigm: first obtain a base model $f^b$ by training on $\mathcal{D}_b$ and then obtain a novel model $f^n$ via finetuning $f^b$ on $\mathcal{D}_n$ (or a combination of $\mathcal{D}_b$ 's subset and $\mathcal{D}_n$ ). However, the finetuning stage tends to degrade the base class performance due to the forgetting effect[28, 27] if it is finetuned on $\mathcal{D}_n$ , or due to the sample limitation on $\mathcal{D}_b$ to balance class frequency if finetuned on both classes. Regarding this problem, a question is probably raised: is the degradation unavoidable?
55
+
56
+ <table><tr><td>Metric / Component</td><td>RPN</td><td>RCNN</td><td>drop</td></tr><tr><td>uAR@1000</td><td>34.1</td><td>8.5</td><td>25.6</td></tr><tr><td>AR@1000</td><td>61.1</td><td>54.7</td><td>6.4</td></tr></table>
57
+
58
+ Table 1. Recall between the output of RPN, the detector and the ground truths of unseen classes (uAR) and seen classes (AR).
59
+
60
+ <table><tr><td>Metric / RPN</td><td>pretrained</td><td>finetuned</td></tr><tr><td>AR@100</td><td>31.3</td><td>34.2</td></tr><tr><td>AR@1000</td><td>45.8</td><td>48.0</td></tr></table>
61
+
62
+ Table 2. Mean average recall between the output of RPN and ground truths of both base and novel classes.
63
+
64
+ ![](images/38492d340025676dbb6a17aa2c1046132003f050fcd9bd983915190f764a38e7.jpg)
65
+
66
+ ![](images/a12d01f8bcd012113fd47f625617b2709d4b368692769d021eb09be18ac5bd06.jpg)
67
+
68
+ ![](images/0045acad9e461a9c0c053f8ebb059e6183ef87b838fe079b3504d60a0eaea697.jpg)
69
+
70
+ ![](images/bde245b1346c59d96bc14f394051003a2ece364a769bb8ef81c3f86ba4cd290f.jpg)
71
+
72
+ ![](images/25b9b23e84ea857147ebdc49609adf940420d3b2f11768f76d7ca2c2a518c70f.jpg)
73
+ Figure 2. (a) L2-norms of ROI features extracted from a pretrained R-CNN on $\mathcal{D}^b$ , sorted by class index. Blue and red represent seen and unseen classes, respectively, and dashed lines denote their average. Unseen classes with norms significantly higher or lower than average are annotated with class names in blue or red, respectively. (b) Backbone features' (FPN-P3) L2-norm map and (c) the corresponding detections of the base detector (green boxes) and ground truths of unseen classes (black boxes). The base detector has a strong ability to reject unseen classes.
74
+
75
+ ![](images/d74aa419bd6ce4dd5c64cf6dcf483c45287cc92a369557c2c1d64299f2cde7da.jpg)
76
+ (c)
77
+
78
+ ![](images/bb1ede7cd451dc55c077bac5298d1fe6e6c851066309f87f350d9d1782d04d21.jpg)
79
+
80
+ # 3.2. Analysis on Transfer Learning based Few-Shot Object Detection
81
+
82
+ To answer this question without loss of generality, we analyze TFA[41]'s properties as a representative transfer learning model on few-shot detection tasks. TFA is first pretrained on $\mathcal{D}_b$ as ordinary R-CNN, then the last layers in classification and box regression heads are tuned on $\mathcal{D}_n$ . The finetuned novel class heads' weights are concatenated with base class weights as the initialization for the final finetuning on a combined dataset consists of $\mathcal{D}_n$ and $\mathcal{D}_b$ 's subset, where the number of samples per category is enforced to be identical. A slow and steady learning schedule is also applied during the final finetuning stage. Take 10-shot settings on MS-COCO for example, AP on $\mathcal{C}_b$ is better reserved than a pure finetuning baseline (31.8 to 35.0), though AP of the base class detector can achieve as high as 39.2.
83
+
84
+ Why cosine classifier works? Cosine classifier is commonly adapted in few-shot classification[9, 30] as cosine similarity bridged transfer learning and metric learning approach and generally performs well on base and novel class trade-off. The conclusion remains valid for TFA[41] as the base class performance is generally higher with a cosine classifier. We collect the ROI features from an R-CNN pretrained on $\mathcal{D}_b$ of MS-COCO[25] and compute the average pixel-wise L2-norm of $C_b$ and $C_n$ . The results are shown in Figure2(a). A massive variation of norms between base classes and unseen novel classes can be easily observed. This may account for the effectiveness of cosine classifiers for being agnostic to feature norms. Also, the norms of unseen classes with closer relationship with seen classes are
85
+
86
+ ![](images/44c84e07be5782686dd69d75ed38549ad603307a7533b83c997255899f83d848.jpg)
87
+ Figure 3. An overview of the proposed Retentive R-CNN. We implement Bias-Balanced RPN to debias the pretrained RPN and Re-detector to detect objects of both classes without forgetting, where a consistency loss is utilized to regularize finetuning. $\otimes$ represents ensembling operation, which is max in our implementation.
88
+
89
+ relatively higher (blue names annotated in Figure2(a)).
90
+
91
+ Does base detector find novel class salient objects? To a large extent, no. We hypothesize it is due to the features deactivated during training on $\mathcal{C}_b$ as indicated by low L2-norm, which will not produce a high confidence score with a dot-product classifier. We visualize the detection results and its feature norms on FPN[23] P3 in Figure2. The local features around the people in the first two images are obviously deactivated, although the object is of great saliency to humans. Features of the bus are somewhat activated in the third image of Figure2(b) (probably due to close relationship with trucks of $\mathcal{C}_b$ ), yet the detector is still able to recognize it as background. More results indicating this property are provided in the supplementary materials without cherrypicking. To quantitatively answer this question, the average recall between $f^b$ 's RPN proposals, final outputs, and ground truths of unseen class $\mathcal{C}_n$ (uAR) and seen classes (AR), is calculated in Table1. The drastic drop of uAR well demonstrates the ability of $f^b$ to reject novel class objects. Thus we can utilize this property to reserve base class performance as $f^b$ does not introduce many false positives on $\mathcal{C}_b$ when encountering novel class instances.
92
+
93
+ Is RPN class-agnostic? While most transfer learning[41, 44] and meta-learning[46, 45, 18] works treat RPN as class-agnostic and freeze it during finetuning, RPN is not ideally class-agnostic and biased on its seen categories. During training on $\mathcal{D}_b$ , anchors of novel class instances are categorized into non-object due to lack of annotations, making RPN bias on training samples. We compare AR of all classes of a finetuned RPN on $\mathcal{C}_b \cup \mathcal{C}_n$ under 10-shot setting with pretrained RPN in Table2, where the apparent improvement validates our answer.
94
+
95
+ # 3.3. Retentive R-CNN
96
+
97
+ Our proposed model for G-FSD, Retentive R-CNN, consists of Bias-Balanced RPN and Re-detector to utilize the aforementioned properties of the base class detector $f^b$ . The model architecture is illustrated in Figure3.
98
+
99
+ Re-detector. Re-detector consists of two detector heads,
100
+
101
+ predicting detections of $\mathcal{C}_b$ and $\mathcal{C}_b \cup \mathcal{C}_n$ from object proposals in parallel, where one stream remains the same weight as in $f^b$ to predict objects of $\mathcal{C}_b$ (denote as $det^b$ ) and the other holds the finetuned weights to detect objects of both $\mathcal{C}_n$ and $\mathcal{C}_b$ (denote as $det^n$ ). Detecting both classes can well alleviate the false positives due to inadequate data training, as shown in Section4.3. $det^b$ utilize a fully-connected layer for classification and $det^n$ use a cosine classifier to balance the variation of features in their norms. Similar to TFA, we finetune merely the last layers of classification and box regression head of $det^n$ , which is capable of producing competitive results.
102
+
103
+ As $f^b$ is trained from abundant data, we hope that $det^n$ can inherit the reliable knowledge of $f^b$ . Towards this end, we propose an auxiliary consistency loss to regularize $det^n$ to score object proposals similar to $det^b$ on the base class entries, which takes the form of KL-Divergence as in previous knowledge distillation works[15, 48]. For proposals of $C_b$ , $det^n$ is enforced to predict high confidence, and for proposals not belonging to $C_b$ , $det^n$ mimics $det^b$ with similarly low probabilities. Given the final probabilities $p_c^b$ and $p_c^n$ of class $c$ predicted by $det^b$ and $det^n$ , the consistency loss is formalized as:
104
+
105
+ $$
106
+ \mathcal {L} _ {c o n} = \sum_ {c \in \mathcal {C} _ {b}} \tilde {p _ {c} ^ {n}} \log \left(\frac {\tilde {p _ {c} ^ {n}}}{\tilde {p _ {c} ^ {b}}}\right) \tag {1}
107
+ $$
108
+
109
+ where $\tilde{p_i^n} = \frac{p_i^n}{\sum_{c\in\mathcal{C}_b}p_c^n}$ and the same for $\tilde{p_i^b}$ . This is quite different from TK in LSTD[1] where the KL-Divergence is computed between the highest probabilities of $\mathcal{C}_b$ and $\mathcal{C}_n$ . Note that $p_i^n$ is the normalized marginal probability distribution over base classes after softmax over all class entries. The total loss of Re-detector during finetuning stage is
110
+
111
+ $$
112
+ \mathcal {L} _ {\text {d e t}} = \mathcal {L} _ {\text {c l s}} ^ {n} + \mathcal {L} _ {\text {b o x}} ^ {n} + \lambda \mathcal {L} _ {\text {c o n}} \tag {2}
113
+ $$
114
+
115
+ where $\mathcal{L}_{cls}$ and $\mathcal{L}_{box}$ takes the same form as Faster R-CNN[34] and is computed on $det^n$ only, and $\lambda$ denotes the coefficient for the consistency loss.
116
+
117
+ Bias-Balanced RPN. R-CNN relies on RPN to generate object proposals as training samples for second stage classification and other subsequent processing. The quality of RPN proposals is especially crucial when the network is trained under low-data scenarios. As shown in Section3.2, a pretrained RPN may fail to catch novel class objects, further aggravating the scarcity of samples, while a finetuned RPN can alleviate this issue, thus providing better samples for second-stage modules to learn. We try to unfreeze different layers of RPN for finetuning and empirically, unfreeze the final layer that predicts objectness is sufficient to produce a noticeable improvement (results given in Setion4.3).
118
+
119
+ To retain performance on base classes, we propose Bias-Balanced RPN to integrate both pretrained RPN and the finetuned one. It ensembles the objectness prediction heads to raise $\mathcal{C}_b$ and $\mathcal{C}_n$ proposals properly. Given a feature map of size $H \times W$ , base RPN predicts an objectness map $\mathcal{O}_b^{H \times W}$ and finetuned RPN predicts $\mathcal{O}_n^{H \times W}$ , the final output objectness of Bias-Balanced RPN is defined as $\mathcal{O}^{H \times W} = \max(\mathcal{O}_b^{H \times W}, \mathcal{O}_n^{H \times W})$ . Note that, during the finetuning stage, only the objectness of finetuned RPN is set unfrozen. Box regression and the convolution layer are shared across base RPN and finetuned RPN, as illustrated in Figure3. Theoretically, the max operation guarantees the RPN not to overlook proposals of previously learned classes catastrophically. With little computational overhead and extra weights, we believe Bias-Balanced RPN can serve as a general component for G-FSD. The full loss function of Retentive R-CNN during the finetuning stage is
120
+
121
+ $$
122
+ \mathcal {L} _ {f t} = \mathcal {L} _ {o b j} ^ {n} + \mathcal {L} _ {d e t} \tag {3}
123
+ $$
124
+
125
+ where $\mathcal{L}_{obj}^n$ is the binary cross-entropy loss on finetuned RPN's objectness layer.
126
+
127
+ Training. As a transfer learning based method, Retentive R-CNN is trained in two stages: pretraining on $\mathcal{D}_b$ and then finetune on the combined dataset of $\mathcal{D}_n$ and $\mathcal{D}_b$ 's subset. As aforementioned, we only unfreeze three layers: objectness of the finetuned RPN, the last linear layers of classification and box regression of $det^n$ . Thanks to the capability of retaining base class performance, we can apply a swifter learning schedule for finetuning, e.g., 5000 iterations for 10-shot MS-COCO[25] compared to 160000 iterations of TFA[41].
128
+
129
+ Inference. Given the object proposals from Bias-Balanced RPN, the corresponding features are fed into the two heads of Re-detector in parallel. The set of predicted boxes of both heads are gathered into one for the final NMS procedure. As $det^b$ is somehow more reliable as it learns from abundant data, we add a little bonus (0.1 in our implementation) for the scores predicted from $det^b$ if they surpass the pre-NMS threshold, which could encourage the NMS procedure to take $det^b$ 's output when $det^b$ and $det^n$ find similar base class results. More details will be de
130
+
131
+ scribed in the supplementary material. As the backbone and feature transformation layers in Bias-Balanced RPN and Re-detector are shared among both detector heads, we can maintain the base class performance with little overhead compared to an ordinary R-CNN.
132
+
133
+ # 4. Experiments
134
+
135
+ # 4.1. Experimental Settings
136
+
137
+ We evaluate our method on the well-established few-shot detection benchmark[41, 17] based on MS-COCO[25] and Pascal VOC [5], following the same class splits and data splits in previous works[17, 41, 44] for a fair comparison. We report 5,10,30-shot results on MS-COCO and 1,2,3,5,10-shot results on 3 random splits of Pascal VOC. Towards the problem of G-FSD, the overall performance of both classes is our major concern. We reproduce Meta R-CNN[46] and FsDetView[45] using exactly the same samples for finetuning without hyperparameter changing (by running their official code) and denote the reproduced results with a * at the upper right corner. Results for ONCE[16], MetaDet[43] and FSRW[17] are reported from their original paper.
138
+
139
+ We use an ImageNet pretrained ResNet-101[13] with FPN[23] as the backbone. Pretraining on $\mathcal{D}_b$ is the same as in [41], then the finetuning layers are initialized by random. For all experiments, we set learning rate to 0.05 and $\lambda$ to 0.1 to finetune until full convergence.
140
+
141
+ # 4.2. Comparison Experiments
142
+
143
+ We compared our results with both transfer learning[41, 44] and meta-learning based methods[16, 46, 17, 45]. Towards maintaining base class performance, one can quickly come up with an R-CNN model with N binary classifiers for detecting a dataset of N classes as binary classifiers are decoupled with each other. We also train such a model (denoted as FRCN-BCE) with binary cross-entropy loss for ROI classification as a strong baseline, using the same hyperparameters as Retentive R-CNN except for initializing the classifiers' bias as in RetinaNet[24].
144
+
145
+ Results on MS-COCO[25]. Table3 shows mean average precision over 0.5 to 0.95 IOU thresholds on all, base, and novel classes (AP, bAP, nAP) under different data settings. We outperform previous methods significantly on AP and bAP, as our method does not degrade on base classes at all. Meanwhile, we achieve competitive results on novel classes as well (state-of-the-art for 10-shot and on-par with state-of-the-art for 5- and 30-shot).
146
+
147
+ Towards the same objective to incrementally detect rare objects, ONCE[16] does not degrade the base class performance as well, yet its performance on both classes is limited. The very competitive TFA[41] models can gradually recover base class performance with samples increas
148
+
149
+ <table><tr><td rowspan="2" colspan="2">Methods / Shots</td><td colspan="3">5 shot</td><td colspan="3">10 shot</td><td colspan="3">30 shot</td></tr><tr><td>AP</td><td>bAP</td><td>nAP</td><td>AP</td><td>bAP</td><td>nAP</td><td>AP</td><td>bAP</td><td>nAP</td></tr><tr><td>Ours</td><td>Retentive R-CNN</td><td>31.5</td><td>39.2</td><td>8.3</td><td>32.1</td><td>39.2</td><td>10.5</td><td>32.9</td><td>39.3</td><td>13.8</td></tr><tr><td rowspan="5">Transfer Learning</td><td>FRCN-ft-full[41]</td><td>18.0</td><td>22.0</td><td>6.0</td><td>18.1</td><td>21.0</td><td>9.2</td><td>18.6</td><td>20.6</td><td>12.5</td></tr><tr><td>FRCN-BCE</td><td>29.1</td><td>36.8</td><td>6.0</td><td>29.2</td><td>36.8</td><td>6.4</td><td>30.2</td><td>36.8</td><td>10.3</td></tr><tr><td>TFA w/ fc[41]</td><td>27.5</td><td>33.9</td><td>8.4</td><td>27.9</td><td>33.9</td><td>10.0</td><td>29.7</td><td>35.1</td><td>13.4</td></tr><tr><td>TFA w/ cos[41]</td><td>28.1</td><td>34.7</td><td>8.3</td><td>28.7</td><td>35.0</td><td>10.0</td><td>30.3</td><td>35.8</td><td>13.7</td></tr><tr><td>MPSR[44]</td><td>-</td><td>-</td><td>-</td><td>15.3</td><td>17.1</td><td>9.7</td><td>17.1</td><td>18.1</td><td>14.1</td></tr><tr><td rowspan="4">Meta Learning</td><td>ONCE [16]</td><td>13.7</td><td>17.9</td><td>1.0</td><td>13.7</td><td>17.9</td><td>1.2</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Meta R-CNN*[46]</td><td>3.6</td><td>3.5</td><td>3.8</td><td>5.4</td><td>5.2</td><td>6.1</td><td>7.8</td><td>7.1</td><td>9.9</td></tr><tr><td>FSRW[17]</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>5.6</td><td>-</td><td>-</td><td>9.1</td></tr><tr><td>FsDetView*[45]</td><td>5.9</td><td>5.7</td><td>6.6</td><td>6.7</td><td>6.4</td><td>7.6</td><td>10.0</td><td>9.3</td><td>12.0</td></tr></table>
150
+
151
+ Table 3. Few-shot object detection results on MS-COCO under 5,10,30-shot settings, best viewed in color. AP, bAP, nAP represents mAP of MS-COCO for all classes, base classes, and novel classes, respectively. Best results and second-best are colored in red and blue, respectively, ' -' means the result is not reported in the original paper. We outperform or on-par with all previous methods for each metric under these settings, with significant improvements on AP and bAP.
152
+
153
+ <table><tr><td rowspan="2" colspan="2">Methods / Shots</td><td colspan="5">All Set 1</td><td colspan="5">All Set 2</td><td colspan="5">All Set 3</td></tr><tr><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td></tr><tr><td>Ours</td><td>Retentive R-CNN</td><td>71.3</td><td>72.3</td><td>72.1</td><td>74.0</td><td>74.6</td><td>66.8</td><td>68.4</td><td>70.2</td><td>70.7</td><td>71.5</td><td>69.0</td><td>70.9</td><td>72.3</td><td>73.9</td><td>74.1</td></tr><tr><td rowspan="4">Transfer Learning</td><td>FRCN-ft-full[41]</td><td>55.4</td><td>57.1</td><td>56.8</td><td>60.1</td><td>60.9</td><td>50.1</td><td>53.7</td><td>53.6</td><td>55.9</td><td>55.5</td><td>58.5</td><td>59.1</td><td>58.7</td><td>61.8</td><td>60.8</td></tr><tr><td>TFA w/ fc[41]</td><td>69.3</td><td>66.9</td><td>70.3</td><td>73.4</td><td>73.2</td><td>64.7</td><td>66.3</td><td>67.7</td><td>68.3</td><td>68.7</td><td>67.8</td><td>68.9</td><td>70.8</td><td>72.3</td><td>72.2</td></tr><tr><td>TFA w/ cos[41]</td><td>69.7</td><td>68.2</td><td>70.5</td><td>73.4</td><td>72.8</td><td>65.5</td><td>65.0</td><td>67.7</td><td>68.0</td><td>68.6</td><td>67.9</td><td>68.6</td><td>71.0</td><td>72.5</td><td>72.4</td></tr><tr><td>MPSR[44]</td><td>56.8</td><td>60.4</td><td>62.8</td><td>66.1</td><td>69.0</td><td>53.1</td><td>57.6</td><td>62.8</td><td>64.2</td><td>66.3</td><td>55.2</td><td>59.8</td><td>62.7</td><td>66.9</td><td>67.7</td></tr><tr><td rowspan="3">Meta Learning</td><td>Meta R-CNN*[46]</td><td>17.5</td><td>30.5</td><td>36.2</td><td>49.3</td><td>55.6</td><td>19.4</td><td>33.2</td><td>34.8</td><td>44.4</td><td>53.9</td><td>20.3</td><td>31.0</td><td>41.2</td><td>48.0</td><td>55.1</td></tr><tr><td>FSRW[17]</td><td>53.5</td><td>50.2</td><td>55.3</td><td>56.0</td><td>59.5</td><td>55.1</td><td>54.2</td><td>55.2</td><td>57.5</td><td>58.9</td><td>54.2</td><td>53.5</td><td>54.7</td><td>58.6</td><td>57.6</td></tr><tr><td>FsDetView*[45]</td><td>36.4</td><td>40.3</td><td>40.1</td><td>50.0</td><td>55.3</td><td>36.3</td><td>43.7</td><td>41.6</td><td>45.8</td><td>54.1</td><td>37.0</td><td>39.5</td><td>40.7</td><td>50.7</td><td>54.8</td></tr></table>
154
+
155
+ Table 4. Few-shot object detection results on Pascal VOC(07+12) all classes (AP50) under 1,2,3,5,10-shot settings, best viewed in color. Best results and second-best are colored in red and blue, respectively. Thanks to the non-forgetting ability, Retentive R-CNN consistently outperforms other methods w.r.t overall AP under all the data settings.
156
+
157
+ ing; however, the gap is still indispensable, e.g., the bAP gap between 30-shot TFA w/cos[41] and the base model is as large as 3.4. As expected, FRCN-BCE can maintain base class performance from its pretrained model intrinsically, but the performance on both base and novel class is lower than an ordinary RCNN by a large margin. Given that Retentive R-CNN only adds little overhead with layers mostly shared, our method is a superior choice for G-FSD. Despite MPSR[44] slightly outperform our method with respect to nAP on 30-shot, the performance drop on base classes is significant, and thus it is not suitable for G-FSD. An even larger performance drop can be observed in Meta R-CNN[46] and FsDetView[45], probably because they predict the whole probability distribution of an ROI from features reweighted by a certain class-attentive vector. The vast performance drop is alleviated to some extent in FSRW[17] (see Table4), which only predicts the probability for the class of the reweighting vector.
158
+
159
+ Results on Pascal-VOC[5]. Table4 and Table5 show overall and novel class results on VOC benchmark respectively. Results of Meta R-CNN[46] from original paper are also included in Table5 as a reference. Note that the results are not directly comparable because samples used for finetuning are different, which can make a significant im
160
+
161
+ pact on the final metrics. We consistently outperform all methods on overall AP across all datasplits thanks to the non-forgetting property. As stated above, MPSR[44] and several other meta-learning methods[46, 45, 17] do not perform well on overall performance as the base class knowledge is forgotten during the finetuning stage.
162
+
163
+ Notice that performance on novel classes is not our primary concern, though, competitive results are achieved by Retentive R-CNN under most cases on VOC novel classes as shown in Table5. MPSR[44] made most of the best nAP records; however, non-negligible base class performance is sacrificed. Compared to the methods that better preserves base class performance, we outperform the current best TFA[41] in most cases, with approximative results under the rest.
164
+
165
+ # 4.3. Ablation Study and Visualization
166
+
167
+ Without loss of generality, we conduct ablation experiments on COCO benchmark under 10-shot scenario. All models are trained with the same hyperparameters unless otherwise stated.
168
+
169
+ Bias-Balanced RPN. To validate the effectiveness of our design, results on RPN recall and final detection precision for different classes of different RPN designs, including the
170
+
171
+ <table><tr><td rowspan="2" colspan="2">Methods / Shots</td><td colspan="5">Novel Set 1</td><td colspan="5">Novel Set 2</td><td colspan="5">Novel Set 3</td></tr><tr><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td><td>1</td><td>2</td><td>3</td><td>5</td><td>10</td></tr><tr><td>Ours</td><td>Retentive R-CNN</td><td>42.4</td><td>45.8</td><td>45.9</td><td>53.7</td><td>56.1</td><td>21.7</td><td>27.8</td><td>35.2</td><td>37.0</td><td>40.3</td><td>30.2</td><td>37.6</td><td>43.0</td><td>49.7</td><td>50.1</td></tr><tr><td rowspan="4">Transfer Learning</td><td>FRCN-ft-full[41]</td><td>15.2</td><td>20.3</td><td>29.0</td><td>25.5</td><td>28.7</td><td>13.4</td><td>20.6</td><td>28.6</td><td>32.4</td><td>38.8</td><td>19.6</td><td>20.8</td><td>28.7</td><td>42.2</td><td>42.1</td></tr><tr><td>TFA w/ fc[41]</td><td>36.8</td><td>29.1</td><td>43.6</td><td>55.7</td><td>57.0</td><td>18.2</td><td>29.0</td><td>33.4</td><td>35.5</td><td>39.0</td><td>27.7</td><td>33.6</td><td>42.5</td><td>48.7</td><td>50.2</td></tr><tr><td>TFA w/ cos[41]</td><td>39.8</td><td>36.1</td><td>44.7</td><td>55.7</td><td>56.0</td><td>23.5</td><td>26.9</td><td>34.1</td><td>35.1</td><td>39.1</td><td>30.8</td><td>34.8</td><td>42.8</td><td>49.5</td><td>49.8</td></tr><tr><td>MPSR[44]</td><td>42.8</td><td>43.6</td><td>48.4</td><td>55.3</td><td>61.2</td><td>29.8</td><td>28.1</td><td>41.6</td><td>43.2</td><td>47.0</td><td>35.9</td><td>40.0</td><td>43.7</td><td>48.9</td><td>51.3</td></tr><tr><td rowspan="5">Meta Learning</td><td>Meta R-CNN[46]</td><td>19.9</td><td>25.5</td><td>35.0</td><td>45.7</td><td>51.5</td><td>10.4</td><td>19.4</td><td>29.6</td><td>34.8</td><td>45.4</td><td>14.3</td><td>18.2</td><td>27.5</td><td>41.2</td><td>48.1</td></tr><tr><td>Meta R-CNN*[46]</td><td>16.8</td><td>20.1</td><td>20.3</td><td>38.2</td><td>43.7</td><td>7.7</td><td>12.0</td><td>14.9</td><td>21.9</td><td>31.1</td><td>9.2</td><td>13.9</td><td>26.2</td><td>29.2</td><td>36.2</td></tr><tr><td>FSRW[17]</td><td>14.8</td><td>15.5</td><td>26.7</td><td>33.9</td><td>47.2</td><td>15.7</td><td>15.3</td><td>22.7</td><td>30.1</td><td>39.2</td><td>19.2</td><td>21.7</td><td>25.7</td><td>40.6</td><td>41.3</td></tr><tr><td>MetaDet[43]</td><td>18.9</td><td>20.6</td><td>30.2</td><td>36.8</td><td>49.6</td><td>21.8</td><td>23.1</td><td>27.8</td><td>31.7</td><td>43.0</td><td>20.6</td><td>23.9</td><td>29.4</td><td>43.9</td><td>44.1</td></tr><tr><td>FsDetView*[45]</td><td>25.4</td><td>20.4</td><td>37.4</td><td>36.1</td><td>42.3</td><td>22.9</td><td>21.7</td><td>22.6</td><td>25.6</td><td>29.2</td><td>32.4</td><td>19.0</td><td>29.8</td><td>33.2</td><td>39.8</td></tr></table>
172
+
173
+ Table 5. Few-shot object detection results on Pascal VOC(07+12) novel classes (nAP<sub>50</sub>) under 1,2,3,5,10-shot settings, best viewed in color. Best results and second-best are colored in red and blue, respectively. Although nAP is not our primary concern, our method makes competitive results. MPSR[44] made most of the best nAP; however, base class metrics are largely sacrificed, as shown in Table4. We outperform TFA[41], the current best method paying fair attention to both classes, in most cases and on-par with it in the rest.
174
+
175
+ <table><tr><td>cls</td><td>bbox</td><td>AR</td><td>AP</td><td>bAP</td><td>nAP</td></tr><tr><td>max</td><td>-</td><td>47.8</td><td>32.1</td><td>39.2</td><td>10.5</td></tr><tr><td>-</td><td>-</td><td>45.6</td><td>32.0</td><td>39.3</td><td>10.1</td></tr><tr><td>arith-avg</td><td>-</td><td>47.1</td><td>32.0</td><td>39.3</td><td>10.3</td></tr><tr><td>geo-avg</td><td>-</td><td>33.5</td><td>30.5</td><td>37.4</td><td>9.6</td></tr><tr><td>max</td><td>unfreeze</td><td>47.7</td><td>32.0</td><td>39.3</td><td>10.4</td></tr><tr><td>max</td><td>arith-avg</td><td>47.7</td><td>32.0</td><td>39.2</td><td>10.4</td></tr></table>
176
+
177
+ Table 6. AR and AP results for base and novel classes among different RPN variants. Results of RPN components are ensembled by functions, including max, arithmetic average, and geometric average. '-' denotes for no ensembling, only base RPN is applied. The design option for current implementation is in bold.
178
+
179
+ ensembling strategy for both RPN outputs and the choice of unfrozen layers during finetuning, are evaluated in Table6. Taking max as the ensembling strategy performs best, among other alternatives. Taking geometric average significantly degrades performance because any low objectness will produce a low final score. It can also be observed from the experiment that novel class AP is tightly related to AR of the RPN, while base class AP can remain stable with slightly inferior RPN AR, which validates one of our design philosophies to debias RPN thus improve novel class performance. Unfreezing box regression layers and ensembling does not make much difference. Thus the extra computation overhead is not necessary.
180
+
181
+ Re-detector. We study various design options in Redetector, including the form of consistency loss (KL divergence, L1 difference, and negative cosine similarity between the normalized marginal probability distribution on base classes), layers in Re-detector to set unfrozen and classifier choice. As shown in Table7, our current design maximizes the overall performance. Surprisingly, unfreezing more layers even lowers the performance.
182
+
183
+ In addition, to validate the necessity of finetuning on both base and novel classes, we also implement a Redetector where $f^n$ only detects $\mathcal{C}_n$ . It produces relatively low results, probably due to severer false positives as diverse objects in base classes are encountered during test
184
+
185
+ <table><tr><td>C(fn)</td><td>Lcon</td><td>layers</td><td>cls</td><td>AP</td><td>bAP</td><td>nAP</td></tr><tr><td>all</td><td>KLDiv</td><td>c+b</td><td>cos</td><td>32.1</td><td>39.2</td><td>10.5</td></tr><tr><td>all</td><td>L1</td><td>c+b</td><td>cos</td><td>32.0</td><td>39.2</td><td>10.3</td></tr><tr><td>all</td><td>cos</td><td>c+b</td><td>cos</td><td>31.9</td><td>39.2</td><td>10.0</td></tr><tr><td>novel</td><td>-</td><td>c+b</td><td>cos</td><td>31.6</td><td>39.2</td><td>8.7</td></tr><tr><td>all</td><td>KLDiv</td><td>c+b+h</td><td>cos</td><td>31.9</td><td>39.2</td><td>9.8</td></tr><tr><td>all</td><td>KLDiv</td><td>c+b</td><td>fc</td><td>31.9</td><td>39.3</td><td>9.9</td></tr></table>
186
+
187
+ Table 7. Ablation results in Re-detector design. $\mathcal{C}(f^n)$ represents the classification domain of a novel detector. The column of layers denotes unfrozen layers in the second stage, c represents classification, b represents bbox and h represents linear layers in the box head. The design option for current implementation is in bold.
188
+
189
+ time, but unseen during finetuning, and the model is trained to categorize these objects the same as those deactivated background features from only a handful of samples, which is undoubtedly challenging.
190
+
191
+ Inference time. We report average inference time per image on COCO 2014 test set by adding modules into Faster R-CNN in Table8. The inference time of Meta R-CNN[46] is also provided as a reference for representative meta-learning methods that demand exemplars for inference, which also introduces much lower extra computation than others, to the best of our knowledge. As most weights are set frozen and shared, Retentive R-CNN introduces little overhead during test time to realize few-shot detection without forgetting, especially compared to meta learned models requiring exemplars at test time.
192
+
193
+ <table><tr><td>FRCN</td><td>+BB-RPN</td><td>+ReDET</td><td>ours</td><td>Meta R-CNN</td></tr><tr><td>70.2</td><td>70.5</td><td>74.2</td><td>75.7</td><td>85.4</td></tr></table>
194
+
195
+ Table 8. Inference time in milliseconds on MS-COCO dataset. Meta R-CNN is reported in 10-shot from the original paper.
196
+
197
+ Visualization. We provide exemplary results obtained by Retentive R-CNN and TFA w/cos[41] in Figure4 for comparison under MS-COCO 10-shot setting. The nonforgetting property of our method can be observed from the last four images containing either crowded scenes or less
198
+
199
+ ![](images/9b5c16075dfcb9a081e0b1f8b188594bde9063ffd321e7b03e8f43e171900b44.jpg)
200
+ Figure 4. Visualization of Retentve R-CNN and TFA w/cos[41] results under MS-COCO 10-shot setting. Novel classes are bounded with purple boxes while base classes are bounded with green ones. Our method generally performs better on base classes and can detect novel class objects ignored by TFA in certain cases.
201
+
202
+ ![](images/e343cfbcd749ae3606f84a3e9883c4b3caa1eb8c522de164758862fa1cc50112.jpg)
203
+ (a)
204
+
205
+ ![](images/b332cee7cf9ede8edd8c19db767e34524c9e9e756ecc2c41ea96b734082e9ea3.jpg)
206
+ (b)
207
+ Figure 5. Visualization of classification logits of Retentive R-CNN $det^n$ head, TFA w/cos[41] (finetuned from the same model), and the base model's classifiers. Regions colored pink represent novel class logits. The consistency loss regularizes our model to produce similar distribution as the base model on base classes, making detection on (a) base classes more reliable and (b) novel classes less confusing.
208
+
209
+ sallent instances where TFA[41] tends to ignore some of these objects, e.g., the inconspicuous baseball bat in the third image is ignored, and many well-learned objects are overseen in the fourth image by TFA[41]. We also perform better on novel classes under certain cases, as shown in the first two images.
210
+
211
+ We further investigate the role of consistency loss by comparing the classification distribution of our method and TFA w/cos[41] and a base detector. Specifically, we show two representative examples for the base class and novel class and visualize the logits of their classifiers for analysis. To make a fair comparison, both our method and TFA w/cos[41] are trained upon this same base detector. It can be easily observed that our method produces much more similar logits distribution as the base model on base classes rather than TFA w/cos[41]. Such property can better reserve base class performance, as shown in Figure5(a), where the base model and ours produce unimodal distribution with one strong peak. When it comes to novel classes, as shown in Figure5(b), base class distribution is suppressed, thus making a more confident response to novel classes.
212
+
213
+ # 5. Conclusion
214
+
215
+ In this paper, we have presented Retentive R-CNN to tackle the problem of G-FSD and proved that few-shot
216
+
217
+ learning without forgetting is achievable in object detection. We analyze transfer learning based few-shot detection and find useful properties that are neglected by the community. Towards utilizing these properties, Retentive R-CNN is designed to combine base and novel detector simply and effectively, with Bias-Balanced RPN alleviating the bias of pretrained RPN and Re-detector reliably finding objects of both base and novel classes. Experiments on well-established few-shot object detection benchmarks show that Retentive R-CNN does not degrade on the base class while remains competitive on novel classes, reaching state-of-the-art overall performance among all data settings. Ablation study validates the effectiveness of our design. Nevertheless, the huge performance gap between few-shot and general object detection on data-limited classes indicates that this task is arduous by nature, and we hope that this paper sheds light on works to further boost novel class metrics with little or no trade-off on base classes.
218
+
219
+ # Acknowledgement
220
+
221
+ This research was partially supported by National Key R&D Program of China (No. 2017YFA0700800), and Beijing Academy of Artificial Intelligence (BAAI).
222
+
223
+ # References
224
+
225
+ [1] Hao Chen, Yali Wang, Guoyou Wang, and Yu Qiao. Lstd: A low-shot transfer detector for object detection. In AAAI Conference on Artificial Intelligence, pages 2836-2843, 2018. 1, 2, 4
226
+ [2] Yinbo Chen, Xiaolong Wang, Zhuang Liu, Huijuan Xu, and Trevor Darrell. A new meta-baseline for few-shot learning. arXiv preprint arXiv:2003.04390, 2020. 1, 2
227
+ [3] Guneet S Dhillon, Pratik Chaudhari, Avinash Ravichandran, and Stefano Soatto. A baseline for few-shot image classification. arXiv preprint arXiv:1909.02729, 2019. 1, 2
228
+ [4] Kaiwen Duan, Song Bai, Lingxi Xie, Honggang Qi, Qingming Huang, and Qi Tian. Centernet: Keypoint triplets for object detection. In IEEE International Conference on Computer Vision, pages 6569-6578, 2019. 2
229
+ [5] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International Journal of Computer Vision, 88(2):303-338, 2010. 5, 6
230
+ [6] Qi Fan, Wei Zhuo, and Yu-Wing Tai. Few-shot object detection with attention-rpn and multi-relation detector. In IEEE Conference on Computer Vision and Pattern Recognition, pages 4012-4021, 2020. 1, 2
231
+ [7] Zhibo Fan, Jin-Gang Yu, Zhihao Liang, Jiarong Ou, Changxin Gao, Gui-Song Xia, and Yuanqing Li. Fgn: Fully guided network for few-shot instance segmentation. In IEEE Conference on Computer Vision and Pattern Recognition, pages 9169-9178, 2020. 1, 2
232
+ [8] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, 2017. 1, 2
233
+ [9] Spyros Gidaris and Nikos Komodakis. Dynamic few-shot visual learning without forgetting. In IEEE Conference on Computer Vision and Pattern Recognition, pages 4367-4375, 2018. 1, 2, 3
234
+ [10] B. Ross Girshick. Fast r-cnn. In IEEE International Conference on Computer Vision, pages 1440-1448, 2015. 2
235
+ [11] B. Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In IEEE Conference on Computer Vision and Pattern Recognition, pages 580-587, 2014. 2
236
+ [12] Kaiming He, Georgia Gkioxari, Piotr Dólar, and B. Ross Girshick. Mask r-cnn. In IEEE International Conference on Computer Vision, pages 386-397, 2017. 2
237
+ [13] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition, 2016. 5
238
+ [14] Ting-I Hsieh, Yi-Chen Lo, Hwann-Tzong Chen, and Tyng-Luh Liu. One-shot object detection with co-attention and coexcitation. In Neural Information Processing Systems, pages 2721–2730, 2019. 1, 2, 3
239
+ [15] Zhiting Hu, Zichao Yang, Ruslan Salakhutdinov, and Eric Xing. Deep neural networks with massive learned knowledge. In Proceedings of the 2016 Conference on Empirical
240
+
241
+ Methods in Natural Language Processing, pages 1670-1679, 2016.4
242
+ [16] Perez-Rua Juan-Manuel, Zhu Xiatian, Hospedales Timothy, and Xiang Tao. Incremental few-shot object detection. In IEEE Conference on Computer Vision and Pattern Recognition, pages 13843-13852, 2020. 1, 2, 5, 6
243
+ [17] Bingyi Kang, Zhuang Liu, Xin Wang, Fisher Yu, Jiashi Feng, and Trevor Darrell. Few-shot object detection via feature reweighting. In IEEE International Conference on Computer Vision, pages 8419-8428, 2019. 1, 2, 3, 5, 6, 7
244
+ [18] Leonid Karlinsky, Joseph Shtok, Sivan Harary, Eli Schwartz, Amit Aides, Schmidt Rogério Feris, Raja Giryes, and M. Alexander Bronstein. Repmet - representative-based metric learning for classification and few-shot object detection. In IEEE Conference on Computer Vision and Pattern Recognition, pages 5197-5206, 2019. 1, 2, 4
245
+ [19] Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML deep learning workshop, volume 2. Lille, 2015. 1, 2
246
+ [20] Hei Law and Jia Deng. Cornernet: Detecting objects as paired keypoints. In IEEE International Conference on Computer Vision, pages 642-656, 2019. 2
247
+ [21] Aoxue Li, Tiange Luo, Tao Xiang, Weiran Huang, and Liwei Wang. Few-shot learning with global class representations. In IEEE International Conference on Computer Vision, pages 9715-9724, 2019. 2
248
+ [22] Fei-Fei Li, Fergus Rob, and Perona Pietro. One-shot learning of object categories. IEEE transactions on pattern analysis and machine intelligence, 28(4):594-611, 2006. 1
249
+ [23] Tsung-Yi Lin, Piotr Dólar, B. Ross Girshick, Kaiming He, Bharath Hariharan, and J. Serge Belongie. Feature pyramid networks for object detection. In IEEE Conference on Computer Vision and Pattern Recognition, 2017. 2, 4, 5
250
+ [24] Tsung-Yi Lin, Priya Goyal, B. Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object detection. In IEEE International Conference on Computer Vision, pages 318-327, 2017. 2, 5
251
+ [25] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and Lawrence C. Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pages 740-755, 2014. 1, 3, 5
252
+ [26] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, and Scott Reed. Ssd: Single shot multibox detector. In European Conference on Computer Vision, 2016. 2
253
+ [27] David Lopez-Paz and Marc'Aurelio Ranzato. Gradient episodic memory for continual learning. In Neural Information Processing Systems, pages 6467-6476, 2017. 2, 3
254
+ [28] Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109-165. Elsevier, 1989. 2, 3
255
+ [29] Claudio Michaelis, Ivan Ustyuzhaninov, Matthias Bethge, and Alexander S. Ecker. One-shot instance segmentation. arXiv preprint arXiv:1811.11507, 2018. 1, 2, 3
256
+ [30] Hang Qi, Matthew Brown, and David G Lowe. Low-shot learning with imprinted weights. In IEEE Conference
257
+
258
+ on Computer Vision and Pattern Recognition, pages 5822-5830, 2018. 1, 2, 3
259
+ [31] Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan L Yuille. Few-shot image recognition by predicting parameters from activations. In IEEE Conference on Computer Vision and Pattern Recognition, pages 7229-7238, 2018. 2
260
+ [32] Han Qiu, Yuchen Ma, Zeming Li, Songtao Liu, and Jian Sun. Borderdet: Border feature for dense object detection. In European Conference on Computer Vision, pages 549-564. Springer, 2020. 2
261
+ [33] Joseph Redmon, Kumar Santosh Divvala, B. Ross Girshick, and ali farhadi. You only look once: Unified, real-time object detection. In IEEE Conference on Computer Vision and Pattern Recognition, 2016. 2
262
+ [34] Shaoqing Ren, Kaiming He, B. Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, pages 1137-1149, 2017. 2, 4
263
+ [35] A. Andrei Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In International Conference on Learning Representations, 2019. 1, 2
264
+ [36] Edgar Schonfeld, Sayna Ebrahimi, Samarth Sinha, Trevor Darrell, and Zeynep Akata. Generalized zero-and few-shot learning via aligned variational autoencoders. In IEEE Conference on Computer Vision and Pattern Recognition, pages 8247-8255, 2019. 2
265
+ [37] Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Neural Information Processing Systems, pages 4077-4087, 2017. 1, 2
266
+ [38] Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In IEEE Conference on Computer Vision and Pattern Recognition, pages 1199-1208, 2018. 1, 2
267
+ [39] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In IEEE International Conference on Computer Vision, pages 9627-9636, 2019. 2
268
+ [40] Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Neural Information Processing Systems, pages 3630-3638, 2016. 1, 2
269
+ [41] Xin Wang, Thomas Huang, Joseph Gonzalez, Trevor Darryll, and Fisher Yu. Frustratingly simple few-shot object detection. In International Conference on Machine Learning, 2020. 1, 2, 3, 4, 5, 6, 7, 8
270
+ [42] Yan Wang, Wei-Lun Chao, Kilian Q Weinberger, and Laurens van der Maaten. Simpleshot: Revisiting nearest-neighbor classification for few-shot learning. arXiv preprint arXiv:1911.04623, 2019. 1, 2
271
+ [43] Yu-Xiong Wang, Deva Ramanan, and Martial Hebert. Meta-learning to detect rare objects. In IEEE International Conference on Computer Vision, pages 9924-9933, 2019. 1, 2, 5, 7
272
+ [44] Jiaxi Wu, Songtao Liu, Di Huang, and Yunhong Wang. Multi-scale positive sample refinement for few-shot object
273
+
274
+ detection. In European Conference on Computer Vision, 2020. 1, 2, 3, 4, 5, 6, 7
275
+ [45] Yang Xiao and Renaud Marlet. Few-shot object detection and viewpoint estimation for objects in the wild. In European Conference on Computer Vision, 2020. 1, 2, 4, 5, 6, 7
276
+ [46] Xiaopeng Yan, Ziliang Chen, Anni Xu, Xiaoxi Wang, Xiaodan Liang, and Liang Lin. Meta r-cnn - towards general solver for instance-level low-shot learning. In IEEE International Conference on Computer Vision, pages 9576-9585, 2019. 1, 2, 4, 5, 6, 7
277
+ [47] Ze Yang, Yali Wang, Xianyu Chen, Jianzhuang Liu, and Yu Qiao. Context-transformer: Tackling object confusion for few-shot detection. In AAAI Conference on Artificial Intelligence, pages 12653-12660, 2020. 2
278
+ [48] Ruichi Yu, Ang Li, Vlad I Morariu, and Larry S Davis. Visual relationship detection with internal and external linguistic knowledge distillation. In Proceedings of the IEEE international conference on computer vision, pages 1974-1982, 2017. 4
279
+ [49] Shifeng Zhang, Cheng Chi, Yongqiang Yao, Zhen Lei, and Stan Z. Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In IEEE Conference on Computer Vision and Pattern Recognition, pages 9756-9765, 2019. 2
generalizedfewshotobjectdetectionwithoutforgetting/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba033d0b1dd94e5932a59d3e9f14e5102660bdac962eb3e1208af6e0dc952d61
3
+ size 580835
generalizedfewshotobjectdetectionwithoutforgetting/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae79f90ba903ccc0c502b63f6bb516e9f3008710bd3f7e8fa0daff9728efd1fc
3
+ size 378947
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9be9a5160612f3dca7a2eb791b88983ad157e0f2aaa1fc1cc7d94242dd795623
3
+ size 74530
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99e3f3af210f7429ee7f9870588084f3dd5e3cbddafbe4fe78a3d90667b774f3
3
+ size 92142
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/8d50f3ec-9c94-45f9-b802-0daa55621e11_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3743fedfa68175e4e97d217a3ff96434d156aa8671227b6895eb5b043b83b15c
3
+ size 1177650
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/full.md ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generalized Focal Loss V2: Learning Reliable Localization Quality Estimation for Dense Object Detection
2
+
3
+ Xiang Li $^{1,2}$ , Wenhai Wang $^{3}$ , Xiaolin Hu $^{4}$ , Jun Li $^{1}$ , Jinhui Tang $^{1}$ , and Jian Yang $^{1*}$
4
+
5
+ $^{1}$ Nanjing University of Science and Technology $^{2}$ Momenta $^{3}$ Nanjing University $^{4}$ Tsinghua University
6
+
7
+ {xiang.li.implus, junl, jinhuitang, csjyang}@njust.edu.cn, wangwenhai362@163.com, xlu@mail.tsinghua.edu.cn
8
+
9
+ # Abstract
10
+
11
+ Localization Quality Estimation (LQE) is crucial and popular in the recent advancement of dense object detectors since it can provide accurate ranking scores that benefit the Non-Maximum Suppression processing and improve detection performance. As a common practice, most existing methods predict LQE scores through vanilla convolutional features shared with object classification or bounding box regression. In this paper, we explore a completely novel and different perspective to perform LQE - based on the learned distributions of the four parameters of the bounding box. The bounding box distributions are inspired and introduced as "General Distribution" in GFLV1, which describes the uncertainty of the predicted bounding boxes well. Such a property makes the distribution statistics of a bounding box highly correlated to its real localization quality. Specifically, a bounding box distribution with a sharp peak usually corresponds to high localization quality, and vice versa. By leveraging the close correlation between distribution statistics and the real localization quality, we develop a considerably lightweight Distribution-Guided Quality Predictor (DGQP) for reliable LQE based on GFLV1, thus producing GFLV2. To our best knowledge, it is the first attempt in object detection to use a highly relevant, statistical representation to facilitate LQE. Extensive experiments demonstrate the effectiveness of our method. Notably, GFLV2 (ResNet-101) achieves 46.2 AP at 14.6 FPS, surpassing the previous state-of-the-art ATSS baseline (43.6 AP at 14.6 FPS) by absolute 2.6 AP on COCO test-dev, without sacrificing the efficiency both in training and inference.
12
+
13
+ # 1. Introduction
14
+
15
+ Dense object detector [28, 23, 42, 33, 18, 27] which directly predicts pixel-level object categories and bounding boxes over feature maps, becomes increasingly popular due to its elegant and effective framework. One of the crucial techniques underlying this framework is Localization Quality Estimation (LQE). With the help of better LQE, high-quality bounding boxes tend to score higher than low-quality ones, greatly reducing the risk of mistaken suppression in Non-Maximum Suppression (NMS) processing.
16
+
17
+ Many previous works [28, 29, 30, 33, 40, 36, 14, 18, 39, 43, 27] have explored LQE. For example, the YOLO family [28, 29, 30] first adopt Objectness to describe the localization quality, which is defined as the Intersection-over-Union (IoU) between the predicted and ground-truth box. After that, IoU is further explored and proved to be effective in IoU-Net [13], IoU-aware [36], PAA [14], GFLV1 [18] and VFNet [39]. Recently, FCOS [33] and ATSS [40] introduce Centerness, the distance degree to the object center, to suppress low-quality detection results. Generally, the aforementioned methods share a common characteristic that they are all based on vanilla convolutional features, e.g., features of points, borders or regions (see Fig. 2 (a)-(g)), to estimate the localization quality.
18
+
19
+ Different from previous works, in this paper, we explore a brand new perspective to conduct LQE – by directly utilizing the statistics of bounding box distributions, instead of using the vanilla convolutional features (see Fig. 2). Here the bounding box distribution is introduced as “General Distribution” in GFLV1 [18], where it learns a discrete probability distribution of each predicted edge (Fig. 1 (a)) for describing the uncertainty of bounding box regression. Interestingly, we observe that the statistic of the General Distribution has a strong correlation with its real localization quality, as illustrated in Fig. 1 (b). More specifically in Fig. 1 (c) and (d), the shape (flatness) of bounding box distribution can clearly reflect the localization quality of the
20
+
21
+ ![](images/996c7240be8680de8c31264604a9710bb4492e71983cb1b1200cec4df59c74ed.jpg)
22
+ (a)
23
+
24
+ ![](images/27186c58671e3c3598d208a50c44d4d9d83ec16d48127e236f049cff592a1b1b.jpg)
25
+ (b)
26
+
27
+ ![](images/8e919fbb56d0794a6b0a608aed69f9237c4af4278dae97bec4bf42c41705d590.jpg)
28
+ Lower Localization Quality: 0.69 IoU
29
+
30
+ ![](images/6036c78b551476f8fed055014a547e8b62d2addcdd9ba8990a9674d747e53bae.jpg)
31
+ (c)
32
+
33
+ ![](images/c57da2791bdfd667f1bee2b896bd5e9ffbeb6cb0920043a31d060c83ac29575f.jpg)
34
+ Higher Localization Quality: 0.90 IoU
35
+
36
+ ![](images/571020d23fbeb46127f64918c1d71f7e8aae2d0533cfbb9596267fce0abd810a.jpg)
37
+ (d)
38
+ Figure 1: Motivation of utilizing the highly relevant statistics of learned bounding box distributions to guide the better generation of its estimated localization quality. (a): The illustration of General Distribution in GFLV1 [18] to represent bounding boxes, which models the probability distribution of the predicted edges. (b): The scatter diagram of the relation between Top-1 (mean of four sides) value of General Distribution of predicted boxes and their real localization quality (IoU between the prediction and ground-truth), calculated over all validation images on COCO [22] dataset, based on GFLV1 model. (c) and (d): Two specific examples from (b), where the sharp distribution corresponds to higher quality, whilst the flat one stands for lower quality usually. Green: predicted bounding boxes; White: ground-truth bounding boxes.
39
+
40
+ predicted results: the sharper the distribution, the more accurate the predicted bounding box, and vice versa. Consequently, it can potentially be easier and very efficient to conduct better LQE by the guidance of the distribution information, as the input (distribution statistics of bounding boxes) and the output (LQE scores) are highly correlated.
41
+
42
+ Inspired by the strong correlation between the distribution statistics and LQE scores, we propose a very lightweight sub-network with only dozens of (e.g., 64) hidden units, on top of these distribution statistics to produce reliable LQE scores, significantly boosting the detec
43
+
44
+ tion performance. Importantly, it brings negligible additional computation cost in practice and almost does not affect the training/inference speed of the basic object detectors. In this paper, we term this lightweight sub-network as Distribution-Guided Quality Predictor (DGQP), since it relies on the guidance of distribution statistics for quality predictions.
45
+
46
+ By introducing the lightweight DGQP that predicts reliable LQE scores via statistics of bounding box distributions, we develop a novel dense object detector based on the framework of GFLV1, thus termed GFLV2. To verify the effectiveness of GFLV2, we conduct extensive experiments on the challenging benchmark COCO [22]. Notably, based on ResNet-101 [11], GFLV2 achieves impressive detection performance (46.2 AP), i.e., 2.6 AP gains over the state-of-the-art ATSS baseline (43.6 AP) on COCO test-dev, under the same training schedule and without sacrificing the efficiency both in training and inference.
47
+
48
+ In summary, our contributions are as follows:
49
+
50
+ - To our best knowledge, our work is the first to bridge the statistics of bounding box distributions and localization quality estimation in an end-to-end dense object detection framework.
51
+ - The proposed GFLV2 is considerably lightweight and cost-free in practice. It can also be easily plugged into most dense object detectors with a consistent gain of $\sim 2$ AP, and without loss of training/inference speed.
52
+ - Our GFLV2 (Res2Net-101-DCN) achieves very competitive 53.3 AP (multi-scale testing) on COCO dataset among dense object detectors.
53
+
54
+ # 2. Related Work
55
+
56
+ Formats of LQE: Early popular object detectors [9, 31, 1, 10] simply treat the classification confidence as the formulation of LQE score, but there is an obvious inconsistency between them, which inevitably degrades the detection performance. To alleviate this problem, AutoAssign [43] and BorderDet [27] employ additional localization features to rescore the classification confidence, but they still lack an explicit definition of LQE.
57
+
58
+ Recently, FCOS [33] and ATSS [40] introduce a novel format of LQE, termed Centerness, which depicts the distance degree to the center of the object. Although Centerness is effective, recent researches [18, 39] show that it has certain limitations and may be suboptimal for LQE. SABL [35] introduces boundary buckets for coarse localization, and utilizes the averaged bucketing confidence as a formulation of LQE.
59
+
60
+ After years of technical iterations [28, 29, 30, 13, 34, 12, 36, 14, 18, 39], IoU has been deeply studied and becomes increasingly popular as an excellent measurement of LQE. IoU is first known as the Objectness inYOLO [28, 29, 30], where the network is supervised to produce estimated IoUs
61
+
62
+ ![](images/0274c383aaf6f5b9fecd61f45f53439ff493042c39224368234bf6d5f932e2ef.jpg)
63
+ Figure 2: Comparisons of input features for predicting localization quality between existing works (left) and ours (right). Existing works focus on different spatial locations of convolutional features, including (a): point [28, 29, 30, 33, 40, 36, 14, 18], (b): region [13], (c): border [27] dense points, (d): border [27] middle points, (e): border [27] extreme points, (f): regular sampling points [39], and (g): deformable sampling points [4, 5]. In contrast, we use the statistic of learned box distribution to produce reliable localization quality.
64
+
65
+ between predicted boxes and ground-truth ones, to reduce ranking basis during NMS. Following the similar paradigm, IoU-Net [13], Fitness NMS [34], MS R-CNN [12], IoU-aware [36], PAA [14] utilize a separate branch to perform LQE in the IoU form. Concurrently, GFLV1 [18] and VFNet [39] demonstrate a more effective format, by merging the classification score with IoU to reformulate a joint representation. Due to its great success [18, 39], we build our GFLV2 based on the Classification-IoU Joint Representation [18], and develop a novel approach for reliable LQE. Input Features for LQE: As shown in the left part of Fig. 2, previous works directly use convolutional features as input for LQE, which only differ in the way of spatial sampling. Most existing methods [28, 29, 30, 33, 40, 36, 14, 18] adopt the point features (see Fig. 2 (a)) to produce LQE scores for high efficiency. IoU-Net [13] predicts IoU based on the region features as shown in Fig. 2 (b). BorderDet [27] designs three types of border-sensitive features (see Fig. 2 (c)-(e)) to facilitate LQE. Similar with BorderDet, a star-shaped sampling manner (see Fig. 2 (f)) is designed in VFNet [39]. Alternatively, HSD [2] and RepPoints [38, 4] focus on features with learned locations (see Fig. 2 (g)) via the deformable convolution [5, 46].
66
+
67
+ The aforementioned methods mainly focus on extracting discriminating convolutional features with various spatial aspects for better LQE. Different from previous methods, our proposed GFLV2 is designed in an artful perspective: predicting LQE scores by its directly correlated variables—the statistics of bounding box distributions (see the right part of Fig. 2).
68
+
69
+ # 3. Method
70
+
71
+ In this section, we first briefly review the Generalized Focal Loss (i.e., GFLV1 [18]), and then derive the proposed GFLV2 based on the relevant concepts and formulations.
72
+
73
+ # 3.1. Generalized Focal Loss V1
74
+
75
+ Classification-IoU Joint Representation: This representation is the key component in GFLV1, which is designed to reduce the inconsistency between localization quality es
76
+
77
+ timation and object classification during training and inference. Concretely, given an object with category label $c \in \{1,2,\dots,m\}$ ( $m$ indicates the total number of categories), GFLV1 utilizes the classification branch to produce the joint representation of Classification and IoU as $\mathbf{J} = [J_1,J_2,\dots,J_m]$ , which satisfies:
78
+
79
+ $$
80
+ J _ {i} = \left\{ \begin{array}{l l} \operatorname {I o U} \left(b _ {p r e d}, b _ {g t}\right), & \text {i f} i = c; \\ 0, & \text {o t h e r w i s e ,} \end{array} \right. \tag {1}
81
+ $$
82
+
83
+ where $\mathrm{IoU}(b_{pred}, b_{gt})$ denotes the IoU between the predict bounding box $b_{pred}$ and the ground truth $b_{gt}$ .
84
+
85
+ General Distribution of Bounding Box Representation: Modern detectors [31, 21, 33] usually describe the bounding box regression by Dirac delta distribution: $y = \int_{-\infty}^{+\infty}\delta (x - y)x\mathrm{d}x$ . Unlike them, GFLV1 introduces a flexible General Distribution $P(x)$ to represent the bounding box, where each edge of the bounding box can be formulated as: $\hat{y} = \int_{-\infty}^{+\infty}P(x)x\mathrm{d}x = \int_{y_0}^{y_n}P(x)x\mathrm{d}x$ , under a predefined output range of $[y_0,y_n]$ . To be compatible with the convolutional networks, the continuous domain is converted into the discrete one, via discretizing the range $[y_0,y_n]$ into a list $[y_0,y_1,\dots ,y_i,y_{i + 1},\dots ,y_{n - 1},y_n]$ with even intervals $\Delta$ $(\Delta = y_{i + 1} - y_i,\forall i\in \{0,1,\dots ,n - 1\})$ . As a result, given the discrete distribution property $\sum_{i = 0}^{n}P(y_{i}) = 1$ , the estimated regression value $\hat{y}$ can be presented as:
86
+
87
+ $$
88
+ \hat {y} = \sum_ {i = 0} ^ {n} P \left(y _ {i}\right) y _ {i}. \tag {2}
89
+ $$
90
+
91
+ Compared with the Dirac delta distribution, the General Distribution $P(x)$ can faithfully reflect the prediction quality (see Fig. 1 (c)-(d)), which is the cornerstone of this work.
92
+
93
+ # 3.2. Generalized Focal Loss V2
94
+
95
+ Decomposed Classification-IoU Representation: Although the joint representation solves the inconsistency problem [18] between object classification and quality estimation during training and testing, there are still some limitations in using only the classification branch to predict the joint representation. In this work, we decompose the joint representation explicitly by leveraging information
96
+
97
+ ![](images/759ca39d9a596dfe915966aa0e8c089a90cf9d9bd6d84beab82b8516a6c4fed6.jpg)
98
+ Figure 3: The illustration of the proposed Generalized Focal Loss V2 (GFLV2), where a novel and tiny Distribution-Guided Quality Predictor (DGQP) uses the statistics of learned bounding box distributions to facilitate generating reliable IoU quality estimations.
99
+
100
+ from both classification (C) and regression $(I)$ branches:
101
+
102
+ $$
103
+ \mathbf {J} = \mathbf {C} \times I, \tag {3}
104
+ $$
105
+
106
+ where $\mathbf{C} = [C_1, C_2, \dots, C_m], C_i \in [0, 1]$ denotes the Classification Representation of total $m$ categories, and $I \in [0, 1]$ is a scalar that stands for the IoU Representation.
107
+
108
+ Although $\mathbf{J}$ is decomposed into two components, we use the final joint formulation (i.e., $\mathbf{J}$ ) in both the training and testing phases, so it can still avoid the inconsistency problem as mentioned in GFLV1. Specifically, we first combine $\mathbf{C}$ from the classification branch and $I$ from the proposed Distribution-Guided Quality Predictor (DGQP) in regression branch, into the unified form $\mathbf{J}$ . Then, $\mathbf{J}$ is supervised by Quality Focal loss (QFL) as proposed in [18] during training, and used directly as NMS score in inference.
109
+
110
+ Distribution-Guided Quality Predictor: DGQP is the key component of GFLV2. It delivers the statistics of the learned General Distribution $\mathbf{P}$ into a tiny sub-network (see red dotted frame in Fig. 3) to obtain the predicted IoU scalar $I$ , which helps to generate high-quality Classification-IoU Joint Representation (Eq. (3)). Following GFLV1 [18], we adopt the relative offsets from the location to the four sides of a bounding box as the regression targets, which are represented by the General Distribution. For convenience, we mark the left, right, top and bottom sides as $\{l, r, t, b\}$ , and define the discrete probabilities of the $w$ side as $\mathbf{P}^w = [P^w(y_0), P^w(y_1), \dots, P^w(y_n)]$ , where $w \in \{l, r, t, b\}$ .
111
+
112
+ As illustrated in Fig. 1, the flatness of the learned distribution is highly related to the quality of the final detected bounding box, and some relevant statistics can be used to reflect the flatness of the General Distribution. As a result, such statistical features have a very strong correlation with the localization quality, which will ease the training difficulty and improves the quality of estimation. Practically, we recommend to choose the Top- $k$ values along with the mean value of each distribution vector $\mathbf{P}^w$ , and concatenate
113
+
114
+ them as the basic statistical feature $\mathbf{F}\in \mathbb{R}^{4(k + 1)}$
115
+
116
+ $$
117
+ \mathbf {F} = \operatorname {C o n c a t} \left(\left\{\operatorname {T o p k m} \left(\mathbf {P} ^ {w}\right) \mid w \in \{l, r, t, b \} \right\}\right), \tag {4}
118
+ $$
119
+
120
+ where $\mathrm{Topkm}(\cdot)$ denotes the joint operation of calculating Top- $k$ values and their mean value. $\mathrm{Concat}(\cdot)$ means the channel concatenation. Selecting Top- $k$ values and their mean value as the input statistics have two benefits:
121
+
122
+ - Since the sum of $\mathbf{P}^w$ is fixed (i.e., $\sum_{i=0}^{n} P^w(y_i) = 1$ ), Top- $k$ values along with their mean value can basically reflect the flatness of the distribution: the larger, the sharper; the smaller, the flatter;
123
+ - Top- $k$ and mean values can make the statistical feature insensitive to its relative offsets over the distribution domain (see Fig. 4), resulting in a robust representation which is not affected by object scales.
124
+
125
+ ![](images/f398d3cf83da16e7f6c3dc2065bb00c6d76fe9f22168a78c4bd2c17eae3bd9c6.jpg)
126
+ Figure 4: Topkm(·) feature is robust to object scales.
127
+
128
+ Given the statistical feature $\mathbf{F}$ of General Distribution as input, we design a very tiny sub-network $\mathcal{F}(\cdot)$ to predict the final IoU quality estimation. The sub-network has only two Fully-Connected (FC) layers, which are followed by ReLU [16] and Sigmoid, respectively. Consequently, the IoU scalar $I$ can be calculated as:
129
+
130
+ $$
131
+ I = \mathcal {F} (\mathbf {F}) = \sigma \left(\mathbf {W} _ {2} \delta \left(\mathbf {W} _ {1} \mathbf {F}\right)\right), \tag {5}
132
+ $$
133
+
134
+ where $\delta$ and $\sigma$ refer to the ReLU and Sigmoid, respectively. $\mathbf{W}_1\in \mathbb{R}^{p\times 4(k + 1)}$ and $\mathbf{W}_2\in \mathbb{R}^{1\times p}$ . $k$ denotes the Top- $k$ parameter and $p$ is the channel dimension of the hidden layer ( $k = 4$ , $p = 64$ is a typical setting in our experiment).
135
+
136
+ **Complexity:** The overall architecture of GFLV2 is illustrated in Fig. 3. It is worth noting that the DGQP module is very lightweight. First, it only brings thousands of additional parameters, which are negligible compared to the
137
+
138
+ <table><tr><td>Top-k (4)</td><td>Mean</td><td>Var</td><td>Dim</td><td>AP</td><td>\( AP_{50} \)</td><td>\( AP_{75} \)</td></tr><tr><td>✓</td><td></td><td></td><td>16</td><td>40.8</td><td>58.5</td><td>44.2</td></tr><tr><td></td><td>✓</td><td></td><td>4</td><td>40.2</td><td>58.5</td><td>43.6</td></tr><tr><td></td><td></td><td>✓</td><td>4</td><td>40.3</td><td>58.3</td><td>43.7</td></tr><tr><td>✓</td><td>✓</td><td></td><td>20</td><td>41.1</td><td>58.8</td><td>44.9</td></tr><tr><td>✓</td><td></td><td>✓</td><td>20</td><td>40.9</td><td>58.5</td><td>44.7</td></tr><tr><td>✓</td><td>✓</td><td>✓</td><td>24</td><td>40.9</td><td>58.4</td><td>44.7</td></tr></table>
139
+
140
+ Table 1: Performances of different combinations of the input statistics by fixing $k = 4$ and $p = {64}$ . "Mean" denotes the mean value, "Var" denotes the variance number, and "Dim" is short for "Dimension" that means the total amount of the input channels.
141
+
142
+ number of parameters of the entire detection model. For example, for the model with ResNet-50 [11] and FPN [20], the extra parameters of the DGQP module only account for $\sim 0.003\%$ . Second, the computational overhead of the DGQP module is also very small due to its extremely light structure. As shown in Table 5 and 8, the use of the DGQP module hardly reduces the training and inference speed of the original detector in practice.
143
+
144
+ # 4. Experiment
145
+
146
+ Experimental Settings: We conduct experiments on COCO benchmark [22], where trainval35k with 115K images is used for training and minival with 5K images for validation in our ablation study. Besides, we obtain the main results on test-dev with 20K images from the evaluation server. All results are produced under mmdetection [3] for fair comparisons, where the default hyperparameters are always adopted. Unless otherwise stated, we apply the standard 1x learning schedule (12 epochs) without multi-scale training for the ablation study, based on ResNet-50 [11] backbone. The training/testing details follow the descriptions in previous works [18, 4].
147
+
148
+ # 4.1. Ablation Study
149
+
150
+ Combination of Input Statistics: In addition to the pure Top- $k$ values, there are some statistics that may reflect more characteristics of the distributions, such as the mean and variance of these Top- $k$ numbers. Therefore, we conduct experiments to investigate the effect of their combinations as input, by fixing $k = 4$ and $p = 64$ . From Table 1, we observe that the Top-4 values with their mean number perform best. Therefore, we default to use such a combination as the standard statistical input in the following experiments.
151
+
152
+ Structure of DGQP (i.e., $k, p$ ): We then examine the impact of different parameters of $k, p$ in DGQP on the detection performance. Specifically, we report the effect of $k$ and $p$ by fixing one and varying another in Table 2. It is observed that $k = 4, p = 64$ steadily achieves the optimal accuracy among various combinations.
153
+
154
+ Type of Input Features: To the best of our knowledge, the proposed DGQP is the first to use the statistics of learned
155
+
156
+ <table><tr><td>k</td><td>p</td><td>AP</td><td>\( AP_{50} \)</td><td>\( AP_{75} \)</td><td>\( AP_S \)</td><td>\( AP_M \)</td><td>\( AP_L \)</td></tr><tr><td>0</td><td>-</td><td>40.2</td><td>58.6</td><td>43.4</td><td>23.0</td><td>44.3</td><td>53.0</td></tr><tr><td>1</td><td></td><td>40.2</td><td>58.3</td><td>44.0</td><td>23.4</td><td>44.1</td><td>52.1</td></tr><tr><td>2</td><td></td><td>40.9</td><td>58.5</td><td>44.6</td><td>23.3</td><td>44.8</td><td>53.5</td></tr><tr><td>3</td><td rowspan="2">64</td><td>40.9</td><td>58.5</td><td>44.6</td><td>24.3</td><td>44.9</td><td>52.3</td></tr><tr><td>4</td><td>41.1</td><td>58.8</td><td>44.9</td><td>23.5</td><td>44.9</td><td>53.3</td></tr><tr><td>8</td><td></td><td>41.0</td><td>58.6</td><td>44.5</td><td>23.5</td><td>44.5</td><td>53.4</td></tr><tr><td>16</td><td></td><td>40.8</td><td>58.5</td><td>44.4</td><td>23.4</td><td>44.2</td><td>53.1</td></tr><tr><td rowspan="6">4</td><td>8</td><td>40.9</td><td>58.4</td><td>44.5</td><td>23.1</td><td>44.5</td><td>52.6</td></tr><tr><td>16</td><td>40.8</td><td>58.3</td><td>44.1</td><td>23.3</td><td>44.6</td><td>52.0</td></tr><tr><td>32</td><td>40.9</td><td>58.7</td><td>44.3</td><td>23.1</td><td>44.6</td><td>53.2</td></tr><tr><td>64</td><td>41.1</td><td>58.8</td><td>44.9</td><td>23.5</td><td>44.9</td><td>53.3</td></tr><tr><td>128</td><td>40.9</td><td>58.3</td><td>44.6</td><td>23.2</td><td>44.4</td><td>52.7</td></tr><tr><td>256</td><td>40.7</td><td>58.3</td><td>44.4</td><td>23.4</td><td>44.3</td><td>52.9</td></tr></table>
157
+
158
+ Table 2: Performances of various $k,p$ in DGQP. $k = 0$ denotes the baseline version without the usage of DGQP (i.e., GFLV1).
159
+
160
+ <table><tr><td colspan="2">Input Feature</td><td>AP</td><td>\( AP_{50} \)</td><td>\( AP_{75} \)</td><td>FPS</td></tr><tr><td colspan="2">Baseline (ATSS [40] w/ QFL [18])</td><td>39.9</td><td>58.5</td><td>43.0</td><td>19.4</td></tr><tr><td rowspan="7">Convolutional Features</td><td>(a)</td><td>40.2</td><td>58.6</td><td>43.7</td><td>19.3</td></tr><tr><td>(b)</td><td>40.5</td><td>59.0</td><td>44.0</td><td>14.0</td></tr><tr><td>(c)</td><td>40.5</td><td>58.7</td><td>44.1</td><td>16.2</td></tr><tr><td>(d)</td><td>40.6</td><td>59.0</td><td>44.0</td><td>18.3</td></tr><tr><td>(e)</td><td>40.6</td><td>58.9</td><td>44.1</td><td>17.8</td></tr><tr><td>(f)</td><td>40.7</td><td>59.0</td><td>44.1</td><td>17.9</td></tr><tr><td>(g)</td><td>40.8</td><td>58.9</td><td>44.6</td><td>18.4</td></tr><tr><td colspan="2">Distribution Statistics (ours)</td><td>41.1</td><td>58.8</td><td>44.9</td><td>19.4</td></tr></table>
161
+
162
+ Table 3: Comparisons among different input features by fixing the hidden layer dimension of DGQP.
163
+
164
+ ![](images/537f091d4c26673e4e603d1a66db804c07e339f83d34dbf6ae5f57ab0fb7332e.jpg)
165
+ Figure 5: Different ways to utilize the distribution statistics, including Decomposed Form (left) and Composed Form (right).
166
+
167
+ distributions of bounding boxes for the generation of better LQE scores in the literature. Since the input (distribution statistics) and the output (LQE scores) are highly correlated, we speculate that it can be more effective or efficient than ordinary convolutional input proposed in existing methods. Therefore, we fix the hidden layer dimension of DGQP (i.e., $p = 64$ ) and compare our statistical input with most existing possible types of convolutional inputs, from point (a), region (b), border (c)-(e), regular points (f), and deformable points (g), respectively (Fig. 2). Table 3 shows that our distribution statistics perform best in overall AP, also fastest in inference, compared against various convolutional features.
168
+
169
+ Usage of the Decomposed Form: Next, we examine what is the best formulation of Classification-IoU Joint Representation in the case of using distribution statistics. There
170
+
171
+ <table><tr><td colspan="2">Type</td><td>AP</td><td>AP50</td><td>AP75</td><td>FPS</td></tr><tr><td colspan="2">Baseline (GFLV1 [18])</td><td>40.2</td><td>58.6</td><td>43.4</td><td>19.4</td></tr><tr><td rowspan="5">Composed Form</td><td>d = 16</td><td>40.5</td><td>58.5</td><td>43.7</td><td>19.2</td></tr><tr><td>d = 32</td><td>40.5</td><td>58.5</td><td>43.7</td><td>19.2</td></tr><tr><td>d = 64</td><td>40.7</td><td>58.5</td><td>44.3</td><td>19.1</td></tr><tr><td>d = 128</td><td>40.7</td><td>58.6</td><td>44.4</td><td>18.9</td></tr><tr><td>d = 256</td><td>40.7</td><td>58.3</td><td>44.2</td><td>18.5</td></tr><tr><td colspan="2">Decomposed Form (ours)</td><td>41.1</td><td>58.8</td><td>44.9</td><td>19.4</td></tr></table>
172
+
173
+ Table 4: Comparisons between Decomposed Form (proposed) and Composed Form (with various dimension $d$ settings).
174
+
175
+ <table><tr><td>Method</td><td>GFLV2</td><td>AP</td><td>\( AP_{50} \)</td><td>\( AP_{75} \)</td><td>FPS</td></tr><tr><td>RetinaNet [21]</td><td></td><td>36.5</td><td>55.5</td><td>38.7</td><td>19.0</td></tr><tr><td>RetinaNet [21]</td><td>✓</td><td>38.6 (+2.1)</td><td>56.2</td><td>41.7</td><td>19.0</td></tr><tr><td>FoveaNet [15]</td><td></td><td>36.4</td><td>55.8</td><td>38.8</td><td>20.0</td></tr><tr><td>FoveaNet [15]</td><td>✓</td><td>38.5 (+2.1)</td><td>56.8</td><td>41.6</td><td>20.0</td></tr><tr><td>FCOS [33]</td><td></td><td>38.5</td><td>56.9</td><td>41.4</td><td>19.4</td></tr><tr><td>FCOS [33]</td><td>✓</td><td>40.6 (+2.1)</td><td>58.2</td><td>43.9</td><td>19.4</td></tr><tr><td>ATSS [40]</td><td></td><td>39.2</td><td>57.4</td><td>42.2</td><td>19.4</td></tr><tr><td>ATSS [40]</td><td>✓</td><td>41.1 (+1.9)</td><td>58.8</td><td>44.9</td><td>19.4</td></tr></table>
176
+
177
+ are basically two formats: the Composed Form and the proposed Decomposed Form (Sec. 3.2), as illustrated in Fig. 5. Here the "Decomposed" (the left part of Fig. 5) means that the final joint representation can be explicitly decomposed through multiplication by two components, i.e., $\mathbf{J} = \mathbf{C} \times I$ in Eq. (3). Whilst the "Composed" (the right part of Fig. 5) shows that $\mathbf{J}$ is directly obtained through FC layers where its input feature is enriched ( $d$ is the dimension of the appended feature) by the information of distribution statistics. From Table 4, our proposed Decomposed Form is always superior than the Composed Forms with various $d$ settings in both accuracy and running speed.
178
+
179
+ Compatibility for Dense Detectors: Since GFLV2 is very lightweight and can be adapted to various types of dense detectors, we employ it to a series of recent popular detection methods. For those detectors that do not support the distributed representation of bounding boxes, we make the minimal and necessary modifications to enable it to generate distributions for each edge of a bounding box. Based on the results in Table 5, GFLV2 can consistently improve $\sim 2$ AP in popular dense detectors, without loss of inference speed.
180
+
181
+ # 4.2. Comparisons with State-of-the-arts
182
+
183
+ In this section, we compare GFLV2 with state-of-the-art approaches on COCO test-dev in Table 7. Following previous works [21, 33], the multi-scale ([480, 960]) training strategy and $2\mathrm{x}$ learning schedule (24 epochs) are adopted during training. For a fair comparison, the re
184
+
185
+ ![](images/8ab9d6e178ec546927ef6870898b3d4c38a370f017afed5634dbe732f0986c27.jpg)
186
+ Figure 6: Single-model single-scale speed (ms) vs. accuracy (AP) on COCO test-dev among state-of-the-art approaches. GFLV2 achieves better speed-accuracy trade-off than its competitive counterparts.
187
+
188
+ Table 5: Integrating GFLV2 into various popular dense object detectors. A consistent $\sim 2$ AP gain is observed without loss of inference speed.
189
+
190
+ <table><tr><td>Method</td><td>AP</td><td>FPS</td><td>PCC ↑</td></tr><tr><td>FCOS* [33]</td><td>39.1</td><td>19.4</td><td>0.624</td></tr><tr><td>ATSS* [40]</td><td>39.9</td><td>19.4</td><td>0.631</td></tr><tr><td>GFLV1 [18]</td><td>40.2</td><td>19.4</td><td>0.634</td></tr><tr><td>GFLV2 (ours)</td><td>41.1 (+0.9)</td><td>19.4</td><td>0.660 (+0.26)</td></tr></table>
191
+
192
+ Table 6: Pearson Correlation Coefficients (PCC) for representative dense object detectors. * denotes the application of Classification-IoU Joint Representation, instead of additional Centerness branch.
193
+
194
+ sults of single-model single-scale testing for all methods are reported, including their corresponding inference speeds (FPS). We also report additional multi-scale testing results for GFLV2. The visualization of the accuracy-speed trade-off is demonstrated in Fig. 6, and we observe that GFLV2 pushes the envelope of accuracy-speed boundary to a new level. Our best result with a single Res2Net-101-DCN model achieves considerably competitive 53.3 AP.
195
+
196
+ # 4.3. Analysis
197
+
198
+ Although the proposed DGQP module has been shown to improve the performance of dense object detectors, we would also like to understand how its mechanism operates.
199
+
200
+ DGQP Improves LQE: To assess whether DGQP is able to benefit the estimation of localization quality, we first obtain the predicted IoUs (given by four representative models with IoU as the quality estimation targets) and their corresponding real IoUs over all the positive samples on COCO minival. Then we calculate their Pearson Correlation Coefficient (PCC) in Table 6. It demonstrates that DGQP in GFLV2 indeed improves the linear correlation between the estimated IoUs and the ground-truth ones by a considerable margin (+0.26) against GFLV1, which eventually leads to an absolute 0.9 AP gain.
201
+
202
+ DGQP Eases the Learning Difficulty: Fig. 8 provides the visualization of the training losses on LQE scores, where
203
+
204
+ <table><tr><td>Method</td><td>Backbone</td><td>Epoch</td><td>\(MS_{train}\)</td><td>FPS</td><td>AP</td><td>\(AP_{50}\)</td><td>\(AP_{75}\)</td><td>\(AP_S\)</td><td>\(AP_M\)</td><td>\(AP_L\)</td><td>Reference</td></tr><tr><td colspan="12">multi-stage:</td></tr><tr><td>Faster R-CNN w/ FPN [20]</td><td>R-101</td><td>24</td><td></td><td>14.2</td><td>36.2</td><td>59.1</td><td>39.0</td><td>18.2</td><td>39.0</td><td>48.2</td><td>CVPR17</td></tr><tr><td>Cascade R-CNN [1]</td><td>R-101</td><td>18</td><td></td><td>11.9</td><td>42.8</td><td>62.1</td><td>46.3</td><td>23.7</td><td>45.5</td><td>55.2</td><td>CVPR18</td></tr><tr><td>Grid R-CNN [24]</td><td>R-101</td><td>20</td><td></td><td>11.4</td><td>41.5</td><td>60.9</td><td>44.5</td><td>23.3</td><td>44.9</td><td>53.1</td><td>CVPR19</td></tr><tr><td>Libra R-CNN [26]</td><td>X-101-64x4d</td><td>12</td><td></td><td>8.5</td><td>43.0</td><td>64.0</td><td>47.0</td><td>25.3</td><td>45.6</td><td>54.6</td><td>CVPR19</td></tr><tr><td>RepPoints [38]</td><td>R-101</td><td>24</td><td></td><td>13.3</td><td>41.0</td><td>62.9</td><td>44.3</td><td>23.6</td><td>44.1</td><td>51.7</td><td>ICCV19</td></tr><tr><td>RepPoints [38]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>11.8</td><td>45.0</td><td>66.1</td><td>49.0</td><td>26.6</td><td>48.6</td><td>57.5</td><td>ICCV19</td></tr><tr><td>RepPointsV2 [4]</td><td>R-101</td><td>24</td><td>✓</td><td>11.1</td><td>46.0</td><td>65.3</td><td>49.5</td><td>27.4</td><td>48.9</td><td>57.3</td><td>NeurIPS20</td></tr><tr><td>RepPointsV2 [4]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>10.0</td><td>48.1</td><td>67.5</td><td>51.8</td><td>28.7</td><td>50.9</td><td>60.8</td><td>NeurIPS20</td></tr><tr><td>TridentNet [19]</td><td>R-101</td><td>24</td><td>✓</td><td>2.7*</td><td>42.7</td><td>63.6</td><td>46.5</td><td>23.9</td><td>46.6</td><td>56.6</td><td>ICCV19</td></tr><tr><td>TridentNet [19]</td><td>R-101-DCN</td><td>36</td><td>✓</td><td>1.3*</td><td>46.8</td><td>67.6</td><td>51.5</td><td>28.0</td><td>51.2</td><td>60.5</td><td>ICCV19</td></tr><tr><td>TSD [32]</td><td>R-101</td><td>20</td><td></td><td>1.1</td><td>43.2</td><td>64.0</td><td>46.9</td><td>24.0</td><td>46.3</td><td>55.8</td><td>CVPR20</td></tr><tr><td>BorderDet [27]</td><td>R-101</td><td>24</td><td>✓</td><td>13.2*</td><td>45.4</td><td>64.1</td><td>48.8</td><td>26.7</td><td>48.3</td><td>56.5</td><td>ECCV20</td></tr><tr><td>BorderDet [27]</td><td>X-101-64x4d</td><td>24</td><td>✓</td><td>8.1*</td><td>47.2</td><td>66.1</td><td>51.0</td><td>28.1</td><td>50.2</td><td>59.9</td><td>ECCV20</td></tr><tr><td>BorderDet [27]</td><td>X-101-64x4d-DCN</td><td>24</td><td>✓</td><td>6.4*</td><td>48.0</td><td>67.1</td><td>52.1</td><td>29.4</td><td>50.7</td><td>60.5</td><td>ECCV20</td></tr><tr><td colspan="12">one-stage:</td></tr><tr><td>CornerNet [17]</td><td>HG-104</td><td>200</td><td>✓</td><td>3.1*</td><td>40.6</td><td>56.4</td><td>43.2</td><td>19.1</td><td>42.8</td><td>54.3</td><td>ECCV18</td></tr><tr><td>CenterNet [7]</td><td>HG-104</td><td>190</td><td>✓</td><td>3.3*</td><td>44.9</td><td>62.4</td><td>48.1</td><td>25.6</td><td>47.4</td><td>57.4</td><td>ICCV19</td></tr><tr><td>CentripetalNet [6]</td><td>HG-104</td><td>210</td><td>✓</td><td>n/a</td><td>45.8</td><td>63.0</td><td>49.3</td><td>25.0</td><td>48.2</td><td>58.7</td><td>CVPR20</td></tr><tr><td>RetinaNet [21]</td><td>R-101</td><td>18</td><td></td><td>13.6</td><td>39.1</td><td>59.1</td><td>42.3</td><td>21.8</td><td>42.7</td><td>50.2</td><td>ICCV17</td></tr><tr><td>FreeAnchor [41]</td><td>R-101</td><td>24</td><td>✓</td><td>12.8</td><td>43.1</td><td>62.2</td><td>46.4</td><td>24.5</td><td>46.1</td><td>54.8</td><td>NeurIPS19</td></tr><tr><td>FreeAnchor [41]</td><td>X-101-32x8d</td><td>24</td><td>✓</td><td>8.2</td><td>44.9</td><td>64.3</td><td>48.5</td><td>26.8</td><td>48.3</td><td>55.9</td><td>NeurIPS19</td></tr><tr><td>FSAF [45]</td><td>R-101</td><td>18</td><td>✓</td><td>15.1</td><td>40.9</td><td>61.5</td><td>44.0</td><td>24.0</td><td>44.2</td><td>51.3</td><td>CVPR19</td></tr><tr><td>FSAF [45]</td><td>X-101-64x4d</td><td>18</td><td>✓</td><td>9.1</td><td>42.9</td><td>63.8</td><td>46.3</td><td>26.6</td><td>46.2</td><td>52.7</td><td>CVPR19</td></tr><tr><td>FCOS [33]</td><td>R-101</td><td>24</td><td>✓</td><td>14.7</td><td>41.5</td><td>60.7</td><td>45.0</td><td>24.4</td><td>44.8</td><td>51.6</td><td>ICCV19</td></tr><tr><td>FCOS [33]</td><td>X-101-64x4d</td><td>24</td><td>✓</td><td>8.9</td><td>44.7</td><td>64.1</td><td>48.4</td><td>27.6</td><td>47.5</td><td>55.6</td><td>ICCV19</td></tr><tr><td>SAPD [44]</td><td>R-101</td><td>24</td><td>✓</td><td>13.2</td><td>43.5</td><td>63.6</td><td>46.5</td><td>24.9</td><td>46.8</td><td>54.6</td><td>CVPR20</td></tr><tr><td>SAPD [44]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>11.1</td><td>46.0</td><td>65.9</td><td>49.6</td><td>26.3</td><td>49.2</td><td>59.6</td><td>CVPR20</td></tr><tr><td>SAPD [44]</td><td>X-101-32x4d-DCN</td><td>24</td><td>✓</td><td>8.8</td><td>46.6</td><td>66.6</td><td>50.0</td><td>27.3</td><td>49.7</td><td>60.7</td><td>CVPR20</td></tr><tr><td>ATSS [40]</td><td>R-101</td><td>24</td><td>✓</td><td>14.6</td><td>43.6</td><td>62.1</td><td>47.4</td><td>26.1</td><td>47.0</td><td>53.6</td><td>CVPR20</td></tr><tr><td>ATSS [40]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>12.7</td><td>46.3</td><td>64.7</td><td>50.4</td><td>27.7</td><td>49.8</td><td>58.4</td><td>CVPR20</td></tr><tr><td>ATSS [40]</td><td>X-101-32x8d-DCN</td><td>24</td><td>✓</td><td>6.9</td><td>47.7</td><td>66.6</td><td>52.1</td><td>29.3</td><td>50.8</td><td>59.7</td><td>CVPR20</td></tr><tr><td>PAA [14]</td><td>R-101</td><td>24</td><td>✓</td><td>14.6</td><td>44.8</td><td>63.3</td><td>48.7</td><td>26.5</td><td>48.8</td><td>56.3</td><td>ECCV20</td></tr><tr><td>PAA [14]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>12.7</td><td>47.4</td><td>65.7</td><td>51.6</td><td>27.9</td><td>51.3</td><td>60.6</td><td>ECCV20</td></tr><tr><td>PAA [14]</td><td>X-101-64x4d-DCN</td><td>24</td><td>✓</td><td>6.9</td><td>49.0</td><td>67.8</td><td>53.3</td><td>30.2</td><td>52.8</td><td>62.2</td><td>ECCV20</td></tr><tr><td>GFLV1 [18]</td><td>R-50</td><td>24</td><td>✓</td><td>19.4</td><td>43.1</td><td>62.0</td><td>46.8</td><td>26.0</td><td>46.7</td><td>52.3</td><td>NeurIPS20</td></tr><tr><td>GFLV1 [18]</td><td>R-101</td><td>24</td><td>✓</td><td>14.6</td><td>45.0</td><td>63.7</td><td>48.9</td><td>27.2</td><td>48.8</td><td>54.5</td><td>NeurIPS20</td></tr><tr><td>GFLV1 [18]</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>12.7</td><td>47.3</td><td>66.3</td><td>51.4</td><td>28.0</td><td>51.1</td><td>59.2</td><td>NeurIPS20</td></tr><tr><td>GFLV1 [18]</td><td>X-101-32x4d-DCN</td><td>24</td><td>✓</td><td>10.7</td><td>48.2</td><td>67.4</td><td>52.6</td><td>29.2</td><td>51.7</td><td>60.2</td><td>NeurIPS20</td></tr><tr><td>GFLV2 (ours)</td><td>R-50</td><td>24</td><td>✓</td><td>19.4</td><td>44.3</td><td>62.3</td><td>48.5</td><td>26.8</td><td>47.7</td><td>54.1</td><td>-</td></tr><tr><td>GFLV2 (ours)</td><td>R-101</td><td>24</td><td>✓</td><td>14.6</td><td>46.2</td><td>64.3</td><td>50.5</td><td>27.8</td><td>49.9</td><td>57.0</td><td>-</td></tr><tr><td>GFLV2 (ours)</td><td>R-101-DCN</td><td>24</td><td>✓</td><td>12.7</td><td>48.3</td><td>66.5</td><td>52.8</td><td>28.8</td><td>51.9</td><td>60.7</td><td>-</td></tr><tr><td>GFLV2 (ours)</td><td>X-101-32x4d-DCN</td><td>24</td><td>✓</td><td>10.7</td><td>49.0</td><td>67.6</td><td>53.5</td><td>29.7</td><td>52.4</td><td>61.4</td><td>-</td></tr><tr><td>GFLV2 (ours)</td><td>R2-101-DCN</td><td>24</td><td>✓</td><td>10.9</td><td>50.6</td><td>69.0</td><td>55.3</td><td>31.3</td><td>54.3</td><td>63.5</td><td>-</td></tr><tr><td>GFLV2 (ours) + \(MS_{test}\)</td><td>R2-101-DCN</td><td>24</td><td>✓</td><td>-</td><td>53.3</td><td>70.9</td><td>59.2</td><td>35.7</td><td>56.1</td><td>65.6</td><td>-</td></tr></table>
205
+
206
+ Table 7: Comparisons between state-of-the-art detectors (single-model and single-scale results except the last row) on COCO test-dev. "MStrain" and "MStest" denote multi-scale training and testing, respectively. FPS values with * are from [44] or their official repositories [27], while others are measured on the same machine with a single GeForce RTX 2080Ti GPU under the same mmdetection [3] framework, using a batch size of 1 whenever possible. "n/a" means that both trained models and timing results from original papers are not available. R: ResNet [11]. X: ResNeXt [37]. HG: Hourglass [25]. DCN: Deformable Convolutional Network [46]. R2: Res2Net [8].
207
+
208
+ ![](images/1a803d1c6c919783e6bda0e993223555f5f3176e7b968b926773745e818a4dd5.jpg)
209
+ Figure 7: Visualization of predicted bounding boxes before and after NMS, along with their corresponding predicted LQE scores (only Top-4 scores are plotted for a better view). For many existing approaches [33, 40, 18], they fail to produce the highest LQE scores for the best candidates. In contrast, our GFLV2 reliably assigns larger quality scores for those real high-quality ones, thus reducing the risk of mistaken suppression in NMS processing. White: ground-truth bounding boxes; Other colors: predicted bounding boxes.
210
+
211
+ ![](images/dceef20d5dc03555890f5ab9211bb6580f613f00ed1f80b045e4162e04cd9667.jpg)
212
+ Figure 8: Comparisons of losses on LQE between GFLV1 and GFLV2. DGQP helps to ease the learning difficulty with lower losses during training.
213
+
214
+ DGQP in GFLV2 successfully accelerates the training process and converges to lower losses.
215
+
216
+ Training/Inference Efficiency: We also compare the training and inference efficiency among recent state-of-the-art dense detectors in Table 8. Note that PAA [14], RepPointsV2 [4] and BorderDet [27] bring an inevitable time overhead (52%, 65%, and 22% respectively) during training, and the latter two also sacrifice inference speed by 30% and 14%, respectively. In contrast, our proposed GFLV2 can achieve top performance (~41 AP) while still maintaining the training and inference efficiency.
217
+
218
+ Qualitative Results: In Fig. 7, we qualitatively demonstrate the mechanism how GFLV2 makes use of its more reliable IoU quality estimations to maintain accurate predictions during NMS. Unfortunately for other detectors, high-quality candidates are wrongly suppressed due to their relatively lower localization confidences, which eventually leads to a performance degradation.
219
+
220
+ <table><tr><td>Method</td><td>AP</td><td>Training Hours ↓</td><td>Inference FPS ↑</td></tr><tr><td>ATSS* [40]</td><td>39.9</td><td>8.2</td><td>19.4</td></tr><tr><td>GFLV1 [18]</td><td>40.2</td><td>8.2</td><td>19.4</td></tr><tr><td>PAA [14]</td><td>40.4</td><td>12.5 (+52%)</td><td>19.4</td></tr><tr><td>RepPointsV2 [4]</td><td>41.0</td><td>14.4 (+65%)</td><td>13.5 (-30%)</td></tr><tr><td>BorderDet [27]</td><td>41.4</td><td>10.0 (+22%)</td><td>16.7 (-14%)</td></tr><tr><td>GFLV2 (ours)</td><td>41.1</td><td>8.2</td><td>19.4</td></tr></table>
221
+
222
+ Table 8: Comparisons of training and inference efficiency based on ResNet-50 backbone. "Training Hours" is evaluated on 8 GeForce RTX 2080Ti GPUs under standard 1x schedule (12 epochs). * denotes the application of Classification-IoU Joint Representation.
223
+
224
+ # 5. Conclusion
225
+
226
+ In this paper, we propose to learn reliable localization quality estimation, through the guidance of statistics of bounding box distributions. It is an entirely new and completely different perspective in the literature, which is also conceptually effective as the information of distribution is highly correlated to the real localization quality. Based on it we develop a dense object detector, namely GFLV2. Extensive experiments and analyses on COCO dataset further validate its effectiveness, compatibility and efficiency. We hope GFLV2 can serve as simple yet effective baseline for the community.
227
+
228
+ # Acknowledgments
229
+
230
+ The authors would like to thank the editor and the anonymous reviewers for their critical and constructive comments and suggestions. This work was supported by Postdoctoral Innovative Talent Support Program of China under Grant BX20200168, 2020M681608, NSFC 62072242, 61836014, U19B2034 and U1713208, Program for Changjiang Scholars.
231
+
232
+ # References
233
+
234
+ [1] Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In CVPR, 2018.
235
+ [2] Jiale Cao, Yanwei Pang, Jungong Han, and Xuelong Li. Hierarchical shot detector. In ICCV, 2019.
236
+ [3] Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
237
+ [4] Yihong Chen, Zheng Zhang, Yue Cao, Liwei Wang, Stephen Lin, and Han Hu. Reppoints v2: Verification meets regression for object detection. arXiv preprint arXiv:2007.08508, 2020.
238
+ [5] Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. In ICCV, 2017.
239
+ [6] Zhiwei Dong, Guoxuan Li, Yue Liao, Fei Wang, Pengju Ren, and Chen Qian. Centripetalnet: Pursuing high-quality keypoint pairs for object detection. In CVPR, 2020.
240
+ [7] Kaiwen Duan, Song Bai, Lingxi Xie, Honggang Qi, Qingming Huang, and Qi Tian. Centernet: Keypoint triplets for object detection. In ICCV, 2019.
241
+ [8] Shanghua Gao, Ming-Ming Cheng, Kai Zhao, Xin-Yu Zhang, Ming-Hsuan Yang, and Philip HS Torr. Res2net: A new multi-scale backbone architecture. TPAMI, 2019.
242
+ [9] Ross Girshick. Fast r-cnn. In ICCV, 2015.
243
+ [10] Kaiming He, Georgia Gkioxari, Piotr Dólar, and Ross Girshick. Mask r-cnn. In ICCV, 2017.
244
+ [11] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
245
+ [12] Zhaojin Huang, Lichao Huang, Yongchao Gong, Chang Huang, and Xinggang Wang. Mask scoring r-cnn. In CVPR, 2019.
246
+ [13] Borui Jiang, Ruixuan Luo, Jiayuan Mao, Tete Xiao, and Yun-ting Jiang. Acquisition of localization confidence for accurate object detection. In ECCV, 2018.
247
+ [14] Kang Kim and Hee Seok Lee. Probabilistic anchor assignment with iou prediction for object detection. ECCV, 2020.
248
+ [15] Tao Kong, Fuchun Sun, Huaping Liu, Yuning Jiang, and Jianbo Shi. Foveabox: Beyond anchor-based object detector. arXiv preprint arXiv:1904.03797, 2019.
249
+ [16] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012.
250
+ [17] Hei Law and Jia Deng. Cornernet: Detecting objects as paired keypoints. In ECCV, 2018.
251
+ [18] Xiang Li, Wenhai Wang, Lijun Wu, Shuo Chen, Xiaolin Hu, Jun Li, Jinhui Tang, and Jian Yang. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. In NeurlPS, 2020.
252
+ [19] Yanghao Li, Yuntao Chen, Naiyan Wang, and Zhaoxiang Zhang. Scale-aware trident networks for object detection. In ICCV, 2019.
253
+ [20] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In CVPR, 2017.
254
+
255
+ [21] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dólár. Focal loss for dense object detection. In ICCV, 2017.
256
+ [22] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dólar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
257
+ [23] Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In ECCV, 2016.
258
+ [24] Xin Lu, Buyu Li, Yuxin Yue, Quanquan Li, and Junjie Yan. Grid r-cnn. In CVPR, 2019.
259
+ [25] Alejandro Newell, Kaiyu Yang, and Jia Deng. Stacked hourglass networks for human pose estimation. In ECCV, 2016.
260
+ [26] Jiangmiao Pang, Kai Chen, Jianping Shi, Huajun Feng, Wanli Ouyang, and Dahua Lin. Libra r-cnn: Towards balanced learning for object detection. In CVPR, 2019.
261
+ [27] Han Qiu, Yuchen Ma, Zeming Li, Songtao Liu, and Jian Sun. Borderdet: Border feature for dense object detection. ECCV, 2020.
262
+ [28] Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In CVPR, pages 779-788, 2016.
263
+ [29] Joseph Redmon and Ali Farhadi. Yolo9000: better, faster, stronger. In CVPR, 2017.
264
+ [30] Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. arXiv preprint arXiv:1804.02767, 2018.
265
+ [31] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, 2015.
266
+ [32] Guanglu Song, Yu Liu, and Xiaogang Wang. Revisiting the sibling head in object detector. In CVPR, 2020.
267
+ [33] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In ICCV, 2019.
268
+ [34] Lachlan Tychsen-Smith and Lars Petersson. Improving object localization with fitness nms and bounded iou loss. In CVPR, 2018.
269
+ [35] Jiaqi Wang, Wenwei Zhang, Yuhang Cao, Kai Chen, Jiangmiao Pang, Tao Gong, Jianping Shi, Chen Change Loy, and Dahua Lin. Side-aware boundary localization for more precise object detection. ECCV, 2020.
270
+ [36] Shengkai Wu, Xiaoping Li, and Xinggang Wang. Iou-aware single-stage object detector for accurate localization. Image and Vision Computing, 2020.
271
+ [37] Saining Xie, Ross Girshick, Piotr Dolkar, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In CVPR, 2017.
272
+ [38] Ze Yang, Shaohui Liu, Han Hu, Liwei Wang, and Stephen Lin. Repoints: Point set representation for object detection. In ICCV, 2019.
273
+ [39] Haoyang Zhang, Ying Wang, Feras Dayoub, and Niko Sünderhauf. Varifocalnet: An iou-aware dense object detector. arXiv preprint arXiv:2008.13367, 2020.
274
+ [40] Shifeng Zhang, Cheng Chi, Yongqiang Yao, Zhen Lei, and Stan Z Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In CVPR, 2020.
275
+
276
+ [41] Xiaosong Zhang, Fang Wan, Chang Liu, Rongrong Ji, and Qixiang Ye. Freeanchor: Learning to match anchors for visual object detection. In NeurIPS, 2019.
277
+ [42] Xingyi Zhou, Dequan Wang, and Philipp Krahenbuhl. Objects as points. arXiv preprint arXiv:1904.07850, 2019.
278
+ [43] Benjin Zhu, Jianfeng Wang, Zhengkai Jiang, Fuhang Zong, Songtao Liu, Zeming Li, and Jian Sun. Autoassign: Differentiable label assignment for dense object detection. arXiv preprint arXiv:2007.03496, 2020.
279
+ [44] Chenchen Zhu, Fangyi Chen, Zhiqiang Shen, and Marios Savvides. Soft anchor-point object detection. In CVPR, 2020.
280
+ [45] Chenchen Zhu, Yihui He, and Marios Savvides. Feature selective anchor-free module for single-shot object detection. In CVPR, 2019.
281
+ [46] Xizhou Zhu, Han Hu, Stephen Lin, and Jifeng Dai. Deformable convnets v2: More deformable, better results. In CVPR, 2019.
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ce5257d92ca5f27dc0f1b2d148d20e5146f9d6e3ad9aecc3fe12783d4b9c96d2
3
+ size 963769
generalizedfocallossv2learningreliablelocalizationqualityestimationfordenseobjectdetection/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9389b164fa6dd23fe303a667bc5403a5d1dc81bba5cdc6e67110a2b674aa54e
3
+ size 368979
generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05a387b817f9f4f9c2495be4ff6c0175b0e0907529b2fc2a6802b74229abbdc2
3
+ size 80282
generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a10e4e88bebd3d4b95f36936953a1a81195db0b31fc60071298bfb35fd6547a8
3
+ size 99512
generalizingfaceforgerydetectionwithhighfrequencyfeatures/dea5c24d-3079-465b-aa6a-fc0736818581_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6fe8196a938343bae053801201608dc0b83aabf26ad72c8511968679d660389
3
+ size 2097791
generalizingfaceforgerydetectionwithhighfrequencyfeatures/full.md ADDED
@@ -0,0 +1,352 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generalizing Face Forgery Detection with High-frequency Features
2
+
3
+ Yuchen Luo\*1,2
4
+
5
+ Yong Zhang*3
6
+
7
+ Junchi Yan $^{\ddagger,2}$
8
+
9
+ Wei Liu†4
10
+
11
+ $^{1}$ Department of Computer Science and Engineering, Shanghai Jiao Tong University $^{2}$ MoE Key Lab of Artificial Intelligence, AI Institute, Shanghai Jiao Tong University $^{3}$ Tencent AI Lab $^{4}$ Tencent Data Platform
12
+
13
+ {592mcavoy,yanjunchi}@sjtu.edu.cn
14
+
15
+ zhangyong201303@gmail.com
16
+
17
+ w12223@columbia.edu
18
+
19
+ # Abstract
20
+
21
+ Current face forgery detection methods achieve high accuracy under the within-database scenario where training and testing forgeries are synthesized by the same algorithm. However, few of them gain satisfying performance under the cross-database scenario where training and testing forgeries are synthesized by different algorithms. In this paper, we find that current CNN-based detectors tend to overfit to method-specific color textures and thus fail to generalize. Observing that image noises remove color textures and expose discrepancies between authentic and tampered regions, we propose to utilize the high-frequency noises for face forgery detection. We carefully devise three functional modules to take full advantage of the high-frequency features. The first is the multi-scale high-frequency feature extraction module that extracts high-frequency noises at multiple scales and composes a novel modality. The second is the residual-guided spatial attention module that guides the low-level RGB feature extractor to concentrate more on forgery traces from a new perspective. The last is the cross-modality attention module that leverages the correlation between the two complementary modalities to promote feature learning for each other. Comprehensive evaluations on several benchmark databases corroborate the superior generalization performance of our proposed method.
22
+
23
+ # 1. Introduction
24
+
25
+ As face manipulation techniques [4, 24, 59] spring up along with the breakthrough of deep generators [27, 20], face forgery detection becomes an arousing research topic. Most existing methods focus on within-database detection [7, 29, 9], where forged images in the training set and testing set are manipulated by the same algorithm. However, the biggest challenge hampering face forgery detec
26
+
27
+ ![](images/fc3dfdd2cbcb964f61ebf4a2de53f3ed5a4eb4eec102cc78202570fa8adde3dc.jpg)
28
+ Figure 1: Training and testing forgeries of within-database detection are synthesized by the same algorithm while those of cross-database detection are synthesized by different algorithms. We focus on the latter which is more challenging.
29
+
30
+ tion is the generalization problem. Due to the diversified data distributions generated by different manipulation techniques, methods with high within-database detection accuracy always experience a severe performance drop in the cross-database scenario, thus limiting broader applications.
31
+
32
+ Recently, several works are devoted to addressing the generalizing problem. [30, 28] assume that some artifacts are shared in forged faces and customize databases specialized on those artifacts. However, these assumptions do not always hold. Besides, transfer learning [13], domain adaptation [54], and multi-task learning [14, 35, 45] are utilized to improve model's performance in unseen domains. Nevertheless, the acquisition of target samples and annotations is expensive. Meanwhile, some attempt to obtain information from frequency domains, such as Fourier transformation [11], DCT [38], and steganalysis features [52, 57]. But they rarely consider the relation and interaction between the additional information and regular color textures.
33
+
34
+ In this paper, we aim at learning a more generalizable face forgery detector (See Fig. 1). To facilitate understanding why current CNN-based works fail on unseen forgeries, we analyze CNN-based classifiers' behaviors and find that
35
+
36
+ the model is biased to method-specific color textures. Observing that high-frequency noises can suppress image textures and expose statistical discrepancies between tampered and authentic regions, we propose to utilize noises to tackle the overfitting problem.
37
+
38
+ We propose a generalizable model for face forgery detection. To take full advantage of image noises, we carefully devise three novel modules. The first is the multiscale high-frequency feature extraction module. We adopt the widely used high-pass filters from SRM [18] to extract high-frequency noises from images. Unlike [11, 52, 57] that only consider extracting noises from an input image, we further apply these filters to low-level features at multiple scales to compose more abundant and informative features. Employing both the high-frequency noises and the low-frequency textures, we build a two-stream network to process the two modalities, respectively. Secondly, we apply the residual guided spatial attention in the entry part to guide the RGB modality from the residual perspective to attach more importance to forgery traces. Thirdly, we design a dual cross-modality attention module to formulate the interaction between the two modalities instead of keeping them independent [11, 52]. In this way, the two modalities provide complementary information based on their correlation and mutually promote representation learning.
39
+
40
+ Our contributions are summarized as follows:
41
+
42
+ - We perform an analysis on CNN-based detectors and find that they are biased to method-specific textures, leading to the generalization problem. Given that the image's high-frequency noises can remove color textures and reveal forgery traces, we propose to utilize image noises to boost the generalization ability.
43
+ - We devise a generalizable model by exploiting high-frequency features and modeling the correlation and interaction between the high-frequency modality and the regular one. We design three functional modules for learning an adequate representation, i.e., the multiscale high-frequency feature extraction module, the residual guided spatial attention module, and the dual cross-modality attention module.
44
+ - We conduct comprehensive evaluations on several benchmarks and demonstrate the superior generalization ability of the proposed model.
45
+
46
+ # 2. Related Work
47
+
48
+ Conventional image forgery detection. Though image tampering detection has been investigated for a long time, those conventional detectors [16, 39] cannot handle the detection of face forgery well. Firstly, those methods detect image editing operations like copy-move or copy-paste [8], which produce different artifacts from those in GAN-based
49
+
50
+ face forgeries. Besides, face forgeries have a much smaller size and inferior quality than natural images. Furthermore, recent advanced forgery techniques leave almost no visible artifact in the tampered face, which easily deceive conventional detectors and require specialized treatments.
51
+
52
+ Specific artifacts or novel architectures. Current attempts mainly focus on improving within-database performance. [29, 34, 55, 9, 7, 32] targeted at specific artifacts such as abnormal eye-blinking frequency [29] or head-pose inconsistency [55]. However, those artifacts may not exist in improved forgeries. For network design, Afchar et al. [6] provided two compact network architectures to capture the mesoscopic features. Nguyen et al. [36] introduced the capsule network. These methods emphasize the power of representation and computational efficiency but did not explicitly consider the generalization ability.
53
+
54
+ Auxiliary tasks or synthetic data. Some works notice the generalization problem and attempt to utilize additional tasks [14, 35, 45, 44] or generate samples capturing the typical defects [30, 28, 54]. Stehouwer et al. [45] proposed to jointly predict the binary label and the attention map of the manipulated region. Yang et al. [54] generated samples with similar distributions to those in the target domain. These methods require additional annotations or extra data samples. Li et al. [30] observed that forged images contain some common warping and blurring effects. Li et al. [28] focused on the fusion operation in forgery creation. Both of them customized a database to learn such artifacts, but there remain non-negligible gaps between the hand-crafted forgeries and those from sophisticated algorithms.
55
+
56
+ High-frequency features. Several methods tried to exploit information from other domains. Durall et al. [15] found that the spectrum of real and fake images distributes differently in the high-frequency part. Chen et al. [11] proposed a multi-stream design and leveraged the DFT features. Wu et al. [52] proposed a two-stream network to extract spatial features and steganalysis features, respectively. Qian et al. [38] applied DCT on images and collected the frequency-aware clues to mine subtle forgery artifacts and compression errors. These methods exploited frequency information but did not explicitly consider the relationship between different domains.
57
+
58
+ # 3. Analysis of Generalizable Forgery Detector
59
+
60
+ # 3.1. Why current methods fail to generalize?
61
+
62
+ CNN and texture bias. Although many previous methods perform flawlessly on the testing set, they always suffer from a significant performance drop on images manipulated by unseen algorithms (See Tab. 1). Why do they fail to generalize? The reason is that those deep CNN models learn to capture the method-specific texture patterns for forgery
63
+
64
+ ![](images/2cc0087abdcef8f2797834e5712acf7be63469478529cbc5b27e666783ebe22a.jpg)
65
+ Figure 2: Grad-CAM maps from the Xception model trained on F2F forgeries. Numbers in the bracket denote the probability of being classified as fake. The mouth region is especially highlighted in F2F images, indicating that the model learns F2F's specific texture. But when evaluated on unseen forgeries (i.e., NT, DF, and FS), the model's responses resemble those in the real face more, showing that it fails to recognize identical artifacts and mistakes these forgeries as real.
66
+
67
+ Table 1: Xception [12] detector experiences a significant performance drop when evaluated on unseen forgeries.
68
+
69
+ <table><tr><td rowspan="2">Training Set</td><td colspan="4">Testing Set (AUC)</td></tr><tr><td>DF</td><td>F2F</td><td>FS</td><td>NT</td></tr><tr><td>DF</td><td>0.993</td><td>0.736</td><td>0.485</td><td>0.736</td></tr><tr><td>F2F</td><td>0.803</td><td>0.994</td><td>0.762</td><td>0.696</td></tr><tr><td>FS</td><td>0.664</td><td>0.888</td><td>0.994</td><td>0.713</td></tr><tr><td>NT</td><td>0.800</td><td>0.813</td><td>0.731</td><td>0.991</td></tr></table>
70
+
71
+ detection [32]. Geirhos et al. [19] studied the texture response of CNNs and showed that CNN models are strongly biased to textures. Different forgery algorithms always have unique network architectures and processing streams, so images manipulated by different algorithms will have different fake textures. Therefore, it is hard for a CNN model that has already been biased to one kind of fake textures to generalize to another.
72
+
73
+ Grad-CAM study and results. To verify that the CNN classifier is biased to specific fake textures, we exploit the gradient-based visualization tool [42] to generate class activation maps, namely Grad-CAM maps, which reveal the regions that CNNs rely on for classification. We train Xception [12] on images forged by the Face2Face method and then evaluate it on forgeries of four different algorithms.
74
+
75
+ As presented in Fig. 2, in the within-database evaluation, the model correctly finds out forgeries with high confidence. It especially concentrates on regions around the mouth (warmer color region), just as it does on the training images. Nevertheless, when encountering unseen forgeries, the model mistakes the other three kinds of fakes as real though they contain many visible artifacts. Besides, the high response regions deviate significantly from those in the training set and resemble those in the real face. The reason is that the model has overfitted to F2F's unique fake textures. Thus, when it cannot recognize the identical fake texture patterns, it always gives wrong predictions.
76
+
77
+ ![](images/27defb6a0a4044a187c0fab5c6e2149a13377be86e5aa1133a8adc966ec6d155.jpg)
78
+ Figure 3: The overview of the typical manipulation pipeline. The two stages bring the method-specific texture artifacts and characteristics discrepancy, respectively.
79
+
80
+ The above observation motivates us to investigate more general clues other than the texture patterns.
81
+
82
+ # 3.2. What is common in forged face images?
83
+
84
+ Manipulation pipeline. To find the commonality among different manipulation methods, let us review the typical face manipulation pipeline firstly. As presented in Fig. 3, the manipulation procedure can be roughly divided into two processing stages, i.e., fake face creation and face blending. In the first stage, fake faces are generated by sophisticated deep networks [46, 3] or rendered based on model templates [47, 5]. Different manipulation methods always adopt different algorithms and thus produce varied texture patterns. In the second stage, the generated face is further refined and warped back to the original image. This stage usually consists of some post-processing operations such as color correction and image blending.
85
+
86
+ Discrepancy brought by forged part. Though the face region in the output image is manipulated, the background remains the same as in the source image (See Fig. 3). Assuming that different images have unique characteristics, the blending stage violates the original data distributions, and we can utilize the characteristics discrepancy to gener
87
+
88
+ ![](images/c81d12de27fbc080f3341826adc50bdb0fd960182bea1d5f524db8d98f1e34fb.jpg)
89
+ Figure 4: Noises extracted by SRM from (a) authentic face and face manipulated by (b) Deepfakes and (c) Face2Face. Red boxes mark blending traces that are hard to recognize in the RGB space but distinctive in the noise space. Blue boxes mark noise statistics in the central face region. Noises in the face region distribute continuously in authentic images but are visibly smoother or sharper in tampered images.
90
+
91
+ alize forgery detection. We share a similar intuition to [28], which focuses on the blending operation and detects the blending boundary. But instead of identifying the boundary pattern which may change with various post-processing operations, we expect a more robust way to discover the inconsistency between authentic and tampered regions.
92
+
93
+ # 3.3. Use SRM to extract high-frequency noise features and boost the generalization ability
94
+
95
+ Based on the above analysis, we assume that a generalizable forgery detector should (i) pay attention not only to texture-related features but also to texture-irrelevant ones, and (ii) be capable of discovering the discrepancy between the tampered face and pristine background. Observing that the image's high-frequency noises remove the color content while portrait the intrinsic characteristics, we attempt to utilize image noises for face forgery detection.
96
+
97
+ Image Noise Analysis. Noises are some high-frequency signals capturing random variations of brightness or color information. The distributions of image noises are influenced by the image sensor or circuitry of a digital camera. Hence images processed by different equipment or coming from different sources have different noise patterns. Noises can be viewed as an intrinsic specificity of an image and can be found in various forms in all digital imagery domains [25]. Given that manipulation operations ruin the consistency of characteristics in the original image, there often leave distinctive traces in the noise space [17, 33].
98
+
99
+ SRM for noise feature extraction. Inspired by recent progress on SRM [18] noise features in general image manipulation detection [58, 53], we adopt SRM filters for noise
100
+
101
+ extraction. Fig. 4 shows some examples of SRM noises.
102
+
103
+ To validate noise features' effectiveness, we compare the detection performance on RGB color textures and SRM noises features, respectively. We train two Xception models, one with the regular RGB images and the other with the SRM noises. The two models are trained on images forged by the F2F method and evaluated on all four methods. As presented in the first two rows in Tab. 3, the model with SRM noise generalizes better than that with the regular color textures, especially on FS and NT methods.
104
+
105
+ # 4. The Proposed Method
106
+
107
+ The promising performance of SRM noises motivates us to explore the noise space further and boost generalization. In this section, we devise three modules to take full advantage of the high-frequency features, i.e., a multi-scale high-frequency feature extraction module, a dual cross-modality attention module, and a residual guided spatial attention module. The proposed model is illustrated in Fig. 5.
108
+
109
+ # 4.1. Multi-scale High-frequency Feature Extraction
110
+
111
+ Previous methods [57, 53, 11] extract noise residuals solely from the input image. Apart from a straight-forward conversion of the input image, we apply high-pass filters to multiple low-level feature maps to enrich the high-frequency features. As shown in Fig. 5, given an input RGB image $\mathbf{X}$ , we convert it to a residual image $\mathbf{X}_h$ in the high-frequency domain exploiting the SRM filters [18]. The entry flow takes both $\mathbf{X}$ and $\mathbf{X}_h$ as input and generates two types of raw features, i.e., the multi-scale high-frequency feature maps $\mathbf{F}_h$ and the low-frequency spatial feature maps $\mathbf{F}$ , which can be formulated as
112
+
113
+ $$
114
+ \mathbf {F}, \mathbf {F} _ {h} = f _ {\text {e n t r y}} (\mathbf {X}, \mathbf {X} _ {h}). \tag {1}
115
+ $$
116
+
117
+ The multi-scale high-frequency features are obtained as follows. Firstly, we apply regular convolutions on $\mathbf{X}$ and $\mathbf{X}_h$ to produce feature maps $\mathbf{F}^1$ and $\mathbf{F}_h^1$ . To extract more high-frequency information, we then apply SRM filters on $\mathbf{F}^1$ , following a $1\times 1$ convolution to align the channel dimensions and get the output $\tilde{\mathbf{F}}_h^1$ . As $\mathbf{F}_h^1$ and $\tilde{\mathbf{F}}_h^1$ are obtained from different sources and different operations, they contain different information. We down-sample $\mathbf{F}_1$ as well as the sum of $\mathbf{F}_h^1$ and $\tilde{\mathbf{F}}_h^1$ , and then get $\mathbf{F}^2$ and $\mathbf{F}_h^2$ in the two streams, respectively. Repeating the above operations, we finally acquire the multi-scale high-frequency feature maps $\mathbf{F}_h$ . Compared with $\mathbf{X}_h$ , $\mathbf{F}_h$ embodies more abundant high-frequency signals from both the image and low-level feature maps at multiple scales.
118
+
119
+ # 4.2. Residual Guided Spatial Attention
120
+
121
+ Inspired by CBAM [51], we adopt spatial attention to highlight the manipulation traces and guide the feature
122
+
123
+ ![](images/ea55882033d48c363697cf12996959a1e01ad6465ed388a263ebfbe3c85623fc.jpg)
124
+ Figure 5: The pipeline of the proposed model. We design a two-stream architecture to process the RGB image and the high-frequency noises. In the entry flow, we extract multi-scale high-frequency features and residual guided spatial features. In the middle flow, we model the interaction between feature maps of the two modalities via several DCMA modules. Features from the two streams are fused in an attention-based manner for the final classification.
125
+
126
+ ![](images/468645a6a1be408386ac7a04c7b16e9bc582497a7b17dffea3b9ff8157c1f9d1.jpg)
127
+ Figure 6: The residual guided spatial attention.
128
+
129
+ learning in the RGB modality. While CBAM derives the attention weights from the RGB image, we exploit the residuals generated by the SRM filters to predict the attention maps, which guide from a high-frequency perspective (See Fig. 6). Considering that the spatial correspondence between the noise residuals and low-level RGB features is still well maintained, we place several spatial attention modules in the entry part. The residual guided spatial attention block is defined as
130
+
131
+ $$
132
+ \mathbf {M} = f _ {\text {a t t}} \left(\mathbf {X} _ {h}\right), \tag {2}
133
+ $$
134
+
135
+ where $\mathbf{M}$ is the output attention map and $\mathbf{X}_h$ is the residual image. The raw feature maps $\mathbf{F}$ in Eq. (1) are computed by feeding the element-wise production $\mathbf{M} \odot \mathbf{F}^2$ into consequent convolutions and down-sampling operations.
136
+
137
+ See the attention visualizations in Fig. 8, high responses occur around abnormal facial boundaries in manipulated faces but distribute uniformly in real ones, which implies
138
+
139
+ ![](images/0c5c07f9c7229d1f7d2d3fa462b8ec55a6a90f5ab77079db375b91e31e81aac5.jpg)
140
+ Figure 7: The dual cross-modality attention.
141
+
142
+ that the residual guided spatial attention can help feature extractor focus on forgery traces.
143
+
144
+ # 4.3. Dual Cross-modality Attention
145
+
146
+ The attention mechanism has been broadly applied in natural language processing [48] and computer vision [22, 37, 23]. As for the cross-modality attention, Ye et al. [56] applied self-attention to concatenated features, while Hou et al. [21] derives correlation-based attention for paired class and query features. Inspired by these works, we devise a dual cross-modality attention module (DCMA) to capture long-range dependency and model the interaction between the low-frequency textures and the high-frequency noises.
147
+
148
+ Denoting input features derived from the RGB stream and the high-frequency stream as $\mathbf{T}$ and $\mathbf{T}_h$ , respectively,
149
+
150
+ the DCMA module leverages the computation block described in Fig. 7 to convert them to $\mathbf{T}'$ and $\mathbf{T}_h'$ :
151
+
152
+ $$
153
+ \mathbf {T} ^ {\prime}, \mathbf {T} _ {h} ^ {\prime} = f _ {\mathrm {D C M A}} (\mathbf {T}, \mathbf {T} _ {h}). \tag {3}
154
+ $$
155
+
156
+ Taking the conversion of $\mathbf{T}$ as an example, we first convert the input $\mathbf{T} \in \mathbb{R}^{C \times H \times W}$ into two components through different convolution blocks. One value component $\mathbf{V} \in \mathbb{R}^{C \times H \times W}$ represents the domain-specific information, the other key component $\mathbf{K} \in \mathbb{R}^{C / r \times \bar{H} \times W}$ measures the correlation between two different domains. $r$ is a scalar that reduces $\mathbf{K}$ 's channel dimension for computation efficiency. Input features $\mathbf{T}_h \in \mathbb{R}^{C \times H \times W}$ in the high-frequency domain are converted into two components, i.e., $\mathbf{V}_h$ and $\mathbf{K}_h$ , similarly. Note that the key component is obtained through a two-layer convolution block. We set the first layer independently while sharing the second layer to project feature maps from the two modalities onto the same space.
157
+
158
+ Then we measure the correlation $\mathbf{C} \in \mathcal{R}^{HW \times HW}$ between the two modalities through $\mathbf{C} = \mathrm{flt}(\mathbf{K})^T \otimes \mathrm{flt}(\mathbf{K}_h)$ , where $\mathrm{flt}(\cdot)$ denotes the flatten operation and $\otimes$ denotes matrix multiplication. For the RGB attention, we multiply the correlation $\mathbf{C}$ with weight matrix $\mathbf{W}$ and generate the attention map $\mathbf{A}$ through the softmax operation, which is formulated as $\mathbf{A} = \operatorname{softmax}(\mathbf{C} \otimes \mathbf{W})$ . Similarly, we obtain the high-frequency attention map $\mathbf{A}_h = \operatorname{softmax}(\mathbf{C}^T \otimes \mathbf{W}_h)$ . $\mathbf{A}$ and $\mathbf{A}_h$ re-weight features in one modality according to its correlation with the other.
159
+
160
+ Applying $\mathbf{A}$ to the corresponding value component $\mathbf{V}_h$ , we obtain the refined features $\mathbf{R}$ , where $\mathbf{R} = \mathrm{flt}(\mathbf{V}_h) \otimes \mathbf{A}$ . We then recover $\mathbf{R}$ to the input dimension, and output the features $\mathbf{T}'$ of the RGB stream by $\mathbf{T}' = \mathbf{T} + \mathbf{R}$ . The calculation for features $\mathbf{T}_h'$ in the high-frequency stream is the same. $\mathbf{T}'$ and $\mathbf{T}_h'$ embody complementary information and promote the feature learning for each other. As shown in the pipeline, the DCMA module can be applied $N$ times to model the correlations between the two modalities at different scales. We set $N = 2$ in our experiments.
161
+
162
+ Feature Fusion and Loss Function. High-level features of the two modalities are fused at the end of the exit flow (See Fig. 5). We apply channel-wise attention [22] on the concatenated features and then make the prediction. Inspired by progress in face recognition [50, 43], we adopt the AM-Softmax Loss [49] as the objective function since it leads to smaller intra-class variations and larger inter-class differences than the regular cross-entropy loss.
163
+
164
+ # 5. Experiments
165
+
166
+ # 5.1. Settings
167
+
168
+ Datasets. To evaluate the generalization ability, we perform experiments on five large scale benchmark databases, i.e., FaceForensics++ (FF++) [40], DeepfakeDetection
169
+
170
+ Table 2: Specifications of benchmark databases.
171
+
172
+ <table><tr><td>Database</td><td>Video Scale</td><td>Manipulation Algorithm</td></tr><tr><td>FF++ [40]</td><td>1000 real, 4000 fake</td><td>DF [3], FS [5], NT [46], F2F [47]</td></tr><tr><td>DFD [2]</td><td>363 real, 3068 fake</td><td>Improved DF</td></tr><tr><td>CelebDF [31]</td><td>408 real, 795 fake</td><td>Improved DF</td></tr><tr><td>DFDC [1]</td><td>1133 real, 4080 fake</td><td>Unpublished</td></tr><tr><td>DF1.0 [24]</td><td>11,000 fake</td><td>DF-VAE [24]</td></tr></table>
173
+
174
+ Table 3: Ablation study on $\mathrm{FF} + +$ . The metric is AUC. Results in gray indicate the within-dataset performance.
175
+
176
+ <table><tr><td>Method</td><td>DF</td><td>F2F</td><td>FS</td><td>NT</td></tr><tr><td>RGB</td><td>0.803</td><td>0.994</td><td>0.762</td><td>0.696</td></tr><tr><td>SRM</td><td>0.758</td><td>0.994</td><td>0.913</td><td>0.858</td></tr><tr><td>Two-stream Fusion (Fusion)</td><td>0.810</td><td>0.994</td><td>0.922</td><td>0.894</td></tr><tr><td>Fusion + RSA</td><td>0.819</td><td>0.995</td><td>0.966</td><td>0.927</td></tr><tr><td>Fusion + RSA + DCMA</td><td>0.801</td><td>0.995</td><td>0.975</td><td>0.957</td></tr><tr><td>Fusion + RSA + DCMA + Multi-scale</td><td>0.837</td><td>0.994</td><td>0.987</td><td>0.984</td></tr></table>
177
+
178
+ (DFD) [2], Deepfake Detection Challenge (DFDC) [1], CelebDF [31], and DeeperForensics-1.0 (DF1.0) [24]. Detailed specifications are presented in Tab. 2. For evaluation on $\mathrm{FF}++$ , we follow the official splits by using 740 videos for training, 140 videos for validation, and 140 videos for testing. There are three versions of $\mathrm{FF}++$ in terms of compression level, i.e., raw, lightly compressed (HQ), and heavily compressed (LQ). The heavier the compression level, the harder it to distinguish the forgery traces. Since realistic forgeries always have a limited quality, we use the HQ and LQ versions in experiments. We adopt the HQ version by default and specify the version otherwise.
179
+
180
+ Implementation. We modify Xception [12, 40] as the backbone network. We use DLIB [41] for face extraction and alignment and resize the aligned faces to $256 \times 256$ . Model parameters are initialized by Xception pre-trained on ImageNet. The batch size is set to 32. Adam [26] is used for optimization with a learning rate of 0.0002. Details of the two-stream network structure and training settings are presented in the supplementary material.
181
+
182
+ # 5.2. Ablation Study
183
+
184
+ To demonstrate the benefit of each module, we evaluate the proposed model and its variants on the $\mathrm{FF + + }$ database. All models are trained on F2F and examined on all four datasets. The results are presented in Tab. 3. RGB represents the Xception baseline with RGB images as input. SRM denotes the modified model with the input image replaced by SRM noise residuals. Two-stream Fusion represents the basic two-stream model, which consists of an RGB stream and a high-frequency noise stream and adopts the attention-based fusion mechanism. RSA, DCMA, and Multi-scale represent the residual guided spatial attention module, the dual cross-modality attention module, and the multi-scale high-frequency feature extraction module.
185
+
186
+ ![](images/18fd43a6e12c7241870ccb4bc0372038a05687a6e911bcaf99b723241a2d58f4.jpg)
187
+
188
+ ![](images/dca0b37f8da9196db499f8cbc656d29e618e66f86b53a34aba91449fd424fe3d.jpg)
189
+
190
+ ![](images/0c1ce00014c79d5203bd4d418d79ba98c87aa2bb85865eaf99dc76395e29af9f.jpg)
191
+
192
+ ![](images/980a29a2e29e612c404d943c7ea942f53a6296d67f70f10d7af82724e95cdfe3.jpg)
193
+ Figure 8: Examples of the residual guided attention. High responses occur around abnormal facial boundaries in manipulated faces while distribute uniformly in real ones.
194
+
195
+ ![](images/8dbf7e53861a830e421b5d0afe41a307fd64c2d27f83db1f823b1667edad9acb.jpg)
196
+
197
+ ![](images/92e2a33c1677879f7506f5070595a999238043e09e4c9c2a985ba7348513b5f1.jpg)
198
+
199
+ ![](images/d8bf4efd44dbff5578ed5b6eaf2e6e7d268499996b02a5b07a7efff264e63b76.jpg)
200
+
201
+ ![](images/53342d577a9c5da0d3c5476eab7d1a0df04d7eeb393be12bc1b4832f14cffde2.jpg)
202
+
203
+ ![](images/66f267469bf16e3b446aa09349f1eb15b0f101de6f60ff30e97045b41fb3db39.jpg)
204
+
205
+ ![](images/e13405cc1fb5b2fa9dc8fe64c5aeb21534e1ebf22ffb75c62c3978296497770c.jpg)
206
+
207
+ ![](images/c57169b9f4c78d0596105b5934f972836f395ce06d523fb2790631ca129b9ca7.jpg)
208
+
209
+ ![](images/c3f6359b6e015a59d413076bc303dd1a1fcb4ce3d760a4da296c4d7ab47e3817.jpg)
210
+
211
+ ![](images/3d9b2b827bf1b2eadb19b477bda8638f9df241bdd027c2f485d5678c9a82458e.jpg)
212
+ Attention
213
+
214
+ ![](images/7fc02f6ca04a1620caf9e9c08b538b57b4e0f23c208189f89b8f5dad86a035d0.jpg)
215
+
216
+ ![](images/3993cee9d5262c982645aa2ba1adaffaf3bc38800fb4b5d837936c7c257c8ddf.jpg)
217
+
218
+ ![](images/2784f517655903b0786a388d952f6826434569939b7f04a682693a1709d02e4f.jpg)
219
+
220
+ ![](images/0f070ff852c3a9c8dc4fab086ba750e62e26f16cf4e055294470638361ae3218.jpg)
221
+ Real
222
+
223
+ ![](images/2644af40f861c1dbb80d42c64f34190aae9e9f19c0483f2190a8c2699c3122d9.jpg)
224
+
225
+ ![](images/6c819a0bff36c0d3bde8e72f5bd7b14674f2ab4c5fac82c55f7cabda29450701.jpg)
226
+
227
+ ![](images/0067ccc6057ba083a0bfaaa9de04c20b46c926c6e5185b118b2e930e44b18f74.jpg)
228
+
229
+ ![](images/52211644cea74568e6bb17199859dfc97cbaa86c1f18c253bb4e347bdb492fae.jpg)
230
+ Attention
231
+
232
+ ![](images/dafada9f463509be2014f41d4f3a7bf4cf5ab3636fdedc7aefa6e15680917746.jpg)
233
+
234
+ ![](images/484925829408ece3a041ce218ddbb519e36891fd8b2b3c09b15cdbb13c026964.jpg)
235
+
236
+ ![](images/6d22e27437ed9ffc4e47760a38a44d77deb0ea2be4eaa17ba551e5d6401206c1.jpg)
237
+
238
+ Table 4: Cross-database evaluation on FF++ database (HQ).
239
+
240
+ <table><tr><td rowspan="2">Training Set</td><td rowspan="2">Model</td><td colspan="4">Testing Set (AUC)</td></tr><tr><td>DF</td><td>F2F</td><td>FS</td><td>NT</td></tr><tr><td rowspan="3">DF</td><td>Xception [40]</td><td>0.993</td><td>0.736</td><td>0.490</td><td>0.736</td></tr><tr><td>Face X-ray [28]</td><td>0.987</td><td>0.633</td><td>0.600</td><td>0.698</td></tr><tr><td>Ours</td><td>0.992</td><td>0.764</td><td>0.497</td><td>0.814</td></tr><tr><td rowspan="3">F2F</td><td>Xception [40]</td><td>0.803</td><td>0.994</td><td>0.762</td><td>0.696</td></tr><tr><td>Face X-ray [28]</td><td>0.630</td><td>0.984</td><td>0.938</td><td>0.945</td></tr><tr><td>Ours</td><td>0.837</td><td>0.994</td><td>0.987</td><td>0.984</td></tr><tr><td rowspan="3">FS</td><td>Xception [40]</td><td>0.664</td><td>0.888</td><td>0.994</td><td>0.713</td></tr><tr><td>Face X-ray [28]</td><td>0.458</td><td>0.961</td><td>0.981</td><td>0.957</td></tr><tr><td>Ours</td><td>0.685</td><td>0.993</td><td>0.995</td><td>0.980</td></tr><tr><td rowspan="3">NT</td><td>Xception [40]</td><td>0.799</td><td>0.813</td><td>0.731</td><td>0.991</td></tr><tr><td>Face X-ray [28]</td><td>0.705</td><td>0.917</td><td>0.910</td><td>0.925</td></tr><tr><td>Ours</td><td>0.894</td><td>0.995</td><td>0.993</td><td>0.994</td></tr></table>
241
+
242
+ Table 5: Cross-database evaluation from FF++ to others.
243
+
244
+ <table><tr><td rowspan="2">Training</td><td rowspan="2">Model</td><td colspan="4">Testing AUC</td></tr><tr><td>DFD</td><td>DFDC</td><td>CelebDF</td><td>DF1.0</td></tr><tr><td rowspan="3">FF++</td><td>Xception [40]</td><td>0.831</td><td>0.679</td><td>0.594</td><td>0.698</td></tr><tr><td>Face X-ray [28]</td><td>0.856</td><td>0.700</td><td>0.742</td><td>0.723</td></tr><tr><td>Ours</td><td>0.919</td><td>0.797</td><td>0.794</td><td>0.738</td></tr></table>
245
+
246
+ From this experiment we get the following observations. Firstly, compared with RGB, SRM achieves better performance on FS and NT. Furthermore, the basic two-stream model outperforms both RGB and SRM on all datasets, indicating the two modalities' complementary nature. As presented in the last three rows, the model's performance gradually improves with each module added step-by-step, demonstrating each module's effectiveness.
247
+
248
+ # 5.3. Generalization Ability Evaluation
249
+
250
+ To fully evaluate the proposed model's generalization ability, we conduct extensive cross-database evaluations in two different settings. The model is compared against two competing methods, Xception [40] and Face X-ray [28]. Face X-ray attempts to detect the fusion boundary brought by the blending operation. We implement it rigorously following the companion paper's instructions and train these models under the same setting.
251
+
252
+ Generalize from one method to another. We conduct this experiment on the FF++ (HQ) database [40] that contains forged images from four different manipulation techniques, i.e., DeepFakes (DF) [3], Face2Face (F2F) [47], FaceSwap (FS) [5], and NeuralTextures (NT) [46]. We use forged images of one method for training and those of all four methods for testing. As shown in Tab. 4, our model exceeds the competitors in most cases. Since Xception overly relies on the texture patterns, its performance drops drastically in unseen forgeries. Face X-ray achieves a relatively better generalization ability as it detects the blending evidence. Our model leverages both textures and noises and captures the blending effects in the noise space, therefore generalizing better from one method to another.
253
+
254
+ Generalize from $\mathbf{F}\mathbf{F} + +$ to other databases. In this experiment, we train models on $\mathrm{FF} + +$ (HQ) [40] and evaluate them in DFD [2], DFDC [1], CelebDF [31], and DF1.0 [24], respectively. This setting is more challenging than the first one since the testing sets share much less similarity with the training set. We can see from Tab. 5 that our method achieves apparent improvements over Xception and Face
255
+
256
+ X-ray on all the databases, especially on DFD, DFDC, and CelebDF. This is because Face X-ray learns to identify the boundary patterns that are sensitive to the post-process operations varying in different databases. On the contrary, our model learns more robust representations.
257
+
258
+ We present more statistics on the cross-database evaluation and the comparison result with Face X-ray on the blend face (BI) dataset in the supplementary material.
259
+
260
+ # 5.4. Comparison with recent works
261
+
262
+ Comparison with methods utilizing high-frequency features. We first compare with methods exploiting high-frequency features, i.e., SRMNet [58], Bayar Conv [10], SSTNet [52], and F3Net [38]. The former three methods target video forges and share the same backbone but different high-pass filters, i.e., SRM filters, Bayar Conv filters, and loosely-constrained residual filters. F3Net adopts Discrete Cosine Transform to estimate frequency statistics. We follow their setting and perform video-level detection on the highly compressed (LQ) FF++ database. Since our model is trained at the image level, we sample 1 frame every five frames to collect a total of 25 images for each video. Then we average the predictions over sampled images to classify each video. Results are presented in Tab. 6. Note that we compare against F3Net with the Xception backbone for a fair comparison. Our method achieves comparable robustness with F3Net and better performance than the others.
263
+
264
+ Comparison with methods using multi-task learning. We then compare our model against several methods that adopt multi-task learning for a better generalization ability, including LAE [14], ClassNSeg [35], and Forensic-Trans [13]. These three methods perform forgery localization and classification simultaneously. Note that Forensic-Trans adopts image residuals as input and needs to be finetuned on a few samples from the target domain. Following these methods, we train our model on F2F and test it on both F2F and FS. The results of the competing methods are the reported statistics in the corresponding papers. As illustrated in Tab. 7, our method surpasses the competitors in both within-database and cross-database evaluations.
265
+
266
+ Comparison with other state-of-the-art methods. We further compare our model with FWA [30] and FFD [45]. FWA focuses on post-processing artifacts such as blurring and warping effects, and it is trained on synthetic data which mimics those artifacts explicitly. FFD exploits annotated forgery masks to provide supervision on attention maps. Note that FFD is trained on the DFFD [45] database, which contains $\mathrm{FF} + +$ and forges from other manipulation algorithms. We adopt CelebDF as the testing set. As shown in Tab. 8, our method outperforms the competing methods by more than $15\%$ in AUC.
267
+
268
+ Table 6: Comparison on $\mathrm{FF}++$ with methods using high-frequency features. The metric is accuracy.
269
+
270
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Training/Testing Set (LQ)</td></tr><tr><td>DF</td><td>F2F</td><td>FS</td><td>Real</td></tr><tr><td>SRMNet [58]</td><td>0.919</td><td>0.927</td><td>0.891</td><td>0.693</td></tr><tr><td>Bayar Conv [10]</td><td>0.929</td><td>0.946</td><td>0.897</td><td>0.755</td></tr><tr><td>SSTNet [52]</td><td>0.934</td><td>0.919</td><td>0.919</td><td>0.793</td></tr><tr><td>F3Net [38]</td><td>0.980</td><td>0.953</td><td>0.965</td><td>-</td></tr><tr><td>Ours</td><td>0.986</td><td>0.957</td><td>0.929</td><td>0.971</td></tr></table>
271
+
272
+ Table 7: Comparison with recent works using multi-task learning. The metric is accuracy.
273
+
274
+ <table><tr><td rowspan="2">Training Set</td><td rowspan="2">Model</td><td colspan="2">Testing Set (Acc)</td></tr><tr><td>FS(HQ)</td><td>F2F(HQ)</td></tr><tr><td rowspan="4">F2F(HQ)</td><td>LAE [14]</td><td>0.632</td><td>0.909</td></tr><tr><td>ClassNSeg [35]</td><td>0.541</td><td>0.928</td></tr><tr><td>ForensicTrans [13]</td><td>0.726</td><td>0.945</td></tr><tr><td>Ours</td><td>0.867</td><td>0.992</td></tr></table>
275
+
276
+ Table 8: Comparison on CelebDF. The metric is AUC.
277
+
278
+ <table><tr><td>Model</td><td>Training Set</td><td>Testing AUC on CelebDF</td></tr><tr><td>FWA [30]</td><td>self-collected</td><td>0.538</td></tr><tr><td>FFD [45]</td><td>DFFD [45]</td><td>0.644</td></tr><tr><td>Ours</td><td>FF++(HQ)</td><td>0.794</td></tr></table>
279
+
280
+ # 6. Conclusion
281
+
282
+ In this paper, we conducted studies on the CNN-based forgery detector, finding that the CNN detector is easily overfitted to method-specific texture patterns. To learn more robust representations, we proposed to utilize the image's high-frequency noise features, which remove the color textures and reveal forgery traces. We leveraged both the color textures and the high-frequency noises and proposed a new face forgery detector. Three functional modules were carefully devised, i.e., a multi-scale high-frequency feature extraction module, a residual guided spatial attention module, and a dual cross-modality attention module. We employed the proposed modules to extract more informative features and capture the correlation and interaction between complementary modalities. The comprehensive experiments demonstrate the effectiveness of each module, and the comparisons with the competing methods further corroborate our model's superior generalization ability.
283
+
284
+ # Acknowledgement
285
+
286
+ This work was partly supported by the National Key Research and Development Program of China (2018AAA0100704), NSFC (61972250, U19B2035), CCF-Tencent Open Fund (RAGR20200113), and Shanghai Municipal Science and Technology Major Project (2021SHZDZX0102).
287
+
288
+ # References
289
+
290
+ [1] Deepfake detection challenge. https://www.kaggle.com/c/deepfake-detection-challenge. Accessed: 2020-05-10. 6, 7
291
+ [2] Deepfakedetection. https://ai.googleblog.com/2019/09/contributing-data-to-deepfake-detection.html. Accessed: 2020-05-10. 6,7
292
+ [3] Deepfakes. https://github.com/iperov/DeepFaceLab. Accessed: 2020-05-10. 3, 6, 7
293
+ [4] Faceapp. https://www_faceapp.com/. Accessed: 2020-05-10.1
294
+ [5] Faceswap. https://github.com/MarekKowalski/FaceSwap. Accessed: 2020-05-10.3,6,7
295
+ [6] Darius Afchar, Vincent Nozick, Junichi Yamagishi, and Isao Echizen. Mesonet: a compact facial video forgery detection network. In WIFS, 2018. 2
296
+ [7] Shruti Agarwal, Hany Farid, Yuming Gu, Mingming He, Koki Nagano, and Hao Li. Protecting world leaders against deep fakes. In CVPRW, 2019. 1, 2
297
+ [8] Irene Amerini, Lamberto Ballan, Roberto Caldelli, Alberto Del Bimbo, and Giuseppe Serra. A sift-based forensic method for copy-move attack detection and transformation recovery. TIFS, 2011. 2
298
+ [9] Irene Amerini, Leonardo Galteri, Roberto Caldelli, and Alberto Del Bimbo. Deepfake video detection through optical flow based cnn. In ICCVW, 2019. 1, 2
299
+ [10] Belhassen Bayar and Matthew C Stamm. A deep learning approach to universal image manipulation detection using a new convolutional layer. In Proceedings of the 4th ACM Workshop on Information Hiding and Multimedia Security, pages 5-10, 2016. 8
300
+ [11] Zehao Chen and Hua Yang. Manipulated face detector: Joint spatial and frequency domain attention network. arXiv preprint arXiv:2005.02958, 2020. 1, 2, 4
301
+ [12] F. Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017. 3, 6
302
+ [13] Davide Cozzolino, Justus Thies, Andreas Rössler, Christian Riess, Matthias Nießner, and Luisa Verdoliva. Forensictransfer: Weakly-supervised domain adaptation for forgery detection. arXiv preprint arXiv:1812.02510, 2018. 1, 8
303
+ [14] Mengnan Du, Shiva Pentyala, Yuening Li, and Xia Hu. Towards generalizable forgery detection with locality-aware autoencoder. arXiv preprint arXiv:1909.05999, 2019. 1, 2, 8
304
+ [15] Ricard Durall, Margret Keuper, Franz-Josef Pfreundt, and Janis Keuper. Unmasking deepfakes with simple features. arXiv preprint arXiv:1911.00686, 2019. 2
305
+ [16] Hany Farid. Image forgery detection. IEEE Signal processing magazine, 2009. 2
306
+ [17] J. Fridrich. Digital image forensics. IEEE Signal Processing Magazine, 26(2):26-37, 2009. 4
307
+ [18] Jessica Fridrich and Jan Kodovsky. Rich models for steganalysis of digital images. TIFS, 2012. 2, 4
308
+ [19] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel.
309
+
310
+ Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019. 3
311
+ [20] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014. 1
312
+ [21] Ruibing Hou, Hong Chang, MA Bingpeng, Shiguang Shan, and Xilin Chen. Cross attention network for few-shot classification. In NIPS, 2019. 5
313
+ [22] Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In CVPR, 2018. 5, 6
314
+ [23] Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. Ccnet: Criss-cross attention for semantic segmentation. In ICCV, October 2019. 5
315
+ [24] Liming Jiang, Ren Li, Wayne Wu, Chen Qian, and Chen Change Loy. Deeperforensics-1.0: A large-scale dataset for real-world face forgery detection. In CVPR, 2020. 1, 6, 7
316
+ [25] Thibaut Julliand, Vincent Nozick, and Hugues Talbot. Image noise and digital image forensics. volume 9569, pages 3-17, 03 2016. 4
317
+ [26] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. *ICLR*, 2015. 6
318
+ [27] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. *ICLR*, 2014. 1
319
+ [28] Lingzhi Li, Jianmin Bao, Ting Zhang, Hao Yang, Dong Chen, Fang Wen, and Baining Guo. Face x-ray for more general face forgery detection. CVPR, 2020. 1, 2, 4, 7
320
+ [29] Yuezun Li, Ming-Ching Chang, and Siwei Lyu. In ictu oculi: Exposing ai created fake videos by detecting eye blinking. In WIFS, 2018. 1, 2
321
+ [30] Yuezun Li and Siwei Lyu. Exposing deepfake videos by detecting face warping artifacts. CVPRW, 2019. 1, 2, 8
322
+ [31] Yuezun Li, Xin Yang, Pu Sun, Honggang Qi, and Siwei Lyu. Celeb-df: A new dataset for deepfake forensics. arXiv preprint arXiv:1909.12962, 2019. 6, 7
323
+ [32] Z. Liu, X. Qi, and P. H. S. Torr. Global texture enhancement for fake face detection in the wild. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 8057-8066, 2020. 2, 3
324
+ [33] Babak Mahdian and Stanislav Saic. Using noise inconsistencies for blind image forensics. Image and Vision Computing, 27(10):1497 - 1503, 2009. Special Section: Computer Vision Methods for Ambient Intelligence. 4
325
+ [34] Falko Matern, Christian Riess, and Marc Stamminger. Exploiting visual artifacts to expose deepfakes and face manipulations. In WACVW, 2019. 2
326
+ [35] Huy H Nguyen, Fuming Fang, Junichi Yamagishi, and Isao Echizen. Multi-task learning for detecting and segmenting manipulated facial images and videos. arXiv preprint arXiv:1906.06876, 2019. 1, 2, 8
327
+ [36] Huy H Nguyen, Junichi Yamagishi, and Isao Echizen. Capsule-forensics: Using capsule networks to detect forged images and videos. In ICASSP, 2019. 2
328
+
329
+ [37] Marco Pedersoli, Thomas Lucas, Cordelia Schmid, and Jakob Verbeek. Areas of attention for image captioning. In ICCV, 2017. 5
330
+ [38] Yuyang Qian, Guojun Yin, Lu Sheng, Zixuan Chen, and Jing Shao. Thinking in frequency: Face forgery detection by mining frequency-aware clues. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision – ECCV 2020, pages 86–103, Cham, 2020. Springer International Publishing. 1, 2, 8
331
+ [39] Anderson Rocha, Walter Scheirer, Terrance Boult, and Siome Goldenstein. Vision of the unseen: Current trends and challenges in digital image and video forensics. ACM Computing Surveys (CSUR), 2011. 2
332
+ [40] Andreas Rossler, Davide Cozzolino, Luisa Verdoliva, Christian Riess, Justus Thies, and Matthias Nießner. Faceforensics: Learning to detect manipulated facial images. In ICCV, 2019. 6, 7
333
+ [41] Christos Sagonas, Epameinondas Antonakos, Georgios Tzimiropoulos, Stefanos Zafeiriou, and Maja Pantic. 300 faces in-the-wild challenge: Database and results. IVC, 2016. 6
334
+ [42] R. R. Selvaraju, M. Cogswell, A. Das, R. Vedantam, D. Parikh, and D. Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 618-626, 2017. 3
335
+ [43] L. Song, D. Gong, Z. Li, C. Liu, and W. Liu. Occlusion robust face recognition based on mask learning with pairwise differential siamese network. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 773-782, 2019. 6
336
+ [44] Kritaphat Songsri-in and Stefanos Zafeiriou. Complement face forensic detection and localization with faciallandmarks. arXiv preprint arXiv:1910.05455, 2019. 2
337
+ [45] Joel Stehouwer, Hao Dang, Feng Liu, Xiaoming Liu, and Anil Jain. On the detection of digital face manipulation. CVPR, 2020. 1, 2, 8
338
+ [46] Justus Thies, Michael Zollhöfer, and Matthias Nießner. Deferred neural rendering: Image synthesis using neural textures. TOG, 2019. 3, 6, 7
339
+ [47] Justus Thies, Michael Zollhofer, Marc Stamminger, Christian Theobalt, and Matthias Nießner. Face2face: Real-time face capture and reenactment of rgb videos. In CVPR, 2016. 3, 6, 7
340
+ [48] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017. 5
341
+ [49] Feng Wang, Jian Cheng, Weiyang Liu, and Hajjun Liu. Additive margin softmax for face verification. IEEE Signal Processing Letters, 2018. 6
342
+ [50] H. Wang, Y. Wang, Z. Zhou, X. Ji, D. Gong, J. Zhou, Z. Li, and W. Liu. Cosface: Large margin cosine loss for deep face recognition. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5265-5274, 2018. 6
343
+ [51] Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. Cbam: Convolutional block attention module. In ECCV, 2018. 4
344
+
345
+ [52] Xi Wu, Zhen Xie, YuTao Gao, and Yu Xiao. Sstnet: Detecting manipulated faces through spatial, steganalysis and temporal features. In ICASSP, 2020. 1, 2, 8
346
+ [53] Yue Wu, Wael AbdAlmageed, and Premkumar Natarajan. *Mantra-net: Manipulation tracing network for detection and localization of image forgeries with anomalous features*. In *CVPR*, 2019. 4
347
+ [54] Chao Yang and Ser-Nam Lim. One-shot domain adaptation for face generation. CVPR, 2020. 1, 2
348
+ [55] Xin Yang, Yuezun Li, and Siwei Lyu. Exposing deep fakes using inconsistent head poses. In ICASSP, 2019. 2
349
+ [56] Linwei Ye, Mrigank Rochan, Zhi Liu, and Yang Wang. Cross-modal self-attention network for referring image segmentation. In CVPR, 2019. 5
350
+ [57] Peng Zhou, Xintong Han, Vlad I Morariu, and Larry S Davis. Two-stream neural networks for tampered face detection. In CVPRW, 2017. 1, 2, 4
351
+ [58] Peng Zhou, Xintong Han, Vlad I Morariu, and Larry S Davis. Learning rich features for image manipulation detection. In CVPR, 2018. 4, 8
352
+ [59] Hao Zhu, Chaoyou Fu, Qianyi Wu, W. Wu, Chen Qian, and R. He. Aot: Appearance optimal transport based identity swapping for forgery detection. ArXiv, abs/2011.02674, 2020. 1
generalizingfaceforgerydetectionwithhighfrequencyfeatures/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99f8a40c17c6246d44cc6665c330c6bb4ce438a269b7eca3e1317a520c08bf98
3
+ size 609317
generalizingfaceforgerydetectionwithhighfrequencyfeatures/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c350a16f53f999325da368e223b6a5303de3a8887fc8eae15bf0ae38a61721eb
3
+ size 419440
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:644daf7322734b2066a80ce78d6e8b20b0d476087ac9202bf6d56fa3bb7a4970
3
+ size 81582
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1556dd63b353cc69df58eabc18964179b9d581bd17011bf0622c7c2a0c3da422
3
+ size 100529
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/411c1ebf-036c-426d-b5e3-4b5ce3568659_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02105a9241f4ec6264b064fad4858e9cfb5ebbe2474d67c0d929abe41e93647e
3
+ size 1629943
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/full.md ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generalizing to the Open World: Deep Visual Odometry with Online Adaptation
2
+
3
+ Shunkai Li
4
+
5
+ Xin Wu
6
+
7
+ Yingdian Cao
8
+
9
+ Hongbin Zha
10
+
11
+ Key Laboratory of Machine Perception (MOE), School of EECS, Peking University PKU-SenseTime Machine Vision Joint Lab
12
+
13
+ {lishunkai, wuxin1998, yingdianc}@pku.edu.cn zha@cis.pku.edu.cn
14
+
15
+ # Abstract
16
+
17
+ Despite learning-based visual odometry (VO) has shown impressive results in recent years, the pretrained networks may easily collapse in unseen environments. The large domain gap between training and testing data makes them difficult to generalize to new scenes. In this paper, we propose an online adaptation framework for deep VO with the assistance of scene-agnostic geometric computations and Bayesian inference. In contrast to learning-based pose estimation, our method solves pose from optical flow and depth while the single-view depth estimation is continuously improved with new observations by online learned uncertainties. Meanwhile, an online learned photometric uncertainty is used for further depth and pose optimization by a differentiable Gauss-Newton layer. Our method enables fast adaptation of deep VO networks to unseen environments in a self-supervised manner. Extensive experiments including Cityscapes to KITTI and outdoor KITTI to indoor TUM demonstrate that our method achieves state-of-the-art generalization ability among self-supervised VO methods.
18
+
19
+ # 1. Introduction
20
+
21
+ Estimating camera motion from monocular videos plays an essential role in many real-world applications, such as autonomous driving and robotics. This problem is usually solved by visual odometry (VO) or simultaneous localization and mapping (SLAM). Classic SLAM/VO methods [7, 8, 10, 26] perform well in favorable conditions but often fail in challenging situations (e.g. textureless region, dynamic object) due to the reliance on low-level features and handcrafted pipeline. Since deep neural networks are able to extract high-level features and infer end-to-end by learning from data, many learning-based VO methods [21, 22, 39, 47] have been proposed to break through the limitations of classic SLAM/VO. Among them, self-supervised VO methods are able to jointly learn camera pose, depth and optical flow by minimizing photometric error [39], which have shown promising results in recent years.
22
+
23
+ ![](images/eca915795881b7d379685c8a84ed92124b25b192c5d9a8378284809bff6de7d1.jpg)
24
+ Pretrained on Cityscapes
25
+
26
+ ![](images/fe6f4dc5a4e0bf8b3e6a9fead1b843c2e162f5cff3252442b78199973c6d08cf.jpg)
27
+
28
+ ![](images/71300d0f51e9d18a2811fb4605a675518036eecd1411ff6585a46021568a2b28.jpg)
29
+ Test on KITTI
30
+ Pretrained on KITTI
31
+
32
+ ![](images/5c4735c8114cdb35af8e6164d8155b5bd0a27f18079170b4ce9c770d3cf4c311.jpg)
33
+ Test on TUM
34
+
35
+ ![](images/52bee20c91cdf4ff0347fb20cadf7dbb3335c02c694a125c23dd490ea54efee5.jpg)
36
+
37
+ ![](images/05b2e04a76829a2069f142b7babd64dd90f5efcd07c4d36fba1ba081b78666bb.jpg)
38
+ Figure 1. In this paper, we focus on the generalization ability to unseen environments of deep VO. When the test data are different from the training data, previous methods fail to generalize while our method still performs well with very small trajectory error.
39
+
40
+ However, learning-based VO often fails during inference when the scenes are different from the training data. The inability of pretrained VO to generalize to unseen environments limits its wide applications [21, 44]. To this end, the pretrained networks are required to achieve real-time online adaptation in a self-supervised manner.
41
+
42
+ As a result, several previous works [3, 21, 44] have been proposed to mitigate the domain generalization problem of stereo matching and VO. However, the performance is still much inferior to classic methods in terms of accuracy and the pretrained networks suffer from slow convergence. These methods treat VO as a black-box by learning all components (pose, depth, optical flow, etc.) but ignore well-defined geometric computations and optimization methods, which leads to slow convergence during online adaptation.
43
+
44
+ Existing deep VO methods predict depth by single-view estimation, which is an ill-posed problem [22]. The learned depth has a strong reliance on the training dataset. During inference, the camera intrinsics, scene layouts and distances are usually different. Meanwhile, the camera pose is learned rather than calculated analytically, which requires favorable camera motion with sufficient disparity (e.g. KITTI dataset). Therefore, these methods tend to fail when faced with unseen or more complicated motion patterns. In addition, existing learning-based methods do not explicitly ensure multi-view geometric consistency during inference, which leads to large scale drift in trajectories.
45
+
46
+ In order to improve the online adaptation of VO to unseen environments, we propose a self-supervised framework that combines the advantage of deep learning and geometric computations. The proposed framework utilizes scene-agnostic 3D geometry constraints and Bayesian inference formulations to speed up online adaptation. During inference, the single-view depth estimation is used as a prior of the current scene geometry and is continuously improved with incoming observations by a probabilistic Bayesian updating framework. The refined depth is used as Maximum A Posteriori (MAP) to train DepthNet for better estimation at the next timestep. Instead of predicting pose by PoseNet, our framework solves pose analytically from optical flow and refined depth. Meanwhile, in order to deal with observation noise, the proposed method online learns depth and photometric uncertainties which are used in the depth refinement process and differentiable Gauss-Newton optimization, respectively. Finally, the optimized pose, depth and flow are used for online self-supervision. Our framework ensures scale consistency by exploiting multi-view geometric constraints. The well-defined scene-agnostic computation helps our VO framework achieve good generalization ability across different scene conditions. Our contributions can be summarized as follows:
47
+
48
+ - We propose a generalizable deep VO that uses scene-agnostic geometric formulation and Bayesian inference to speed up self-supervised online adaptation.
49
+ - The predicted depth is continuously refined by a Bayesian fusion framework, which is further used to train depth and optical flow during online learning.
50
+ - We introduce online learned depth and photometric uncertainties for better depth refinement and differentiable Gauss-Newton optimization.
51
+
52
+ Our method achieves much better generalization than state-of-the-art baselines when tested cross different domains, including Cityscapes [4] to KITTI [13] and outdoor KITTI to indoor TUM [31] datasets. Meanwhile, we also achieve state-of-the-art depth estimation results on KITTI and NYUv2 [30] datasets.
53
+
54
+ # 2. Related works
55
+
56
+ Learning-based VO has been widely studied in recent years and shown impressive results [35, 37, 45]. DeepTAM [45] mimics the framework of parallel tracking and mapping in classic SLAM/VO by using two networks for depth and pose estimation simultaneously. Xue et al [37] extends the VO pipeline to tracking, selecting memory and refining modules, which shows superior performance under challenging conditions. However, these methods require ground truth which is often impractical to obtain. In order to alleviate the need of ground truth data, self-supervised VO has been proposed. SfMLearner [47] learns depth and pose simultaneously by minimizing photometric loss between warped and input image. Zhao et al. [43] and Ranjan et al. [28] extend this idea to joint estimation of pose, depth and optical flow. Monodepth2 [15] explicitly handles non-rigid and occluded cases which are against static-scene assumption. SAVO [22] exploits spatial-temporal correlations over long sequence and utilizes RNN to reduce scale drift. In this paper, we use the depth network of Monodepth2 [15] for single-view depth estimation.
57
+
58
+ Online adaptation Most machine learning algorithms assume that the training and testing data are sampled from the same feature distribution. However, when the test data are different from the training set, most pretrained models suffer from a significant reduce in performance. In this situation, online learning [23, 33] is an effective method to solve the domain shift problem. Previous methods use online gradient update [5] and probabilistic filtering [2] to accelerate domain adaptation. In the computer vision field, Zhong et al. [44] proposes a self-supervised framework for stereo matching in the open world. Li et al. [21] proposes an online meta-learning algorithm for VO to continuously adapt to unseen environments. However, these methods learn all components by deep networks, leading to slow convergence and inferior performance. In contrast, our method combines the advantage of deep learning and well-defined geometric computations to achieve better generalization.
59
+
60
+ 3D Geometric computations In classic 3D computer vision, the relative pose between two images and scene depth can be solved analytically by multi-view geometric constraints. Given a set of correspondences, the pose can be solved by epipolar geometry [16, 17] with 2D-2D matching or Perspective-n-Point (PnP) [19] with 3D-2D matching. The depth of each correspondence can be recovered by mid-point triangulation [26]. On the other hand, the depth and pose can also be solved by minimizing photometric error [7, 8] via classic optimizations. If more observations are available, the 3D map can be further refined by Bundle Adjustment (BA) [26] or filtering [10]. In this paper, we adopt a Bayesian depth fusion method to refine single-view depth estimation and propose a differentiable Gauss-Newton layer to minimize weighted photometric residuals.
61
+
62
+ ![](images/96a7623ee79759b4753b1987ab4c450bb4b6465b6c65451461197d864bb7178a.jpg)
63
+ Figure 2. The framework of our online adaptation method. FlowNet predicts dense optical flow $F_{k,t}$ , $F_{t,k}$ and photometric uncertainty $\Gamma_t$ while DepthNet provides a prior depth estimation of the keyframe by estimating initial depth $D_k^0$ and uncertainty $\Sigma_k$ . The relative pose $T_k^t$ is solved analytically from selected correspondences. During online adaptation, the initial depth $D_k^0$ is continuously improved with new triangulated depth patches in a Bayesian updating framework. The photometric loss weighted by $\Gamma_t$ is minimized by a differentiable Gauss-Newton layer. Finally, the optimized depth and pose are then used to self-supervise the online learning of DepthNet and FlowNet.
64
+
65
+ # 3. Method
66
+
67
+ In this section, we will introduce our framework in detail. The system overview is illustrated in Fig. 2. Firstly, the FlowNet predicts dense optical flow between the keyframe $I_{k}$ and current frame $I_{t}$ (Section 3.1), and predicts photometric uncertainty map $\Gamma_{t}$ (Section 3.4) as a side output. Meanwhile, the DepthNet estimates depth mean $D_{k}^{0}$ and uncertainty $\Sigma_{k}$ of keyframe, providing a prior of the current scene geometry (Section 3.2). The relative pose $T_{k}^{t}$ is solved by essential matrix or PnP from selected flow correspondences. During online adaptation, we firstly reconstruct the sparse depth of $I_{k}$ by a differentiable triangulation module. Then, the prior keyframe depth $D_{k}^{0}$ is continuously improved by subsequent depth estimations in a Bayesian updating framework (Section 3.3). Next, the differentiable Gauss-Newton layer minimizes the photometric loss of $I_{t}$ and warped image $\hat{I}_{t}$ weighted by predicted $\Gamma_{t}$ (Section 3.5). Finally, the optimized depth $D_{k}^{\prime}$ and flow $F_{k,t}^{\prime}$ are used as pseudo ground truth to supervise the online learning of DepthNet and FlowNet (Section 3.6).
68
+
69
+ # 3.1. Pose recovery from optical flow
70
+
71
+ We use RAFT [32] to learn dense optical flow $F_{k,t}$ between keyframe $I_{k}$ and current frame $I_{t}$ . The optical flow
72
+
73
+ between $I_{k}$ and $I_{t - 1}$ is used as a prior to initialize current flow prediction. However, the predicted flow is not accurate for all pixels and the pose estimation error will increase if the displacement becomes small. Thus we select robust correspondences $(p_k,p_t)$ with good forward-backward flow consistency and moderate flow magnitude [42]:
74
+
75
+ $$
76
+ \left\| F _ {k, t} \left(p _ {k}\right) + F _ {t, k} \left(p _ {t}\right) \right\| < \delta_ {1}, \quad \left\| F _ {k, t} \left(p _ {k}\right) \right\| > \delta_ {2}, \tag {1}
77
+ $$
78
+
79
+ where we set $\delta_1 = 0.1, \delta_2 = 3$ . We select $I_t$ as a new keyframe if the mean flow of robust correspondences is larger than 30. Benefiting from this keyframe-based scheme, the motion disparity between two frames are increased, enabling more accurate pose and depth estimation.
80
+
81
+ Given 2D correspondences between $p_k, p_t$ , the relative pose $T_k^t = [R|t]$ is computed by solving essential matrix $E$ with RANSAC [9] algorithm:
82
+
83
+ $$
84
+ p _ {t} ^ {T} K ^ {- T} E K ^ {- 1} p _ {k} = 0, \quad E = [ t ] _ {\times} R, \tag {2}
85
+ $$
86
+
87
+ where $K$ denotes camera intrinsics. The scale of up-to-scale pose $T_{k}^{t}$ is recovered by aligning triangulated sparse depth (detailed in Section 3.3) with keyframe depth. However, when confronted with small translation or pure rotation, the 2D-2D estimation fails. In these cases, we recover pose with PnP [19] by minimizing reprojection error:
88
+
89
+ $$
90
+ e _ {r} = \sum \left| \left| K T _ {k} ^ {t} D _ {k} K ^ {- 1} p _ {k} - p _ {t} \right| \right| _ {2}, \tag {3}
91
+ $$
92
+
93
+ where the 2D correspondences in $I_{k}$ are lifted to 3D with depth $D_{k}$ (detailed in Section 3.2-3.3) and intrinsics $K$ .
94
+
95
+ # 3.2. Depth modeling
96
+
97
+ In this paper, we model the depth estimation and updating in a unified Bayesian framework. The inverse depth $z_{i} = \frac{1}{d_{i}}$ of every pixel $i$ is used since it obeys Gaussian-like distribution and is more robust to distant objects. For inverse depth measurement $z_{i}^{t}$ at time $t$ , we model the good measurement as Gaussian distribution around the ground truth $z_{i}$ while the bad one is regarded as observation noise which is uniformly distributed within the interval $[z_{i}^{\min}, z_{i}^{\max}]$ . For every new observation $z_{i}^{t}$ , the probability of being a inlier is $\rho_{i}^{t}$ . Thus $z_{i}^{t}$ is modeled as [10]:
98
+
99
+ $$
100
+ p \left(z _ {i} ^ {t} \mid z _ {i}, \rho_ {i} ^ {t}\right) := \rho_ {i} ^ {t} \mathcal {N} \left(z _ {i} ^ {t} \mid z _ {i}, \tau_ {i} ^ {2}\right) + \left(1 - \rho_ {i} ^ {t}\right) \mathcal {U} \left(z _ {i} ^ {t} \mid z _ {i} ^ {\min }, z _ {i} ^ {\max }\right), \tag {4}
101
+ $$
102
+
103
+ where $\tau_{i}^{2}$ denotes the variance of a good measurement. We follow [10] to set inverse depth variance $\tau_{i}^{2}$ as the photometric disparity error of one pixel.
104
+
105
+ During online inference, we seek to find the Maximum A Posteriori (MAP) estimation of $z_{i}^{t}$ at each timestep, which can be approximated [34] by the product of a Gaussian distribution for $z_{i}^{t}$ and a Beta distribution for inlier ratio $\rho_{i}^{t}$ :
106
+
107
+ $$
108
+ q \left(z _ {i} ^ {t}, \rho_ {i} ^ {t} \mid a _ {i} ^ {t}, b _ {i} ^ {t}, \mu_ {i} ^ {t}, \sigma_ {i} ^ {t 2}\right) := B e t a \left(\rho_ {i} ^ {t} \mid a _ {i} ^ {t}, b _ {i} ^ {t}\right) \mathcal {N} \left(z _ {i} ^ {t} \mid \mu_ {i} ^ {t}, \sigma_ {i} ^ {t 2}\right), \tag {5}
109
+ $$
110
+
111
+ where $a_i^t, b_i^t$ are the parameters in Beta distribution, and $\mu_i^t, \sigma_i^t$ the mean and variance of Gaussian depth estimate.
112
+
113
+ The depth of keyframe is initialized with single-view estimation $d_k^0 \in D_k^0$ and inverse depth uncertainty $\sigma_i^0 \in \Sigma_k$ from DepthNet as follows:
114
+
115
+ $$
116
+ \begin{array}{l} \mu_ {i} ^ {0} = \frac {1}{d _ {k} ^ {0}}, \quad \sigma_ {i} ^ {0} \in \Sigma_ {k}, \quad z _ {i} ^ {\max } = \mu_ {i} ^ {0} + \sigma_ {i} ^ {0}, \tag {6} \\ z _ {i} ^ {\min } = \left\{ \begin{array}{l l} \mu_ {i} ^ {0} - \sigma_ {i} ^ {0}, & \quad \text {i f} \mu_ {i} ^ {0} - \sigma_ {i} ^ {0} > 0 \\ 1 e ^ {- 6}, & \quad \text {e l s e} \end{array} \right. \\ \end{array}
117
+ $$
118
+
119
+ During adaptation, the DepthNet online learns the prior knowledge of the new scene geometry. Besides, the learned uncertainties can also serve to gauge the reliability in probabilistic depth fusion.
120
+
121
+ # 3.3. Online depth refinement
122
+
123
+ Given the relative pose $T_{k}^{t}$ and 2D correspondences, the subsequent depth estimation of keyframe can be further calculated by two-view triangulation [26]:
124
+
125
+ $$
126
+ d _ {i} ^ {k} = \underset {d _ {i} ^ {k}} {\arg \min } \left[ \operatorname {d i s} \left(L _ {k}, d _ {i} ^ {k}\right) ^ {2} + \operatorname {d i s} \left(L _ {t}, d _ {i} ^ {k}\right) \right] ^ {2}, \tag {7}
127
+ $$
128
+
129
+ ![](images/23ae28aa876673eec69f3db3c5f07d0ca52e6fffaade9103b8e843ba4dfa751a.jpg)
130
+ Figure 3. Illustration of online depth refinement process. When tested on TUM dataset, the pretrained network predicts erroneous depth. The initial guess is continuously updated by triangulated depth patches in a Bayesian refinement framework which becomes much more accurate after only 4 timesteps.
131
+
132
+ where $\mathrm{dis}()$ denotes the distance between $d_i^k$ and two camera rays $L_{k},L_{t}$ generated from 2D correspondences. The midpoint triangulation is naturally differentiable, enabling our VO framework to perform end-to-end online learning.
133
+
134
+ The triangulated depth map $D_{k}^{s}$ is usually very sparse ( $\sim 2000$ points) and we densify each point with a local $3 \times 3$ patch $D_{k}^{s^{\prime}}$ . The depth of each patch pixel is assumed the same as the central point. The patch-based representation allows larger region of depth filtering and provides more valid gradients with a wider basin of convergence.
135
+
136
+ During online adaptation, $D_k^{s'}$ is used to update the prior depth estimate to get a MAP estimation $z_i^t$ according to Eq. 5 as illustrated in Fig. 3. Meanwhile, the parameters $a_i^t, b_i^t, \mu_i^t, \sigma_i^{t2}$ in Eq. 5 are incrementally updated by Bayesian formulation. The updating method can be found in the supplementary materials. We assume the inverse depth $z_i^t$ have converged to the ground truth $z_i$ once the uncertainty $\sigma_i^{t2}$ is lower than a threshold.
137
+
138
+ # 3.4. Photometric residuals with learned uncertainty
139
+
140
+ Given the estimated pose $T_{k}^{t}$ and refined depth $D_{k}$ , one can synthesize $\hat{I}_{t}$ by warping $I_{k}$ to the target image $I_{t}$ [47]:
141
+
142
+ $$
143
+ p _ {t} \sim K T _ {k} ^ {t} D _ {k} \left(p _ {k}\right) K ^ {- 1} p _ {k}, \tag {8}
144
+ $$
145
+
146
+ However, view synthesis builds on the photometric constancy assumption, which is often violated in practice. In order to alleviate this issue, we regard these corner cases as
147
+
148
+ observation noise and use deep neural network to predict a posterior probability distribution $p(I|\mu_I,\gamma)$ for each RGB pixel parametrized by mean $\mu_I$ and variance $\gamma \in \Gamma$ over ground truth intensity $I$ . By assuming the observation noise to be Laplacian, the online learning process can be formulated as minimizing the negative log-likelihood, which can be converted to a weighted photometric loss:
149
+
150
+ $$
151
+ \mathcal {L} _ {p h o} = \sum - \log p (I | \mu_ {I}, \gamma) = \frac {\| \hat {I} _ {t} - I _ {t} \| _ {1}}{\Gamma_ {t}} + \log \Gamma_ {t}, \tag {9}
152
+ $$
153
+
154
+ where $\Gamma_t$ denotes photometric uncertainty map.
155
+
156
+ # 3.5. Differentiable Gauss-Newton optimization
157
+
158
+ Furthermore, we propose to use a differentiable Gauss-Newton [7] layer to minimize $\mathcal{L}_{pho}$ for optimized depth $D_{k}^{\prime}$ and pose $T_{k}^{t}$ . The predicted $\Gamma_{t}$ in Eq. 9 improves the robustness to illumination change and occlusions. Specifically, starting with an initial depth and pose $D_{k}, T_{k}^{t}$ , we compute the weighted photometric loss $r_{i}(p)$ for each pixel $p_{i}$ in all frames $I_{i}$ among two keyframes $I_{k_{1}}, I_{k_{2}}$ :
159
+
160
+ $$
161
+ r _ {i} (p) = \frac {\hat {I} _ {i} \left(p _ {i}\right) - I _ {i} (p)}{\gamma_ {i}}, \quad \gamma_ {i} \in \Gamma_ {t} \tag {10}
162
+ $$
163
+
164
+ The first order derivatives with respect to $D_{k}$ and $T_{k}^{t}$ are:
165
+
166
+ $$
167
+ J _ {i} ^ {D} (p) = \frac {1}{\gamma_ {i}} \frac {\partial \hat {I} _ {i} \left(p _ {i}\right)}{\partial p _ {i}} \frac {\partial p _ {i}}{\partial D _ {k} (p)}, \quad J _ {i} ^ {T} (p) = \frac {1}{\gamma_ {i}} \frac {\partial \hat {I} _ {i} \left(p _ {i}\right)}{\partial p _ {i}} \frac {\partial p _ {i}}{\partial T _ {k} ^ {t}} \tag {11}
168
+ $$
169
+
170
+ Thus the increment $\delta$ to the current estimation is:
171
+
172
+ $$
173
+ \delta = - \left(J ^ {T} J\right) ^ {- 1} J ^ {T} r, \quad J = \left[ J ^ {D} J ^ {T} \right] \tag {12}
174
+ $$
175
+
176
+ where $J$ denotes the stack of Jacobians $\{J_i(p)\}$ and $r$ denotes the stack of weighted photometric residuals $\{r_i(p)\}$ . The Gauss-Newton algorithm is naturally differentiable and we implement it as a layer in neural network. In practice, we find that it converges within only 3 iterations.
177
+
178
+ # 3.6. Loss functions
179
+
180
+ We propose to use the following loss functions to online learn DepthNet and FlowNet in a self-supervised manner.
181
+
182
+ Smoothness loss We introduce an edge-aware loss for depth and flow to enforce local smoothness:
183
+
184
+ $$
185
+ \mathcal {L} _ {\text {s m o o t h}} (G) = \frac {1}{N} \sum_ {x, y} \| \nabla_ {x} G (x, y) \| e ^ {- \| \nabla_ {x} I (x, y) \|} + \tag {13}
186
+ $$
187
+
188
+ $$
189
+ \| \nabla_ {y} G (x, y) \| e ^ {- \| \nabla_ {y} I (x, y) \|},
190
+ $$
191
+
192
+ where $G$ denotes optical flow or depth.
193
+
194
+ Depth loss We derive a loss function of depth by evaluating the negative log-likelihood of the estimated inverse depth $\tilde{z}_i$ with uncertainty $\sigma_i$ defined in Eq. 6. This allows
195
+
196
+ the network to attenuate the cost of difficult regions and to focus more on well explained parts. We assume a Laplacian distribution of inverse depth residuals:
197
+
198
+ $$
199
+ p \left(\tilde {z} _ {i} \mid \mu_ {i}, \sigma_ {i}\right) = \frac {1}{2 \sigma_ {i}} \exp \left(- \frac {\left| \tilde {z} _ {i} - \mu_ {i} \right|}{\sigma_ {i}}\right) \tag {14}
200
+ $$
201
+
202
+ We use refined inverse depth $z_k'$ as $\mu_i$ for self-supervision. Thus the negative log-likelihood becomes:
203
+
204
+ $$
205
+ \mathcal {L} _ {d} = \sum - \log p (\tilde {z} _ {i} | \mu_ {i}, \sigma_ {i}) = \frac {\left\| 1 / D _ {k} ^ {\prime} - 1 / D _ {k} \right\| _ {1}}{\Sigma_ {k}} + \log \Sigma_ {k} \tag {15}
206
+ $$
207
+
208
+ Intuitively, the network will tune the depth uncertainty $\sigma_{i}$ that best minimize the depth loss $\|1 / D_k' - 1 / D_k\|_1$ while being subject to the regularization term $\log \Sigma_{k}$ . In order to enforce depth continuity, we modify Eq. 15 to:
209
+
210
+ $$
211
+ \mathcal {L} _ {d} = \frac {\left\| 1 / D _ {k} ^ {\prime} - 1 / D _ {k} \right\| _ {1}}{\Sigma_ {k}} + \log \Sigma_ {k} + \mathcal {L} _ {\text {s m o o t h}} (D _ {k}) \tag {16}
212
+ $$
213
+
214
+ Flow loss The optimized depth and pose $D_{k}^{\prime}, T_{k}^{t}$ can be used to synthesize optical flow $F_{k,t}^{\prime}$ by calculating the difference between warped coordinates $p_t^\prime$ and $p_t$ . We use $F_{k,t}^{\prime}$ to supervise FlowNet during online adaptation:
215
+
216
+ $$
217
+ \mathcal {L} _ {f l o w} = \left\| F _ {k, t} - F _ {k, t} ^ {\prime} \right\| _ {1} + \mathcal {L} _ {s m o o t h} \left(F _ {k, t}\right) \tag {17}
218
+ $$
219
+
220
+ Photometric loss is defined in Eq. 9. Thus the total self-supervised loss is:
221
+
222
+ $$
223
+ \mathcal {L} = \mathcal {L} _ {p h o} + \mathcal {L} _ {d} + \mathcal {L} _ {f l o w} \tag {18}
224
+ $$
225
+
226
+ # 4. Experiments
227
+
228
+ # 4.1. Implementation details
229
+
230
+ Network Architectures Since our method focuses on improving online adaptation of deep VO to achieve better generalization, we adopt similar networks with existing self-supervised VO methods. As for DepthNet, we use the same architecture as Monodepth2 [15] and add a $5 \times 5$ convolution layer at the output to predict depth uncertainty map $\Sigma_{k}$ . The optical flow network is based on RAFT [32]. We add a $5 \times 5$ convolution + Sigmoid layer at output to predict photometric uncertainty $\Gamma_{t}$ at the same time.
231
+
232
+ Learning Settings Our model is implemented by PyTorch [27] on a single NVIDIA GTX 2080Ti. The images are resized to $256 \times 832$ for KITTI [13] and Cityscapes [4] datasets while set $192 \times 256$ for TUM dataset [31]. The FlowNet and DepthNet are pretrained in a self-supervised manner for $1 \times 10^{5}$ iterations according to [28]. The Adam [18] optimizer with $\beta_{1} = 0.9, \beta_{2} = 0.99$ is used. The learning objective (Eq. 18) is used for both pretraining and online adaptation with the learning rate of $1 \times 10^{-4}$ . The uncertainty maps $\Gamma_{t}, \Sigma_{k}$ are also jointly trained by minimizing Eq. 18. During online adaptation, we retrain FlowNet and DepthNet for 2 iterations in every time step.
233
+
234
+ ![](images/4bb5e58ab4bdb5e5f144b7cba14f27d318e8351d9d69f68d9198c416ea27c8d5.jpg)
235
+ (a) Seq.00
236
+
237
+ ![](images/805a76352682b2702cf622aa5d4d00a748574549d9274d049672d73f94bdb030.jpg)
238
+ (b) Seq.01
239
+
240
+ ![](images/1c89659dabc546fde65669d462e7dabfb70bc28933a651c7e4914affcb59c0c5.jpg)
241
+ (c) Seq.02
242
+ Figure 4. Selected trajectories of different methods on KITTI odometry dataset. We use pretrained network on Cityscapes to directly test on KITTI while all the other methods use pretrained network on KITTI for testing. It can be seen that our method shows much more accurate trajectories. Note that we do not use any mapping, pose graph optimization, loop closing or bundle adjustment techniques.
243
+
244
+ ![](images/58783ee757a3e1d51d08d25993f2a391083bac05345c2dab1b1c56e94feec00f.jpg)
245
+ (d) Seq.08
246
+
247
+ # 4.2. Cityscapes to KITTI
248
+
249
+ Firstly, we try to test the generalization ability of our framework to different outdoor environments. We pretrain our method on Cityscapes [4] dataset and test on KITTI [13] dataset, which differ not only in scene contents and white balance but also in camera intrinsics. We compare with recent self-supervised VO baselines: GeoNet [39], Vid2Depth [24], Zhan et al. [41], SAVO [22] and Li et al. [21] as well as classic methods: ORB-SLAM2 [26] (with and without loop closure) and VISO2 [14]. Besides, we compare with Zhao et al. [43] and DF-VO [42] which are state-of-the-art methods that combine the output of pretrained networks with classic VO pipeline.
250
+
251
+ As for pose estimation, we evaluate on 11 KITTI sequences with ground truth poses [39]. It's worthy to note that all the other VO baselines are pretrained on KITTI, while our method is only pretrained on Cityscapes and directly tested on KITTI dataset. Although in such unfair conditions, our method achieves state-of-the-art results even compared with ORB-SLAM2 (LC) (shown in Table 1 and Fig. 4). Meanwhile, different from most self-supervised VO baselines, our method maintains a consistent scale of the entire trajectory. Thus, instead of calculating absolute trajectory error (ATE) on short sequence as previous methods, we align trajectories with ground truth [13] by a single scaling factor and compute translation/rotation error $t_{err} / r_{err}$ on entire trajectory.
252
+
253
+ Our method outperforms all the other baselines (including end-to-end learning and combination of geometric computation methods) by a clear margin. The rotation and translation errors are an order of magnitude smaller than the other self-supervised baselines, indicating that pose, depth and scale estimation collaborated with probabilistic geometric computation is much better than learning-based inference. As for classic baselines, ORB-SLAM2 is implemented by a local map tracking with bundle adjustment
254
+
255
+ ![](images/a7b3d65d072e4dd1794f881441f96c986da08ffa86fd946aac00496ba742624b.jpg)
256
+
257
+ ![](images/a311040a29f22a6f49adcd221630bbc1c3eb9a71328060bfb9c2a7eb939f954d.jpg)
258
+
259
+ ![](images/2f5194e94cd36c35dd5ab5f6da61a249be935523c193b59a92c88c846cc29ebf.jpg)
260
+ (c) fr3/long_office_hou_valid
261
+ Figure 5. Visual odometry results pretrained on outdoor KITTI and tested on indoor TUM dataset. All the other learning-based baselines tend to fail when faced with large domain shift. In contrast, our method is still able to recover accurate VO estimation by online adapting to challenging indoor datasets.
262
+
263
+ ![](images/c014a4070b75c5ad740e7ab30627ee0faaa9687bb5ecd57006dc921f5956106b.jpg)
264
+ (d) fr2/pioneer_360
265
+
266
+ (BA) and ORB-SLAM2 (LC) processes the entire sequence with loop closure, pose graph optimization and global BA to ensure good performance. Our method doesn't use any optimization backend techniques but it still achieves comparable results with ORB-SLAM2 (LC).
267
+
268
+ # 4.3. Outdoor KITTI to indoor TUM
269
+
270
+ In order to further evaluate the generalization ability to more complex indoor environments, we test on TUM [31] dataset using networks pretrained on KITTI. TUM indoor dataset contains much more complicated motion patterns
271
+
272
+ <table><tr><td>Method</td><td>Seq.00
273
+ terr/err</td><td>Seq.01
274
+ terr/err</td><td>Seq.02
275
+ terr/err</td><td>Seq.03
276
+ terr/err</td><td>Seq.04
277
+ terr/err</td><td>Seq.05
278
+ terr/err</td><td>Seq.06
279
+ terr/err</td><td>Seq.07
280
+ terr/err</td><td>Seq.08
281
+ terr/err</td><td>Seq.09
282
+ terr/err</td><td>Seq.10
283
+ terr/err</td></tr><tr><td>Vid2Depth [24]</td><td>59.97 22.59</td><td>9.34 4.18</td><td>55.20 14.61</td><td>27.02 10.39</td><td>1.89 1.19</td><td>51.14 21.86</td><td>58.07 26.83</td><td>51.21 36.64</td><td>45.82 18.10</td><td>44.52 12.11</td><td>21.45 12.50</td></tr><tr><td>GeoNet [39]</td><td>27.60 5.72</td><td>12.25 4.15</td><td>42.21 6.14</td><td>19.21 9.78</td><td>9.09 7.55</td><td>20.12 7.67</td><td>9.28 4.34</td><td>8.27 5.93</td><td>18.59 7.85</td><td>23.94 9.81</td><td>20.73 9.10</td></tr><tr><td>Zhan et al. [41]</td><td>6.23 2.44</td><td>23.78 1.75</td><td>6.59 2.26</td><td>15.76 10.62</td><td>3.14 2.02</td><td>4.94 2.34</td><td>5.80 2.06</td><td>6.49 3.56</td><td>5.45 2.39</td><td>11.89 3.62</td><td>12.82 3.40</td></tr><tr><td>SAVO [22]</td><td>18.67 3.12</td><td>9.86 1.23</td><td>17.58 4.29</td><td>15.01 6.54</td><td>3.35 1.18</td><td>9.82 2.53</td><td>5.27 4.30</td><td>9.85 4.03</td><td>21.37 3.65</td><td>9.52 3.64</td><td>6.45 2.41</td></tr><tr><td>Li et al. [21]</td><td>8.42 3.91</td><td>17.36 4.60</td><td>14.38 2.62</td><td>18.24 0.92</td><td>3.28 4.40</td><td>7.58 3.31</td><td>4.36 2.28</td><td>5.58 3.12</td><td>7.51 2.63</td><td>5.89 3.34</td><td>4.79 0.83</td></tr><tr><td>VISO2 [14]</td><td>12.66 2.73</td><td>41.93 7.68</td><td>9.47 1.19</td><td>3.93 2.21</td><td>2.50 1.78</td><td>15.10 3.65</td><td>6.80 1.93</td><td>10.80 4.67</td><td>14.82 2.52</td><td>3.69 1.25</td><td>21.01 3.26</td></tr><tr><td>DF-VO [42]</td><td>2.25 0.58</td><td>66.98 17.04</td><td>3.60 0.52</td><td>2.67 0.50</td><td>1.43 0.29</td><td>1.10 0.30</td><td>1.03 0.30</td><td>0.97 0.27</td><td>1.60 0.32</td><td>2.61 0.29</td><td>2.29 0.37</td></tr><tr><td>D3VO [38] (stereo)</td><td>- -</td><td>1.07 -</td><td>0.80 -</td><td>- -</td><td>- -</td><td>- -</td><td>0.67 -</td><td>- -</td><td>1.00 -</td><td>0.78 -</td><td>0.62 -</td></tr><tr><td>Zhao et al. [43]</td><td>4.45 1.13</td><td>62.54 2.71</td><td>4.64 0.91</td><td>6.86 1.26</td><td>4.76 3.31</td><td>2.93 0.90</td><td>3.48 1.32</td><td>2.57 1.21</td><td>5.09 1.19</td><td>6.81 0.72</td><td>4.39 1.05</td></tr><tr><td>ORB-SLAM2 [26]</td><td>11.43 0.58</td><td>107.57 0.89</td><td>10.34 0.26</td><td>0.97 0.19</td><td>1.30 0.27</td><td>9.04 0.26</td><td>14.56 0.26</td><td>9.77 0.36</td><td>11.46 0.28</td><td>9.30 0.26</td><td>2.57 0.32</td></tr><tr><td>ORB-SLAM2 (LC)</td><td>2.35 0.35</td><td>109.10 0.45</td><td>3.32 0.31</td><td>0.91 0.19</td><td>1.56 0.27</td><td>1.84 0.20</td><td>4.99 0.23</td><td>1.91 0.28</td><td>9.41 0.30</td><td>2.88 0.25</td><td>3.30 0.30</td></tr><tr><td>Ours (w/o RDS)</td><td>4.67 1.28</td><td>6.99 2.83</td><td>4.33 1.05</td><td>8.73 1.14</td><td>3.78 2.09</td><td>4.20 1.98</td><td>5.02 3.61</td><td>7.24 1.11</td><td>3.30 2.78</td><td>7.99 2.53</td><td>5.21 2.87</td></tr><tr><td>Ours (w/o PU)</td><td>2.28 0.87</td><td>5.42 1.40</td><td>3.98 1.87</td><td>7.76 0.99</td><td>2.92 1.04</td><td>3.63 1.28</td><td>4.92 2.07</td><td>8.25 2.39</td><td>3.28 1.69</td><td>4.60 1.13</td><td>3.25 1.70</td></tr><tr><td>Ours</td><td>1.32 0.45</td><td>2.83 0.65</td><td>1.42 0.45</td><td>1.77 0.39</td><td>1.22 0.27</td><td>1.07 0.44</td><td>1.02 0.41</td><td>2.06 1.18</td><td>1.50 0.42</td><td>1.87 0.46</td><td>1.93 0.30</td></tr></table>
284
+
285
+ Table 1. Quantitative comparison on KITTI dataset. Our method is pretrained on Cityscapes and tested on KITTI, while all the other learning-based methods are pretrained on KITTI. LC: loop closure, w/o: without, RDS: refined depth for online supervision, PU: photometric uncertainty. $t_{err}$ : translational root mean square error (RMSE) drift (\%); $r_{err}$ : average rotational RMSE drift ( $^\circ/100\mathrm{m}$ ).
286
+
287
+ <table><tr><td>Sequence</td><td>Vid2Depth [24]</td><td>GeoNet [39]</td><td>Zhan et al. [41]</td><td>SAVO [22]</td><td>Li et al. [21]</td><td>DF-VO [42]</td><td>Zhao et al. [43]</td><td>DSO [7]</td><td>ORB-SLAM2 (LC) [26]</td><td>Ours</td><td>Ours (w/o RDS)</td><td>Ours (w/o PU)</td></tr><tr><td>fr2/desk</td><td>0.698</td><td>0.462</td><td>0.570</td><td>0.402</td><td>0.214</td><td>0.306</td><td>0.485</td><td>X</td><td>X</td><td>0.158</td><td>0.572</td><td>0.221</td></tr><tr><td>fr2/pioneer_360</td><td>0.581</td><td>0.662</td><td>0.453</td><td>0.402</td><td>0.218</td><td>0.599</td><td>0.693</td><td>X</td><td>X</td><td>0.201</td><td>0.638</td><td>0.254</td></tr><tr><td>fr2/pioneer_slam</td><td>0.367</td><td>0.301</td><td>0.309</td><td>0.338</td><td>0.190</td><td>0.585</td><td>0.354</td><td>0.737</td><td>X</td><td>0.176</td><td>0.481</td><td>0.210</td></tr><tr><td>fr2/360_kidnap</td><td>0.564</td><td>0.579</td><td>0.430</td><td>0.421</td><td>0.357</td><td>0.745</td><td>0.468</td><td>X</td><td>0.582</td><td>0.384</td><td>0.605</td><td>0.371</td></tr><tr><td>fr3/cabinet</td><td>0.492</td><td>0.282</td><td>0.316</td><td>0.281</td><td>0.272</td><td>0.447</td><td>0.227</td><td>X</td><td>X</td><td>0.213</td><td>0.453</td><td>0.276</td></tr><tr><td>fr3/long_office_hou_valid</td><td>0.401</td><td>0.316</td><td>0.327</td><td>0.297</td><td>0.237</td><td>0.227</td><td>0.534</td><td>0.327</td><td>0.042</td><td>0.133</td><td>0.529</td><td>0.168</td></tr><tr><td>fr3/nostr_texture_near_loop</td><td>0.328</td><td>0.277</td><td>0.340</td><td>0.440</td><td>0.255</td><td>0.564</td><td>0.348</td><td>0.093</td><td>0.057</td><td>0.159</td><td>0.401</td><td>0.186</td></tr><tr><td>fr3/str_notexture FAR</td><td>0.227</td><td>0.258</td><td>0.235</td><td>0.216</td><td>0.177</td><td>0.505</td><td>0.175</td><td>0.543</td><td>X</td><td>0.104</td><td>0.432</td><td>0.201</td></tr><tr><td>fr3/str_notexture_near</td><td>0.235</td><td>0.198</td><td>0.217</td><td>0.204</td><td>0.128</td><td>0.603</td><td>0.218</td><td>0.481</td><td>X</td><td>0.207</td><td>0.579</td><td>0.224</td></tr></table>
288
+
289
+ Table 2. Quantitative evaluation of different methods pretrained on KITTI and tested on TUM-RGBD dataset. We evaluate relative pose error (RPE) which is presented as translational RMSE in [m/s]. LC: loop closure, X: fail. w/o RDS: without refined depth for online supervision. w/o PU: without online learned photometric uncertainty.
290
+
291
+ and challenging conditions. As shown in Table 2 and Fig. 5, learning-based baselines have large errors when confronted with significant domain shift and different motion patterns (from fast planar motion to small motion in $xyz$ axes). On the contrary, our method yields promising results due to fast online adaptation. Besides, our method is more robust than classic methods (ORB-SLAM2 [26] and DSO [7]) in textureless scenes, abrupt motion and illumination changes, indicating that it tends to find out robust correspondences and online learns depth/photometric uncertainty in challenging conditions.
292
+
293
+ # 4.4. Depth evaluation on KITTI and NYUv2
294
+
295
+ We demonstrate the effectiveness of using optimized $D_{k}^{\prime}$ for self-supervision by evaluating different single-view depth estimation methods on KITTI [13] and NYUv2 [30] datasets. We only use triangulation and Bayesian updating for training. During test, our method predicts single-view depth without refinement. As for KITTI, we take Eigen et al. [6] split for training and test. As for NYUv2, we use the raw training set and evaluate depth prediction results on labeled test set. The predicted depth is multiplied by a
296
+
297
+ scaling factor to match the median with ground truth [6].
298
+
299
+ Table 3, 4 and Fig. 6 show the depth evaluation results on KITTI and NYUv2 datasets. Benefiting from the patch-based depth triangulation and multi-frame refinement process, our method is able to synthesize refined depth for self-supervision. The learned depth is more accurate and preserves sharper edges with fine details than other methods. More qualitative results and analysis can be found in the supplementary materials.
300
+
301
+ # 4.5. Ablation studies
302
+
303
+ In order to demonstrate the effectiveness of each component, we present ablation studies on various versions of our method on KITTI, TUM and NYUv2 datasets (shown in Table 1, 2, 3, 4). 'w/o RDS' means without the final step of retraining both DepthNet and FlowNet. It can be seen that the performance of pose and depth estimation shows a considerable improvement when the refined depth is used for online training the DepthNet. Besides, it can be noticed that KITTI contains many moving objects (cars, people) and all these datasets have many sequences with changing camera exposure time. The online learned
304
+
305
+ <table><tr><td>Method</td><td>Supervision</td><td>Abs Rel</td><td>Sq Rel</td><td>RMSE</td><td>RMSE log</td><td>δ &lt; 1.25</td><td>δ &lt; 1.252</td><td>δ &lt; 1.253</td></tr><tr><td>SfMLearner [47]</td><td>-</td><td>0.208</td><td>1.768</td><td>6.856</td><td>0.283</td><td>0.678</td><td>0.885</td><td>0.957</td></tr><tr><td>Garg et al. [12]</td><td>stereo</td><td>0.169</td><td>1.080</td><td>5.104</td><td>0.273</td><td>0.740</td><td>0.904</td><td>0.962</td></tr><tr><td>Vid2Depth [24]</td><td>-</td><td>0.163</td><td>1.240</td><td>6.220</td><td>0.250</td><td>0.762</td><td>0.916</td><td>0.968</td></tr><tr><td>GeoNet [39]</td><td>-</td><td>0.155</td><td>1.296</td><td>5.857</td><td>0.233</td><td>0.793</td><td>0.931</td><td>0.973</td></tr><tr><td>Zhan et al. [41]</td><td>stereo</td><td>0.135</td><td>1.132</td><td>5.585</td><td>0.229</td><td>0.820</td><td>0.933</td><td>0.971</td></tr><tr><td>Mahjourian et al. [25]</td><td>-</td><td>0.163</td><td>1.240</td><td>6.220</td><td>0.250</td><td>0.762</td><td>0.916</td><td>0.968</td></tr><tr><td>SAVO [22]</td><td>-</td><td>0.150</td><td>1.127</td><td>5.564</td><td>0.229</td><td>0.823</td><td>0.936</td><td>0.974</td></tr><tr><td>SC-SfMLearner [1]</td><td>-</td><td>0.137</td><td>1.089</td><td>5.439</td><td>0.217</td><td>0.830</td><td>0.942</td><td>0.975</td></tr><tr><td>Zhao et al. [43]</td><td>-</td><td>0.113</td><td>0.704</td><td>4.581</td><td>0.184</td><td>0.871</td><td>0.961</td><td>0.984</td></tr><tr><td>Monodepth2 [15] (w/o pretrain)</td><td>-</td><td>0.132</td><td>1.044</td><td>5.142</td><td>0.210</td><td>0.845</td><td>0.948</td><td>0.977</td></tr><tr><td>Monodepth2 (ImageNet pretrain)</td><td>-</td><td>0.115</td><td>0.882</td><td>4.701</td><td>0.190</td><td>0.879</td><td>0.961</td><td>0.982</td></tr><tr><td>Ranjan et al. [28]</td><td>-</td><td>0.148</td><td>1.149</td><td>5.464</td><td>0.226</td><td>0.815</td><td>0.935</td><td>0.973</td></tr><tr><td>Ours (w/o RDS)</td><td>-</td><td>0.136</td><td>1.087</td><td>5.118</td><td>0.210</td><td>0.843</td><td>0.952</td><td>0.980</td></tr><tr><td>Ours (w/o PU)</td><td>-</td><td>0.115</td><td>0.799</td><td>4.282</td><td>0.253</td><td>0.882</td><td>0.965</td><td>0.981</td></tr><tr><td>Ours</td><td>-</td><td>0.106</td><td>0.701</td><td>4.129</td><td>0.210</td><td>0.889</td><td>0.967</td><td>0.984</td></tr></table>
306
+
307
+ ![](images/4ff5fcdb5b68250c9244b8ad96f027f2e3d73245b4c089ff267c6d667ec32c5e.jpg)
308
+ Input
309
+ Figure 6. Depth estimation results on KITTI dataset. Thanks to our triangulation process and multi-frame depth refinement, our method shows better predictions and preserves sharp edges while other methods tend to predict vague depth. Best viewed in color.
310
+
311
+ ![](images/31902b9e0d5865833e46d19bf6b6701b5fc8bb39bcf3381486e7efbfbdcec909.jpg)
312
+ GeoNet
313
+
314
+ ![](images/a024a9d2c0d0b312b6bd3292604ee6a43b3a0aed8aed3874c9f2ea2cdbacdab0.jpg)
315
+ SAVO
316
+
317
+ ![](images/e94f2262f3e4513b4c288175a8b4b03ce0a888e0696b8e3d3974d81931adaf01.jpg)
318
+ Monodepth2
319
+
320
+ ![](images/37bafb9a4e34e267a0375f848cc44bf4f5c6df990ee477b4355cedf54cfad9ef.jpg)
321
+ Ours
322
+
323
+ Table 3. Depth estimation results on KITTI dataset by Eigen et al. [6] split. The results are capped at 80 meters. As for error metrics Abs Rel, Seq Rel, RMSE and RMSE log, lower value is better; as for accuracy metrics $\delta$ ,higher value is better. w/o RDS: without refined depth for online supervision. w/o PU: without online learned photometric uncertainty.
324
+
325
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Rel</td><td rowspan="2">Error log10</td><td rowspan="2">RMSE</td><td colspan="3">Accuracy δ &lt; 1.25n</td></tr><tr><td>n = 1</td><td>n = 2</td><td>n = 3</td></tr><tr><td>Make3D [29]</td><td>0.349</td><td>-</td><td>1.214</td><td>0.447</td><td>0.745</td><td>0.987</td></tr><tr><td>Li et al. [20]</td><td>0.232</td><td>0.094</td><td>0.821</td><td>0.621</td><td>0.886</td><td>0.968</td></tr><tr><td>MS-CRF [36]</td><td>0.121</td><td>0.052</td><td>0.586</td><td>0.811</td><td>0.954</td><td>0.987</td></tr><tr><td>DORN [11]</td><td>0.115</td><td>0.051</td><td>0.509</td><td>0.828</td><td>0.965</td><td>0.992</td></tr><tr><td>Zhou et al. [46]</td><td>0.208</td><td>0.086</td><td>0.712</td><td>0.674</td><td>0.900</td><td>0.968</td></tr><tr><td>Zhao et al. [43]</td><td>0.201</td><td>0.085</td><td>0.708</td><td>0.687</td><td>0.903</td><td>0.968</td></tr><tr><td>P2Net* [40]</td><td>0.147</td><td>0.062</td><td>0.553</td><td>0.801</td><td>0.951</td><td>0.987</td></tr><tr><td>Ours (w/o RDS)</td><td>0.225</td><td>0.090</td><td>0.702</td><td>0.711</td><td>0.882</td><td>0.970</td></tr><tr><td>Ours (w/o PU)</td><td>0.142</td><td>0.087</td><td>0.631</td><td>0.784</td><td>0.923</td><td>0.976</td></tr><tr><td>Ours</td><td>0.139</td><td>0.071</td><td>0.528</td><td>0.805</td><td>0.967</td><td>0.989</td></tr></table>
326
+
327
+ Table 4. Depth estimation results on NYUv2 dataset. Supervised methods are shown in the first rows. *The inference resolution of $\mathrm{P^2Net}$ is $288\times 384$ with 5-frame left-right flipping augmentation.
328
+
329
+ photometric uncertainty (w/o PU) helps a lot on KITTI and TUM for pose estimation. We suggest readers to refer to supplementary materials for more qualitative comparisons.
330
+
331
+ # 5. Conclusions
332
+
333
+ In this paper, we propose an online adaptation framework for deep VO with the assistance of scene-agnostic geometric computations and Bayesian inference. The predicted single-view depth is continuously improved with incoming observations by Baysian depth filter. Meanwhile, we explicitly model depth and photometric uncertainties to deal with the observation noise. The optimized pose, depth and flow from differentiable Gauss-Newton layer are used for online self-supervision. Extensive experiments on various environment shifting demonstrate that our method has much better generalization ability than state-of-the-art learning-based VO methods.
334
+
335
+ Acknowledgments This work is supported by the National Key Research and Development Program of China (2017YFB1002601) and National Natural Science Foundation of China (61632003, 61771026).
336
+
337
+ # References
338
+
339
+ [1] Jiawang Bian, Zhichao Li, Naiyan Wang, Huangying Zhan, Chunhua Shen, Ming-Ming Cheng, and Ian Reid. Unsupervised Scale-Consistent Depth and Ego-Motion Learning From Monocular Video. In NeurIPS, 2019. 4328
340
+ [2] Tamara Broderick, Nicholas Boyd, Andre Wibisono, Ashia C Wilson, and Michael I Jordan. Streaming Variational Bayes. In NeurIPS, 2013. 4322
341
+ [3] Vincent Casser, Soeren Pirk, Reza Mahjourian, and Anelia Angelova. Depth Prediction without the Sensors: Leveraging Structure for Unsupervised Learning from Monocular Videos. In AAAI, 2019. 4321
342
+ [4] Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The Cityscapes Dataset for Semantic Urban Scene Understanding. In CVPR, 2016. 4322, 4325, 4326
343
+ [5] John Duchi, Elad Hazan, and Yoram Singer. Adaptive Subgradient Methods for Online Learning and Stochastic Optimization. Journal of Machine Learning Research, 12(Jul):2121-2159, 2011. 4322
344
+ [6] David Eigen, Christian Puhrsch, and Rob Fergus. Depth Map Prediction From a Single Image Using a Multi-Scale Deep Network. In NeurIPS, 2014. 4327, 4328
345
+ [7] Jakob Engel, Vladlen Koltun, and Daniel Cremers. Direct Sparse Odometry. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(3):611-625, 2018. 4321, 4322, 4325, 4327
346
+ [8] Jakob Engel, Thomas Schöps, and Daniel Cremers. LSD-SLAM: Large-Scale Direct Monocular SLAM. In ECCV, 2014. 4321, 4322
347
+ [9] Martin A Fischler and Robert C Bolles. Random Sample Consensus: a Paradigm for Model Fitting with Applications to Image Analysis and Automated Cartography. Communications of the ACM, 24(6):381-395, 1981. 4323
348
+ [10] Christian Forster, Matia Pizzoli, and Davide Scaramuzza. SVO: Fast Semi-Direct Monocular Visual Odometry. In ICRA, 2014. 4321, 4322, 4324
349
+ [11] Huan Fu, Mingming Gong, Chaohui Wang, Kayhan Batmanghelich, and Dacheng Tao. Deep Ordinal Regression Network for Monocular Depth Estimation. In CVPR, 2018. 4328
350
+ [12] Ravi Garg, Vijay Kumar Bg, Gustavo Carneiro, and Ian Reid. Unsupervised CNN for Single View Depth Estimation: Geometry to the Rescue. In ECCV, 2016. 4328
351
+ [13] Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are We Ready for Autonomous Driving? The KITTI Vision Benchmark Suite. In CVPR, 2012. 4322, 4325, 4326, 4327
352
+ [14] Andreas Geiger, Julius Ziegler, and Christoph Stiller. StereoScan: Dense 3D Reconstruction in Real-Time. In 2011 IEEE intelligent vehicles symposium (IV), 2011. 4326, 4327
353
+ [15] Clément Godard, Oisin Mac Aodha, Michael Firman, and Gabriel J Brostow. Digging into Self-Supervised Monocular Depth Estimation. In ICCV, 2019. 4322, 4325, 4328
354
+ [16] Richard I Hartley. In Defense of the Eight-Point Algorithm. PAMI, 19(6):580-593, 1997. 4322
355
+
356
+ [17] Mingxing Hu, Gordon Dodds, and Baozong Yuan. Evolutionary agents for epipolar geometry estimation. In ICIP, 2004. 4322
357
+ [18] Diederik P Kingma and Jimmy Ba. Adam: A method for Stochastic Optimization. In ICLR, 2015. 4325
358
+ [19] Vincent Lepetit, Francesc Moreno-Noguer, and Pascal Fua. Epnp: An Accurate O (n) Solution to the PnP Problem. IJCV, 81(2):155, 2009. 4322, 4323
359
+ [20] Bo Li, Chunhua Shen, Yuchao Dai, Anton Van Den Hengel, and Mingyi He. Depth and Surface Normal Estimation from Monocular Images Using Regression on Deep Features and Hierarchical CRFs. In CVPR, 2015. 4328
360
+ [21] Shunkai Li, Xin Wang, Yingdian Cao, Fei Xue, Zike Yan, and Hongbin Zha. Self-Supervised Deep Visual Odometry with Online Adaptation. In CVPR, 2020. 4321, 4322, 4326, 4327
361
+ [22] Shunkai Li, Fei Xue, Xin Wang, Zike Yan, and Hongbin Zha. Sequential Adversarial Learning for Self-Supervised Deep Visual Odometry. In ICCV, 2019. 4321, 4322, 4326, 4327, 4328
362
+ [23] Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Deep Transfer Learning with Joint Adaptation Networks. In ICML, 2017. 4322
363
+ [24] Reza Mahjourian, Martin Wicke, and Anelia Angelova. Unsupervised Learning of Depth and Ego-Motion from Monocular Video Using 3D Geometric Constraints. In CVPR, 2018. 4326, 4327, 4328
364
+ [25] Reza Mahjourian, Martin Wicke, and Anelia Angelova. Unsupervised Learning of Depth and Ego-Motion from Monocular Video Using 3D Geometric Constraints. In CVPR, 2018. 4328
365
+ [26] Raul Mur-Artal, Jose Maria Martinez Montiel, and Juan D Tardos. ORB-SLAM: A Versatile and Accurate Monocular SLAM System. IEEE Transactions on Robotics, 31(5):1147-1163, 2015. 4321, 4322, 4324, 4326, 4327
366
+ [27] Adam Paszke, Sam Gross, Soumith Chintala, and Gregory Chanan. PyTorch. https://github.com/pytorch/pytorch, 2017.4325
367
+ [28] Anurag Ranjan, Varun Jampani, Lukas Balles, Kihwan Kim, Deqing Sun, Jonas Wulff, and Michael J Black. Competitive Collaboration: Joint Unsupervised Learning of Depth, Camera Motion, Optical Flow and Motion Segmentation. In CVPR, 2019. 4322, 4325, 4328
368
+ [29] Ashutosh Saxena, Min Sun, and Andrew Y Ng. Make3D: Learning 3D Scene Structure from a Single Still Image. PAMI, 31(5):824-840, 2008. 4328
369
+ [30] Nathan Silberman, Derek Hoiem, Pushmeet Kohli, and Rob Fergus. Indoor segmentation and support inference from rgbd images. In ECCV, 2012. 4322, 4327
370
+ [31] Jürgen Sturm, Nikolas Engelhard, Felix Endres, Wolfram Burgard, and Daniel Cremers. A Benchmark for the Evaluation of RGB-D SLAM Systems. In IROS, 2012. 4322, 4325, 4326
371
+ [32] Zachary Teed and Jia Deng. RAFT: Recurrent All-Pairs Field Transforms for Optical Flow. In ECCV, 2020. 4323, 4325
372
+ [33] Sebastian Thrun. Lifelong learning algorithms. In Learning to learn, pages 181-209. Springer, 1998. 4322
373
+
374
+ [34] George Vogiatzis and Carlos Hernández. Video-Based, Real-Time Multi-View Stereo. Image and Vision Computing, 29(7):434-441, 2011. 4324
375
+ [35] Sen Wang, Ronald Clark, Hongkai Wen, and Niki Trigoni. DeepVO: Towards End-to-End Visual Odometry with Deep Recurrent Convolutional Neural Networks. In ICRA, 2017. 4322
376
+ [36] Dan Xu, Elisa Ricci, Wanli Ouyang, Xiaogang Wang, and Nicu Sebe. Multi-Scale Continuous CRFs as Sequential Deep networks for Monocular Depth Estimation. In CVPR, 2017. 4328
377
+ [37] Fei Xue, Xin Wang, Shunkai Li, Qiuyuan Wang, Junqiu Wang, and Hongbin Zha. Beyond Tracking: Selecting Memory and Refining Poses for Deep Visual Odometry. In CVPR, 2019. 4322
378
+ [38] Nan Yang, Lukas von Stumberg, Rui Wang, and Daniel Cremers. D3VO: Deep Depth, Deep Pose and Deep Uncertainty for Monocular Visual Odometry. In CVPR, 2020. 4327
379
+ [39] Zhichao Yin and Jianping Shi. GeoNet: Unsupervised Learning of Dense Depth, Optical Flow and Camera Pose. In CVPR, 2018. 4321, 4326, 4327, 4328
380
+ [40] Zehao Yu, Lei Jin, and Shenghua Gao. P2Net: Patch-match and Plane-regularization for Unsupervised Indoor Depth Estimation. In ECCV. 4328
381
+ [41] Huangying Zhan, Ravi Garg, Chamara Saroj Weerasekera, Kejie Li, Harsh Agarwal, and Ian Reid. Unsupervised Learning of Monocular Depth Estimation and Visual Odometry with Deep Feature Reconstruction. In CVPR, 2018. 4326, 4327, 4328
382
+ [42] Huangying Zhan, Chamara Saroj Weerasekera, Jiawang Bian, and Ian Reid. Visual Odometry Revisited: What Should be Learned? ICRA, 2020. 4323, 4326, 4327
383
+ [43] Wang Zhao, Shaohui Liu, Yezhi Shu, and Yong-Jin Liu. Towards Better Generalization: Joint Depth-Pose Learning without PoseNet. In CVPR, 2020. 4322, 4326, 4327, 4328
384
+ [44] Yiran Zhong, Hongdong Li, and Yuchao Dai. Open-World Stereo Video Matching with Deep RNN. In ECCV, 2018. 4321, 4322
385
+ [45] Huizhong Zhou, Benjamin Ummenhofer, and Thomas Brox. DeepTAM: Deep Tracking and Mapping. In ECCV, 2018. 4322
386
+ [46] Junsheng Zhou, Yuwang Wang, Kaihuai Qin, and Wenjun Zeng. Moving Indoor: Unsupervised Video Depth Learning in Challenging Environments. In ICCV, 2019. 4328
387
+ [47] Tinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised Learning of Depth and Ego-Motion from Video. In CVPR, 2017. 4321, 4322, 4324, 4328
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:709491ed1f19d70b329e833cca211e170a96e6949ba32570c35389f51d0d3d94
3
+ size 869163
generalizingtotheopenworlddeepvisualodometrywithonlineadaptation/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef17faf86adab67f9655ab4b632311b0fe477fc5ee9ed8dae7be6735d6058ff7
3
+ size 448618
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c332dba2f003849701a95bef4d42caff37f43fa1f8644562a14972ade7e0087
3
+ size 72638
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0cf35c937bc618f757472a931e2bd85661d96d0e68621b57a9c78a568d9bd64c
3
+ size 87843
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/82c87cc9-3101-48ac-af50-3482ddef1b26_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8516a2db423243044abffb6468a38c065be6d9454290baa0ae616180aa83a68
3
+ size 2088104
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/full.md ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generating Diverse Structure for Image Inpainting With Hierarchical VQ-VAE
2
+
3
+ Jialun Peng $^{1}$ Dong Liu $^{1*}$
4
+
5
+ Songcen Xu² Houqiang Li¹
6
+
7
+ <sup>1</sup> University of Science and Technology of China <sup>2</sup> Noah's Ark Lab, Huawei Technologies Co., Ltd.
8
+
9
+ pjl@mail.ustc.edu.cn, {dongeliu, lihq}@ustc.edu.cn, xusongcen@huawei.com
10
+
11
+ # Abstract
12
+
13
+ Given an incomplete image without additional constraint, image inpainting natively allows for multiple solutions as long as they appear plausible. Recently, multiple-solution inpainting methods have been proposed and shown the potential of generating diverse results. However, these methods have difficulty in ensuring the quality of each solution, e.g. they produce distorted structure and/or blurry texture. We propose a two-stage model for diverse inpainting, where the first stage generates multiple coarse results each of which has a different structure, and the second stage refines each coarse result separately by augmenting texture. The proposed model is inspired by the hierarchical vector quantized variational auto-encoder (VQ-VAE), whose hierarchical architecture disentangles structural and textural information. In addition, the vector quantization in VQ-VAE enables autoregressive modeling of the discrete distribution over the structural information. Sampling from the distribution can easily generate diverse and high-quality structures, making up the first stage of our model. In the second stage, we propose a structural attention module inside the texture generation network, where the module utilizes the structural information to capture distant correlations. We further reuse the VQ-VAE to calculate two feature losses, which help improve structure coherence and texture realism, respectively. Experimental results on CelebA-HQ, Places2, and ImageNet datasets show that our method not only enhances the diversity of the inpainting solutions but also improves the visual quality of the generated multiple images. Code and models are available at: https://github.com/USTC-JialunPeng/Diverse-Structure-Inpainting.
14
+
15
+ # 1. Introduction
16
+
17
+ Image inpainting refers to the task of filling in the missing region of an incomplete image so as to produce a complete and visually plausible image. Inpainting benefits a se
18
+
19
+ ![](images/d7843f9d6459b5a17fad17f2bebaa358f0a9888a625534a0afd2fdfd2323a52d.jpg)
20
+
21
+ ![](images/341c6d5b465e3ade5b41aa56f6b48b7ddf20872de38939c5e9474721d14a12d7.jpg)
22
+
23
+ ![](images/7b702a2794551c23db4447f61bdd1cdad9be870481f9ed67a9f9b52f4d10c09f.jpg)
24
+
25
+ ![](images/782ed5a0ae36af794b776912e67f2a8aca2b87f9326fb2bed6371053f2e8423a.jpg)
26
+
27
+ ![](images/c0ca53a1766d3a2519ac9a3e12dfe88c31332553ecc2c2cb528fe08d110e7c5c.jpg)
28
+ Figure 1. (Top) Input incomplete image, where the missing region is depicted in gray. (Middle) Visualization of the generated diverse structures. (Bottom) Output images of our method.
29
+
30
+ ![](images/6dbd01556ca90935a45ce0dee4e521bb3fc6fe0ff2052c86c3888c097a948ccd.jpg)
31
+
32
+ ![](images/ec0fc8e34c3422b97853891b66474f4adf1f38316c01915f715e191aa5178e2e.jpg)
33
+
34
+ ries of applications including object removal, photo restoration, and transmission error concealment. As an ill-posed problem, inpainting raises a great challenge especially when the missing region is large and contains complex content. As such, inpainting has attracted much research attention.
35
+
36
+ Recently, a series of deep learning-based methods are proposed for inpainting [10, 19]. They usually employ encoder-decoder architectures and train the networks with the combinations of reconstruction and adversarial losses. To enhance the visual quality of the results, a number of studies [23, 26, 32, 34, 36] adopt the contextual attention mechanisms to use the available content for generating the missing content. Also, several studies [13, 33, 35] propose modified convolutions in replacement of normal convolutions to reduce the artifacts.
37
+
38
+ The aforementioned methods all learn a deterministic mapping from an incomplete image to a complete im
39
+
40
+ age. However, in practice, the solution to inpainting is not unique. Without additional constraint, multiple inpainting results are equally/similarly plausible for an incomplete image, especially when the missing region is large and contains complex content (e.g. Figure 1). Moreover, for typical applications, providing multiple inpainting results may enable the user to select from them according to his/her own preference. It then motivates the design for multiple-solution inpainting.
41
+
42
+ In contrast to single-solution methods, multiple-solution inpainting shall build a probabilistic model of the missing content conditioned on the available content. Several recent studies [38, 39] employ variational auto-encoder (VAE) architectures and train the networks with the combinations of Kullback-Leibler (KL) divergences and adversarial losses. VAE-based methods [38, 39] assume a Gaussian distribution over continuous latent variables. Sampling from the Gaussian distribution presents diverse latent features and leads to diverse inpainted images. Although these methods can generate multiple solutions, some of their solutions are of low quality due to distorted structures and/or blurry textures. It may be attributed to the limitation of the parametric (e.g. Gaussian) distribution when we try to model the complex natural image content. In addition, recent studies more and more demonstrate the importance of structural information, e.g. segmentation maps [12, 27], edges [17, 30], and smooth images [14, 21], for guiding image inpainting. Such structural information is yet to be incorporated into multiple-solution inpainting. Thus, VAE-based methods [38, 39] tend to produce multiple results with limited structural diversity, which is called posterior collapse in [29].
43
+
44
+ In this paper we try to address the limitations of the existing multiple-solution inpainting methods. First, instead of parametric distribution modeling of continuous variables, we resort to autoregressive modeling of discrete variables. Second, we want to generate multiple structures in an explicit fashion, and then base the inpainting upon the generated structure. We find that the hierarchical vector quantized VAE (VQ-VAE) [20] is suitable for our study<sup>1</sup>. First, there is a vector quantization step in VQ-VAE making the latent variables to be all discrete; as noted in [29], these discrete latent variables allow the usage of powerful decoders to avoid the posterior collapse. Second, the hierarchical layout encourages the split of the image information into global and local parts; with proper design, it may disentangle structural features from textural features of an image.
45
+
46
+ Based on the hierarchical VQ-VAE, we propose a two-stage model for multiple-solution inpainting. The first stage is known as diverse structure generator, where sampling from a conditional autoregressive distribution pro
47
+
48
+ duces multiple sets of structural features. The second stage is known as texture generator, where an encoder-decoder architecture is used to produce a complete image based on the guidance of a set of structural features. Note that each set of the generated structural features leads to a complete image (see Figure 1).
49
+
50
+ The main contributions we have made in this paper can be summarized as follows:
51
+
52
+ - We propose a multiple-solution image inpainting method based on hierarchical VQ-VAE. The method has two distinctions from previous multiple-solution methods: first, the model learns an autoregressive distribution over discrete latent variables; second, the model splits structural and textural features.
53
+ - We propose to learn a conditional autoregressive network for the distribution over structural features. The network manages to generate reasonable structures with high diversity.
54
+ - For texture generation we propose a structural attention module to capture distant correlations of structural features. We also propose two new feature losses to improve structure coherence and texture realism.
55
+ - Extensive experiments on three benchmark datasets including CelebA-HQ, Places2, and ImageNet demonstrate the superiority of our proposed method in both quality and diversity.
56
+
57
+ # 2. Related Work
58
+
59
+ # 2.1. Image Inpainting
60
+
61
+ Traditional image inpainting methods such as diffusion-based methods [1, 4] and patch-based methods [2, 5, 7, 8] borrow image-level patches from source images to fill in the missing regions. They are unable to generate unique content not found in the source images. Furthermore, these methods often generate unreasonable results without considering high-level semantics of the images.
62
+
63
+ Recently, learning-based methods which use deep convolutional networks are proposed to semantically predict the missing regions. Pathak et al. [19] first apply adversarial learning to the image inpainting. Iizuka et al. [10] introduce an extra discriminator to enforce the local consistency. Yan et al. [32] and Yu et al. [34] propose patch-swap and contextual attention to make use of distant feature patches for the higher inpainting quality. Liu et al. [13] and Yu et al. [35] introduce partial convolutions and gated convolutions to reduce visual artifacts caused by normal convolutions. In order to generate reasonable structures and realistic textures, Nazeri et al. [17] and Xu et al. [31] use edge maps as structural information to guide image inpainting. Ren et al. [21] propose to use edge-preserved smooth images instead of edge maps. Liu et al. [14] propose feature equalizations to improve the consistency between the structure and the texture. However, these learning-based meth
64
+
65
+ ods only generate one optimal result for each incomplete input. They focus on reconstructing ground truth rather than creating plausible results.
66
+
67
+ To obtain multiple inpainting solutions, Zheng et al. [39] propose a VAE-based model with two parallel paths, which trades off between reconstructing ground truth and maintaining the diversity of the inpainting results. Zhao et al. [38] propose a similar VAE-based model which uses instance images to improve the diversity. However, these methods do not effectively separate the structural and textural information, they often produce distorted structures and/or blurry textures.
68
+
69
+ # 2.2. VQ-VAE and Autoregressive Networks
70
+
71
+ The vector quantized variational auto-encoder (VQ-VAE) [29] is a discrete latent VAE model which relies on vector quantization layers to model discrete latent variables. The discrete latent variables allow a powerful autoregressive network such as PixelCNN [6, 18, 25, 28] to model latents without worrying about the posterior collapse problem [29]. Razavi et al. [20] propose a hierarchical VQ-VAE which uses a hierarchy of discrete latent variables to separate the structural and textural information. Then they use two PixelCNNs to model structural and textural information, respectively. However, the PixelCNNs are conditioned on the class label for image generation, while there is no class label in the image inpainting task. Besides, the generated textures of the PixelCNNs lack fine-grained details due to the lossy nature of VQ-VAE. It relieves the generation model from modeling negligible information, but it hinders the inpainting model from generating realistic textures consistent with the known regions. The PixelCNNs are thus not practical for image inpainting.
72
+
73
+ # 3. Method
74
+
75
+ As shown in Figure 2, the pipeline of our method consists of three parts: hierarchical VQ-VAE $E_{vq} - D_{vq}$ , diverse structure generator $G_{s}$ and texture generator $G_{t}$ . The hierarchical encoder $E_{vq}$ disentangles discrete structural features and discrete textural features of the ground truth $\mathbf{I}_{\mathrm{gt}}$ and the decoder $D_{vq}$ outputs the reconstructed image $\mathbf{I}_{\mathrm{r}}$ . The diverse structure generator $G_{s}$ produces diverse discrete structural features given an input incomplete image $\mathbf{I}_{\mathrm{in}}$ . The texture generator $G_{t}$ synthesizes the image texture given the discrete structural features and outputs the completion result $\mathbf{I}_{\mathrm{comp}}$ . We also use the pre-trained $E_{vq}$ as an auxiliary evaluator to define two novel feature losses for better visual quality of the completion result.
76
+
77
+ # 3.1. Hierarchical VQ-VAE
78
+
79
+ In order to disentangle structural and textural information, we pre-train a hierarchical VQ-VAE $E_{vq} - D_{vq}$ following [20]. The hierarchical encoder $E_{vq}$ maps ground truth
80
+
81
+ $\mathbf{I}_{\mathrm{gt}}$ onto structural features $\mathbf{s}_{\mathrm{gt}}$ and textural features $\mathbf{t}_{\mathrm{gt}}$ . The processing of $E_{vq}$ can be written as $(\mathbf{s}_{\mathrm{gt}},\mathbf{t}_{\mathrm{gt}}) = E_{vq}(\mathbf{I}_{\mathrm{gt}})$ . These features are then quantized to discrete features by two vector quantization layers. Each vector quantization layer has $K = 512$ prototype vectors in its codebook and the vector dimensionality is $D = 64$ . As such, each vector of features is replaced by the nearest prototype vector based on Euclidean distance. The processing of vector quantization can be written as $\bar{\mathbf{s}}_{\mathrm{gt}} = VQ_s(\mathbf{s}_{\mathrm{gt}})$ and $\bar{\mathbf{t}}_{\mathrm{gt}} = VQ_t(\mathbf{t}_{\mathrm{gt}})$ . Finally, the decoder $D_{vq}$ reconstructs image from these two sets of discrete features. The processing of $D_{vq}$ can be written as $\mathbf{I}_{\mathrm{r}} = D_{vq}(\bar{\mathbf{s}}_{\mathrm{gt}},\bar{\mathbf{t}}_{\mathrm{gt}})$ .
82
+
83
+ The reconstruction loss of $E_{vq} - D_{vq}$ is defined as:
84
+
85
+ $$
86
+ \mathcal {L} _ {\ell_ {2}} = \left\| \mathbf {I} _ {\mathrm {r}} - \mathbf {I} _ {\mathrm {g t}} \right\| _ {2} ^ {2} \tag {1}
87
+ $$
88
+
89
+ To back-propagate the gradient of the reconstruction loss through vector quantization, we use the straight-through gradient estimator [3]. The codebook prototype vectors are updated using the exponential moving average of the encoder output. As proposed in [29], we also use two commitment losses $\mathcal{L}_{sc}$ and $\mathcal{L}_{tc}$ to align the encoder output with the codebook prototype vectors for stable training. The commitment loss of structural features is defined as:
90
+
91
+ $$
92
+ \mathcal {L} _ {s c} = \left\| \mathbf {s} _ {\mathrm {g t}} - s g \left[ \bar {\mathbf {s}} _ {\mathrm {g t}} \right] \right\| _ {2} ^ {2} \tag {2}
93
+ $$
94
+
95
+ where $sg$ denotes the stop-gradient operator [29]. The commitment loss of textural features (denoted as $\mathcal{L}_{tc}$ ) is similar to $\mathcal{L}_{sc}$ . The total loss of $E_{vq} - D_{vq}$ is defined as:
96
+
97
+ $$
98
+ \mathcal {L} _ {v q} = \alpha_ {\ell_ {2}} \mathcal {L} _ {\ell_ {2}} + \alpha_ {c} \left(\mathcal {L} _ {s c} + \mathcal {L} _ {t c}\right) \tag {3}
99
+ $$
100
+
101
+ where $\alpha_{\ell_2}$ and $\alpha_{c}$ are loss weights.
102
+
103
+ For $256 \times 256$ images, the size of structural features is $32 \times 32$ and that of textural features is $64 \times 64$ . We visualize their discrete representations using the decoder $D_{vq}$ . The visualized results can be written as $D_{vq}(\overline{\mathbf{s}}_{\mathrm{gt}}, \mathbf{0})$ and $D_{vq}(\mathbf{0}, \overline{\mathbf{t}}_{\mathrm{gt}})$ , where $\mathbf{0}$ is a zero tensor. As shown in Figure 2, the structural features model global information such as shapes and colors, and the textural features model local information such as details and textures.
104
+
105
+ # 3.2. Diverse Structure Generator
106
+
107
+ Previous multiple-solution inpainting methods [38, 39] often produce distorted structures and/or blurry textures, suggesting that these methods struggle to recover the structure and the texture simultaneously. Therefore, we first propose a diverse structure generator $G_{s}$ which uses an autoregressive network to formulate a conditional distribution over the discrete structural features. Sampling from the distribution can produce diverse structural features.
108
+
109
+ Similar to the PixelCNN in [20], our autoregressive network consists of 20 residual gated convolution layers and
110
+
111
+ ![](images/72d449393f820515117229363c05b589fca3a2375a87ac769ea947319f8ff43d.jpg)
112
+ Figure 2. Overview of the proposed method. (Top) Hierarchical vector quantized variational auto-encoder (VQ-VAE) consists of hierarchical encoder $E_{vq}$ and decoder $D_{vq}$ . $E_{vq}$ extracts discrete structural features $\bar{\mathbf{s}}_{\mathrm{gt}}$ and discrete textural features $\bar{\mathbf{t}}_{\mathrm{gt}}$ . $D_{vq}$ reconstructs the image from these two sets of discrete features. (Middle) Diverse structure generator $G_{s}$ models the conditional distribution over the discrete structural features by using an autoregressive network, where $\bar{\mathbf{s}}_{\mathrm{gt}}$ is used to calculate the loss $\mathcal{L}_{NLL}$ . During inference, sampling from the distribution can generate multiple possible structural features $\bar{\mathbf{s}}_{\mathrm{gen}}$ . (Bottom) Texture generator $G_{t}$ synthesizes the image texture given the discrete structural features $(\bar{\mathbf{s}}_{\mathrm{gt}}$ in the training and $\bar{\mathbf{s}}_{\mathrm{gen}}$ in the inference). The pre-trained $E_{vq}$ is used as an auxiliary evaluator to improve image quality, where $\bar{\mathbf{s}}_{\mathrm{gt}}$ and $\bar{\mathbf{t}}_{\mathrm{gt}}$ are used to calculate the losses $\mathcal{L}_{sf}$ and $\mathcal{L}_{tf}$ . During training, the hierarchical VQ-VAE is firstly trained, and then $G_{s}$ and $G_{t}$ are trained individually. During inference, only $G_{s}$ and $G_{t}$ are used.
113
+
114
+ 4 casual multi-headed attention layers. Since the PixelCNN in [20] is conditioned on the class label for the image generation task, we make two modifications to make it practical for the image inpainting task. First, we stack gated convolution layers to map the input incomplete image $\mathbf{I}_{\mathrm{in}}$ and its binary mask $\mathbf{M}$ to a condition. The condition is injected into each residual gated convolution layer of the autoregressive network. Second, we use a light-weight autoregressive network by reducing both the hidden units and the residual units to 128 for efficiency.
115
+
116
+ During training, $G_{s}$ utilizes the input incomplete image as the condition and models the conditional distribution over $\bar{\mathbf{s}}_{\mathrm{gt}}$ . This distribution can be written as $p_{\theta}(\bar{\mathbf{s}}_{\mathrm{gt}}|\mathbf{I}_{\mathrm{in}},\mathbf{M})$ , where $\theta$ denotes network parameters of $G_{s}$ . The training loss of $G_{s}$ is defined as the negative log likelihood of $\bar{\mathbf{s}}_{\mathrm{gt}}$ :
117
+
118
+ $$
119
+ \mathcal {L} _ {N L L} = - \mathbb {E} _ {\mathbf {I} _ {\mathrm {g t}} \sim p _ {d a t a}} \left[ \log p _ {\theta} (\bar {\mathbf {s}} _ {\mathrm {g t}} | \mathbf {I} _ {\mathrm {i n}}, \mathbf {M}) \right] \tag {4}
120
+ $$
121
+
122
+ where $p_{data}$ denotes the distribution of training dataset. During inference, $G_{s}$ utilizes the input incomplete image
123
+
124
+ as condition and outputs a conditional distribution for generating structural features. This distribution can be written as $p_{\theta}(\bar{\mathbf{s}}_{\mathrm{gen}}|\mathbf{I}_{\mathrm{in}},\mathbf{M})$ . Sampling from $p_{\theta}(\bar{\mathbf{s}}_{\mathrm{gen}}|\mathbf{I}_{\mathrm{in}},\mathbf{M})$ sequentially can generate diverse discrete structural features $\bar{\mathbf{s}}_{\mathrm{gen}}$ .
125
+
126
+ Due to the low-resolution of structural features, our diverse structure generator can better capture global information. It thus helps generate reasonable global structures. In addition, the training objective of our diverse structure generator is to maximize likelihood of all samples in the training set without any additional loss. Thus, the generated structures do not suffer from GAN's known shortcomings such as mode collapse and lack of diversity.
127
+
128
+ # 3.3. Texture Generator
129
+
130
+ Network Architecture. After obtaining the generated structural features $\bar{\mathbf{s}}_{\mathrm{gen}}$ , our texture generator $G_{t}$ synthesizes the image texture based on the guidance of $\bar{\mathbf{s}}_{\mathrm{gen}}$ . The network architecture of $G_{t}$ is similar to the refine network in [33]. As shown in Figure 2, the network architecture consists of gated convolutions and dilated convolutions. Unlike
131
+
132
+ existing inpainting methods, our texture generator $G_{t}$ utilizes the given structural features as guidance. The structural features are not only input to the first few layers of $G_{t}$ , but also input to our structural attention module. The proposed structural attention module borrows distant information based on the correlations of the structural features. It thus ensures that the synthesized texture is consistent with the generated structure.
133
+
134
+ Let $\mathbf{I}_{\mathrm{out}}$ denote the output of $G_{t}$ . The final completion result $\mathbf{I}_{\mathrm{comp}}$ is the output $\mathbf{I}_{\mathrm{out}}$ with the non-masked pixels directly set to ground truth. During training, $G_{t}$ takes the ground truth structural features $\bar{\mathbf{s}}_{\mathrm{gt}}$ as input so that $\mathbf{I}_{\mathrm{comp}}$ is the reconstruction of ground truth. During inference, $G_{t}$ takes the generated structural features $\bar{\mathbf{s}}_{\mathrm{gen}}$ as input so that $\mathbf{I}_{\mathrm{comp}}$ is the inpainting result.
135
+
136
+ Structural Attention Module. Attention modules are widely used in the existing image inpainting methods. They generally calculate the attention scores on a low-resolution intermediate feature map of the network. However, due to the lack of direct supervision on the attention scores, the learned attention is insufficiently reliable [41]. These attention modules may refer to unsuitable features, resulting in poor inpainting quality. To address this problem, we propose a structural attention module which directly calculates the attention scores on the structural features. Intuitively, regions with similar structures should have similar textures. Calculating the attention scores on the structural features can model accurate long-range correlations of structural information, thereby improving the consistency between the synthesized texture and the generated structure.
137
+
138
+ In addition, the attention modules in the existing image inpainting methods distinguish the foreground features and the background features using the down-sampled mask. This hand-crafted design may incorrectly divide the feature map and produce artifacts in the inpainting result. Therefore, our structural attention module calculates full attention scores on the structural features. Unlike the foreground-background cross attention that only models correlations between the foreground and the background, our full attention learns full correlations regardless of the feature division. It thus maintains the global consistency of the inpainting result. Moreover, our full attention does not increase the amount of calculation compared to the cross attention.
139
+
140
+ Like [33], our structural attention module consists of an attention computing step and an attention transfer step. The attention computing step extracts $3 \times 3$ patches from the input structural features. Then, the truncated distance similarity score [23] between the patches at $(x,y)$ and $(x',y')$ is defined as:
141
+
142
+ $$
143
+ \tilde {d} _ {(x, y), \left(x ^ {\prime}, y ^ {\prime}\right)} = \tanh \left(- \left(\frac {d _ {(x , y) , \left(x ^ {\prime} , y ^ {\prime}\right)} - m}{\sigma}\right)\right) \tag {5}
144
+ $$
145
+
146
+ where $d_{(x,y),(x',y')}$ is the Euclidean distance, $m$ and $\sigma$ are the mean value and the standard deviation of $d_{(x,y),(x',y')}$ .
147
+
148
+ The truncated distance similarity scores are applied by a scaled sotfmax layer to output full attention scores:
149
+
150
+ $$
151
+ s _ {(x, y), \left(x ^ {\prime}, y ^ {\prime}\right)} ^ {*} = \operatorname {s o f t m a x} \left(\lambda_ {1} \tilde {d} _ {(x, y), \left(x ^ {\prime}, y ^ {\prime}\right)}\right) \tag {6}
152
+ $$
153
+
154
+ where $\lambda_{1} = 50$ . After obtaining the full attention scores from the structural features, the attention transfer step reconstructs lower-level feature maps $(P^{l})$ by using the full attention scores as weights:
155
+
156
+ $$
157
+ q _ {(x ^ {\prime}, y ^ {\prime})} ^ {l} = \sum_ {x, y} s _ {(x, y), (x ^ {\prime}, y ^ {\prime})} ^ {*} p _ {(x, y)} ^ {l} \tag {7}
158
+ $$
159
+
160
+ where $l \in (1,2)$ is the layer number and $p_{(x,y)}^{l}$ is the patch of $P^l$ , and $q_{(x',y')}^{l}$ is the patch of the reconstructed feature map. The size of patches varies according to the size of feature map like [33]. Finally, the reconstructed feature maps supplement the decoder of $G_t$ via skip connections.
161
+
162
+ Training Losses. The total loss of $G_{t}$ consists of a reconstruction loss, an adversarial loss, and two feature losses. The reconstruction loss of $G_{t}$ is defined as:
163
+
164
+ $$
165
+ \mathcal {L} _ {\ell_ {1}} = \left\| \mathbf {I} _ {\text {o u t}} - \mathbf {I} _ {\mathrm {g t}} \right\| _ {1} \tag {8}
166
+ $$
167
+
168
+ We use SN-PatchGAN [35] as our discriminator $D_{t}$ . The hinge version of the adversarial loss for $D_{t}$ is defined as:
169
+
170
+ $$
171
+ \begin{array}{l} \mathcal {L} _ {d} = \mathbb {E} _ {\mathbf {I} _ {\mathrm {g t}} \sim p _ {d a t a}} \left[ \operatorname {R e L U} \left(1 - D _ {t} \left(\mathbf {I} _ {\mathrm {g t}}\right)\right) \right] \tag {9} \\ + \mathbb {E} _ {\mathbf {I} _ {\mathrm {c o m p}} \sim p _ {z}} [ \mathrm {R e L U} (1 + D _ {t} (\mathbf {I} _ {\mathrm {c o m p}})) ] \\ \end{array}
172
+ $$
173
+
174
+ where $p_z$ denotes the distribution of the inpainting results. The adversarial loss for $G_{t}$ is defined as:
175
+
176
+ $$
177
+ \mathcal {L} _ {a d v} = - \mathbb {E} _ {\mathbf {I} _ {\mathrm {c o m p}} \sim p _ {z}} \left[ D _ {t} \left(\mathbf {I} _ {\mathrm {c o m p}}\right) \right] \tag {10}
178
+ $$
179
+
180
+ Some inpainting methods such as [13, 14] use the pretrained VGG-16 as an auxiliary evaluator to improve the perceptual quality of the results. They define a perceptual loss and a style loss based on the VGG features to train the generator. Inspired by these feature losses, we propose two novel feature losses by reusing our pre-trained hierarchical encoder $E_{vq}$ as an auxiliary evaluator. As shown in Figure 2, $E_{vq}$ maps $\mathbf{I}_{\mathrm{comp}}$ onto structural features $\mathbf{s}_{\mathrm{comp}}$ and textural features $\mathbf{t}_{\mathrm{comp}}$ . The structural feature loss of $G_{t}$ is defined as the multi-class cross-entropy between $\mathbf{s}_{\mathrm{comp}}$ and $\overline{\mathbf{s}}_{\mathrm{gt}}$ :
181
+
182
+ $$
183
+ \mathcal {L} _ {s f} = - \sum_ {i, j} I _ {i j} \log \left(\operatorname {s o f t m a x} \left(\lambda_ {2} \tilde {d} _ {i j}\right)\right) \tag {11}
184
+ $$
185
+
186
+ Here, we set $\lambda_{2} = 10$ . $\tilde{d}_{ij}$ denotes the truncated distance similarity score between the $i^{th}$ feature vector of $\mathbf{s}_{\mathrm{comp}}$ and the $j^{th}$ prototype vector of the structural codebook. $I_{ij}$ is an indicator of the prototype vector class. $I_{ij} = 1$ when the $i^{th}$ feature vector of $\bar{\mathbf{s}}_{\mathrm{gt}}$ belongs to the $j^{th}$ class of the structural codebook, otherwise $I_{ij} = 0$ . The textural feature loss (denoted as $\mathcal{L}_{tf}$ ) is similar to $\mathcal{L}_{sf}$ . The total loss of $G_{t}$ is defined as:
187
+
188
+ $$
189
+ \mathcal {L} _ {t g} = \alpha_ {\ell 1} \mathcal {L} _ {\ell 1} + \alpha_ {a d v} \mathcal {L} _ {a d v} + \alpha_ {f} \left(\mathcal {L} _ {s f} + \mathcal {L} _ {t f}\right) \tag {12}
190
+ $$
191
+
192
+ where $\alpha_{\ell 1}$ , $\alpha_{adv}$ , and $\alpha_{f}$ are loss weights.
193
+
194
+ ![](images/3405894268c98c822b802b0ccdbabddbe5978336899f7c177d6e42a700fb025b.jpg)
195
+ Figure 3. Qualitative comparison results on two test images of CelebA-HQ. For each group, from top to bottom, from left to right, the pictures are: incomplete image, results of CA [34], GC [35], CSA [15], SF [21], FE [14], results of PIC [39] (with blue box), results of UCTGAN [38] (with green box), and results of our method (with red box).
196
+
197
+ ![](images/eeb0a2671949b454fed2ecffe2c8335a4f6be33518cf7069b64dbb0c683426de.jpg)
198
+ Figure 4. Qualitative comparison results on two test images of Places2. For each group, from top to bottom, from left to right, the pictures are: incomplete image, results of CA [34], GC [35], CSA [15], SF [21], FE [14], results of PIC [39] (with blue box), results of UCTGAN [38] (with green box), and results of our method (with red box).
199
+
200
+ <table><tr><td></td><td>Method</td><td>PSNR\( ^\uparrow \)</td><td>SSIM\( ^\uparrow \)</td><td>IS\( ^\uparrow \)</td><td>MIS\( ^\uparrow \)</td><td>FID\( ^\downarrow \)</td></tr><tr><td rowspan="5">Single-Solution</td><td>CA [34]</td><td>23.65</td><td>0.8525</td><td>3.206</td><td>0.0207</td><td>16.64</td></tr><tr><td>GC [35]</td><td>25.23</td><td>0.8713</td><td>3.384</td><td>0.0235</td><td>12.24</td></tr><tr><td>CSA [15]</td><td>25.26</td><td>0.8840</td><td>3.408</td><td>0.0199</td><td>11.78</td></tr><tr><td>SF [21]</td><td>25.05</td><td>0.8717</td><td>3.360</td><td>0.0229</td><td>10.59</td></tr><tr><td>FE [14]</td><td>24.10</td><td>0.8632</td><td>3.357</td><td>0.0240</td><td>10.73</td></tr><tr><td rowspan="3">Multiple-Solution</td><td>PIC [39]</td><td>23.93</td><td>0.8567</td><td>3.357</td><td>0.0225</td><td>11.70</td></tr><tr><td>UCTGAN [38]</td><td>24.39</td><td>0.8603</td><td>3.342</td><td>0.0237</td><td>11.74</td></tr><tr><td>Ours</td><td>24.56</td><td>0.8675</td><td>3.456</td><td>0.0245</td><td>9.784</td></tr></table>
201
+
202
+ Table 1. Quantitative comparison of different methods on the CelebA-HQ test set. For multiple-solution methods, we sample 50 images for each incomplete image and report the average result. Note that PSNR and SSIM are full-reference metrics that compare the generated image with the ground truth, but IS, MIS, and FID are not. For each metric, the best score is highlighted in bold, and the best score within the other category is highlighted in red.
203
+
204
+ # 4. Experiments
205
+
206
+ # 4.1. Implementation Details
207
+
208
+ Our model is implemented in TensorFlow v1.12 and trained on two NVIDIA 2080 Ti GPUs. The batch size is 8. During optimization, the weights of different losses are set to $\alpha_{\ell_1} = \alpha_{\ell_2} = \alpha_{adv} = 1$ , $\alpha_c = 0.25$ , $\alpha_f = 0.1$ . We use the Adam optimizer to train the three parts of our model. The learning rate of $E_{vq} - D_{vq}$ is $10^{-4}$ . The learning rate of $G_s$ follows the linear warm-up and square-root decay schedule used in [20]. The learning rate of $G_t$ is $10^{-4}$ and $\beta_1 = 0.5$ . We also use polyak exponential moving average (EMA) decay of 0.9997 when training $E_{vq} - D_{vq}$ and $G_s$ . Each part is trained for 1M iterations. During training, $E_{vq} - D_{vq}$ is firstly trained, and then $G_s$ and $G_t$ are trained individually. During inference, only $G_s$ and $G_t$ are used.
209
+
210
+ # 4.2. Performance Evaluation
211
+
212
+ We evaluate our method on three datasets including CelebA-HQ [11], Places2 [40], and ImageNet [22]. We use the original training, testing, and validation splits for these three datasets. For CelebA-HQ, training images are downsampled to $256 \times 256$ and data augmentation is adopted. For Places2 and ImageNet, training images are randomly cropped to $256 \times 256$ . The missing regions of the incomplete images can be regular or irregular. We compare our method with state-of-the-art single-solution and multiple-solution inpainting methods. The single-solution methods among them are CA [34], GC [35], CSA [15], SF [21] and FE [14]. The multiple-solution methods among them are PIC [39] and UCTGAN [38]
213
+
214
+ Qualitative Comparisons. Figure 3 and Figure 4 show the qualitative comparison results of center-hole inpainting on CelebA-HQ and Places2, respectively. It is difficult for CA [34], GC [35] and CSA [15] to generate reasonable structures without structural information acts as prior knowledge. SF [21] and FE [14] use edge-preserved smooth images to guide structure generation. However, they strut
215
+
216
+ gle to synthesize fine-grained textures, which indicates that their structural information provides limited help to texture generation. PIC [39] and UCTGAN [38] show high diversity. But their results are of low quality, especially for the challenging Places2 test images. Compared to these methods, the results of our method have more reasonable structures and more realistic textures, e.g. fine-grained hair and eyebrows in Figure 3. In addition, the diversity of our method is enhanced, e.g. different eye colors in Figure 3 and varying window sizes in Figure 4. More qualitative results and analyses of artifacts are presented in the supplementary material.
217
+
218
+ Quantitative Comparisons. Following previous image inpainting methods, we use common evaluation metrics such as peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) to measure the similarity between the inpainting result and ground truth. However, these full-reference metrics are not suitable for the image inpainting task because there are multiple plausible solutions for an incomplete image. The image inpainting methods are supposed to focus on generating realistic results rather than merely approximating ground truth. Therefore, we also use Inception Score (IS) [24], Modified Inception Score (MIS) [38], and Fréchet Inception Distance (FID) [9] as perceptual quality metrics. These metrics are consistent with human judgment [9]. FID can also detect GAN's known shortcomings such as mode collapse and mode dropping [16].
219
+
220
+ Unlike previous multiple-solution methods [38, 39] that use discriminator to select samples for quantitative evaluation, we use all samples for fair comparison. The comparison is conducted on CelebA-HQ 1000 testing images with $128 \times 128$ center holes. As shown in Table 1, multiple-solution methods score relatively low on PSNR and SSIM because they generate highly diverse results instead of approximating ground truth. Still, our method outperforms PIC [39] and UCTGAN [38] on these two metrics. Furthermore, our method outperforms all the other methods in terms of IS, MIS and FID.
221
+
222
+ ![](images/ba2b73d294f5a88ba99259439a265141ab51c176937c8b9855d18014f9210d4d.jpg)
223
+ Figure 5. Results of the ablation study on the structural attention module. (a) Incomplete image. (b) Using cross attention on the learned features. (c) Using full attention on the learned features. (d) Using cross attention on the structural features. (e) Using full attention on the structural features. [Best viewed with zoom-in.]
224
+
225
+ <table><tr><td>Full</td><td>Structural</td><td>SSIM↑</td><td>IS↑</td><td>FID↓</td></tr><tr><td></td><td></td><td>0.8606</td><td>3.402</td><td>11.55</td></tr><tr><td>✓</td><td></td><td>0.8645</td><td>3.436</td><td>11.26</td></tr><tr><td></td><td>✓</td><td>0.8675</td><td>3.416</td><td>10.12</td></tr><tr><td>✓</td><td>✓</td><td>0.8676</td><td>3.467</td><td>9.670</td></tr></table>
226
+
227
+ We also evaluate the diversity of our method using the LPIPS [37] metric. The average score is calculated between consecutive pairs of 50K results which are sampled from 1K incomplete images. Higher score indicates higher diversity. The reported scores of PIC [39] and UCTGAN [38] are 0.029 and 0.030, respectively. Our method achieves a comparable score of 0.029. Please refer to the supplementary material for some discussions about the diversity.
228
+
229
+ # 4.3. Ablation Study
230
+
231
+ We conduct an ablation study on CelebA-HQ to show the effect of different components of the texture generator $G_{t}$ . Since the structure generator $G_{s}$ can produce diverse structural features, we randomly sample a set of generated structural features. Then we use it across all the following experiments for fair comparison.
232
+
233
+ Effect of structural attention module. We compare the effect of different attention modules. The attention module in [33] calculates cross attention scores on the learned features, which often results in texture artifacts (see Figure 5(b)). Using full attention instead of cross attention maintains global consistency (see Figure 5(c)). Using the structural features instead of the learned features improves the consistency between structures and textures (see Figure 5(d)). Our structural attention module calculates full attention scores on the structural features, which can synthesize realistic textures, such as symmetric eyes and eyebrows (see Figure 5(e)). The quantitative results in Table 2 also demonstrate the benefits of our structural attention module.
234
+
235
+ Effect of our feature losses. We compare the effect of
236
+
237
+ ![](images/516284d1a1df263993d1f387a67b65ceabe14fafaf85979a7c3e6189f2639d48.jpg)
238
+ Figure 6. Results of the ablation study on the auxiliary losses. (a) Incomplete image. (b) Using no feature losses (but still using $\mathcal{L}_{\ell 1}$ and $\mathcal{L}_{adv}$ ). (c) Using $\mathcal{L}_{sf}$ . (d) Using $\mathcal{L}_{tf}$ . (e) Using both $\mathcal{L}_{sf}$ and $\mathcal{L}_{tf}$ . (f) Using the perceptual and style losses as in [13, 14]. [Best viewed with zoom-in.]
239
+
240
+ Table 2. Quantitative comparison for the ablation study on the structural attention module. Refer to Section 4.3 and Figure 5 for description.
241
+
242
+ <table><tr><td>\( \mathcal{L}_{sf} \)</td><td>\( \mathcal{L}_{tf} \)</td><td>\( SSIM^{\uparrow} \)</td><td>\( IS^{\uparrow} \)</td><td>\( FID^{\downarrow} \)</td></tr><tr><td></td><td></td><td>0.8581</td><td>3.383</td><td>11.02</td></tr><tr><td>✓</td><td></td><td>0.8589</td><td>3.367</td><td>11.16</td></tr><tr><td></td><td>✓</td><td>0.8625</td><td>3.414</td><td>10.34</td></tr><tr><td>✓</td><td>✓</td><td>0.8676</td><td>3.467</td><td>9.670</td></tr><tr><td colspan="2">\( \mathcal{L}_{perceptual} + \mathcal{L}_{style} \) [13, 14]</td><td>0.8638</td><td>3.388</td><td>9.672</td></tr></table>
243
+
244
+ Table 3. Quantitative comparison for the ablation study on the auxiliary losses. Refer to Section 4.3 and Figure 6 for description.
245
+
246
+ different auxiliary losses. Without any auxiliary loss, the perceptual quality of the inpainting result is not satisfactory (see Figure 6(b)). Using our structural feature loss $\mathcal{L}_{sf}$ can improve structure coherence, such as the shape of nose and mouth (see Figure 6(c)). Using our textural feature loss $\mathcal{L}_{tf}$ can improve texture realism, such as the luster of facial skin (see Figure 6(d)). Using both $\mathcal{L}_{sf}$ and $\mathcal{L}_{tf}$ can generate more natural images (see Figure 6(e)). Compared to our feature losses, perceptual and style losses used in [13, 14] may produce a distorted structure or an inconsistent texture (see Figure 6(f)). The quantitative results in Table 3 also demonstrate the benefits of our feature losses.
247
+
248
+ # 5. Conclusion
249
+
250
+ We have proposed a multiple-solution inpainting method for generating diverse and high-quality images using hierarchical VQ-VAE. Our method first formulates an autoregressive distribution to generate diverse structures, then synthesizes the image texture for each kind of structure. We propose a structural attention module to ensure that the synthesized texture is consistent with the generated structure. We further propose two feature losses to improve structure coherence and texture realism, respectively. Extensive qualitative and quantitative comparisons show the superiority of our method in both quality and diversity. We demonstrate that the structural information extracted by the hierarchical VQ-VAE is of great benefit for the inpainting task. As for future work, we plan to extend our method to other conditional image generation tasks including style transfer, image super-resolution, and guided editing.
251
+
252
+ # References
253
+
254
+ [1] Coloma Ballester, Marcelo Bertalmio, Vicent Caseles, Guillermo Sapiro, and Joan Verdera. Filling-in by joint interpolation of vector fields and gray levels. IEEE Trans. Image Process., 10(8):1200-1211, 2001. 2
255
+ [2] Connelly Barnes, Eli Shechtman, Adam Finkelstein, and Dan B. Goldman. PatchMatch: A randomized correspondence algorithm for structural image editing. ACM Trans. Graph., 28(3):24-33, 2009. 2
256
+ [3] Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013. 3
257
+ [4] Marcelo Bertalmio, Guillermo Sapiro, Vincent Caseles, and Coloma Ballester. Image inpainting. In ACM SIGGRAPH, pages 417-424, 2000. 2
258
+ [5] Marcelo Bertalmio, Luminita Vese, Guillermo Sapiro, and Stanley Osher. Simultaneous structure and texture image inpainting. IEEE Trans. Image Process., 12(8):882-889, 2003. 2
259
+ [6] Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. PixelSNAIL: An improved autoregressive generative model. In ICML, pages 864-872, 2018. 3
260
+ [7] Antonio Criminisi, Patrick Pérez, and Kentaro Toyama. Region filling and object removal by exemplar-based image inpainting. IEEE Trans. Image Process., 13(9):1200-1212, 2004. 2
261
+ [8] Iddo Drori, Daniel Cohen-Or, and Hezy Yeshurun. Fragment-based image completion. In ACM SIGGRAPH, pages 303-312. 2003. 2
262
+ [9] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In NIPS, pages 6626-6637, 2017. 7
263
+ [10] Satoshi Iizuka, Edgar Simo-Serra, and Hiroshi Ishikawa. Globally and locally consistent image completion. ACM Trans. Graph., 36(4):1-14, 2017. 1, 2
264
+ [11] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017. 7
265
+ [12] Liang Liao, Jing Xiao, Zheng Wang, Chia-Wen Lin, and Shin'ichi Satoh. Guidance and evaluation: Semantic-aware image inpainting for mixed scenes. In ECCV, pages 1-17, 2020. 2
266
+ [13] Guilin Liu, Fitsum A. Reda, Kevin J. Shih, Ting-Chun Wang, Andrew Tao, and Bryan Catanzaro. Image inpainting for irregular holes using partial convolutions. In ECCV, pages 85-100, 2018. 1, 2, 5, 8
267
+ [14] Hongyu Liu, Bin Jiang, Yibing Song, Wei Huang, and Chao Yang. Rethinking image inpainting via a mutual encoder-decoder with feature equalizations. In ECCV, pages 725-741, 2020. 2, 5, 6, 7, 8
268
+ [15] Hongyu Liu, Bin Jiang, Yi Xiao, and Chao Yang. Coherent semantic attention for image inpainting. In ICCV, pages 4170-4179, 2019. 6, 7
269
+
270
+ [16] Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are GANs created equal? A large-scale study. In NIPS, pages 700-709, 2018. 7
271
+ [17] Kamyar Nazeri, Eric Ng, Tony Joseph, Faisal Z. Qureshi, and Mehran Ebrahimi. EdgeConnect: Structure guided image inpainting using edge prediction. In ICCV Workshops, pages 1-10, 2019. 2
272
+ [18] Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In ICML, pages 1747-1756, 2016. 3
273
+ [19] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A. Efros. Context encoders: Feature learning by inpainting. In CVPR, pages 2536-2544, 2016. 1, 2
274
+ [20] Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with VQ-VAE-2. In NeurIPS, pages 14866-14876, 2019. 2, 3, 4, 7
275
+ [21] Yurui Ren, Xiaoming Yu, Ruonan Zhang, Thomas H. Li, Shan Liu, and Ge Li. StructureFlow: Image inpainting via structure-aware appearance flow. In ICCV, pages 181-190, 2019. 2, 6, 7
276
+ [22] Olga Russakovsky, Jia Deng, Hao Su, et al. ImageNet large scale visual recognition challenge. Int. J. Comput. Vis., 115(3):211-252, 2015. 7
277
+ [23] Min-cheol Sagong, Yong-goo Shin, Seung-wook Kim, Seung Park, and Sung-jae Ko. PEPSI: Fast image inpainting with parallel decoding network. In CVPR, pages 11360-11368, 2019. 1, 5
278
+ [24] Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, pages 2234-2242, 2016. 7
279
+ [25] Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P. Kingma. PixelCNN++: Improving the PixelCNN with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. 3
280
+ [26] Yuhang Song, Chao Yang, Zhe Lin, Xiaofeng Liu, Qin Huang, Hao Li, and C.-C. Jay Kuo. Contextual-based image inpainting: Infer, match, and translate. In ECCV, pages 3-19, 2018. 1
281
+ [27] Yuhang Song, Chao Yang, Yeji Shen, Peng Wang, Qin Huang, and C.-C. Jay Kuo. SPG-Net: Segmentation prediction and guidance network for image inpainting. In BMVC, pages 97–110, 2018. 2
282
+ [28] Aaron van den Oord, Nal Kalchbrenner, Oriol Vinyals, Lasse Espeholt, Alex Graves, and Koray Kavukcuoglu. Conditional image generation with PixelCNN decoders. In NIPS, pages 4790-4798, 2016. 3
283
+ [29] Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. In NIPS, pages 6306-6315, 2017. 2, 3
284
+ [30] Wei Xiong, Jiahui Yu, Zhe Lin, Jimei Yang, Xin Lu, Connelly Barnes, and Jiebo Luo. Foreground-aware image inpainting. In CVPR, pages 5840-5848, 2019. 2
285
+ [31] Shunxin Xu, Dong Liu, and Zhiwei Xiong. E2I: Generative inpainting from edge to image. IEEE Trans. Circuit Syst. Video Technol., 2020. 2
286
+
287
+ [32] Zhaoyi Yan, Xiaoming Li, Mu Li, Wangmeng Zuo, and Shiguang Shan. Shift-Net: Image inpainting via deep feature rearrangement. In ECCV, pages 1–17, 2018. 1, 2
288
+ [33] Zili Yi, Qiang Tang, Shekoofeh Azizi, Daesik Jang, and Zhan Xu. Contextual residual aggregation for ultra high-resolution image inpainting. In CVPR, pages 7508-7517, 2020. 1, 4, 5, 8
289
+ [34] Jiahui Yu, Zhe Lin, Jamei Yang, Xiaohui Shen, Xin Lu, and Thomas S. Huang. Generative image inpainting with contextual attention. In CVPR, pages 5505-5514, 2018. 1, 2, 6, 7
290
+ [35] Jiahui Yu, Zhe Lin, Jamei Yang, Xiaohui Shen, Xin Lu, and Thomas S. Huang. Free-form image inpainting with gated convolution. In ICCV, pages 4471-4480, 2019. 1, 2, 5, 6, 7
291
+ [36] Yanhong Zeng, Jianlong Fu, Hongyang Chao, and Baining Guo. Learning pyramid-context encoder network for high-quality image inpainting. In CVPR, pages 1486-1494, 2019. 1
292
+ [37] Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, pages 586-595, 2018. 8
293
+ [38] Lei Zhao, Qihang Mo, Sihuan Lin, Zhizhong Wang, Zhiwen Zuo, Haibo Chen, Wei Xing, and Dongming Lu. UCTGAN: Diverse image inpainting based on unsupervised cross-space translation. In CVPR, pages 5741-5750, 2020. 2, 3, 6, 7, 8
294
+ [39] Chuanxia Zheng, Tat-Jen Cham, and Jianfei Cai. Pluralistic image completion. In CVPR, pages 1438-1447, 2019. 2, 3, 6, 7, 8
295
+ [40] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 40(6):1452-1464, 2017. 7
296
+ [41] Tong Zhou, Changxing Ding, Shaowen Lin, Xinchao Wang, and Dacheng Tao. Learning oracle attention for high-fidelity face completion. In CVPR, pages 7680-7689, 2020. 5
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df39ed2086e6c4ecec4ed324e6cbb0e2b90ff9c2cee180a2ec7977a98e7ecb04
3
+ size 758803
generatingdiversestructureforimageinpaintingwithhierarchicalvqvae/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7bd047b9aff7f98d791bc64d687f225232eec90869a22f93403f5637161e3e8c
3
+ size 427661
generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13b11d45bfbb481020d7fdad8209bda4684960372a86efa5456f433b4a53030e
3
+ size 77916
generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9866faa9dc0982296216a2c1046832731bb764a781a96fe7591745b6bb0417a0
3
+ size 97851
generatingmangafromillustrationsviamimickingmangacreationworkflow/90196629-b874-4fd9-9ea2-638be4dd8b54_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43f0601c9dca22f321ebbf318592946fc1b2649f90f6e42ba908b20fe4469b1f
3
+ size 1713667
generatingmangafromillustrationsviamimickingmangacreationworkflow/full.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generating Manga from Illustrations via Mimicking Manga Creation Workflow
2
+
3
+ Lvmin Zhang
4
+ Soochow University / Style2Paints Research
5
+ China
6
+
7
+ Ivminzhang@acm.org
8
+
9
+ Xinrui Wang
10
+ The University of Tokyo / Tencent
11
+ China
12
+
13
+ secret_wang@outlook.com
14
+
15
+ Qingnan Fan
16
+ Stanford University
17
+ United States
18
+
19
+ fqnchina@gmail.com
20
+
21
+ Yi Ji
22
+ Soochow University
23
+ China
24
+
25
+ jiyi@suda.edu.cn
26
+
27
+ Chunping Liu
28
+ Soochow University
29
+ China
30
+
31
+ cpliu@suda.edu.cn
32
+
33
+ # Abstract
34
+
35
+ We present a framework to generate manga from digital illustrations. In professional mange studios, the manga create workflow consists of three key steps: (1) Artists use line drawings to delineate the structural outlines in manga storyboards. (2) Artists apply several types of regular screentones to render the shading, occlusion, and object materials. (3) Artists selectively paste irregular screen textures onto the canvas to achieve various background layouts or special effects. Motivated by this workflow, we propose a data-driven framework to convert a digital illustration into three corresponding components: manga line drawing, regular screentone, and irregular screen texture. These components can be directly composed into manga images and can be further retouched for more plentiful manga creations. To this end, we create a large-scale dataset with these three components annotated by artists in a human-in-the-loop manner. We conduct both perceptual user study and qualitative evaluation of the generated manga, and observe that our generated image layers for these three components are practically usable in the daily works of manga artists. We provide 60 qualitative results and 15 additional comparisons in the supplementary material. We will make our presented manga dataset publicly available to assist related applications.
36
+
37
+ # 1. Introduction
38
+
39
+ Generating manga from illustrations (Fig. 1-left) is an important task in high demand. The expansion of manga market and the rarity of manga artist have caused many manga companies to recruit a large number of digital painting or illustration artists and train them as manga creators. Training an artist to master the unique manga workflow, e.g., inking strategy, screentone management, texture applying,
40
+
41
+ ![](images/7012c039e01080a3677489d8e6ba81012e45d1f248969771de89a00c0fb944cd.jpg)
42
+ Figure 1. Our framework automatically generate the right high-quality manga given the left illustration. Zoom in to see details.
43
+
44
+ ![](images/d69212185e282eda04be17d03e9373b2dc7df3ca5393a0338befad996c54e114.jpg)
45
+
46
+ etc., is financially expensive and can often take weeks or even months. To reduce such training costs and speed up the producing, many manga companies have began to adopt techniques that generate manga from generic art forms like illustrations and digital paintings, so that the costs to train artists can be saved, and those newly hired digital illustration artists can be free from learning extra skills and can create manga directly in their familiar digital illustration working environments. The software Clip Studio Paints (CSP) [6] and Adobe After Effects (AE) [1] are typical examples with many plugins and online tutorials [10, 11, 7, 9, 8] for editing illustrations to obtain manga manually. The widespread popularity of those tutorials and plugins verifies the significance of the problem to generate manga from illustrations.
47
+
48
+ This paper starts with a key observation: the unique visual appearance of manga comes from the unique manga creation workflow. As shown in Fig. 2, we verify this observation
49
+
50
+ ![](images/01b9ce9a18a6fd5aba72547bf5322c8139b81f86cc191a424d4b30214ec99a9e.jpg)
51
+ Figure 2. Justification for our motivation: the classic professional manga creation workflow. Artists first ink structural line drawings, and then apply regular screentones and irregular screen texture to obtain the final manga.
52
+
53
+ by studying the manga creation workflow in professional studios. Firstly, artists draw line drawings as the initial outlines in manga storyboards, e.g., the artist delineates the line structure of the girl portrait in Fig. 2-(a). Secondly, artists paste screentone sheets with different regular patterns onto the regions between lines, e.g., the hair, eyes and dress in Fig. 2-(b) are pasted with such screentone sheets. Thirdly, artists fill the canvas with irregular screen textures to achieve background layouts or special effects, e.g., the artist applies the romantic background screen texture to set off the mood of the girl character in Fig. 2-(c). We can see that these three steps are sufficient and necessary to determine the appearance of a manga image, and each step is indispensable for preparing the high-quality manga product.
54
+
55
+ Might we be able to achieve a program that can mimic the above workflow, producing manga images with similar appearance to the ones created by artists manually with this workflow, and at the same time, yielding independently usable result layers that can assist artists in each step of this workflow? To achieve these goals, we present a deep learning approach to mimic the manga creation workflow step-by-step. Firstly, given an input illustration, our framework estimates a line drawing map that plays a similar role to the line drawings inked by artists manually. Secondly, our framework segments the input image into a fixed number of screentone classes, and pastes corresponding regular screentone sheets onto the image regions of each class. Thirdly, our framework predicts a texture mask to identify the areas that need to be pasted with screen textures, and afterwards synthesizes irregular textures in the identified areas. In this way, our framework automatically produces the line drawings, regular screentones, and screen textures. Those components can be independently used by artists for further creation, or can be directly composed into the manga outputs.
56
+
57
+ To this end, we invite artists to annotate a large-scale dataset and learn a hierarchical neural network in a data-driven manner. Our dataset contains 1502 image&annotation pairs of {illustration image, line drawing annotation, regular
58
+
59
+ screentone segmentation annotation, and irregular screen texture mask annotation}. All annotations are achieved with a human-in-the-loop approach, and checked by multiple artists for quality assurance. We will make this dataset publicly available to assist related applications.
60
+
61
+ Experiments show that mimicking the manga creation workflow yields several advantages. Firstly, in qualitative analyse, our framework can produce not only single manga image but also independent image layers at each workflow step to assist artists. Then, in perceptual user study, our framework tends to learn the artist decisions recorded in our presented dataset for each workflow step, making our framework preferred by the artists, as the manga creation depends heavily on content semantics and even artist perception. Furthermore, we provide 60 qualitative results and 15 additional comparisons in the supplementary material.
62
+
63
+ In summary, our contributions are: (1) We propose a data-driven framework to generate manga from illustrations by mimicking the professional manga creation workflow, including the steps of line drawing inking, regular screentone pasting, and irregular screen texture pasting. (2) We present a large-scale artistic dataset of illustration and annotation pairs to facilitate the problem to generate manga from illustrations and assist related applications. (3) Perceptual user study and qualitative evaluations demonstrate that our framework is more preferable by artists when compared to other possible alternatives.
64
+
65
+ # 2. Related Work
66
+
67
+ Screentone and manga processing. The synthesis of manga screentone or halftoned texture is a unique problem with considerable demand. Halftoning exploits the spatial integration of human vision to approximate the intensity over a small local region with black-and-white pixels [24, 16, 44, 21]. Path-based methods [45, 32] try to reduce the artifact patterns by adjusting the scanning path over images. Knuth et al. [24] enhance edges in a prepro
68
+
69
+ ![](images/922bcffae7f9a0d35f445d74e62515190c70f406eda635d26249d9bef63776d4.jpg)
70
+ Figure 3. Overview of our framework. Given an input illustration, our framework separately estimates the line drawing, regular screentone segmentation, and the irregular screen texture mask. These components are composed to produce the final manga result. All convolutional layers use $3 \times 3$ px kernels and are processed by Batch Normalizations (BNs) and ReLU activations.
71
+
72
+ ![](images/d026eb4e0f6902ac413022fc4e440b2b9d2fb3f3ef9113af96b6e40eafb9d637.jpg)
73
+
74
+ ![](images/e48dea7fe9452060f74d004c9dd03eb2adab798c6cdb967fda2cb4d44dbfdfc2.jpg)
75
+
76
+ ![](images/e6e0d791c1e36d7ad6d4fa164b3917d01033cbd26e09508abfb5a0161dc0a1be.jpg)
77
+
78
+ cessing step to preserve the edges. Afterwards, Buchanan et al. [3] preserve the fine structure by optimising the structure similarity. Perception-aware methods [51, 52, 34, 36] map pixel-wise or region-wise luminance to screentone patterns to achieve perceptually distinguishable salient screentone structure. Learning-based method Li et al. [26] train neural networks to predict the sketching texture in an end-to-end manner. Variational-auto-encoder screentone filler [53] maps the screened manga to an intermediate domain. Hatching is another technique to halftoned effects. Winkenbach et al. [50] synthesise pen-and-ink illustrations by rendering a geometric scene with prioritised stroke textures. Our framework not only focuses on the synthesis of screentones, but also works with the practical workflow of manga creation, including the steps of line drawing inking, screentone synthesis, and texture blending.
79
+
80
+ Cartoon and digital painting techniques. Cartoon image processing and computational digital painting have been extensively studied in the past few decades. Manga structure extraction [25], cartoon inking [40, 38, 39], and line closure [29, 31] methods analysis the lines in cartoon and digital paintings. A region-based composition method can be used in cartoon image animating [41]. Stylization methods [5, 48, 54, 56, 55] generate cartoon images or artistic drawings from photographs or human portraits. Line drawing colour filling applications [58, 43, 42] colourize sketch or line drawings with optimization-based or learning-based approaches. Our approach generates manga from illustrations and digital paintings, and can be used in manga products and related cartoon or digital painting applications.
81
+
82
+ Image-to-image translation and stylization. The task of generating manga from illustrations can also be seen as an image-to-image translation or image stylization problem.
83
+
84
+ For example, paired image-to-image translation [20, 47, 4] and unpaired methods [59, 22, 2, 57, 14, 30]. These methods can transform images across categories, e.g., maps-to-aerials, edges-to-cats, and in our case, illustrations-to-manga. Neural style transfer [17, 19, 27] can stylize images via transferring low-level style features to the content images. Our experiments include typical candidates of these methods, analysing the differences between our customized framework and these generic methods.
85
+
86
+ # 3. Method
87
+
88
+ We present an overview of our framework as shown in Fig. 3, where the input is an illustration $\mathbf{X} \in \mathbb{R}^{w \times h \times c}$ (Fig. 3-left), whereas the output is a manga image $\mathbf{Y} \in \mathbb{R}^{w \times h}$ (Fig. 3-right), with $w, h, c$ being the image width, height, and channel quantity. We train Convolutional Neural Networks (CNNs) to mimic the professional manga creation workflow with the following three steps:
89
+
90
+ Firstly, to mimic the behaviour that artists ink line drawings to delineate the structural outlines in manga storyboards (Fig. 2-(a)), our framework estimates a line drawing map $\hat{\pmb{L}}\in \mathbb{R}^{w\times h}$ (Fig. 3-(a)). Learnt from thousands of images, our neural network inks salient structural lines and suppresses unwanted constituents like noises and shadow interferences.
91
+
92
+ Secondly, to mimic the behaviour that artists paste regular screentones to depict the manga shading and object materials (Fig. 2-(b)), our framework estimates a panoptic segmentation map, namely the regular screentone segmentation map $\hat{S} \in \mathbb{R}^{w \times h \times N}$ (Fig. 3-(b)), with $N$ representing the number of screentone classes. Such segmentation yields a set of region labels, and each label indicates one type of screentone that should be pasted to each region. Our framework then
93
+
94
+ pastes the screentones according to such region-wise labels.
95
+
96
+ Thirdly, to mimic the behaviour that artists paste irregular screen textures to achieve background layouts or special effects (Fig. 2-(c)), our framework estimates an irregular texture mask $\hat{M} \in \mathbb{R}^{w \times h}$ (Fig. 3-(c)) to identify the areas that should be covered with irregular textures, and afterwards synthesizes manga textures for those identified areas.
97
+
98
+ Finally, the output manga image $\mathbf{Y}$ can be composed with
99
+
100
+ $$
101
+ \boldsymbol {Y} = \hat {\boldsymbol {L}} \odot \varphi_ {\text {t o n e}} (\hat {\boldsymbol {S}}) \odot \varphi_ {\text {t e x}} (\hat {\boldsymbol {M}}, \boldsymbol {X}), \tag {1}
102
+ $$
103
+
104
+ where $\odot$ is Hadamard product, $\varphi_{\mathrm{tone}}(\cdot)$ is a tone transform (described in § 3.2) that pastes screentone sheets according to the given screentone segmentation $\hat{S}$ , and $\varphi_{\mathrm{tex}}(\cdot,\cdot)$ is a texture transform (described in § 3.3) that synthesizes textures given the texture mask $\hat{M}$ and the illustration $X$ .
105
+
106
+ In order to train this framework, we invite artists to annotate a dataset containing 1502 pairs of $\{$ illustration $X$ , line drawing map $L$ , regular screentone segmentation map $S$ , and irregular texture mask $M\}$ . These data are annotated in a human-in-the-loop manner, i.e., artists create annotations for our framework to learn, and our framework estimates coarse annotations for artists to refine. The annotating approach is detailed in §4.
107
+
108
+ # 3.1. Inking line drawing
109
+
110
+ When creating manga in real life, artists ink line drawings to outline the object structures in manga storyboards. Our framework estimates a line drawing map $\hat{L}$ to mimic this artist behaviour. Given the ground truth line drawing $L$ and the estimation $\hat{L}$ , we customize a likelihood $\mathcal{L}_{\mathrm{ink}}$ with
111
+
112
+ $$
113
+ \mathcal {L} _ {\mathrm {i n k}} = \sum_ {p} \left(\left| \left| \hat {\boldsymbol {L}} _ {p} - \boldsymbol {L} _ {p} \right| \right| _ {2} ^ {2} + \lambda_ {i} \left| \left| \phi (\hat {\boldsymbol {L}}) _ {p} - \phi (\boldsymbol {L}) _ {p} \right| \right| _ {2} ^ {2}\right), \tag {2}
114
+ $$
115
+
116
+ where $p$ is pixel position, $||\cdot||_2$ is Euclidean distance, and $\lambda_i$ is a weighting parameter. The operator $\phi(\cdot)$ is a high-pass transform that penalizes the line patterns — we observe that the line patterns in line drawings routinely come with sparse and discrete high-amplitude/frequency transitions over pixel intensities, and we tailor make the transform $\phi(\cdot)$ to identify such line patterns that are "darker" than their surrounding low-frequency domain with
117
+
118
+ $$
119
+ \phi (\hat {\boldsymbol {L}}) _ {p} = \left\{ \begin{array}{l l} | | \hat {\boldsymbol {L}} _ {p} - g (\hat {\boldsymbol {L}}) _ {p} | | _ {2}, & \text {i f} \quad \hat {\boldsymbol {L}} _ {p} < g (\hat {\boldsymbol {L}}) _ {p}; \\ 0, & \text {o t h e r s ,} \end{array} \right. \tag {3}
120
+ $$
121
+
122
+ where $g(\cdot)$ is a Gaussian filter with a sigma of 3.0. With this transform, the likelihood $\mathcal{L}_{\mathrm{ink}}$ not only describes how close the estimation $\hat{\pmb{L}}$ is to the ground truth $\pmb{L}$ , but also penalizes the lines guided by the transform $\phi (\cdot)$ .
123
+
124
+ # 3.2. Pasting regular screentone
125
+
126
+ Manga artists paste screentone sheets with regular patterns onto their canvases to render the shading, occlusion,
127
+
128
+ ![](images/b7fcdcef54355fe56345260a2ea7028920ea8e9a05222063585cc52d423fb2d2.jpg)
129
+ (a) Screentone sheets
130
+
131
+ ![](images/db07c93b38b47650eed7df71374100a37c330a2f5fb29c535e7e8d1c6a34f305.jpg)
132
+ (b) Regular screentone classes and labels
133
+
134
+ ![](images/d08b2f74d9a85b9355b20be75401715c2819e4154f36a06a4a9060b96f6b0923.jpg)
135
+ (c) Illustration
136
+
137
+ ![](images/b88002f1f3c1f89cfbe113a3a87763d56192f07c67c64ba003e5ea1663f58b2d.jpg)
138
+ (d) Region-wise label
139
+
140
+ ![](images/89d9054030e70e434c9a2c8acf3a5ee9694ff86cd6fb15e0e61c0ff6238586fd.jpg)
141
+ (e) Pasted screentone
142
+ Figure 4. Pasting regular screentone. (a) Examples of real-life screentone sheets. (b) Standard manga screentone classes and corresponding label colours. (c) Example illustration. (d) Screentone segmentation map annotated by artists manually. (e) Screentones pasted according to the segmentation.
143
+
144
+ and object materials. A widely-used commercial screentone standard "JAPAN-DELETETER-SE" [13] (Fig. 4-(a)) includes 8 types of manga screentone sheets (Fig. 4-(b)). Based on this standard, our framework estimates a screentone segmentation map $\hat{S}$ (Fig. 4-(d)) with 8 classes corresponding to these 8 types of screentones. With the estimated logits $\hat{S}$ and the ground truth label $S$ , we measure the likelihood $\mathcal{L}_{\mathrm{seg}}$ with the Softmax Cross Entropy [49] as
145
+
146
+ $$
147
+ \mathcal {L} _ {\mathrm {s e g}} = - \sum_ {p, i} \log (\psi (\hat {\boldsymbol {S}} _ {p}) \odot \boldsymbol {S} _ {p}) _ {i}, \tag {4}
148
+ $$
149
+
150
+ where $\psi (\cdot)$ is Softmax [49] operation, $p$ is pixel position, and $i$ is class channel index. We further observe how artists paste screentone sheets, and find that artists are accustomed to paste screentones in a region-wise manner instead of in pixelwise, i.e., artists paste screentone sheets region-by-region rather than pasting independent sheets for each individual pixel. To achieve such region-wise consistency, we use the Felzenszwalb [15] super-pixel algorithm to segment the input image $\mathbf{X}$ into a set of over-segmented regions $\Omega = \{\omega_{1\dots n}\}$ , and penalize the region-wise variation $\mathcal{L}_{\mathrm{var}}$ with
151
+
152
+ $$
153
+ \mathcal {L} _ {\text {v a r}} = \sum_ {p} \left| \left| \hat {\boldsymbol {S}} _ {p} - \overline {{\hat {\boldsymbol {S}} _ {\omega (p)}}} \right| \right| _ {2} ^ {2}, \tag {5}
154
+ $$
155
+
156
+ where $\omega(p)$ is a super-pixel region in $\Omega$ that the pixel $p$ belongs to, and $\overline{\hat{S}_{\omega(p)}}$ is the average value of $\hat{S}$ in the region $\omega(p)$ . By encouraging the region-wise consistency, this penalty mimics the artist behaviour of region-by-region
157
+
158
+ ![](images/6ec1de9d9adab7eed9cc2b5fab61c7a1b086986bce5146d300099e2c8e57a997.jpg)
159
+ (a) Illustration
160
+
161
+ ![](images/15a2383b769a58bda1e230812b0d6a66fe18d2462baeeb2e9c1db4be1e7ef00d.jpg)
162
+ (b) Mask
163
+
164
+ ![](images/8924f07216b1e4e9465933350b9626bef5ac935f7b93ee77d0d38a89281317e7.jpg)
165
+ (c) Knuth 1987
166
+
167
+ ![](images/91160bfbddad172ad7b793350c23d80d6506e251d086362899245a291b4df2ec.jpg)
168
+ (d)Floyd et al.1974
169
+
170
+ ![](images/5cf59d2409d0180a09fc90aca61923ea0adf311fbb9158c09b37dc96ba294a09.jpg)
171
+ (e) Ulichney 1987 (f) Jarvis et al. 1976 (g) Velho et al. 1991 (h) Ulichney 1991*
172
+
173
+ ![](images/3b62fcf29ce2dcec06fcf5673380b5c2b1955e76457eccd46d2c5677318ab73e.jpg)
174
+
175
+ ![](images/358e067ed171e25639d41cc1346f2f93a3bb0a3c150f8f5c1a42c7819183a441.jpg)
176
+
177
+ ![](images/9176894fc2d13e1ac5354eb65767b567a704c9408daf6c836bb4247639b16c59.jpg)
178
+ Figure 5. Pasting irregular screen texture. (a) Example illustration. (b) Screen texture mask annotated by artist manually. (c-h) Different types of halftone transforms. The “*” indicates the default transform used by our framework.
179
+
180
+ screentone sheet pasting. Afterwards, our framework pastes the screentones according to the segmentation $\hat{S}$ with a tone transform $\varphi_{\mathrm{tone}}(\cdot)$ as
181
+
182
+ $$
183
+ \varphi_ {\text {t o n e}} (\hat {\boldsymbol {S}}) _ {p} = \sum_ {i} \psi (\hat {\boldsymbol {S}} _ {p}) _ {i} \odot (\boldsymbol {T} _ {i}) _ {p}, \tag {6}
184
+ $$
185
+
186
+ where $T_{i} \in \mathbb{R}^{w \times h}$ is a screentone image computed by tiling the $i$ -th screentone patch in Fig. 4-(b). We show an example of the transform $\varphi_{\mathrm{tone}}(\cdot)$ in Fig. 4-(e), where the screentone segmentation (Fig. 4-(d)) is transformed using the screentone-label correspondence in Fig. 4-(b).
187
+
188
+ # 3.3. Pasting irregular screen texture
189
+
190
+ The screen texture pasting is an indispensable step in the manga creation workflow. Such screen textures have irregular patterns and can be used in scenarios like background layouts or special effects. Our framework identifies the areas that need to be pasted with screen texture by estimating a texture mask $\hat{M}$ (Fig. 5-(b)). We minimize the likelihood $\mathcal{L}_{\mathrm{mask}}$ between the estimation $\hat{M}$ and the ground truth $M$ with
191
+
192
+ $$
193
+ \mathcal {L} _ {\text {m a s k}} = \sum_ {p} | | \hat {\boldsymbol {M}} _ {p} - \boldsymbol {M} _ {p} | | _ {2} ^ {2}, \tag {7}
194
+ $$
195
+
196
+ where $p$ is pixel position. Furthermore, we observe how artists paste screen textures, and find that artists tend to paste identical texture in consecutive and monotonic areas, e.g., large backgrounds, full-screen effects, big fonts, etc. To achieve the spacial coherency in such areas, we introduce an anisotropic penalty $\mathcal{L}_{\mathrm{ani}}$ with
197
+
198
+ $$
199
+ \mathcal {L} _ {\mathrm {a n i}} = \sum_ {p} \sum_ {i \in o (p)} \sum_ {j \in o (p)} \left(\delta (\boldsymbol {X}) _ {i j} | | \hat {\boldsymbol {M}} _ {i} - \hat {\boldsymbol {M}} _ {j} | | _ {2} ^ {2}\right), \quad (8)
200
+ $$
201
+
202
+ where $o(p)$ is a $3 \times 3$ window centred at the pixel position $p$ , with $\delta(\cdot)$ being an anisotropic term $\delta(X)_{ij} = \exp(-||X_i - X_j||_2^2/\kappa^2)$ , and $\kappa$ is an anisotropic weight. The term $\delta(X)_{ij}$ increases when $o(p)$ is located at consecutive and monotonic areas with uniform pixel intensities, and decreases when $o(p)$ comes across salient contours like edges. Afterwards, given the estimated mask $\hat{M}$ , our framework synthesizes manga textures in the masked areas with a texture transform $\varphi_{\mathrm{tex}}(\cdot, \cdot)$ as
203
+
204
+ $$
205
+ \varphi_ {\mathrm {t e x}} (\hat {\boldsymbol {M}}, \boldsymbol {X}) _ {p} = \sum_ {p} \xi (\boldsymbol {X}) _ {p} \odot \hat {\boldsymbol {M}} _ {p}, \tag {9}
206
+ $$
207
+
208
+ where $\xi(\cdot)$ is a halftone transform to synthesize texture. Our framework allows the transform $\xi(\cdot)$ to be chosen from many popular halftone synthesizing algorithms [24, 16, 44, 21, 45, 32] as shown in Fig. 5-(c-h), and we use the dotted transform [44] (Fig. 5-(h)) by default.
209
+
210
+ # 3.4. Neural architecture and learning objective
211
+
212
+ Our neural network architecture consists of three convolutional decoders: inking decoder, segment decoder, and mask decoder (Fig. 3). We apply Batch Normalization [18] and ReLU activation [33] to each convolutional layer. The sampling layers have skip connections in U-net [37] style. The three decoders are trained jointly with the loss term $\mathcal{L}$ with
213
+
214
+ $$
215
+ \mathcal {L} = \lambda_ {1} \mathcal {L} _ {\text {i n k}} + \lambda_ {2} \mathcal {L} _ {\text {s e g}} + \lambda_ {3} \mathcal {L} _ {\text {m a s k}} + \lambda_ {\text {v a r}} \mathcal {L} _ {\text {v a r}} + \lambda_ {\text {a n i}} \mathcal {L} _ {\text {a n i}}, \tag {10}
216
+ $$
217
+
218
+ where $\lambda_{1\dots 3},\lambda_{\mathrm{var}},\lambda_{\mathrm{ani}}$ are weighting parameters. Given that the architecture is fully convolutional, this model is applicable to images with adjustable resolutions.
219
+
220
+ # 4. Dataset
221
+
222
+ Our dataset contains 1502 pairs of $\{\text{illustration } X$ , line drawing map $L$ , regular screentone segmentation map $S$ , and irregular texture mask $M\}$ in 1024px resolution. We provide examples in the supplemental material. We invite 5 artists to annotate the dataset. The data preparation starts with a relatively small set of 56 illustration and line drawing pairs collected by searching the key word "illustration with line drawing" in Pixiv [35]. Artists align and retouch those 56 line drawings into usable annotations. Next, artists manually create 56 paired screentone segmentation maps using a commercial segmentation annotation tool [28] and 56 texture masks using Adobe Photoshop "quick select" tool. We train our framework on these initial data for 20 epochs and estimate coarse annotations for 1446 high-quality illustrations in Danbooru [12]. Artists refine those coarse estimations into final annotations. We view 100 refinements as one loop. When each loop is finished, we train our framework on the new data for 50 epochs and all old-and-new data for 20 epochs, and then re-estimate coarse annotations for the remaining
223
+
224
+ ![](images/918677bf1e6b713b95db405a4cfee56811b15df010e6accb3d2e39f058f37c3f.jpg)
225
+ Figure 6. Qualitative results. We show the generated manga image layers. 60 additional results are available in the supplementary material.
226
+
227
+ ![](images/96fc072efa78f85180a53caf555e01ed9048fe3ad9d536c98deb616735d95b29.jpg)
228
+
229
+ ![](images/da8435cce4ab4ce0ca51533d2d4f356af53c4eb54f8ed5b1b09860aeb0d4c7ff.jpg)
230
+
231
+ ![](images/e7acfd635179fafe3f72a5bdd4b6ac0d10e8cb529eaf888f6bad9f764f5d6662.jpg)
232
+
233
+ ![](images/d8839d7fbf6f041f35deea8fbdbc8e5a0ff2dfe38bfdc00b268f28957b3c8458.jpg)
234
+
235
+ <table><tr><td>Method</td><td>Li 2019 [26]</td><td>Qu 2008 [36]</td><td>CSP 2020 [6]</td><td>Xie 2020 [53]</td><td>Ours</td></tr><tr><td>AHR ↓</td><td>3.11 ± 0.53</td><td>4.66 ± 0.31</td><td>2.66 ± 0.37</td><td>4.11 ± 0.29</td><td>1.33 ± 0.24</td></tr></table>
236
+
237
+ Table 1. Average Human Ranking (AHR) of the manga images generated by different methods. The arrow $(\downarrow)$ indicates that lower is better. Top 1 (or 2) score is marked in blue (or red).
238
+
239
+ <table><tr><td>Method</td><td>Li 2019 [26]</td><td>Qu 2008 [36]</td><td>CSP 2020 [6]</td><td>Xie 2020 [53]</td><td>Ours</td></tr><tr><td>AMTFR ↑</td><td>9.52%</td><td>1.16%</td><td>11.52%</td><td>5.06%</td><td>24.54%</td></tr></table>
240
+
241
+ Table 2. Amazon Mechanical Turk Fooling Rate (AMTFR) on generated manga images. This metric reflects how indistinguishable the generated manga images are from real ones. Top 1 (or 2) score is marked in blue (or red). Higher ( $\uparrow$ ) is better.
242
+
243
+ unrefined illustrations. In parallel, all 5 artists are invited to check the annotation quality in that loop. Artists are allowed to remove any annotations when they find low-quality ones. This human-in-the-loop annotation workflow finishes when the quality of each annotation has been assured by at least three artists.
244
+
245
+ # 5. Evaluation
246
+
247
+ # 5.1. Experimental setting
248
+
249
+ Compared approaches. We test several typical manga generation methods of (1) the traditional optimization-based manga screentone method Qu et al. 2008 [36], (2) the com
250
+
251
+ mercial manga software CSP 2020 [6], (3) the learning-based stylization framework Li et al. 2019 [26], (4) the state-of-the-art manga effect ScreenVAE from Xie et al. 2020 [53], (5) Pix2Pix [20], and (6) our framework.
252
+
253
+ Implementation details. Our framework is trained using the Adam optimizer [23] with a learning rate of $\mathrm{lr} = 10^5$ , $\beta = 0.5$ , a batch size of 16, and 100 epochs. Training samples are randomly cropped to be $224 \times 224$ pixels and augmented with random left-and-right flipping. Besides, Qu [36] supports arbitrary screentone types, and we set it to use the same screentones with us. CSP [6] supports a vast majority of screentones with commercial standards, and we choose the same screentones as ours in the their interface. Li [26], Xie [53], and Pix2Pix [20] are learning-based methods with official implementations, and we train them on the illustration-to-manga pairs composed with our dataset.
254
+
255
+ Hyper-parameters. We use the default (and recommended) configuration of our framework: $\lambda_{i} = 0.5, \kappa = 0.1, \lambda_{1} = 1.0, \lambda_{2} = 1.0, \lambda_{3} = 1.0, \lambda_{\mathrm{var}} = 0.1$ and $\lambda_{\mathrm{ani}} = 0.1$ .
256
+
257
+ Testing samples. The tested images are Pixiv [35] and Danbooru [12] illustrations sampled randomly in different experiments. We make sure that all tested images are unseen from the training dataset.
258
+
259
+ # 5.2. Perceptual user study
260
+
261
+ The user study involves 15 individuals, where 10 individuals are non-artist students, and the other 5 are professional
262
+
263
+ ![](images/a1cd757666f5b4ac245697523fe6e738838b381329a2c14939600aadaa2074f1.jpg)
264
+ Figure 7. Comparisons to possible alternative methods. 15 additional full-resolution comparisons are available in the supplementary material.
265
+
266
+ artists. Each artist has at least three months of manga creation experience. We randomly sample 150 unseen illustrations in Danbooru [12], and then use the involved 5 methods ([53, 36, 26, 6] and ours) to generate 150 result groups, with each group containing 5 results from 5 methods. The participants are invited to rank the results in each group. When ranking the results in each group, we ask users the question – “Which of the following results do you prefer most to use in commercial manga? Please rank the following images according to your preference”. We use the Average Human Ranking (AHR) as the testing metric. For each group in the 150 groups, one random user ranks the 5 results in the current group from 1 to 5 (lower is better). Afterwards, we calculate the average ranking obtained by each method.
267
+
268
+ The results of this user study is reported in Table 1. We have several interesting discoveries: (1) Our framework outperforms the secondly best method by a large margin of $1.33 / 5$ . (2) The commercial software CSP 2020 [6] reports the secondly best score. (3) The two learning-based methods [26, 53] reports similar perceptual quality, with [53] slightly better than [26]. (4) Qu 2008 [36] reports a relatively low user preference, possibly due to its hard threshold when segmenting screentone regions.
269
+
270
+ We also conduct a user study with the Amazon Mechanical Turk Fooling Rate (AMTFR). The turk workers first watch a few real manga on the VIZ-manga [46] website, and then play with all the tested tools for 15 minutes to get familiar with the appearance of the "real/fake" manga. We randomly shuffle the 150 fake manga images (generated by the 5 tested methods as described in § 5.2) and another 150 images cropped from the real VIZ manga. We afterwards ask the turk workers to tell whether each image is real manga. The workers' mistake rate (fooling rate) reflects how the generated manga is indistinguishable from the real manga products. The result is presented in Table 2. We can see that our framework reports the highest fooling rate, more than twice that of the secondly best method. This is because our framework mimics the real manga creation workflow to simulate the manga created by artists manually.
271
+
272
+ # 5.3. Qualitative result
273
+
274
+ We present decomposed qualitative results in Fig. 6 and 60 additional results in the supplementary material. We can see that our framework not only generates satisfactory manga results, but also produces independent image layers of line drawing, screentone, and screen texture. These layers are
275
+
276
+ ![](images/4cb0d8276a07dc6b45dad1edf0b93d6f88e79c48d56f7eb615926b53784bed33.jpg)
277
+
278
+ ![](images/bfd23447566db062d6218c10a2e9001d81a41dd83a694f0a219645ecda99056c.jpg)
279
+
280
+ ![](images/3bf4ae87e737221209cee71e46e07314960e9054819af6a02e4c44a8fffed8a2.jpg)
281
+
282
+ ![](images/c1ef75dd16a70bf81bde67a77c23e0c8b0c92beb19cf5d45906b308e936137e8.jpg)
283
+
284
+ ![](images/f35e4328eb6a7f8a02b475fa6727f50d2c12894694d71ffba61dbdb0dbd36685.jpg)
285
+
286
+ ![](images/a486f7e8b2379bbe49f1a673c4f3140bdcbfcb3f70f7491301ee5b1abc146182.jpg)
287
+
288
+ ![](images/5eae7325c309c6e4e20ab2ccef67e9aefcb8a2820caaabc82fe6515e1501b0e5.jpg)
289
+
290
+ ![](images/85295fb79c125078148c8d73e3bea5c33fc234f42e33410623972ddb6ff332ef.jpg)
291
+
292
+ ![](images/b262b79f819c9bf5fdf42938eeded883feda1175f997c0276d68b015ab5f9494.jpg)
293
+ (a) Illustration
294
+
295
+ ![](images/7cf3133d4e0c16c6747d3f368513b691742c6f74ba462be87065ace27b47bd29.jpg)
296
+ (b) W/o inking
297
+
298
+ ![](images/2f5438107a059d0ef2f163c281887e1b9e85e783db1c9a0b690183b898d553e6.jpg)
299
+ (c) W/o segment
300
+
301
+ ![](images/c414c437b18c65a13d6c03b1ae3d33393efb32ec3610569e2be72dbeea7135cb.jpg)
302
+ (d) W/o masking
303
+
304
+ ![](images/dd7e0031fa9ef0d1d5ba896e3865597d96a51bad6c156a94c89a1feac9dcf651.jpg)
305
+ (e) $\mathrm{W / o}\phi (\cdot)$
306
+ Figure 8. Ablative study. We study the impact of each individual component within our framework by removing components one-by-one.
307
+
308
+ ![](images/e8847b69296b948ad0581e2401c3c76af43b712674a53ddac698d5ab32721d1c.jpg)
309
+ (f) W/o $\mathcal{L}_{\mathrm{var}}$
310
+
311
+ ![](images/94c5990233a143fb4d8437a35d0a9afb5a4ceb86b8efc5655891effb2087f8fa.jpg)
312
+ (g) W/o $\mathcal{L}_{\mathrm{ani}}$
313
+
314
+ ![](images/4b793c3ee9f64f558a6aff8361f7ac03db79cf1c2ef09b9f7eafde1970fddae6.jpg)
315
+ (h) Ours
316
+
317
+ practically usable in the daily works of manga artists.
318
+
319
+ # 5.4. Visual comparison
320
+
321
+ We present comparisons with previous methods [26, 36, 6, 53, 20] in Fig. 7 and 15 additional comparisons in the supplementary material. We also provide greyscale images for reference. We can see that CSP 2020 [6] and Qu et al. 2008 [36] can only map region-wise or pixel-wise intensity to screentone dots. Li et al. 2019 [26] causes boundary/detail distortion, e.g., the girl eyes. Xie et al. 2020 [53] and Pix2Pix [20] suffer from severe blurring/halo artifacts (when zooming in), e.g., the cake decoration. Our framework mimics the artist workflow and yields sharp and clean manga products.
322
+
323
+ # 5.5. Ablative study
324
+
325
+ As shown in Fig. 8, the ablative study includes the following experiments. (1) We remove the inking decoder and train our framework without line drawing maps. We can see that the removal of line drawing fails our framework in outlining the object structure (Fig. 8-(b)). (2) If trained without the screentone segmentations (with the segment decoder removed), the framework cannot mimics the artist behaviour of region-by-region screentone pasting, yielding screentone distortions (Fig. 8-(c)). (3) If trained without the screen texture masks (with the mask decoder removed), the framework fails to capture appropriate textures, resulting in dull and defective tone transitions (Fig. 8-(d)). (4) If trained without the line pattern penalty $\phi (\cdot)$ , the lines become blurred (Fig. 8-(e)). (5) If trained without the region-wise variation penalty $\mathcal{L}_{\mathrm{var}}$ , the framework suffers from screentone type inconsistency (Fig. 8-(f)). (6) If trained without the anisotropic penalty $\mathcal{L}_{\mathrm{ani}}$ , the textured areas become uncontrolled and noisy (Fig. 8-(g)). (7) The full framework suppresses these
326
+
327
+ types of artifacts and achieves a satisfactory balance over the line drawing, screentone, and screen texture (Fig. 8-(h)).
328
+
329
+ # 5.6. Influence of hyper-parameters
330
+
331
+ A weak region-wise variation penalty $(\mathcal{L}_{\mathrm{var}} = 0.01)$ causes inconsistency tone over adjacent regions, whereas a too strong penalty $(\mathcal{L}_{\mathrm{var}} = 1.0)$ causes texture vanishing. Besides, a weak anisotropic penalty $(\mathcal{L}_{\mathrm{ani}} = 0.01)$ causes textural distortion, whereas a too strong penalty $(\mathcal{L}_{\mathrm{ani}} = 1.0)$ causes low contrast in detailed constituents. See also the supplement for examples.
332
+
333
+ # 6. Conclusion
334
+
335
+ We present a framework to generate manga from illustrations by mimicking the manga creation workflow, including the steps of line drawing inking, regular screentone pasting, and irregular screen texture pasting. We invite artists to annotate a large-scale dataset to train the neural networks, and the dataset will be publicly available. Both quantitative and qualitative experiments elaborate that the users prefer our layered manga products compared to possible alternatives.
336
+
337
+ # 7. Acknowledgement
338
+
339
+ This technique is presented by Style2Paints Research. This work is supported by National Natural Science Foundation of China Nos 61972059, 61773272, 61602332; Natural Science Foundation of the Jiangsu Higher Education Institutions of China No 19KJA230001, Key Laboratory of Symbolic Computation and Knowledge Engineering of Ministry of Education, Jilin University No93K172016K08; the Priority Academic Program Development of Jiangsu Higher Education Institutions (PAPD). We thank Qianwen Lu for the helpful discussions for the technical merits and limitations.
340
+
341
+ # References
342
+
343
+ [1] Adobe. Adobe after effects. Adobe, 2020.
344
+ [2] Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, and Dilip Krishnan. Unsupervised pixel-level domain adaptation with generative adversarial networks. CVPR, 2017.
345
+ [3] J. W. BUCHANAN, , VEREVKA, and O. Edge preservation with space-filling curve half-toning. In Proceedings of Graphics Interface 95, 7582. ACM, 1995.
346
+ [4] Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. In ICCV, 2017.
347
+ [5] Yang Chen, Yu-Kun Lai, and Yong-Jin Liu. CartoonGAN: Generative adversarial networks for photo cartoonization. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. IEEE, jun 2018.
348
+ [6] clip studio. Clip studio paints. clip studio, 2020.
349
+ [7] clip studio. The complete clip studio paint screentone tutorial. https://doncorgi.com/blog/clip-studio-paint-screentone-tutorial/, 2020.
350
+ [8] clip studio. Csp: Turning your art into screentone. https://digiartstuff.wordpress.com/2019/04/18/csp-turning-your-art-into-screentone/, 2020.
351
+ [9] clip studio. Making comic backgrounds using layer properties. https://tips.clip-studio.com/en-us/articles/1164, 2020.
352
+ [10] clip studio. Turning color illustrations into black and white manga. https://tips.clip-studio.com/en-us/articles/1339, 2020.
353
+ [11] clip studio manga materials. Convert image to comic style background baccis of photo lt conversion. https://manga-materials.net/en/2dlt_b/, 2020.
354
+ [12] DanbooruCommunity. Danbooru2017: A large-scale crowdsourced and tagged anime illustration dataset, 2018.
355
+ [13] DELETER. Deeter official shopping site. http://deetermangashop.com/, 2020.
356
+ [14] Jeff Donahue, Philipp Krhenbhl, and Trevor Darrell. Adversarial feature learning. *ICLR*, 2017.
357
+ [15] Pedro F. Felzenszwalb and Daniel P. Huttenlocher. Efficient graph-based image segmentation. *IJCV*, 2004.
358
+ [16] R. W. FLOYD, , STEINBERG, and L. An adaptive algorithm for spatial grey scale. In SID International Symposium Digest of Technical Papers, Society for Information Display, 3637. ACM, 1974.
359
+ [17] Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In CVPR, pages 2414-2423, 2016.
360
+ [18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). IEEE, jun 2016.
361
+ [19] Mingming He, Jing Liao, Lu Yuan, and Pedro V Sander. Neural color transfer between images. ArXiv, 2017.
362
+ [20] Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. CVPR, 2017.
363
+ [21] J. F. JARVIS, C. N. JUDICE, , NINKE, and W. H. A survey of techniques for the display of continuous tone pictures on bilevel displays. Comput Graphics Image Process 5, 1, 1976.
364
+
365
+ [22] Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jung Kwon Lee, and Jiwon Kim. Learning to discover cross-domain relations with generative adversarial networks. ICML, 2017.
366
+ [23] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. Computer Science, 2014.
367
+ [24] D. E. KNUTH. Digital halftones by dot-diffusion. ACM Transactions on Graphics 6, 4, 1987.
368
+ [25] Chengze Li, Xueting Liu, and Tien-Tsin Wong. Deep extraction of manga structural lines. ACM Transactions on Graphics, 36(4), 2017.
369
+ [26] Yijun Li, Chen Fang, Aaron Hertzmann, Eli Shechtman, and Ming-Hsuan Yang. Im2pencil: Controllable pencil illustration from photographs. In IEEE Conference on Computer Vision and Pattern Recognition, 2019.
370
+ [27] Jing Liao, Yuan Yao, Lu Yuan, Gang Hua, and Sing Bing Kang. Visual attribute transfer through deep image analogy. ACM Transactions on Graphics, 36(4):1-15, jul 2017.
371
+ [28] lionbridge. Lionbridge data annotation platform. https://lionbridge.ai/data-annotation-platform, 2020.
372
+ [29] Chenxi Liu, Enrique Rosales, and Alla Sheffer. Strokeaggregator: Consolidating raw sketches into artist-intended curve drawings. ACM Transactions on Graphics, 2018.
373
+ [30] Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. NIPS, 2017.
374
+ [31] Xueting Liu, Tien-Tsin Wong, and Pheng-Ann Heng. Closure-aware sketch simplification. ACM Transactions on Graphics, 34(6):168:1–168:10, November 2015.
375
+ [32] A. NAIMAN, , LAM, and D. Error diffusion: wavefront traversal and contrast considerations. In Proceedings of Graphics Interface 96, 7886. ACM, 1996.
376
+ [33] Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. ICML, pages 807-814, 2010.
377
+ [34] Wai-Man Pang, Yingge Qu, Tien-Tsin Wong, Daniel Cohen-Or, and Pheng-Ann Heng. Structure-aware halftoning. ACM Transactions on Graphics (SIGGRAPH 2008 issue), 27(3):89:1-89:8, 2008.
378
+ [35] pixiv.net. pixiv. pixiv, 2007.
379
+ [36] Yingge Qu, Wai-Man Pang, Tien-Tsin Wong, and Pheng-Ann Heng. Richness-preserving manga screening. ACM Transactions on Graphics (SIGGRAPH Asia 2008 issue), 27(5):155:1–155:8, December 2008.
380
+ [37] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. MICCAI, 2015.
381
+ [38] Edgar Simo-Serra, Satoshi Iizuka, and Hiroshi Ishikawa. Mastering Sketching: Adversarial Augmentation for Structured Prediction. ACM Transactions on Graphics, 37(1), 2018.
382
+ [39] Edgar Simo-Serra, Satoshi Iizuka, and Hiroshi Ishikawa. Real-time data-driven interactive rough sketch inking. ACM Transactions on Graphics, 2018.
383
+ [40] Edgar Simo-Serra, Satoshi Iizuka, Kazuma Sasaki, and Hiroshi Ishikawa. Learning to Simplify: Fully Convolutional Networks for Rough Sketch Cleanup. ACM Transactions on Graphics, 35(4), 2016.
384
+ [41] Daniel Sykora, Jan Burianek, and Jiří Žára. Sketching cartoons by example. In Proceedings of Eurographics Workshop on Sketch-Based Interfaces and Modeling, pages 27-34, 2005.
385
+
386
+ [42] Daniel Sykora, John Dingliana, and Steven Collins. LazyBrush: Flexible painting tool for hand-drawn cartoons. Computer Graphics Forum, 28(2), 2009.
387
+ [43] TaiZan. Paintschainer tanpopo. PreferredNetwork, 2016.
388
+ [44] R. A. ULICHNEY. Digital halftoning. MIT Press, 25(4), 1991.
389
+ [45] L. VELHO, , GOMES, and J. M. Stochastic screening dithering with adaptive clustering. Computer Graphics (Proceedings of SIGGRAPH95), 273276, 1994.
390
+ [46] viz. Viz manga. https://www.viz.com/read, 2020.
391
+ [47] Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. High-resolution image synthesis and semantic manipulation with conditional gans. CVPR, 2018.
392
+ [48] Xinrui Wang and Jinze Yu. Learning to cartoonize using white-box cartoon representations. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
393
+ [49]wikipedia. Softmax function. wipedia, 2020.
394
+ [50] G. WINKENBACH, , SALESIN, and D. H. Computergenerated pen-and-ink illustration. Proceedings of SIGGRAPH 1994, 91100, 1994.
395
+ [51] Tien-Tsin Wong. The modelling of natural imperfections and an improved space filling curve halftoning technique. Master thesis The Chinese University of Hong Kong, 1994.
396
+ [52] Tien-Tsin Wong and Siu chi Hsu. Halftoning with selective precipitation and adaptive clustering. Graphics Gems V, 1995.
397
+ [53] Minshan Xie, Chengze Li, Xueting Liu, and Tien-Tsin Wong. Manga filling style conversion with screentone variational autoencoder. ACM Transactions on Graphics (SIGGRAPH Asia 2020 issue), 39(6):226:1-226:15, December 2020.
398
+ [54] Ran Yi, Yong-Jin Liu, Yu-Kun Lai, and Paul L. Rosin. AP- DrawingGAN: Generating artistic portrait drawings from face photos with hierarchical GANs. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). IEEE, jun 2019.
399
+ [55] Ran Yi, Yong-Jin Liu, Yu-Kun Lai, and Paul L Rosin. Unpaired portrait drawing generation via asymmetric cycle mapping. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR '20), 2020.
400
+ [56] Ran Yi, Mengfei Xia, Yong-Jin Liu, Yu-Kun Lai, and Paul L. Rosin. Line drawings for face portraits from photos using global and local structure based GANs. IEEE Transactions on Pattern Analysis and Machine Intelligence, pages 1-1, 2020.
401
+ [57] Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. Dualgan: Unsupervised dual learning for image-to-image translation. ICCV, 2017.
402
+ [58] Lvmin Zhang, Chengze Li, Tien-Tsin Wong, Yi Ji, and Chunping Liu. Two-stage sketch colorization. In ACM Transactions on Graphics, 2018.
403
+ [59] Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. ICCV, 2017.
generatingmangafromillustrationsviamimickingmangacreationworkflow/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e99f62675a28c1cca9d34db83fd901bcf6250c7e5ca6f95431a66a5c2f0718f6
3
+ size 1142785
generatingmangafromillustrationsviamimickingmangacreationworkflow/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8948f25122d0741bc6e6cb4a3837e7a335ff09d2140714b1f2f6a5e767b3aecc
3
+ size 455144
generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc6e4170c8b9758be11fac985f5f43bf653bba88f2e7e783bd45a6f0f9e1ae6b
3
+ size 87931
generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b90b8e78d16938143d41c31bdc5eeb93c5b9755b23ddfb131ec8e3f7e10ce49c
3
+ size 108201
generativeclassifiersasabasisfortrustworthyimageclassification/c7d06dbd-ab89-4feb-9c88-9e17706760d2_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5bda6e20ab47f9552db50cd9a82d29cf3692a29516807df3a6d4e974ece17f6
3
+ size 1575611
generativeclassifiersasabasisfortrustworthyimageclassification/full.md ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generative Classifiers as a Basis for Trustworthy Image Classification
2
+
3
+ Radek Mackowiak*
4
+
5
+ Visual Learning Lab, Heidelberg University
6
+
7
+ Ullrich Köthe
8
+
9
+ Visual Learning Lab, Heidelberg University
10
+
11
+ Lynton Ardizzzone*
12
+
13
+ Visual Learning Lab, Heidelberg University
14
+
15
+ Carsten Rother
16
+
17
+ Visual Learning Lab, Heidelberg University
18
+
19
+ * equal contribution
20
+
21
+ # Abstract
22
+
23
+ With the maturing of deep learning systems, trustworthiness is becoming increasingly important for model assessment. We understand trustworthiness as the combination of explainability and robustness. Generative classifiers (GCs) are a promising class of models that are said to naturally accomplish these qualities. However, this has mostly been demonstrated on simple datasets such as MNIST and CIFAR in the past. In this work, we firstly develop an architecture and training scheme that allows GCs to operate on a more relevant level of complexity for practical computer vision, namely the ImageNet challenge. Secondly, we demonstrate the immense potential of GCs for trustworthy image classification. Explainability and some aspects of robustness are vastly improved compared to feed-forward models, even when the GCs are just applied naively. While not all trustworthiness problems are solved completely, we observe that GCs are a highly promising basis for further algorithms and modifications. We release our trained model for download in the hope that it serves as a starting point for other generative classification tasks, in much the same way as pretrained ResNet architectures do for discriminative classification.
24
+
25
+ Code: github.com/VLL-HD/trustworthy_GCs
26
+
27
+ # 1. Introduction
28
+
29
+ Generative classifiers (GCs) and discriminative classifiers (DCs) represent two contrasting ways of solving classification tasks. In short, while standard DCs model the class probability given an input directly, $p(\text{class} \mid \text{image})$ (e.g. softmax classification), generative classifiers (GCs) take the opposite approach: They model the likelihood of the input image, conditioned on each class, $p(\text{image} \mid \text{class})$ . The actual classification is then performed by finding the class under which the image has the highest likelihood.
30
+
31
+ The application of GCs has so far been limited to very
32
+
33
+ Discriminative Classifier
34
+
35
+ $q(\mathrm{class}Y|\mathrm{image}X)$
36
+
37
+ sums to 1 over classes
38
+
39
+ Generative Classifier
40
+
41
+ $q(\mathrm{image}X|\mathrm{class}Y)$
42
+
43
+ integrates to 1 over images
44
+
45
+ ![](images/fe020e1891a1a2670d520419f7bd407efbc46bec9474a60dcc449d6a235fadf7.jpg)
46
+ (a) Normal input
47
+
48
+ ![](images/163a5cdd1b6e00af56acc5dcd268e4fa8cd2366801a6f2e5c1ad1935cba5d9a4.jpg)
49
+ Cat Dog
50
+
51
+ ![](images/5330b5fed1690ab4b3f77957385167c998c87b4da0c0a7d4159379621002dd76.jpg)
52
+ Cat Dog
53
+
54
+ ![](images/d9ea32c24e5bb7d720e0f1951bb1236cf2208352cc3dfc74d4b9852d8687d870.jpg)
55
+ (b) Unrelated input
56
+ Figure 1: Example of one advantage of generative classifiers: The class posterior of a DC always sums up to 1, while the likelihoods of the GC do not have this restriction, constituting inherently more informative outputs. E.g. the GC can show if a prediction is uncertain because the input agrees with both classes, or with neither.
57
+
58
+ ![](images/eb33225244000fd1f399ce9fbbce9c8e91b63d90af65add82c6157561b0bb59f.jpg)
59
+ Cat Dog
60
+
61
+ ![](images/1cf0fe69a36946c4014b3e1c719f8c9dbcfc5e7e29f1555a1952a0a9a0eed503.jpg)
62
+ Cat Dog
63
+
64
+ simple datasets such as MNIST, SVHN and CIFAR-10/100. For any practical image classification tasks, DCs are used exclusively, due to their excellent discriminative performance. In principle, GCs are said to have various advantages over DCs, which align with the term trustworthiness. In general agreement with [24], we understand trustworthiness as the combination of explainability and robustness.
65
+
66
+ Explainability: DCs based on deep neural networks are notorious for being 'black boxes', prompting many developments in the field of explainable AI. In the taxonomy laid out in [18], most commonly used algorithms fall into categories I or II: post-hoc methods that visualize how a network processes information (I), or that show its internal representations (II). The explanations can vary depending on the chosen method, and there is no guarantee that the results faithfully reflect what the DC is doing internally.
67
+
68
+ In contrast, GCs bring to mind Feynman's mantra "What I cannot create, I do not understand". As GCs are able to model the input data itself, not just the class posteriors, they
69
+
70
+ have fundamentally more informative outputs. For instance, GCs allow us to tell if a decision between two classes is uncertain because the input agrees well with both classes, or with neither (see Fig. 1). In addition, most GCs have interpretable latent spaces with meaningful features, allowing for the actual decision process to be directly visualized without post-hoc techniques. Therefore, it could be argued that GCs belong to category III of the explainability taxonomy [18], i.e. methods that intrinsically work in an explainable way, without relying on additional algorithms.
71
+
72
+ Robustness: A second large concern about the practical use of deep learning based classification systems is their robustness, which can have different meanings, depending on the context. In particular, GCs have been assumed to be superior to DCs in terms of generalization under dataset shifts [51, 39] and accurately calibrated posteriors [3]. In addition, a big advantage of GCs is their capability to explicitly identify abnormal inputs in a natural way, thus indicating when a decision should not be trusted. Furthermore, GCs were found to be more robust towards adversarial attacks [33] and allow for their explicit detection [17].
73
+
74
+ It is still unclear if GCs can also manifest these advantages in more complex tasks while remaining competitive to DCs in task performance. For example, the authors of [15] find while GCs can successfully detect adversarily attacked MNIST images, this already fails for the CIFAR-10 dataset. The authors of [34, 30] observe that detection of other forms of OoD data also fails in various ways for natural images. In [16], the authors cast doubt on whether GCs can be used for high-dimensional input data at all.
75
+
76
+ In light of this background, our work makes the following contributions: (i) We design and train a GC that performs at a level relevant to practical image classification, demonstrated on the ImageNet dataset. (ii) We show various native explainability techniques unique to GCs. (iii) We examine the model in terms of robustness.
77
+
78
+ Overall, we find our GC to work better than a comparable DC in terms of trustworthiness. However, we do observe that previous findings on superior generalization under dataset shift [51] and immunity to adversarial attacks [41] do not hold for the ImageNet dataset. For other aspects of robustness, our GC shows some great benefits, such as naturally detecting OoD inputs and adversarial attacks.
79
+
80
+ # 2. Related Work
81
+
82
+ Years before the deep learning revolution, works such as [37, 51, 39] already compared the properties of GCs vs DCs, theoretically and experimentally, with agreement that GCs are more robust and more explainable. Works like [6, 5, 54] presented models that combine the aspects of GCs and DCs, to reach a more favourable trade-off compared to each extreme. However, all these works consider simple problems, and with the unmatched task performance later
83
+
84
+ delivered by deep-learning based DCs in the 2010s, GCs became rarely used.
85
+
86
+ As one example of more recent work, [16] investigates normalizing-flow based GCs trained on natural images. The authors find that naively trained GC models achieve very poor classification performance, and argue that this is due to some model properties that are not properly penalized by maximum likelihood training. Later, [3] propose that this problem can be avoided by training with the Information Bottleneck loss function instead. The authors of [32] modify the problem, and train a GC on features previously extracted from a standard feed-forward network. For all these works, the most complex dataset used is CIFAR-100, at a resolution of $32 \times 32$ pixels.
87
+
88
+ So-called hybrid models [38] have been more successful in practice. Here, a likelihood estimation method is involved, commonly for the marginal $p(\mathrm{image})$ , while the actual classification is still performed in a discriminative way, using shared features between the two tasks, the main motivation being semi-supervised learning. Notable examples are [29, 14, 11, 35, 20]. They have some fundamental differences to GCs, e.g. that the conditional likelihoods are not directly modeled and the latent space has no explicit class structure.
89
+
90
+ Concerning OoD detection with generative models, the authors of [34] and later [30] observed that likelihood models trained on natural images fail to detect certain OoD inputs, and may perform significantly worse than random. This problem is addressed e.g. by [36, 10, 43, 45, 55], where different OoD scores are introduced that correct for these shortcomings. These works only consider unconditional likelihood models for OoD detection, while a separate classifier is still needed to perform the actual task. GCs combine both these steps into a single model, simplifying the process and potentially improving OoD detection at the same time.
91
+
92
+ GCs have also been examined for adversarial defense recently [41, 17, 33]. While these works highlight the potential of GCs, they are limited to simple datasets such as MNIST and SVHN, and do not scale to problems with more than approx. 10 classes, or to natural images [15].
93
+
94
+ # 3. Methods
95
+
96
+ # 3.1. Invertible Neural Networks
97
+
98
+ While VAEs have been used as generative classifiers with some success [41, 17, 33], perhaps the most natural choice are normalizing flows, due to their exact likelihood estimation capabilities [13]. The networks used in normalizing flows are so-called invertible neural networks (INNs), a class of neural network architectures that meet the following conditions: (i) the network represents a diffeomorphism by construction (essentially, a smooth and invertible function), (ii) the inversion can be computed efficiently, and (iii) the network has a tractable Jacobian determinant. These con
99
+
100
+ ditions place some restrictions on the architecture, e.g. that the number of input and output dimensions have to be equal, and that non-invertible operations such as max-pooling can not be used. In recent years, various different invertible architectures have been developed that fulfill these conditions [12, 13, 4, 19]. In this work, we employ the affine coupling block architecture proposed in [13], with additional modifications, as described in Appendix B.1.
101
+
102
+ In any generative setting, there are training images $X$ , that follow some unknown image distribution $p(X)$ . The goal is then to approximate $p(X)$ as closely as possible with a distribution given by the network, which we denote as $q_{\theta}(X)$ . In the case of normalizing flows, $q_{\theta}(X)$ is represented by transforming possible inputs $X$ to a latent space $Z$ using an INN $f_{\theta}$ ('flow'), with a prescribed standard normal latent distribution $p(Z) = \mathcal{N}(0,1)$ ('normalizing'). Then, the change-of-variables formula can be used to compute $q_{\theta}(X)$ at any point $x$ through
103
+
104
+ $$
105
+ q _ {\theta} (x) = p \left(Z = f _ {\theta} (x)\right) | \det J (x) | \tag {1}
106
+ $$
107
+
108
+ with $J \equiv \partial f_{\theta} / \partial X$ being the Jacobian. It can be shown that the network will learn the true distribution $(q_{\theta}(X) = p(X))$ by maximizing the expected log-likelihood $\log q_{\theta}(X)$ , as given through Eq. 1 above [47]. After training is complete, the model can not only be used to estimate likelihoods $q_{\theta}(X)$ , but also to generate new samples by inverting the network, in order to map sampled instances of $Z$ back to image space.
109
+
110
+ In our case, this approach is not sufficient, as we want to use the INN as a generative classifier, meaning we need to model conditional likelihoods $q_{\theta}(X \mid Y)$ . While different approaches for this exist [52, 2], we adopt the form introduced in [25]. Here, the latent distribution is a conditional density $p(Z \mid Y)$ : The standard normal distribution $p(Z)$ is replaced with a Gaussian Mixture Model (GMM) containing a unit-variance mixture component per class
111
+
112
+ $$
113
+ p (Z \mid Y) = \mathcal {N} (Z; \mu_ {Y}, \mathbb {1}) \tag {2}
114
+ $$
115
+
116
+ $$
117
+ p (Z) = \sum p (y) p (Z \mid y) = \sum p (y) \mathcal {N} (Z; \mu_ {y}, \mathbb {1}) \tag {3}
118
+ $$
119
+
120
+ where $\mu_y$ is the mean of class $y$ in latent space; and the mixture weights are the class priors $p(y)$ , i.e. the frequency of occurrence of each class in the dataset. The conditional likelihood $q_{\theta}(X|Y)$ can be evaluated with the change-of-variables formula (Eq. 1) as before by replacing the full distribution $p(Z)$ with the appropriate mixture component:
121
+
122
+ $$
123
+ q _ {\theta} (X \mid Y) = p \left(Z = f _ {\theta} (X) \mid Y\right) | \det J |. \tag {4}
124
+ $$
125
+
126
+ # 3.2. Training INNs with Information Bottleneck
127
+
128
+ An INN naively trained with a class-conditional log-likelihood loss will perform very poorly as GC, even on mildly challenging tasks [16]. Instead, we require a loss function where the focus on the generative and class-separating capabilities can be explicitly controlled. For this,
129
+
130
+ we utilize the IB objective [49], the ideal loss function for robust classification from an information theoretic point of view. Given some features $Z$ of a network, inputs $X$ , and ground-truth outputs $Y$ , the IB loss consists of two terms using the mutual information $I$ (MI):
131
+
132
+ $$
133
+ \mathcal {L} _ {\mathrm {I B}} = I (X, Z) - \hat {\beta} I (Y, Z). \tag {5}
134
+ $$
135
+
136
+ The MI quantifies the degree of shared information between variables and can be written as $I(V,W) = D_{\mathrm{KL}}(p(V,W)\| p(V)p(W))$ . Minimizing the IB loss means maximizing the information about the desired output $Y$ contained in the features, $I(Y,Z)$ . Simultaneously, it minimizes the information about the original image contained in the features, $I(X,Z)$ , resulting in robust and efficient representations $Z$ . The trade-off between these two aspects is explicitly adjusted by choosing $\hat{\beta}$ .
137
+
138
+ How to apply this objective to INNs is not immediately obvious, as INNs preserve information, and the loss becomes ill-defined. The authors of [3] show that this can be avoided by adding very low noise to the inputs. This is already an established practice in the context of normalizing flows for the purpose of dequantization. From this, the authors go on to derive two loss terms representing the IB objective, $\mathcal{L}_{\mathrm{IB}} = \mathcal{L}_X + \beta \mathcal{L}_Y$ . In practice, the two terms amount to the following:
139
+
140
+ $$
141
+ \mathcal {L} _ {X} (x) = - \log | \det J _ {x} | + \frac {1}{2} \operatorname {l o g s u m e x p} \left(v _ {y ^ {\prime}} ^ {2} - 2 w _ {y ^ {\prime}}\right) \tag {6}
142
+ $$
143
+
144
+ $$
145
+ \mathcal {L} _ {Y} (x, y) = \operatorname {o n e h o t} (y) \cdot \log \underset {y ^ {\prime}} {\text {s o f t m a x}} \left(\frac {v _ {y ^ {\prime}} ^ {2}}{2} - w _ {y ^ {\prime}}\right) \tag {7}
146
+ $$
147
+
148
+ Hereby, we use $v_{y} \coloneqq f(x) - \mu_{y}$ , and $\backslash w_{y} \coloneqq \log p(y)$ ( $\log(1 / (\# \text{classes}))$ for uniform class priors in our case). $J_{x}$ is the Jacobian $\frac{\partial f(x)}{\partial x}$ . $y'$ denotes the summation over all classes in the logsumexp and log softmax operations. The difference between $\hat{\beta}$ in the original IB and $\beta$ in the loss is a constant weighting factor for convenience [3], producing a sensible objective for manageable values of $\beta$ in the rough range (1, 100).
149
+
150
+ Intuitively, we find the following: The $\mathcal{L}_X$ -loss forces the data to follow the GMM in latent space, making the INN a generative model. However, it has no effect on the class-conditional aspect, as the class $y$ is summed out. This loss can be rearranged to look similar to the maximum-likelihood-loss used for normalizing flows, but with a GMM as a latent distribution. On the other hand, the $\mathcal{L}_Y$ -loss bears resemblance to the categorical cross entropy loss, except that the usual logits are replaced by $\log p(z|y)p(y) = \log p(z,y)$ . Therefore, $\mathcal{L}_Y$ is responsible for making the likelihood model conditional on the class, but otherwise ignores the generative performance.
151
+
152
+ X
153
+
154
+ # 3.3. Detecting OoD Inputs
155
+
156
+ For likelihood-based generative models, detecting OoD inputs is straight forward, by directly utilizing the estimated
157
+
158
+ probability density $q_{\theta}$ : in principle, if an input is outside the support of the training data, and the model has learned the true distribution, the OoD sample should be assigned $\log q_{\theta}(x) = -\infty$ . In practice, it is only required that OoD samples have lower likelihood scores than the training data. From here, any input with an inferred likelihood below a threshold can be treated as OoD. However, in [34], the authors identified various special cases where OoD inputs have an unnaturally high log-likelihood score. This prompted the development of a typicality-test in [36], that uses both an upper and a lower threshold. Even better performing extensions to this exist [10, 43, 45, 55], but we choose the typicality-test as the simplest option, to examine the natural capabilities of the model. We slightly modify the typicality-test to make it a traditional hypothesis test, with the null hypothesis being that the input is in-distribution, more details in Appendix A.1. The $p$ -value for the hypothesis test is the fraction of training samples with scores in the OoD-zone, which also equals the false positive rate. To evaluate the OoD detection capabilities independent of the threshold, we vary the $p$ -value of the test and produce a receiver operating characteristic (ROC) curve. The area under this curve (ROC-AUC), in percent, serves as a scalar measurement of the OoD detection capabilities, with ROC-AUC of $100\%$ meaning that the OoD samples and in-distribution samples are perfectly separated, and a value at $50\%$ or below indicates a random performance or worse.
159
+
160
+ # 4. Experiments
161
+
162
+ A detailed description of the network architecture is found in Appendix B.1, we summarize the main points in the following. We construct the invertible network (INN) from affine coupling blocks, as introduced in [13], with various modifications from other recent works [1, 2, 26, 28]. As invertible alternatives to $2 \times 2$ max-pooling and global mean-pooling, we use a Haar wavelet transform [2] and a DCT transform [26] respectively.
163
+
164
+ Because of the similarities between affine coupling blocks and residual blocks as used in a ResNet, we match the design of the INN to that of a standard ResNet-50 wherever possible. The overall layout is summarized in Table 1, c.f. [21, Table 1]. Some differences arise due to the constraint of invertibility: the number of feature channels and the available receptive field vary between the two networks. Regarding the effective rather than maximum receptive field, see Appendix B.2. The invertibility is also associated with an extra cost of parameters and computation, summarized in Appendix Table 5: Both in terms of network parameters, as well as FLOPs for one forward pass, the cost of the INN is about twice as high as a standard ResNet-50. We are optimistic that this overhead can be reduced in the future with more efficient INN architectures.
165
+
166
+ <table><tr><td rowspan="2">Layer</td><td rowspan="2">Blocks</td><td rowspan="2">Im. size</td><td colspan="2">Channels</td><td colspan="2">R.F.</td></tr><tr><td>INN</td><td>ResNet</td><td>INN</td><td>ResNet</td></tr><tr><td>Input</td><td></td><td>224</td><td>3</td><td>3</td><td></td><td></td></tr><tr><td>Entry flow</td><td>1</td><td>112</td><td>12</td><td>64</td><td>8</td><td>6</td></tr><tr><td>Pool (Haar/max)</td><td></td><td>56</td><td>48</td><td>64</td><td>10</td><td>10</td></tr><tr><td>Conv_2_x</td><td>3</td><td>56</td><td>48</td><td>256</td><td>34</td><td>34</td></tr><tr><td>Conv_3_x</td><td>4</td><td>28</td><td>192</td><td>512</td><td>106</td><td>90</td></tr><tr><td>Conv_4_x</td><td>6</td><td>14</td><td>768</td><td>1024</td><td>314</td><td>266</td></tr><tr><td>Conv_5_x</td><td>3</td><td>7</td><td>3072</td><td>2048</td><td>538</td><td>426</td></tr><tr><td>Pool (DCT/avg.)</td><td></td><td>1</td><td>150528</td><td>2048</td><td>∞</td><td>∞</td></tr></table>
167
+
168
+ Table 1: For each of the resolution levels in the INN and ResNet-50, the number of coupling/residual blocks and spatial size is given, along with the number of feature channels and the maximum possible receptive field (R.F.).
169
+
170
+ ![](images/5fc11328ca6ab26ce32c36f24abc32041718e9d0a7bcfbfd05ca34f4e5f7d1c2.jpg)
171
+ Figure 2: Trade-off between the two losses $\mathcal{L}_X$ and $\mathcal{L}_Y$ (left), and between generative modeling accuracy in bits/dim, and top-1 accuracy (right). Each point represents one model, trained with a different beta. A standard ResNet has no $\mathcal{L}_X$ loss and is shown as a horizontal line. The model with $\beta = 0$ (standard normalizing flow) is missing the $\mathcal{L}_Y$ loss and is shown as a vertical line. The small numbers inside the markers give the value of $\beta$ of that particular model.
172
+
173
+ ![](images/109a18827c2212a1abf48620a81ac4b7d973bd3c3edd089bf898655408bf8f02.jpg)
174
+
175
+ # 4.1. General Performance
176
+
177
+ We train several generative classifiers, with the following values for the hyperparameter $\beta \in \{1,2,4,8,16,32,\infty\}$ . Again, $\beta$ controls how much the model focuses on the generative likelihood estimation aspect (low $\beta$ ), vs. prioritizing good classification performance (high $\beta$ ). In addition, we include a model trained with $\beta = 0$ , i.e. no classification at all, analogous to a standard normalizing flow, as well as a standard feed-forward ResNet-50 [21], i.e. a pure DC.
178
+
179
+ The primary performance metrics used in Table 2 and Fig. 2 are firstly, the top-1 accuracy on the test set (in our case, the ILSVCR 2012 validation set [40]). We use 10-crop testing, which is most commonly used for performance evaluation in this setting. Secondly, for the generative likelihood estimation performance, we use the bits per dimension ('bits/dim') metric, as this is the prevalent evaluation metric for likelihood-based generative models such as normalizing flows. It quantitatively measures the accuracy of the density estimation (i.e. generative performance), explained e.g. in [48], where a lower bits/dim corresponds to a more accurate generative model.
180
+
181
+ In Table 2, we report the test losses and the two dis
182
+
183
+ <table><tr><td>β</td><td>\( {\mathcal{L}}_{X}^{\left( \text{test}\right) }\left( \downarrow \right) \)</td><td>\( {\mathcal{L}}_{Y}^{\left( \text{test}\right) }\left( \downarrow \right) \)</td><td>Bits/dim (↓)</td><td>Acc. (%) (↑)</td><td>OCE (↓)</td></tr><tr><td>1</td><td>-1.90</td><td>8.52</td><td>4.34</td><td>67.30</td><td>3.87</td></tr><tr><td>2</td><td>-0.65</td><td>8.26</td><td>6.14</td><td>71.73</td><td>4.13</td></tr><tr><td>4</td><td>1.14</td><td>8.14</td><td>8.72</td><td>73.69</td><td>4.31</td></tr><tr><td>8</td><td>3.66</td><td>8.10</td><td>12.35</td><td>74.59</td><td>4.73</td></tr><tr><td>16</td><td>7.17</td><td>8.06</td><td>17.43</td><td>75.54</td><td>4.15</td></tr><tr><td>32</td><td>10.81</td><td>8.01</td><td>22.68</td><td>76.18</td><td>4.94</td></tr><tr><td>∞</td><td>27.68</td><td>7.99</td><td>47.01</td><td>76.27</td><td>5.12</td></tr><tr><td>0</td><td>-3.11</td><td>-</td><td>2.59</td><td>-</td><td>-</td></tr><tr><td>ResNet</td><td>-</td><td>7.87</td><td>-</td><td>77.40</td><td>6.75</td></tr></table>
184
+
185
+ Table 2: Test losses and metrics for models trained with different $\beta$ . Bits/dimension quantifies the performance of density estimation models (see text, smaller is better, i.e. more accurate generative model). As with the original ResNet, the classification accuracy uses 10-crop testing. OCE is the overconfidence error, i.e. how often confident predictions are wrong (see text, smaller is better).
186
+
187
+ cussed performance metrics for the different models. Further shown in Fig. 2, changing $\beta$ moves smoothly between the limit cases of a feed-forward network, and a pure density estimation model: the classification accuracy increases continuously with $\beta$ , but a minor gap remains to the feedforward ResNet-50, in line with works such as [27]. Simultaneously and as expected, the bits/dim get worse as we move away from a purely generative model ( $\beta = 0$ ).
188
+
189
+ Lastly, we examine the uncertainty calibration, a quantitative measure of the quality of the predictive posteriors. The full analysis is provided in the Appendix Table 6. Here we only report the overconfidence error 'OCE', which measures the normalized classification error of predictions with a high confidence $C \geq C_{\mathrm{crit}} = 99.7\%$ . For instance, if the error rate in these cases is $1.1\%$ , although it should only be $0.3\%$ according to the confidence, this gives an OCE of $1.1 / 0.3 \approx 3.7$ . Our findings are in line with previous works, in that the uncertainty calibration improves with lower $\beta$ and better generative capabilities [3].
190
+
191
+ # 4.2. Explainability
192
+
193
+ In the following, we demonstrate several examples on how GCs can be used for native and intuitive explanations of the data and the prediction outputs. Certainly, algorithms and approaches exist that can generate similar results for DCs. The point of the following examples is to show that in GCs a range of explanations is available using only the structure of latent space and the learned likelihoods, without requiring additional modifications or algorithms applied in a post-hoc manner.
194
+
195
+ Visualizing decision-space: The properties of a classification decision are fully determined by the latent code of an input image in relation to the surrounding classes. The only difficulty consists in reducing the high-dimensional latent space to a 2D plot. Fig. 3 shows one possibility: latent codes are visualized in a plane through the centers of the two most probable classes, such that relative distances to
196
+
197
+ ![](images/dc4c6e30b933d7f95710327565a602b0c85d4e9e2eb0715b3e37e303ec2d810c.jpg)
198
+
199
+ ![](images/a1e8f26b93679ce176a47cf4b3a2ea325f7f0cf63a1a3ee41baf1f29dbe4f619.jpg)
200
+
201
+ ![](images/6119d6dfe972561bb660c003090db89005f9eb9a814f26ec7a83920d4fea7b51.jpg)
202
+ Figure 3: Latent space location of input images (black point) in the decision space spanned by the $\mu_y$ of the top 5 predicted classes. The horizontal axis of the plot is the axis connecting the top 2 predicted classes (red and blue points). The vertical axis of the plot shows the radial distance from the horizontal axis in the 5D space. The illustrative circles are chosen such that in both the vertical and horizontal directions, $90\%$ of the mass of the Gaussian mixture component lies inside. Note that the axes in the plot are scaled differently to make it appear as a circle. Test examples from left to right: a confident in-distribution decision, an uncertain in-distribution decision due to ambiguous classes, an uncertain decision due to multiple plausible image interpretations, an uncertain out-of-distribution decision.
203
+
204
+ ![](images/2c6af53602f2d402560c6f26f74e63056e91f0a3d4d480ac1255e34f9d3ef016.jpg)
205
+
206
+ the centers and to their connecting axis are preserved. A second approach is given in Appendix C.1, where the classification among a subset of classes can be fully visualized.
207
+
208
+ Class similarities: Building on Fig. 3, we see that different classes have various amounts of overlap, which represents the relationship between them. This is not possible for a feed-forward model, as there is no latent space where the input data is embedded in such a way. We observe that the locations $\mu_y$ of the Gaussian mixture components are close together for classes that are semantically similar, and far apart for classes that are dissimilar.
209
+
210
+ Importantly, this also has implications for predictions the model makes. For instance, in Fig. 3, top right, the classes overlap a lot. This means more points will lie in the overlap zone, and consequently more of these decisions will be uncertain, compared to e.g. bottom left, where most inputs will be in only one of two classes. More precisely, the closer two class centers are, the larger is the overlap, and the larger
211
+
212
+ ![](images/965d71e63ddec37c66c1f4268adbe0464db822b735e9ab229368afca42340245.jpg)
213
+ Figure 4: Latent similarity between different classes. The colormap indicates the pairwise distance of the $\mu_y$ as well as the expected pairwise posterior, meaning e.g. the binary decision between "tabby cat" and "tiger cat" is associated with $20\%$ expected uncertainty, by construction (see text). The distance on the diagonal is 0 (outside colormap range).
214
+
215
+ ![](images/b1d0343f9af934d170c3df72c946122d029491ef103189d9749808e9b9098298.jpg)
216
+
217
+ ![](images/7807c9c1221da776b10f1de447f074c9a9200e38d916a7fd53640b46e9351792.jpg)
218
+
219
+ ![](images/d20672a53e5e1de4fba6fbfb5361ac41a4e338b14df3bc888db8315a2ccd3c41.jpg)
220
+
221
+ ![](images/764b20ac4ab0a5126a229e8ab6bca8d58552f3e6e618c91a6cc2410cad1bc64c.jpg)
222
+ Figure 5: Examples of the prediction heatmaps. Summing the bright areas directly gives the final class prediction. Top: bowtie and sunglasses are located, suit is distributed over a large area. Middle: The head of the bird causes it to be classified as a limpkin, whereas the feathers are more indicative of an eagle or vulture. Bottom: The heatmaps of both Rottweiler and Appenzeller classes are located in the same area (ambiguous classes), while the soccer ball is separate.
223
+
224
+ the proportion of split decisions between these classes. In fact, if a class A is the top prediction, the expected confidence for any other class B can be worked out explicitly from the distance between $\mu_{A}$ and $\mu_{B}$ in latent space, see Appendix C.2. Some examples are shown in Fig. 4, with the full similarity matrix in Appendix Fig. 16.
225
+
226
+ These considerations highlight an important fact: the latent mixture model contains a built-in uncertainty between classes. A decision between similar classes will always be uncertain, by the structure of the latent space alone. This may be one of the reasons explaining why the predictive uncertainties are better calibrated in such GCs.
227
+
228
+ Posterior Heatmaps: To increase the trust in a decision, it is often helpful to show which regions of the image were
229
+
230
+ relevant. Examples are widespread where models e.g. base the decision on the background of the image, not the object in question, or focus only on a specific detail that identifies an object. Approaches such as CAM or GradCAM [56, 42] are used to generate coarse heatmaps showing regions that are influential for a particular decision. With the IB-INN, we can provide such heatmaps as a direct decomposition of the prediction output, meaning they can be understood simply as a different way of representing the model output, rather than a post-hoc explanation technique.
231
+
232
+ To produce a spatially structured output, we consider the following: Due to the invertibility of every part of the model, we can start from the output $z$ , and transform it back through the DCT operation. Unlike standard mean-pooling, the DCT pooling does not lose any information in either direction. We define the following for short:
233
+
234
+ $$
235
+ w ^ {(y)} = \mathrm {D C T} ^ {- 1} (z - \mu_ {y}). \tag {8}
236
+ $$
237
+
238
+ Importantly, $w^{(y)}$ has the spatial structure of the final convolutional outputs, $w_{kl}^{(y)}$ , with height- and width indexes $k$ and $l$ . Because the DCT is linear and orthogonal, it conserves distances, i.e. $\| z - \mu_y\| = \| w^{(y)}\|$ , which allows us to write
239
+
240
+ $$
241
+ q (z | y) \propto \exp \left(- \frac {\| w ^ {(y)} \| ^ {2}}{2}\right) = \exp \left(- \sum_ {k l} \frac {\left(w _ {k l} ^ {(y)}\right) ^ {2}}{2}\right) \tag {9}
242
+ $$
243
+
244
+ This means the latent density is can be written as a sum over spatial coordinates inside the exponential. We can do the same kind of decomposition to the posterior with a few extra steps, noting $q(y|x) = q(z|y)p(y) / q(z)$ . This leads to our heatmap $Q_{\mathrm{Class}}(k,l,y)$ , that sums to the class posterior over space in the same way as in Eq. 9:
245
+
246
+ $$
247
+ q _ {\theta} (y | x) = \exp \left(\sum_ {k l} Q _ {\text {C l a s s}} (k, l, y)\right). \tag {10}
248
+ $$
249
+
250
+ $Q_{\mathrm{Class}}$ has a single hyperparameter that adjusts the contrast of the heatmaps. The derivation is given in Appendix C.4. Examples are shown in Fig. 5. Similarly, we can compute a salience map $Q_{\mathrm{Salience}}(k,l,y)$ , that decomposes $q_{\theta}(x)$ spatially, showing which parts of the image contain the most information according to the model, explained and shown in Appendix C.3.
251
+
252
+ <table><tr><td colspan="8">Noise</td><td colspan="5">Blur</td><td colspan="4">Weather</td><td colspan="4">Digital</td></tr><tr><td>β</td><td>Clean Error</td><td>mCE</td><td>rel. mCE</td><td>Δ entropy.</td><td>OoD</td><td>Gauss.</td><td>Shot</td><td>Impulse</td><td>Defocus</td><td>Glass</td><td>Motion</td><td>Zoom</td><td>Snow</td><td>Frost</td><td>Fog</td><td>Bright</td><td>Contrast</td><td>Elastic</td><td>Pixel</td><td>JPEG</td></tr><tr><td>0</td><td>-</td><td>-</td><td>-</td><td>-</td><td>77.51</td><td>94.9</td><td>94.3</td><td>98.0</td><td>95.7</td><td>89.8</td><td>88.3</td><td>89.5</td><td>38.1</td><td>43.1</td><td>94.8</td><td>44.7</td><td>96.7</td><td>65.5</td><td>63.0</td><td>66.2</td></tr><tr><td>1</td><td>32.7</td><td>98.5</td><td>116</td><td>1.62</td><td>67.9</td><td>95.3</td><td>95.2</td><td>98.6</td><td>92.9</td><td>87.1</td><td>84.9</td><td>87.4</td><td>33.0</td><td>45.4</td><td>96.5</td><td>43.5</td><td>97.0</td><td>60.4</td><td>61.9</td><td>55.6</td></tr><tr><td>2</td><td>28.27</td><td>92.5</td><td>119</td><td>1.75</td><td>73.6</td><td>94.8</td><td>95.2</td><td>98.5</td><td>87.8</td><td>82.6</td><td>81.3</td><td>84.9</td><td>30.9</td><td>43.2</td><td>96.5</td><td>44.1</td><td>95.2</td><td>56.6</td><td>61.0</td><td>51.2</td></tr><tr><td>4</td><td>26.31</td><td>88.2</td><td>117</td><td>1.72</td><td>70.84</td><td>92.7</td><td>93.8</td><td>97.4</td><td>77.6</td><td>76.7</td><td>75.6</td><td>81.7</td><td>31.0</td><td>43.2</td><td>95.5</td><td>44.5</td><td>89.2</td><td>54.1</td><td>61.7</td><td>48.0</td></tr><tr><td>8</td><td>25.41</td><td>86.8</td><td>117</td><td>1.81</td><td>65.85</td><td>89.3</td><td>91.2</td><td>94.6</td><td>56.9</td><td>63.5</td><td>63.1</td><td>73.7</td><td>37.6</td><td>46.6</td><td>87.8</td><td>45.1</td><td>71.2</td><td>53.1</td><td>65.1</td><td>49.1</td></tr><tr><td>16</td><td>24.46</td><td>84.9</td><td>115</td><td>1.79</td><td>62.43</td><td>83.7</td><td>84.6</td><td>88.0</td><td>46.7</td><td>56.7</td><td>63.5</td><td>67.9</td><td>43.2</td><td>52.0</td><td>80.2</td><td>45.6</td><td>66.3</td><td>53.3</td><td>62.0</td><td>42.7</td></tr><tr><td>32</td><td>23.82</td><td>83.1</td><td>113</td><td>1.71</td><td>55.83</td><td>81.6</td><td>81.5</td><td>84.0</td><td>39.8</td><td>51.6</td><td>50.1</td><td>54.8</td><td>43.9</td><td>44.3</td><td>61.6</td><td>44.6</td><td>53.9</td><td>52.4</td><td>52.5</td><td>41.1</td></tr><tr><td>∞</td><td>23.73</td><td>83.4</td><td>114</td><td>1.58</td><td>44.24</td><td>39.5</td><td>44.5</td><td>40.6</td><td>42.8</td><td>48.1</td><td>46.3</td><td>46.0</td><td>40.9</td><td>38.9</td><td>36.1</td><td>44.3</td><td>48.5</td><td>52.2</td><td>47.9</td><td>47.0</td></tr><tr><td>ResNet</td><td>22.6</td><td>78.2</td><td>109</td><td>1.51</td><td>-</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
253
+
254
+ Table 3: We report the error on the unperturbed images (clean error), the mean corruption error ( $mCE$ ) and the relative mCE, describing the relative performance degradation caused the corruptions ( $\Delta$ entropy.). Furthermore, we report the OoD ROC-AUC detection score ( $OoD$ ) averaged over all corruptions as well as for the individual corruptions. Meaning of colors: good detection $\geq 85\%$ ; some detection $>55\%$ ; random or worse detection $\leq 55\%$ .
255
+
256
+ # 4.3. Robustness
257
+
258
+ Different Measures of Robustness: In current literature, there is no agreement upon a single measurement that clearly defines robustness in deep learning. In general, the question is how a model reacts to out-of-distribution (OoD) inputs, meaning inputs that do not come from the same distribution as the training data. We identify four different concepts of robustness, which are commonly used:
259
+
260
+ (1) Especially for dataset shifts that preserve the semantic information, a robust model is one that retains good performance for the OoD inputs.
261
+ (2) There are other cases where definition (1) is not applicable: There is no 'correct' prediction if the OoD input does not contain any of the classes which were trained for. The second idea of robustness is therefore that the model should at least make uncertain predictions for OoD inputs, measured by discrete entropy of the predictive outputs [44]. In reality, standard (non-robust) models make highly confident predictions on OoD data [44].
262
+ (3) A robust model can be one that is able to explicitly detect OoD inputs. In this case, along with the usual task output, the model has some auxiliary output that indicates whether an input is OoD. The model is robust by explicitly indicating that it's prediction may not be trusted in these cases. GCs are uniquely suited for this, as the estimated likelihood of the inputs can serve as a built-in OoD detection mechanism, but other approaches also exist [31, 23, 9]. To measure this, metrics such as the area under the receiver-operator curve can be used (AUC-ROC).
263
+ (4) In the context of adversarial attacks, robustness is commonly understood to be the amplitude of adversarial perturbation necessary to trick the model [53].
264
+
265
+ Handling Corrupted Images: We first consider the robustness test in the sense of (1) established by [22]. Here, the existing ImageNet validation images are corrupted with 5 severity levels in 15 different ways, examples are shown in Appendix D.1. The authors propose the mean corruption error (mCE) and the relative mean corruption error (rel. mCE) score to measure the robustness of a classifier. We also mea
266
+
267
+ sure the increase in predictive entropy as in [44] for robustness in the sense of (2), and perform OoD detection (3).
268
+
269
+ As can be seen in Table 3 the GC does not show an improvement compared to the ResNet in terms of (rel.) mCE, regardless of $\beta$ . However, it infers more uncertain predictions on corrupted data. For OoD detection, we observe overall better scores for smaller values for $\beta$ . We find the GC trained with $\beta = 2$ to be the most robust classification model: It is able to detect a wide range of corruption types while being a reasonably good classifier (4.54 percentage point classification accuracy gap compared to the $\beta = \infty$ model and 5.67 gap compared to the ResNet).
270
+
271
+ Handling Adversarial Attacks: We are interested in finding out if generative classifiers are more robust to adversarial attacks in the sense of (4). We are not proposing a new, competitive method of adversarial attack defense, the goal is simply to examine whether GCs are naturally more robust to adversarial attacks on ImageNet, in the same way it was observed for e.g. MNIST previously [33, 41]. For this, we perform the well established 'Carlini-Wagner' white-box targeted attack introduced in [8], which optimizes the following objective:
272
+
273
+ $$
274
+ \mathcal {L} _ {\mathrm {C W}} = \| x - x _ {\mathrm {a d v}} \| ^ {2} + c \cdot \mathcal {L} _ {\text {c l a s s}} ^ {(\kappa)} \left(y _ {\text {t a r g e t}}\right), \tag {11}
275
+ $$
276
+
277
+ i.e. the attacked image $x_{\mathrm{adv}}$ should be close to the original image $x$ , while being classified as a target class $y_{\mathrm{target}}$ . $\kappa$ is a hyperparameter that specifies how large the difference in logits should be between $y_{\mathrm{target}}$ and the next highest class, controlling how confident the classifier will be forced to be in its (wrong) decision. When facing a model such as a GC, which can detect attacks, it is also possible to add an extra loss term $\mathcal{L}_{\mathrm{detect}}$ in order to fool the detection mechanism as well, as proposed in [7]:
278
+
279
+ $$
280
+ \mathcal {L} _ {\mathrm {C W D}} = \left\| x - x _ {\mathrm {a d v}} \right\| ^ {2} + c \cdot \mathcal {L} _ {\text {c l a s s}} ^ {(\kappa)} \left(y _ {\text {t a r g e t}}\right) + d \cdot \mathcal {L} _ {\text {d e t e c t}} \tag {12}
281
+ $$
282
+
283
+ The full formulation of the attack objectives is given in Appendix D.2.
284
+
285
+ For evaluation, we examine standard CW attacks and two detection-fooling attacks with $d = 66$ and $d = 1000$ ,
286
+
287
+ ![](images/f170d1b19ee40714293b24f1e40886fc3f1697436747f3067d13f30a158ce98b.jpg)
288
+ Figure 6: Trajectory of four adversarial attacks shown in latent space (colored curves), with $\kappa = 1$ , $d = 0$ (standard CW). The large black dot indicates the position of $\mu_{\mathrm{target}}$ , the target class being 'Harvestman (spider)'. The solid black lines are the decision boundaries to the surrounding classes. The dashed black lines are the boundaries of the region where the classifier is fooled with sufficiently high confidence corresponding to $\kappa$ . In the dotted section of the colored trajectories, the classifier is not yet fooled with sufficiently high confidence. In the solid section, the classifier has been fooled, and the attack only tries to reduce the perturbation. Below, the four perturbed images are shown, along with the absolute perturbation. More examples and detailed explanation in Appendix D.3.
289
+
290
+ each for three values of $\kappa \in \{0.01, 1, \infty\}$ . For these 9 attack settings, we measure the L2 perturbation of the images after the attack and the ROC-AUC of the attack detection.
291
+
292
+ The results are presented in Fig 7, from which we make several key observations. We conclude that the GC requires roughly $2 \times$ larger perturbations for a standard adversarial compared to the ResNet, in line with [33]. We also observe the attack detection mechanism to be partially robust against attacks; even with $d = 1000$ it still works reasonably well for some cases. Furthermore, within this setting, the size of the perturbation is even more extensive compared to the standard attack setting. Fooling the classifier to predict the wrong class with greater confidence also increases the necessary perturbation as the detectability. An intuitive visualization of the adversarial attack in latent space is shown in Fig. 6.
293
+
294
+ ![](images/932744481a383b7c6d27d6dc0fa9ecb41d3cb8585e18c192d2496151c606189c.jpg)
295
+ Figure 7: Behaviour of GCs under adversarial attacks. The first column of plots shows the mean perturbation, the second shows the detection ROC-AUC. The three rows of plots correspond to adversarial attacks with $\kappa = 0.01$ (any confidence for the target prediction is enough), $\kappa = 1$ (should have high confidence), and $\kappa = \infty$ (should be as confident as possible). The labels on the x-axis give the values of $\beta$ , 'RN' is a ResNet-50. The three bars for each $\beta$ correspond to: standard adversarial attack ( $d = 0$ ), $d = 66$ , and $d = 1000$ , i.e. the detection mechanism is fooled at the same time as the prediction. The dotted line in the perturbation plots roughly indicates the level at which attacks are visible by eye. Note that this is subjective and only a rough indication. The line in the detection plots indicates random performance, i.e. the OoD detection does nothing useful.
296
+
297
+ ![](images/a84a10d0cdb16394283070b4b63ae544f617566b8caf9ff71b29b37e574c1ac8.jpg)
298
+
299
+ # 5. Conclusion
300
+
301
+ In this work we have addressed the question of trustworthiness for image classification. In the past, many properties linked with trustworthiness have been ascribed to generative classifier (GCs), such as increased robustness and explainability. Our GC performs nearly on-par with a standard discriminative classifier (DC), here ResNet, when tuned for discriminative performance. We observe that our GC offers significant improvements over standard DCs in terms of explainability and native out-of-distribution detection capability, but does not automatically solve all aspects of trustworthiness: Contrary to common belief, it does not generalize better under image corruptions than a DC, and it does not fully prevent adversarial attacks. In the future, we expect that robustness can be increased with further modifications or additional post-processing algorithms, as already exist for DCs. Finally, we contribute downloadable GC models pre-trained on ImageNet.
302
+
303
+ # References
304
+
305
+ [1] Lynton Ardizzone, Jakob Kruse, Carsten Rother, and Ullrich Kothe. Analyzing inverse problems with invertible neural networks. In Intl. Conf. on Learning Representations, 2019.
306
+ [2] Lynton Ardizzone, Carsten Lüth, Jakob Kruse, Carsten Rother, and Ullrich Köthe. Guided image generation with conditional invertible neural networks. arXiv preprint arXiv:1907.02392, 2019.
307
+ [3] Lynton Ardizzone, Radek Mackowiak, Carsten Rother, and Ullrich Kothe. Training normalizing flows with the information bottleneck for competitive generative classification. Advances in Neural Information Processing Systems, 33, 2020.
308
+ [4] Jens Behrmann, David Duvenaud, and Jörn-Henrik Jacobsen. Invertible residual networks. arXiv:1811.00995, 2018.
309
+ [5] Christopher M. Bishop and Julia Lasserre. Generative or discriminative? getting the best of both worlds. Bayesian statistics, 8(3):3-24, 2007.
310
+ [6] Guillaume Bouchard and Bill Triggs. The tradeoff between generative and discriminative classifiers. In 16th IASC International Symposium on Computational Statistics (COMP-STAT'04), pages 721-728, 2004.
311
+ [7] Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pages 3-14, 2017.
312
+ [8] Nicholas Carlini and David A. Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy, SP 2017, San Jose, CA, USA, May 22-26, 2017, pages 39-57. IEEE Computer Society, 2017.
313
+ [9] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha. Robust out-of-distribution detection in neural networks. CoRR, abs/2003.09711, 2020.
314
+ [10] Hyunsun Choi, Eric Jang, and Alexander A Alemi. Waic, but why? generative ensembles for robust anomaly detection. arXiv preprint arXiv:1810.01392, 2018.
315
+ [11] LI Chongxuan, Taufik Xu, Jun Zhu, and Bo Zhang. Triple generative adversarial nets. In Advances in neural information processing systems, pages 4088-4098, 2017.
316
+ [12] Laurent Dinh, David Krueger, and Yoshua Bengio. NICE: Non-linear independent components estimation. arXiv:1410.8516, 2014.
317
+ [13] Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using Real NVP. arXiv:1605.08803, 2016.
318
+ [14] Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In Intl. Conf. on Learning Representations, 2017.
319
+ [15] Ethan Fetaya, Jorn-Henrik Jacobsen, Will Grathwohl, and Richard S. Zemel. Understanding the limitations of conditional generative models. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
320
+ [16] Ethan Fetaya, Jörn-Henrik Jacobsen, and Richard S. Zemel. Conditional generative models are not robust. CoRR, abs/1906.01171, 2019.
321
+
322
+ [17] Partha Ghosh, Arpan Losalka, and Michael J. Black. Resisting adversarial attacks using gaussian mixture variational autoencoders. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 541-548. AAAI Press, 2019.
323
+ [18] Leilani H Gilpin, David Bau, Ben Z Yuan, Ayesha Bajwa, Michael Specter, and Lalana Kagal. Explaining explanations: An overview of interpretability of machine learning. In 2018 IEEE 5th International Conference on data science and advanced analytics (DSAA), pages 80-89. IEEE, 2018.
324
+ [19] Will Grathwohl, Ricky TQ Chen, Jesse Betterncourt, Ilya Sutskever, and David Duvenaud. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.
325
+ [20] Will Grathwohl, Kuan-Chieh Wang, Jorn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one. arXiv preprint arXiv:1912.03263, 2019.
326
+ [21] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770-778, 2016.
327
+ [22] Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
328
+ [23] Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized ODIN: detecting out-of-distribution image without learning from out-of-distribution data. CoRR, abs/2002.11297, 2020.
329
+ [24] Xiaowei Huang, Daniel Kroening, Wenjie Ruan, James Sharp, Youcheng Sun, Emese Thamo, Min Wu, and Xinping Yi. A survey of safety and trustworthiness of deep neural networks. arXiv preprint arXiv:1812.08342, 2018.
330
+ [25] Pavel Izmailov, Polina Kirichenko, Marc Finzi, and Andrew Gordon Wilson. Semi-supervised learning with normalizing flows. arXiv preprint arXiv:1912.13025, 2019.
331
+ [26] Jorn-Henrik Jacobsen, Jens Behrmann, Richard Zemel, and Matthias Bethge. Excessive invariance causes adversarial vulnerability. arXiv preprint arXiv:1811.00401, 2018.
332
+ [27] Jorn-Henrik Jacobsen, Arnold W.M. Smeulders, and Edouard Oyallon. i-RevNet: deep invertible networks. In International Conference on Learning Representations, 2018.
333
+ [28] Diederik P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. arXiv:1807.03039, 2018.
334
+ [29] Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pages 3581-3589, 2014.
335
+ [30] Polina Kirichenko, Pavel Izmailov, and Andrew Gordon Wilson. Why normalizing flows fail to detect out-of-distribution
336
+
337
+ data. Advances in neural information processing systems, 33, 2020.
338
+ [31] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Samy Bengio, Hanna M. Wallach, Hugo Larochelle, Kristen Grauman, Nicolò Cesà-Bianchi, and Roman Garnett, editors, Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, 3-8 December 2018, Montréal, Canada, pages 7167-7177, 2018.
339
+ [32] Kimin Lee, Sukmin Yun, Kibok Lee, Honglak Lee, Bo Li, and Jinwoo Shin. Robust inference via generative classifiers for handling noisy labels. arXiv preprint arXiv:1901.11300, 2019.
340
+ [33] Yingzhen Li, John Bradshaw, and Yash Sharma. Are generative classifiers more robust to adversarial attacks? In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 3804-3814. PMLR, 2019.
341
+ [34] Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don't know? In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
342
+ [35] Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Hybrid models with deep and invertible features. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pages 4723-4732, 2019.
343
+ [36] Eric T. Nalisnick, Akihiro Matsukawa, Yee Whye Teh, and Balaji Lakshminarayanan. Detecting out-of-distribution inputs to deep generative models using a test for typicality. CoRR, abs/1906.02994, 2019.
344
+ [37] Andrew Y. Ng and Michael I. Jordan. On discriminative vs. generative classifiers: A comparison of logistic regression and naive bayes. In Advances in Neural Information Processing Systems 14 [Neural Information Processing Systems: Natural and Synthetic, NIPS 2001, December 3-8, 2001, Vancouver, British Columbia, Canada], pages 841-848, 2001.
345
+ [38] Rajat Raina, Yirong Shen, Andrew Mccallum, and Andrew Y Ng. Classification with hybrid generative/discriminative models. In Advances in neural information processing systems, pages 545-552, 2004.
346
+ [39] Christian Raymond and Giuseppe Riccardi. Generative and discriminative algorithms for spoken language understanding. In Eighth Annual Conference of the International Speech Communication Association, 2007.
347
+ [40] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 115(3):211-252, 2015.
348
+
349
+ [41] Lukas Schott, Jonas Rauber, Matthias Bethge, and Wieland Brendel. Towards the first adversarially robust neural network model on MNIST. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
350
+ [42] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE international conference on computer vision, pages 618-626, 2017.
351
+ [43] Joan Serrà, David Álvarez, Vicenç Gómez, Olga Slizovskaia, José F Núñez, and Jordi Luque. Input complexity and out-of-distribution detection with likelihood-based generative models. arXiv preprint arXiv:1909.11480, 2019.
352
+ [44] Jasper Snoek, Yaniv Ovadia, Emily Fertig, Balaji Lakshminarayanan, Sebastian Nowozin, D Sculley, Joshua Dillon, Jie Ren, and Zachary Nado. Can you trust your model's uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pages 13969-13980, 2019.
353
+ [45] Jiaming Song, Yang Song, and Stefano Ermon. Unsupervised out-of-distribution detection with batch normalization. arXiv preprint arXiv:1910.09115, 2019.
354
+ [46] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818-2826, 2016.
355
+ [47] Esteban G Tabak and Cristina V Turner. A family of nonparametric density estimation algorithms. Communications on Pure and Applied Mathematics, 66(2):145-164, 2013.
356
+ [48] Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. arXiv preprint arXiv:1511.01844, 2015.
357
+ [49] Naftali Tishby, Fernando C. N. Pereira, and William Bialek. The information bottleneck method. CoRR, physics/0004057, 2000.
358
+ [50] Jakub M Tomczak and Max Welling. Improving variational auto-encoders using householder flow. arXiv preprint arXiv:1611.09630, 2016.
359
+ [51] Ilkay Ulusoy and Christopher M. Bishop. Comparison of generative and discriminative techniques for object detection and classification. In Toward Category-Level Object Recognition, pages 173-195, 2006.
360
+ [52] Christina Winkler, Daniel Worrall, Emiel Hoogeboom, and Max Welling. Learning likelihoods with conditional normalizing flows. arXiv preprint arXiv:1912.00042, 2019.
361
+ [53] Han Xu, Yao Ma, Haochen Liu, Debayan Deb, Hui Liu, Jiliang Tang, and Anil Jain. Adversarial attacks and defenses in images, graphs and text: A review. arXiv preprint arXiv:1909.08072, 2019.
362
+ [54] Jing-Hao Xue and D. M. Titterington. On the generative-discriminative tradeoff approach: Interpretation, asymptotic efficiency and classification performance. Computational Statistics & Data Analysis, 54(2):438-451, 2010.
363
+ [55] Yufeng Zhang, Wanwei Liu, Zhenbang Chen, Ji Wang, Zhiming Liu, Kenli Li, Hongmei Wei, and Zuoning Chen.
364
+
365
+ Out-of-distribution detection with distance guarantee in deep generative models. arXiv preprint arXiv:2002.03328, 2020.
366
+ [56] Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2921-2929, 2016.
generativeclassifiersasabasisfortrustworthyimageclassification/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ebd3086a1c1e9de9b18eee178f89006791420e4adaff2bb6ca411e7872b5c2c
3
+ size 482794
generativeclassifiersasabasisfortrustworthyimageclassification/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36c594cf9d5b3b259de39ca316038c30f5c6c623ef5c2aad99af2b785ba1408f
3
+ size 465165
generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ecdd1b1933b9b60dcdd22339e4c7b5ed16a2b9050dcbb362a91cc7742756692e
3
+ size 93277
generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7be339f069c99fef303dc8c4c33dd4caf21a0353ada7cd57734be04c5c462b1
3
+ size 113255
generativehierarchicalfeaturesfromsynthesizingimages/d3f1d387-5a67-4e8c-82c9-bf3e31d9011f_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:456ccccde15841e43f3da7d4329ff032541e2628706bdf822a8c5306d4f2d44f
3
+ size 3785284
generativehierarchicalfeaturesfromsynthesizingimages/full.md ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Generative Hierarchical Features from Synthesizing Images
2
+
3
+ Yinghao Xu* Yujun Shen* Jiapeng Zhu Ceyuan Yang Bolei Zhou The Chinese University of Hong Kong
4
+
5
+ {xy119, syl116, jpzhu, yc019, bzhou}@ie.cuhk.edu.hk
6
+
7
+ # Abstract
8
+
9
+ Generative Adversarial Networks (GANs) have recently advanced image synthesis by learning the underlying distribution of the observed data. However, how the features learned from solving the task of image generation are applicable to other vision tasks remains seldom explored. In this work, we show that learning to synthesize images can bring remarkable hierarchical visual features that are generalizable across a wide range of applications. Specifically, we consider the pre-trained StyleGAN generator as a learned loss function and utilize its layer-wise representation to train a novel hierarchical encoder. The visual feature produced by our encoder, termed as Generative Hierarchical Feature (GH-Feat), has strong transferability to both generative and discriminative tasks, including image editing, image harmonization, image classification, face verification, landmark detection, and layout prediction. Extensive qualitative and quantitative experimental results demonstrate the appealing performance of GH-Feat. $^{1}$
10
+
11
+ # 1. Introduction
12
+
13
+ Representation learning plays an essential role in the rise of deep learning. The learned representation is able to express the variation factors of the complex visual world. Accordingly, the performance of a deep learning algorithm highly depends on the features extracted from the input data. As pointed out by Bengio et al. [4], a good representation is expected to have the following properties. First, it should be able to capture multiple configurations from the input. Second, it should organize the explanatory factors of the input data as a hierarchy, where more abstract concepts are at a higher level. Third, it should have strong transferability, not only from datasets to datasets but also from tasks to tasks.
14
+
15
+ Deep neural networks supervisedly trained for image classification on large-scale datasets (e.g., ImageNet [8] and Places [66]) have resulted in expressive and discriminative
16
+
17
+ visual features [46]. However, the developed features are heavily dependent on the training objective. For example, prior work has shown that deep features trained for the object recognition task may mainly focus on the shapes and parts of the objects while remain invariant to rotation [1, 41], and the deep features from a scene classification model may focus more on detecting the categorical objects (e.g., bed for bedroom and sofa for living room) [65]. Thus the discriminative features learned from solving high-level image classification tasks might not be necessarily good for other mid-level and low-level tasks, limiting their transferability [57, 64]. Besides, it remains unknown how the discriminative features can be used in generative applications like image editing.
18
+
19
+ Generative Adversarial Network (GAN) [17] has recently made great progress in synthesizing photo-realistic images. It considers the image generation task as the training supervision to learn the underlying distribution of real data. Through adversarial training, the generator can capture the multi-level variations underlying the input data to the most extent, otherwise, the discrepancy between the real and synthesized data would be spotted by the discriminator. The recent state-of-the-art StyleGAN [31] has been shown to encode rich hierarchical semantics in its layer-wise representations [31, 55, 47]. However, the generator is primarily designed for image generation and hence lacks the inference ability of taking an image as the input and extracting its visual feature, which greatly limits the applications of GANs to real images.
20
+
21
+ To solve this problem, a common practice is to introduce an additional encoder into the two-player game described in GANs [12, 15, 13, 44]. Nevertheless, existing encoders typically choose the initial latent space (i.e., the most abstract level feature) as the target representation space, omitting the pre-layer information learned by the generator. On the other hand, the transferability of the representation from GAN models is not fully verified in the literature. Most prior work focuses on learning discriminative features for the high-level image classification task [12, 15, 13] yet put little effort on other mid-level and low-level downstream tasks, such as landmark detection and layout prediction.
22
+
23
+ In this work, we show that the pre-trained GAN generator can be considered as a learned loss function. Training with it can bring highly competitive hierarchical visual features which are generalizable to various tasks. Based on the StyleGAN model, we tailor a novel hierarchical encoder whose outputs align with the layer-wise representations from the generator. In particular, the generator takes the feature hierarchy produced by the encoder as the per-layer inputs and supervises the encoder via reconstructing the input image. We evaluate such visual features, termed as Generative Hierarchical Features (GH-Feat), on both generative and discriminative tasks, including image editing, image harmonization, image classification, face verification, landmark detection, layout prediction, etc. Extensive experiments validate that the generative feature learned from solving the image synthesis task has compelling hierarchical and transferable properties, facilitating many downstream applications.
24
+
25
+ # 2. Related Work
26
+
27
+ Visual Features. Visual Feature plays a fundamental role in the computer vision field. Traditional methods used manually designed features [40, 3, 7] for pattern matching and object detection. These features are significantly improved by deep models [34, 49, 20], which automatically learn the feature extraction from large-scale datasets. However, the features supervisedly learned for a particular task could be biased to the training task and hence become difficult to transfer to other tasks, especially when the target task is too far away from the base task [57, 64]. Unsupervised representation learning is widely explored to learn a more general and transferable feature [10, 61, 53, 16, 24, 68, 19, 42, 21, 51]. However, most of existing unsupervised feature learning methods focus on evaluating their features on the tasks of image recognition, yet seldom evaluate them on other mid-level or low-level tasks, let alone generative tasks. Shocher et al. [48] discover the potential of discriminative features in image generation, but the transferability of these features are still not fully verified.
28
+
29
+ Generative Adversarial Networks. GANs [17] are able to produce photo-realistic images via learning the underlying data distribution. The recent advance of GANs [45, 30, 5] has significantly improved the synthesis quality. StyleGAN [31] proposes a style-based generator with multi-level style codes and achieves the start-of-the-art generation performance. However, little work explores the representation learned by GANs as well as how to apply such representation for other applications. Some recent work interprets the semantics encoded in the internal representation of GANs and applies them for image editing [27, 47, 2, 18, 55, 67]. But it remains much less explored whether the learned GAN representations are transferable to discriminative tasks.
30
+
31
+ Adversarial Representation Learning. The main reason of hindering GANs from being applied to discriminative tasks comes from the lack of inference ability. To fill this gap, prior work introduces an additional encoder to the GAN structure [12, 15]. Donahue and Simonyan [13] and Pidhorskyi et al. [44] extend this idea to the state-of-the-art BigGAN [5] and StyleGAN [31] models respectively. In this paper, we also study the representation learning using GANs, with following improvements compared to existing methods. First, we propose to treat the well-trained StyleGAN generator as a learned loss function. Second, instead of mapping the images to the initial GAN latent space, like most algorithms [12, 15, 13, 44] have done, we design a novel encoder to produce hierarchical features that well align with the layer-wise representation learned by StyleGAN. Third, besides the image classification task that is mainly targeted at by prior work [12, 15, 13, 44], we validate the transferability of our proposed GH-Feat on a range of generative and discriminative tasks, demonstrating its generalization ability.
32
+
33
+ # 3. Methodology
34
+
35
+ We design a novel encoder to extract hierarchical visual features from the input images. This encoder is trained in an unsupervised learning manner from the image reconstruction loss based on a prepared StyleGAN generator. Sec. 3.1 describes how we abstract the multi-level representation from StyleGAN. Sec. 3.2 presents the structure of the novel hierarchical encoder. Sec. 3.3 introduces the idea of using pre-trained StyleGAN generator as a learned loss function for representation learning.
36
+
37
+ # 3.1. Layer-wise Representation from StyleGAN
38
+
39
+ The generator $G(\cdot)$ of GANs typically takes a latent code $\mathbf{z} \in \mathcal{Z}$ as the input and is trained to synthesize a photo-realistic image $\mathbf{x} = G(\mathbf{z})$ . The recent state-of-the-art StyleGAN [31] proposes to first map $\mathbf{z}$ to a disentangled space $\mathcal{W}$ with $\mathbf{w} = f(\mathbf{z})$ . Here, $f(\cdot)$ denotes the mapping implemented by multi-layer perceptron (MLP). The $\mathbf{w}$ code is then projected to layer-wise style codes $\{\mathbf{y}^{(\ell)}\}_{\ell=1}^{L} \triangleq \{(\mathbf{y}_s^{(\ell)}, \mathbf{y}_b^{(\ell)})\}_{\ell=1}^{L}$ with affine transformations, where $L$ is the number of convolutional layers. $\mathbf{y}_s^{(\ell)}$ and $\mathbf{y}_b^{(\ell)}$ correspond to the scale and weight parameters in Adaptive Instance Normalization (AdaIN) [26]. These style codes are used to modulate the output feature maps of each convolutional layer with
40
+
41
+ $$
42
+ \operatorname {A d a I N} \left(\mathbf {x} _ {i} ^ {(\ell)}, \mathbf {y} ^ {(\ell)}\right) = \mathbf {y} _ {s, i} ^ {(\ell)} \frac {\mathbf {x} _ {i} ^ {(\ell)} - \mu \left(\mathbf {x} _ {i} ^ {(\ell)}\right)}{\sigma \left(\mathbf {x} _ {i} ^ {(\ell)}\right)} + \mathbf {y} _ {b, i} ^ {(\ell)}, \tag {1}
43
+ $$
44
+
45
+ where $\mathbf{x}_i^{(\ell)}$ indicates the $i$ -th channel of the output feature map from the $\ell$ -th layer. $\mu (\cdot)$ and $\sigma (\cdot)$ denote the mean and variance respectively.
46
+
47
+ ![](images/37726374705c9852e602a52c6425b44e9e7e2928fa75f08848a9a91f93673d50.jpg)
48
+ Figure 1. Framework of the proposed encoder, which is able to extract Generative Hierarchical Features (GH-Feat) from input image. This feature hierarchy highly aligns with the layer-wise representation (i.e., style codes of per-layer AdaIN) learned by the StyleGAN generator. Parameters in blue blocks are trainable.
49
+
50
+ ![](images/1a775ae422a058334a7d386c08cbbb48e3af4d85092bdf7a12ef79be3e50928f.jpg)
51
+
52
+ Here, we treat the layer-wise style codes, $\{\mathbf{y}^{(\ell)}\}_{\ell = 1}^{L}$ , as the generative visual features that we would like to extract from the input image. There are two major advantages. First, the synthesized image can be completely determined by these style codes without any other variations, making them suitable to express the information contained in the input data from the generative perspective. Second, these style codes are organized as a hierarchy where codes at different layers correspond to semantics at different levels [31, 55]. To the best of our knowledge, this is the first work that adopts the style codes for the per-layer AdaIN module as the learned representations of StyleGAN.
53
+
54
+ # 3.2. Hierarchical Encoder
55
+
56
+ Based on the layer-wise representation described in Sec. 3.1, we propose a novel encoder $E(\cdot)$ with a hierarchical structure to extract multi-level visual features from a given image. As shown in Fig. 1, the encoder is designed to best align with the StyleGAN generator. In particular, the Generative Hierarchical Features (GH-Feat) produced by the encoder, $\{\mathbf{f}^{(\ell)}\}_{\ell = 1}^{L} \triangleq \{(\mathbf{f}_s^{(\ell)},\mathbf{f}_b^{(\ell)})\}_{\ell = 1}^L$ , are fed into the per-layer AdaIN module of the generator by replacing the style code $\mathbf{y}^{(L - \ell +1)}$ in Eq. (1).
57
+
58
+ We adopt ResNet [20] architecture as the encoder backbone and add an extra residual block to get an additional feature map with lower resolution. Besides, we introduce a feature pyramid network [36] to learn the features from multiple levels. The output feature maps from the last three stages, $\{R_4, R_5, R_6\}$ , are used to produce GH-Feat. Taking a 14-layer StyleGAN generator as an instance, $R_4$ aligns with layer 9-14, $R_5$ with 5-8, while $R_6$ with 1-4. Here, to bridge the feature map with each style code, we first downsample it to $4 \times 4$ resolution and then map it to a vector of the target dimension using a fully-connect (FC) layer. In addition, we introduce a lightweight Spatial Alignment Module (SAM) [56, 38] into the encoder structure to better capture the spatial information from the input image. SAM
59
+
60
+ works in a simple yet efficient way:
61
+
62
+ $$
63
+ R _ {i} = W _ {i} \operatorname {d o w n} \left(R _ {i}\right) + W _ {6} R _ {6} \quad i \in \{4, 5 \},
64
+ $$
65
+
66
+ where $W_{4}, W_{5}$ , and $W_{6}$ (all are implemented with an $1 \times 1$ convolutional layer) are used to project the feature maps $R_{4}$ , $R_{5}$ , and $R_{6}$ to have the same number of feature channels respectively. $R_{4}$ and $R_{5}$ are downsampled to the same resolution of $R_{6}$ before fusion. The detailed structure of the encoder can be found in Supplementary Material.
67
+
68
+ # 3.3. StyleGAN Generator as Learned Loss
69
+
70
+ We consider the pre-trained StyleGAN generator as a leaned loss function. Specifically, we employ a StyleGAN generator to supervise the encoder training with the objective of image reconstruction. We also introduce a discriminator to compete with the encoder, following the formulation of GANs [17], to ensure the reconstruction quality. To summarize, the encoder $E(\cdot)$ and the discriminator $D(\cdot)$ are jointly trained with
71
+
72
+ $$
73
+ \begin{array}{l} \min _ {\Theta_ {E}} \mathcal {L} _ {E} = | | \mathbf {x} - G (E (\mathbf {x})) | | _ {2} - \lambda_ {1} \mathbb {E} _ {\mathbf {x}} [ D (G (E (\mathbf {x}))) ] \tag {2} \\ + \lambda_ {2} | | F (\mathbf {x}) - F (G (E (\mathbf {x}))) | | _ {2}, \\ \end{array}
74
+ $$
75
+
76
+ $$
77
+ \begin{array}{l} \min _ {\Theta_ {D}} \mathcal {L} _ {D} = \mathbb {E} _ {\mathbf {x}} [ D (G (E (\mathbf {x}))) ] - \mathbb {E} _ {\mathbf {x}} [ D (\mathbf {x}) ] \tag {3} \\ + \lambda_ {3} \mathbb {E} _ {\mathbf {x}} [ | | \nabla_ {\mathbf {x}} D (\mathbf {x}) | | _ {2} ^ {2} ], \\ \end{array}
78
+ $$
79
+
80
+ where $||\cdot ||_2$ denotes the $\ell_2$ norm and $\lambda_1,\lambda_2,\lambda_3$ are loss weights to balance different loss terms. The last term in Eq. (2) represents the perceptual loss [29] and $F(\cdot)$ denotes the conv4_3 output from a pre-trained VGG [49] model.
81
+
82
+ # 4. Experiments
83
+
84
+ We evaluate Generative Hierarchical Features (GH-Feat) on a wide range of downstream applications. Sec. 4.1 introduces the experimental settings, such as implementation details, datasets, and tasks. Sec. 4.2 conducts ablation study on the proposed hierarchical encoder. Sec. 4.3 and Sec. 4.4 evaluate the applicability of GH-Feat on generative and discriminative tasks respectively.
85
+
86
+ # 4.1. Experimental Settings
87
+
88
+ Implementation Details. The loss weights are set as $\lambda_1 = 0.1$ , $\lambda_2 = 5e^{-5}$ , and $\lambda_3 = 5$ . We use Adam [32] optimizer, with $\beta_1 = 0$ and $\beta_2 = 0.99$ , to train both the encoder and the discriminator. The learning rate is initially set as $1e^{-4}$ and exponentially decayed with the factor of 0.8.
89
+
90
+ Datasets and Models. We conduct experiments on four StyleGAN [31] models, pre-trained on MNIST [35], FF-HQ [31], LSUN bedrooms [58], and ImageNet [8] respectively. The MNIST model is with $32 \times 32$ resolution and the remaining models are with $256 \times 256$ resolution.
91
+
92
+ Tasks and Metrics. Unlike existing adversarial feature learning methods [15, 12, 44, 13] that are mainly evaluated on the high-level image classification task, we benchmark GH-Feat on a range of both generative and discriminative tasks from multiple levels, including (1) Image editing. It focuses on manipulating the image content or style, e.g., style mixing, global editing, and local editing. (2) Image harmonization. This task harmonizes a discontinuous image to produce a realistic output. (3) MNIST digit recognition. It is a long-standing image classification task. We report the Top-1 accuracy on the test set following [35]. (4) Face verification. It aims at distinguishing whether the given pair of faces come from the same identity. We validates on the LFW dataset [25] following the standard protocol [25]. (5) ImageNet classification. This is a large-scale image classification dataset [8], consisting of over $1M$ training samples across 1,000 classes and $50K$ validation samples. We use Top-1 accuracy as the evaluation metric following existing work [12, 13]. (6) Pose estimation. This task targets at estimating the yaw pose of the input face. $70K$ real faces on FF-HQ [31] are split to $60K$ training samples and $10K$ test samples. The $\ell_1$ regression error is used as the evaluation metric. (7) Landmark detection. This task learns a set of semantic points with visual meaning. We use FF-HQ [31] dataset and follow the standard MSE metric [63] to report performances in inter-ocular distance (IOD). (8) Layout prediction. We extract the corner points of the layout line and convert the task to a landmark regression task. The annotations of the collected $90K$ bedroom images ( $70K$ for training and $20K$ for validation) are obtained with [62]. Following [69], we report the corner distance as the metric. (9) Face luminance regression. It focuses on regressing the luminance of face images. We use it as a low-level task on the FF-HQ [31] dataset.
93
+
94
+ # 4.2. Ablation Study
95
+
96
+ We make ablation studies on the training of encoder from two perspectives. (1) We choose the layer-wise style codes $\mathbf{y}$ over the $\mathbf{w}$ codes as the representation from StyleGAN. (2) We introduce Spatial Alignment Module (SAM) into the encoder to better handle the spatial information.
97
+
98
+ Table 1. Quantitative results on ablation study.
99
+
100
+ <table><tr><td>Space</td><td>SAM</td><td>MSE↓</td><td>SSIM↑</td><td>FID↓</td></tr><tr><td>W</td><td>✓</td><td>0.0601</td><td>0.540</td><td>22.24</td></tr><tr><td>Y</td><td></td><td>0.0502</td><td>0.550</td><td>19.06</td></tr><tr><td>Y</td><td>✓</td><td>0.0464</td><td>0.558</td><td>18.48</td></tr></table>
101
+
102
+ Table 2. Quantitative comparison with ALAE [44] on reconstructing images from FF-HQ faces [31] and LSUN bedrooms [58].
103
+
104
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Face</td><td colspan="3">Bedroom</td></tr><tr><td>MSE↓</td><td>SSIM↑</td><td>FID↓</td><td>MSE↓</td><td>SSIM↑</td><td>FID↓</td></tr><tr><td>ALAE [44]</td><td>0.182</td><td>0.398</td><td>24.86</td><td>0.275</td><td>0.315</td><td>21.01</td></tr><tr><td>GH-Feat (Ours)</td><td>0.046</td><td>0.558</td><td>18.42</td><td>0.068</td><td>0.507</td><td>16.01</td></tr></table>
105
+
106
+ ![](images/5694d5037ff19b223da2f625f820ce3c54885d0e3d72dd3f06e8ad7a6870495e.jpg)
107
+
108
+ ![](images/48dde8de2b1ebcfb7146853307ee2c366835832e3818fa7928b9dc6518dbeebd.jpg)
109
+
110
+ ![](images/5b32ecac5029e4c23551d70f06ff97ac735ee20caf9ed93965ae025291d3b5e4.jpg)
111
+
112
+ ![](images/5d99c34e3d5fcd353a481a777937b6561d728c2ad0620291b2f95070d8f7deec.jpg)
113
+ Figure 2. Qualitative comparison on reconstructing real images. From left to right: Inputs, ALAE [44], and our GH-Feat.
114
+
115
+ ![](images/cc0f15ffbd5b53a59756788027295e2d6446225248bd341daae29039dc9c7f80.jpg)
116
+
117
+ ![](images/ed6e60ad5e9413bed847f02d53b7c4d365581b655710aba6d02b7556f723ded7.jpg)
118
+
119
+ Since the encoder is trained with the objective of image reconstruction, we use mean square error (MSE), SSIM [52], and FID [22] to evaluate the encoder performance. Tab. 1 shows the results where we can tell that our encoder benefits from the effective SAM module and that choosing an adequate representation space (i.e., the comparison between the first row and the last row) results in a better reconstruction. More discussion on the differences between $\mathcal{W}$ space and $\mathcal{V}$ space can be found in Sec. 4.4.1.
120
+
121
+ # 4.3. Evaluation on Generative Tasks
122
+
123
+ Thanks to using the StyleGAN as a learned loss function, a huge advantage of GH-Feat over existing unsupervised feature learning approaches [24, 68, 42, 51, 19], which mainly focus on the image classification task, is its generative capability. In this section, we conduct a number of generative experiments to verify this point.
124
+
125
+ # 4.3.1 Image Reconstruction
126
+
127
+ Image reconstruction is an important evaluation on whether the learned features can best represent the input image. The very recent work ALAE [44] also employs StyleGAN for representation learning. We have following differences from ALAE: (1) We use the $\mathcal{V}$ space instead of the $\mathcal{W}$
128
+
129
+ ![](images/bafae2d8b89c39d5c2c865039ada2d6c871bde242df67a7842f6634432522399.jpg)
130
+ Figure 3. Style mixing results by exchanging the GH-Feat extracted from the content image and the style image (first row) at different levels. Higher level corresponds to more abstract feature.
131
+
132
+ ![](images/a8d3510bf15aa47738a76b4b906f19c110681c545703f3d62ebcd5f32dd8a7c0.jpg)
133
+ Figure 4. Global image editing achieved by GH-Feat. On the left is the input image, while the others are generated by randomly sampling the visual feature at some particular level.
134
+
135
+ space of StyleGAN as the representation space. (2) We learn hierarchical features that highly align with the perlayer style codes in StyleGAN. (3) Our encoder can be efficiently trained with a well-learned generator by treating StyleGAN as a loss function. Tab. 2 and Fig. 2 show the quantitative and qualitative comparison between GH-Feat and ALAE [44] on FF-HQ faces [31] and LSUN bedrooms [58]. We can tell that GH-Feat better reconstructs the input by preserving more information, resulting a more expressiveness representation.
136
+
137
+ # 4.3.2 Image Editing
138
+
139
+ In this part, we evaluate GH-Feat on a number of image editing tasks. Different from the features learned from discriminative tasks [20, 19], our GH-Feat naturally supports sampling and enables creating new data.
140
+
141
+ Style Mixing. To achieve style mixing, we use the encoder to extract visual features from both the content image and the style image and swap these two features at some particular level. The swapped features are then visualized by the generator, as shown in Fig. 3. We can observe the compelling hierarchical property of the learned GH-Feat. For example, by exchanging low-level features, only the image color tone and the skin color are changed. Meanwhile, mid-level features controls the expression, age, or even hair styles. Finally, high-level features correspond to the face shape and pose information (last two columns).
142
+
143
+ Global Editing. The style mixing results have suggested the potential of GH-Feat in multi-level image stylization. Sometimes, however, we may not have a target style image to use as the reference. Thanks to the design of the latent space in GANs [17], the generative representation naturally
144
+
145
+ supports sampling, resulting in a strong creativity. In other words, based on GH-Feat, we can arbitrarily sample meaningful visual features and use them for image editing. Fig. 4 presents some high-fidelity editing results at multiple levels. This benefits from the matching between the learned GH-Feat and the internal representation of StyleGAN.
146
+
147
+ Local Editing. Besides global editing, our GH-Feat also facilitates editing the target image locally by deeply cooperating with the generator. In particular, instead of directly swapping features, we can exchange a certain region of the spatial feature map at some certain level. In this way, only a local patch in the output image will be modified while other parts remain untouched. As shown in Fig. 5, we can successfully manipulate the input face with different eyes, noses, and mouths.
148
+
149
+ # 4.3.3 Image Harmonization
150
+
151
+ Our hierarchical encoder is robust such that it can extract reasonable visual features even from discontinuous image content. We copy some patches (e.g., bed and window) onto a bedroom image and feed the stitched image into our proposed encoder for feature extraction. The extracted features are then visualized via the generator, as in Fig. 6. We can see that the copied patches well blend into the "background". We also surprisingly find that when copying a window into the source image, the view from the original window and that from the new window highly align with each other (e.g., vegetation or ocean), benefiting from the robust generative visual features.
152
+
153
+ # 4.4. Evaluation on Discriminative Tasks
154
+
155
+ In this part, we verify that even the proposed GH-Feat is learned from generative models, it can be applicable
156
+
157
+ ![](images/661113d6e5c33379626d16a2533092d3d73a67f16a64480c40823156ebb91872.jpg)
158
+ Input
159
+
160
+ ![](images/17881a12abe2ade4d227a868f36f028b1c12fafe81b4cd7131bc2bfb653ba660.jpg)
161
+ Figure 5. Local image editing achieved by GH-Feat. On the left is the input image, while the others are generated by randomly sampling the visual feature and replacing the spatial feature map (for different regions) at some particular level. Zoom in for details.
162
+
163
+ ![](images/3f6f933077d6dee304c9f41b1dbb866ab38f9869c3f3a00c9988a3baba88bf23.jpg)
164
+ Eyes
165
+
166
+ ![](images/c0f0c378fc3fe89d71087aabf1a6e6be257d44e6bc27082ad8e78d2b05c76d75.jpg)
167
+
168
+ ![](images/e36e146022498c5554dc7511a28990388db719912e5dc874a40df6ae031f734f.jpg)
169
+ Nose
170
+
171
+ ![](images/a0eb186403452b7196d06dd1b69d15893e400cbe149805fcdcdf4619cafa779d.jpg)
172
+
173
+ ![](images/780dbb61ab6fc96c3d597167a7a7fe585ccae3b1c03fcfafe655c4e252d41ae4.jpg)
174
+ Mouth
175
+
176
+ ![](images/21f8062aa96a98bebd5aca3e08e8fb7a9a15f497d5276a184bc054d9863e7502.jpg)
177
+
178
+ ![](images/1b8156de8370709d63c6362329a735c15925c97ca34ebd839fdcfcf573f5f834.jpg)
179
+
180
+ ![](images/5ac15c4ec9c0baa2234dc505b4d9ee27398957d531f8168f1d07bb3b1842962a.jpg)
181
+
182
+ ![](images/e81ca7fd8cc2fb1015bfee6d68036d74a9e3f544a02751775d3f2382ba2d958a.jpg)
183
+
184
+ ![](images/62cbd5fdf2c616f7997a3abd904b82744c9c9f4ebca146c4949a55fa20f6c90c.jpg)
185
+
186
+ ![](images/6ac57ecf6b029c2077f985d5fb26b06c485c927aea75e8c9c056936f325b671f.jpg)
187
+
188
+ ![](images/88dae244652a09fe5b67332cb94197748b73e5186154b142ceace3e672d62b3c.jpg)
189
+
190
+ ![](images/63a3e6b3836c03a1003f7fc0a8eaba58698760391b091b721eb9474c2e5d7071.jpg)
191
+
192
+ ![](images/d509ea78b14020ac97c0c6bf987ebbeda981eeb450e769c0cd713e31ddd7e31d.jpg)
193
+
194
+ ![](images/6393af93c44749e4ce7b5105c464b7d89f9d74c6a080e79ec8b6fff8a370393f.jpg)
195
+ Figure 6. Image harmonization with GH-Feat. On the top left corner is the original image. Pasting a target image patch onto the original image then feeding it as the input (top row), our hierarchical encoder is able to smooth the image content and produce a photo-realistic image (bottom row).
196
+
197
+ ![](images/219ee5562e1bbc50379a4803caf4ec22e4469dca0c02cfddb74e9e7bbf5985be.jpg)
198
+ Bed
199
+
200
+ ![](images/e7907fea382914d61d2eecb9d81ba330666aa8f9a291162a3da2b27240005f1f.jpg)
201
+
202
+ ![](images/81197592372ea4e78cc451d6c04eca99989f61635ab5e6858fd95f94c273e159.jpg)
203
+ Window
204
+
205
+ ![](images/6b1a718b75d885583e78c51ac9c5133a569b12d46171a85f1c32e78f1183253a.jpg)
206
+
207
+ ![](images/e3f46300e083d3624bf2387e6a395b17da3ca6ff4fcbb993a11555eea84cc572.jpg)
208
+ Ceiling Light
209
+
210
+ ![](images/f124236860ee7dc95e75a39c0f7088ef0ae5b65d251c97ac503ce6b1badb2cfa.jpg)
211
+
212
+ ![](images/530cc35abc6094c9d5bdc4a577747a8e3faefba4cfcf0b886c1eebb3f7aea0eb.jpg)
213
+ Figure 7. Performance on different discriminative tasks using GH-Feat. Left three columns enclose the comparisons between using different spaces of StyleGAN as the representation space, where $\mathcal{V}$ space (in red color) shows stronger discriminative and hierarchical property than $\mathcal{W}$ space (in blue color). This is discussed in Sec. 4.4.1. The last column compares the two different strategies used in the face verification task, which is explained in Sec. 4.4.2. Higher level corresponds to more abstract feature.
214
+
215
+ ![](images/07614ba314eab76ea9e40d04d8a5c2d26996234336d14abc7e4e697e6385d905.jpg)
216
+
217
+ ![](images/f0a56aac308fc833fbe3c9eca2f6c8a6f6bf3ce9d169e76d613cb51a65f341ed.jpg)
218
+
219
+ ![](images/dd2185d95abbb0a2e4de0d3273dbf2fcf193635373c2c50be5315042785b6e88.jpg)
220
+
221
+ to a wide range of discriminative tasks with competitive performances. Here, we do not fine-tune the encoder for any certain task. In particular, we choose multi-level downstream applications, including image classification, face verification, pose estimation, layout prediction, landmark detection, and luminance regression. For each task, we use our encoder to extract visual features from both the training and the test set. A linear regression model (i.e., a fully-connected layer) is learned on the training set with ground-truth and then evaluated on the test set.
222
+
223
+ # 4.4.1 Discriminative and Hierarchical Property
224
+
225
+ Recall that GH-Feat is a multi-scale representation learned by using StyleGAN as a loss function. As a results, it consists of features from multiple levels, each of which correspond to a certain layer in the StyleGAN generator.
226
+
227
+ Here, we would to explore how this feature hierarchy is organized as well as how they can facilitate multi-level discriminative tasks, including face pose estimation, indoor scene layout prediction, and luminance<sup>3</sup> regression from face images. In particular, we evaluate GH-Feat on each task level by level. As a comparison, we also train encoders by treating the w code, instead of the style code y, as the representation. From Fig. 7, we have three observations: (1) GH-Feat is discriminative. (2) Features at lower level are more suitable for low-level tasks (e.g., luminance regression) and those at higher level better aid high-level tasks (e.g., pose estimation). (3) $\mathcal{V}$ space demonstrates a more obvious hierarchical property than $\mathcal{W}$ space.
228
+
229
+ ![](images/b173b837c04f847493add0102a3cebd0555d6da4313b889f9337bb2ed6756d38.jpg)
230
+ Figure 8. Image reconstruction results on LFW [25]. For each pair of images, left is the low-resolution input while right is reconstructed by GH-Feat. All samples are with the same identity.
231
+
232
+ ![](images/e4ec978ea04e942c5c336e14a7e234eb2b83cfdc95305fd9e0654ba835ff289d.jpg)
233
+
234
+ ![](images/7fb8625de8ba03ddf4efe2627bc988bf1f237decbc8867d65798cd4d12556d01.jpg)
235
+
236
+ ![](images/fcea9fd25723feb6a42b58912851f1d8721ea2fff3a8580ae798f1f6022a8616.jpg)
237
+
238
+ ![](images/f12dbbed5412e4de016b338f38619efa08ba202d2e5efb3e0abde19d6da0f1f1.jpg)
239
+
240
+ ![](images/3a8a13268edf4e82acdc56eb7f2b72e21bcf22ec9a9518fc04c84e00ca7ab430.jpg)
241
+
242
+ ![](images/8db72aeebc71b91f103f422a588cd1513c8f4f83bcc171cafd00107141fffe42.jpg)
243
+
244
+ ![](images/89279a2fc6cf6e77deb952bea1a4cb2f43e66989095dd7b7538cb61f38d01918.jpg)
245
+
246
+ # 4.4.2 Digit Recognition & Face Verification
247
+
248
+ Image classification is widely used to evaluate the performance of learned representations [24, 68, 19, 42, 13]. In this section, we first compare our proposed GH-Feat with other alternatives on a toy dataset, i.e., MNIST [35]. Then, we use a more challenging task, i.e., face verification, to evaluate the discriminative property of GH-Feat.
249
+
250
+ MNIST Digit Recognition. We first show a toy example on MNIST following prior work [12, 44]. We make a little modification to ResNet-18 like [37] which is widely used in literatures to handle samples from MNIST [35] in lower resolution. The Top-1 accuracy is reported in Tab. 3 (a). Our GH-feat outperforms ALAE [44] and BiGAN [12] with $1.45\%$ and $1.92\%$ , suggesting a stronger discriminative power. Here, ResNet-18 [20] is employed as the backbone structure for both MoCo [19] and GH-Feat.
251
+
252
+ LFW Face Verification. We directly use the proposed encoder, which is trained on FF-HQ [31], to extract GH-Feat from face images in LFW [25] and tries three different strategies on exploiting GH-Feat for face verification: (1) using a single level feature; (2) grouping multi-level features (starting from the highest level) together; (3) voting by choosing the largest face similarity across all levels. Fig. 7 (last column) shows the results from the first two strategies. Obviously, GH-Feat from the 5-th to the 9-th levels best preserve the identity information. Tab. 3 (b) compares GH-Feat with other unsupervised feature learning methods, including VAE [33], MoCo [19], and ALAE [44]. All these competitors are also trained on FF-HQ dataset [31] with optimally chosen hyper-parameters. ResNet-50 [20] is employed as the backbone for MoCo and GH-Feat. Our method with voting strategy achieves $69.7\%$ accuracy, surpassing other competitors by a large margin. We also visualize some reconstructed LFW faces in Fig. 8, where our GH-Feat well handles the domain gap (e.g., image resolution) and preserves the identity information.
253
+
254
+ # 4.4.3 Large-Scale Image Classification
255
+
256
+ We further evaluate GH-Feat on the high-level image classification task using ImageNet [8]. Before the training of encoder, we first train a StyleGAN model, with $256 \times 256$ resolution, on the ImageNet training collection. After that, we learn the hierarchical encoder by using the pre-trained generator as the supervision. No labels are involved in the
257
+
258
+ Table 3. Quantitative comparison between our proposed GH-Feat and other alternatives on MNIST [35] and LFW [25].
259
+ (a) Digit recognition on MNIST.
260
+
261
+ <table><tr><td>Methods</td><td>Acc.</td></tr><tr><td>AE(ℓ1) [23]</td><td>97.43</td></tr><tr><td>AE(ℓ2) [23]</td><td>97.37</td></tr><tr><td>BiGAN [12]</td><td>97.14</td></tr><tr><td>ALAE [44]</td><td>97.61</td></tr><tr><td>MoCo-R18 [19]</td><td>95.89</td></tr><tr><td>GH-Feat (Ours)</td><td>99.06</td></tr></table>
262
+
263
+ (b) Face verification on LFW.
264
+
265
+ <table><tr><td>Methods</td><td>Acc.</td></tr><tr><td>VAE [33]</td><td>49.3</td></tr><tr><td>MoCo-R50 [19]</td><td>48.9</td></tr><tr><td>ALAE [44]</td><td>55.7</td></tr><tr><td>GH-Feat (Grouping)</td><td>60.1</td></tr><tr><td>GH-Feat (Layer-wise)</td><td>67.5</td></tr><tr><td>GH-Feat (Voting)</td><td>69.7</td></tr></table>
266
+
267
+ Table 4. Quantitative comparison on the ImageNet [8] classification task.
268
+
269
+ <table><tr><td>Method</td><td>Architecture</td><td>Top-1 Acc.</td></tr><tr><td>Motion Seg (MS) [43, 11]</td><td>ResNet-101</td><td>27.6</td></tr><tr><td>Exemplar (Ex) [14, 11]</td><td>ResNet-101</td><td>31.5</td></tr><tr><td>Relative Po (RP) [9, 11]</td><td>ResNet-101</td><td>36.2</td></tr><tr><td>Colorization (Col) [60, 11]</td><td>ResNet-101</td><td>39.6</td></tr><tr><td colspan="3">Contrastive Learning</td></tr><tr><td>InstDisc [54]</td><td>ResNet-50</td><td>42.5</td></tr><tr><td>CPC [42]</td><td>ResNet-101</td><td>48.7</td></tr><tr><td>MoCo [19]</td><td>ResNet-50</td><td>60.6</td></tr><tr><td colspan="3">Generative Modeling</td></tr><tr><td>BiGAN [12]</td><td>AlexNet</td><td>31.0</td></tr><tr><td>SS-GAN [6]</td><td>ResNet-19</td><td>38.3</td></tr><tr><td>BigBiGAN [13]</td><td>ResNet-50</td><td>55.4</td></tr><tr><td>GH-Feat (Ours)</td><td>ResNet-50</td><td>51.1</td></tr></table>
270
+
271
+ above training process. $^{4}$ For the image classification problem, we train a linear model on top of the features extracted from the training set with the softmax loss. Then, this linear model is evaluated on the validation set. $^{5}$ Tab. 4 shows the comparison between GH-Feat and other unsupervised representation learning approaches [54, 42, 19, 12, 6, 13], where we beat most of the competitors. The state-of-the-art MoCo [19] gives the most compelling performance. But different from the representations learned with contrastive learning, GH-Feat has huge advantages in generative tasks, as already discussed in Sec. 4.3. Among adversarial representation learning approaches, BigBiGAN [13] achieves
272
+
273
+ ![](images/1457f425388b19fc6f1da07724f6686f2cac7b794672ffbd111d433c35f05ee3.jpg)
274
+ Figure 9. Landmark detection results. GH-Feat is trained on FF-HQ [31] dataset but can successfully handle the hard cases (large pose and low image quality) in MAFL dataset [63], a subset of CelebA [39].
275
+
276
+ ![](images/f052e1867671cef77727221719915ebefd1fc4e60d4ccc11f6ab7dabf2c6b882.jpg)
277
+ FF-HQ
278
+
279
+ ![](images/c4bbb89463a6b6672b9036a4360cebc0c64964167c610071b46572eae643635c.jpg)
280
+
281
+ ![](images/11b76364a6b2165d08351df47f8e6c5dad6dd38a5f49f6cf5dfc928e7aa7db31.jpg)
282
+
283
+ ![](images/bd90ace8400e720af3d6477e61799d39a401303e94c41fce6b903e4214c42744.jpg)
284
+
285
+ ![](images/4cfe02671608447cbe2004ff35ec9182caff82c9c4d311fd349da5c413bf5194.jpg)
286
+ CelebA
287
+
288
+ ![](images/f23934ad1598c20bcb69b20868013f46a38667eab441e85d71528633b4f1fbca.jpg)
289
+
290
+ ![](images/d9d986e654c193fce0099d103d1ae172af853b419e157dc94d3c7bf2bc705d13.jpg)
291
+
292
+ ![](images/04a487dccd28bbb745469b4efafab3ef60e5a79800a7635bd818497c3b83b9fb.jpg)
293
+
294
+ ![](images/fd018851b14cd88de024d7bb417724e3054171af377e944ad7007cdc1b8db83e.jpg)
295
+ Figure 10. Layout prediction results using feature learned by MoCo [19] (top row) and our GH-Feat (bottom row). Both methods are trained on LSUN bedrooms [58] and then transferred to LSUN kitchens.
296
+
297
+ ![](images/fd4aea8d8b584461235d7f3cd9c968b91aae251c9646893afa3efe817a894267.jpg)
298
+
299
+ ![](images/4a3cee648dc40da98600dd55a18dab81c0f67755da29c0effb7e378d6e63631d.jpg)
300
+ Bedroom
301
+
302
+ ![](images/e502d60cb2134e5699a999a0318c650a151fd985e471526ca6d5af6228661d1e.jpg)
303
+
304
+ ![](images/0398625901b024c22129d939009dc9b3db55187bdaaae22c92175d4754d33337.jpg)
305
+
306
+ ![](images/7786a5e39dcbab643be02f3a3fc08baa5f58d1ae5c5e0493dca303d2879c2d85.jpg)
307
+
308
+ ![](images/3143129e63f9c44040c62a63f6d867a76c92a3a6c6df45a36ea7a502dc28b716.jpg)
309
+
310
+ ![](images/351560e8de93926b1bcc19761820c94a007e5bff46530daf88ab8d0dca83c257.jpg)
311
+
312
+ ![](images/5131a4ca34d6803899f0fade48550681ccadef70d896c0196a10d2f5d541053c.jpg)
313
+
314
+ ![](images/d5e6551e773683b0729a7c8fac4fd78b4e422e389be0854a5326c090b7aa7788.jpg)
315
+
316
+ ![](images/2632053ccbd21647479cf4decab218f60349f54784b0fdc830c9b3c5c43c24b8.jpg)
317
+ Kitchen
318
+
319
+ ![](images/d55425d3c91c1a2998608559049146cac21b984ce2e03e4f00447f4f10110417.jpg)
320
+
321
+ ![](images/c2ae8f0144accdab907ebdf3e72e8555a4da1ac394ce873b02f9065eae3fedc6.jpg)
322
+
323
+ ![](images/24200682b13b53d7b64db423b60b223a62d5e995e41b0a0e3670a0bcfded5f84.jpg)
324
+
325
+ ![](images/4e436eebd63bef319066224071ac6b5c94136fa0e064acb2e0744a2a8c0f9d51.jpg)
326
+
327
+ the best performance, benefiting from the incredible large-scale training. However, GH-Feat presents a stronger generative ability, suggested by the comparison results on image reconstruction shown in Tab. 5. More discussion can be found in Supplementary Material.
328
+
329
+ # 4.4.4 Transfer Learning
330
+
331
+ In this part, we explore how GH-Feat can be transferred from one dataset to another.
332
+
333
+ Landmark Detection. We train a linear regression model using GH-Feat on FF-HQ [31] and test it on MAFL [63], which is a subset of CelebA [39]. This two datasets have a large domain gap, e.g., faces in MAFL have larger poses yet lower image quality. As shown in Fig. 9, GH-Feat shows a strong transferability across these two datasets. We compare our approach with some supervised and unsupervised alternatives [63, 59, 28, 19]. For a fair comparison, we try the multi-scale representations from MoCo [19] (i.e., Res2, Res3, Res4, and Res5 feature maps) and report the best results. Tab. 6 demonstrates the strong generalization ability of GH-Feat. In particular, it achieves on-par or better performance than the methods that are particular designed for this task [63, 59, 28]. Also, it outperforms MoCo [19] on this mid-level discriminative task.
334
+
335
+ Layout Prediction. We train the layout predictor on LSUN [58] bedrooms and test it on kitchens to validate how GH-Feat can be transferred from one scene category to another. Feature learned by MoCo [19] on the bedroom dataset is used for comparison. We can tell from Fig. 10 that GH-Feat shows better predictions than MoCo, especially on the target set (i.e., kitchens), suggesting a
336
+
337
+ Table 5. Qualitative comparison between BigBiGAN [13] and GH-Feat on reconstructing images from ImageNet [8].
338
+
339
+ <table><tr><td></td><td>MSE↓</td><td>SSIM↑</td><td>FID↓</td></tr><tr><td>BigBiGAN [13]</td><td>0.363</td><td>0.236</td><td>33.42</td></tr><tr><td>GH-Feat (Ours)</td><td>0.078</td><td>0.431</td><td>22.70</td></tr></table>
340
+
341
+ Table 6. Landmark detection results on MAFL [63].
342
+
343
+ <table><tr><td>Method</td><td>Supervision</td><td>MSE↓</td></tr><tr><td>TCDCN [63]</td><td>✓</td><td>7.95</td></tr><tr><td>MTCNN [59]</td><td>✓</td><td>5.39</td></tr><tr><td>Cond. ImGen [28]</td><td></td><td>4.95</td></tr><tr><td>ALAE [44].</td><td></td><td>10.13</td></tr><tr><td>MoCo-R50 [19]</td><td></td><td>9.07</td></tr><tr><td>GH-Feat (Ours)</td><td></td><td>5.12</td></tr></table>
344
+
345
+ stronger transferability. Like landmark detection, we also conduct experiments with the 4-level representations from MoCo [19] and select the best.
346
+
347
+ # 5. Conclusion
348
+
349
+ In this work, we consider the well-trained GAN generator as a learned loss function for learning multi-scale features. The resulting Generative Hierarchical Features are shown to be generalizable to a wide range of vision tasks.
350
+
351
+ Acknowledgements: This work is supported in part by the Early Career Scheme (ECS) through the Research Grants Council (RGC) of Hong Kong under Grant No.24206219, CUHK FoE RSFS Grant, SenseTime Collaborative Grant, and Centre for Perceptual and Interactive Intelligence (CPII) Ltd under the Innovation and Technology Fund.
352
+
353
+ # References
354
+
355
+ [1] David Bau, Bolei Zhou, Aditya Khosla, Aude Oliva, and Antonio Torralba. Network dissection: Quantifying interpretability of deep visual representations. In IEEE Conf. Comput. Vis. Pattern Recog., 2017. 1
356
+ [2] David Bau, Jun-Yan Zhu, Hendrik Strobelt, Bolei Zhou, Joshua B. Tenenbaum, William T. Freeman, and Antonio Torralba. Gan dissection: Visualizing and understanding generative adversarial networks. In Int. Conf. Learn. Represent., 2019. 2
357
+ [3] Herbert Bay, Tinne Tuytelaars, and Luc Van Gool. Surf: Speeded up robust features. In Eur. Conf. Comput. Vis., 2006. 2
358
+ [4] Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Trans. Pattern Anal. Mach. Intell., 2013. 1
359
+ [5] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In Int. Conf. Learn. Represent., 2019. 2
360
+ [6] Ting Chen, Xiaohua Zhai, Marvin Ritter, Mario Lucic, and Neil Houlsby. Self-supervised gans via auxiliary rotation loss. In IEEE Conf. Comput. Vis. Pattern Recog., 2019. 7
361
+ [7] Navneet Dalal and Bill Triggs. Histograms of oriented gradients for human detection. In IEEE Conf. Comput. Vis. Pattern Recog., 2005. 2
362
+ [8] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In IEEE Conf. Comput. Vis. Pattern Recog., 2009. 1, 4, 7, 8
363
+ [9] Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Int. Conf. Comput. Vis., 2015. 7
364
+ [10] Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In Int. Conf. Comput. Vis., 2017. 2
365
+ [11] Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In Int. Conf. Comput. Vis., 2017.
366
+ [12] Jeff Donahue, Philipp Krahenbuhl, and Trevor Darrell. Adversarial feature learning. In Int. Conf. Learn. Represent., 2017. 1, 2, 4, 7
367
+ [13] Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. In Adv. Neural Inform. Process. Syst., 2019. 1, 2, 4, 7, 8
368
+ [14] Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Ried-miller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Adv. Neural Inform. Process. Syst., 2014. 7
369
+ [15] Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarily learned inference. In Int. Conf. Learn. Represent., 2017. 1, 2, 4
370
+ [16] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In Int. Conf. Learn. Represent., 2018. 2
371
+ [17] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and
372
+
373
+ Yoshua Bengio. Generative adversarial nets. In Adv. Neural Inform. Process. Syst., 2014. 1, 2, 3, 5
374
+ [18] Jinjin Gu, Yujun Shen, and Bolei Zhou. Image processing using multi-code gan prior. In IEEE Conf. Comput. Vis. Pattern Recog., 2020. 2
375
+ [19] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In IEEE Conf. Comput. Vis. Pattern Recog., 2020. 2, 4, 5, 7, 8
376
+ [20] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conf. Comput. Vis. Pattern Recog., 2016. 2, 3, 5, 7
377
+ [21] Olivier J Henaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019. 2
378
+ [22] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local Nash equilibrium. In Adv. Neural Inform. Process. Syst., 2017. 4
379
+ [23] Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. Science, 2006. 7
380
+ [24] R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In Int. Conf. Learn. Represent., 2019. 2, 4, 7
381
+ [25] Gary B Huang, Manu Ramesh, Tamara Berg, and Erik Learned-Miller. Labeled faces in the wild: A database for studying face recognition in unconstrained environments. Technical report, Technical Report 07-49, University of Massachusetts, Amherst, 2007. 4, 7
382
+ [26] Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Int. Conf. Comput. Vis., 2017. 2
383
+ [27] Ali Jahanian, Lucy Chai, and Phillip Isola. On the "steerability" of generative adversarial networks. In Int. Conf. Learn. Represent., 2020. 2
384
+ [28] Tomas Jakab, Ankush Gupta, Hakan Bilen, and Andrea Vedaldi. Unsupervised learning of object landmarks through conditional image generation. In Adv. Neural Inform. Process. Syst., 2018. 8
385
+ [29] Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Eur. Conf. Comput. Vis., 2016. 3
386
+ [30] Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In Int. Conf. Learn. Represent., 2018. 2
387
+ [31] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In IEEE Conf. Comput. Vis. Pattern Recog., 2019. 1, 2, 3, 4, 5, 7, 8
388
+ [32] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Int. Conf. Learn. Represent., 2015. 4
389
+
390
+ [33] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In Int. Conf. Learn. Represent., 2014. 7
391
+ [34] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Adv. Neural Inform. Process. Syst., 2012. 2
392
+ [35] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 1998. 4, 7
393
+ [36] Tsung-Yi Lin, Piotr Dólar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In IEEE Conf. Comput. Vis. Pattern Recog., 2017. 3
394
+ [37] Kuang Liu. Pyotrch cifar10. https://github.com/kuangliu/pytorch-cifar.git, 2019.7
395
+ [38] Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In IEEE Conf. Comput. Vis. Pattern Recog., 2018. 3
396
+ [39] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaou Tang. Deep learning face attributes in the wild. In Int. Conf. Comput. Vis., 2015. 8
397
+ [40] David G Lowe. Distinctive image features from scale-invariant keypoints. Int. J. Comput. Vis., 2004. 2
398
+ [41] DZ Matthew and R Fergus. Visualizing and understanding convolutional neural networks. In IEEE Conf. Comput. Vis. Pattern Recog., 2014. 1
399
+ [42] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 2, 4, 7
400
+ [43] Deepak Pathak, Ross Girshick, Piotr Dollar, Trevor Darrell, and Bharath Hariharan. Learning features by watching objects move. In IEEE Conf. Comput. Vis. Pattern Recog., 2017. 7
401
+ [44] Stanislav Pidhorskyi, Donald Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In IEEE Conf. Comput. Vis. Pattern Recog., 2020. 1, 2, 4, 5, 7, 8
402
+ [45] Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In Int. Conf. Learn. Represent., 2016. 2
403
+ [46] Ali Sharif Razavian, Hossein Azizpour, Josephine Sullivan, and Stefan Carlsson. Cnn features off-the-shelf: an astounding baseline for recognition. In IEEE Conf. Comput. Vis. Pattern Recog. Worksh., 2014. 1
404
+ [47] Yujun Shen, Ceyuan Yang, Xiaou Tang, and Bolei Zhou. Interfacegan: Interpreting the disentangled face representation learned by gans. IEEE Trans. Pattern Anal. Mach. Intell., 2020. 1, 2
405
+ [48] Assaf Shocher, Yossi Gandelsman, Inbar Mosseri, Michal Yarom, Michal Irani, William T Freeman, and Tali Dekel. Semantic pyramid for image generation. In IEEE Conf. Comput. Vis. Pattern Recog., 2020. 2
406
+ [49] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In Int. Conf. Learn. Represent., 2015. 2, 3
407
+ [50] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with
408
+
409
+ convolutions. In IEEE Conf. Comput. Vis. Pattern Recog., 2015. 7
410
+ [51] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019. 2, 4
411
+ [52] Zhou Wang, Alan C Bovik, Hamid R Sheikh, and Eero P Simoncelli. Image quality assessment: from error visibility to structural similarity. IEEE Trans. Image Process., 2004. 4
412
+ [53] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In IEEE Conf. Comput. Vis. Pattern Recog., 2018. 2
413
+ [54] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In IEEE Conf. Comput. Vis. Pattern Recog., 2018. 7
414
+ [55] Ceyuan Yang, Yujun Shen, and Bolei Zhou. Semantic hierarchy emerges in deep generative representations for scene synthesis. Int. J. Comput. Vis., 2020. 1, 2, 3
415
+ [56] Ceyuan Yang, Yinghao Xu, Jianping Shi, Bo Dai, and Bolei Zhou. Temporal pyramid network for action recognition. In IEEE Conf. Comput. Vis. Pattern Recog., 2020. 3
416
+ [57] Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Adv. Neural Inform. Process. Syst., 2014. 1, 2
417
+ [58] Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015. 4, 5, 8
418
+ [59] Kaipeng Zhang, Zhanpeng Zhang, Zhifeng Li, and Yu Qiao. Joint face detection and alignment using multitask cascaded convolutional networks. IEEE Signal Processing Letters, 2016. 8
419
+ [60] Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In Eur. Conf. Comput. Vis., 2016. 7
420
+ [61] Richard Zhang, Phillip Isola, and Alexei A Efros. Split-brain autoencoders: Unsupervised learning by cross-channel prediction. In IEEE Conf. Comput. Vis. Pattern Recog., 2017. 2
421
+ [62] Weidong Zhang, Wei Zhang, and Jason Gu. Edge-semantic learning strategy for layout estimation in indoor environment. Transactions On Cybernetics, 2019. 4
422
+ [63] Zhanpeng Zhang, Ping Luo, Chen Change Loy, and Xiaou Tang. Facial landmark detection by deep multi-task learning. In Eur. Conf. Comput. Vis., 2014. 4, 8
423
+ [64] Nanxuan Zhao, Zhirong Wu, Rynson WH Lau, and Stephen Lin. What makes instance discrimination good for transfer learning? arXiv preprint arXiv:2006.06606, 2020. 1, 2
424
+ [65] Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Object detectors emerge in deep scene cnns. In Int. Conf. Learn. Represent., 2015. 1
425
+ [66] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 2017. 1
426
+ [67] Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. Indomain gan inversion for real image editing. In Eur. Conf. Comput. Vis., 2020. 2
427
+
428
+ [68] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In Int. Conf. Comput. Vis., 2019. 2, 4, 7
429
+ [69] Chuhang Zou, Alex Colburn, Qi Shan, and Derek Hoiem. Layoutnet: Reconstructing the 3d room layout from a single rgb image. In IEEE Conf. Comput. Vis. Pattern Recog., 2018. 4
generativehierarchicalfeaturesfromsynthesizingimages/images.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93a4b481909234eeb2b3f4edff74e156ba3b783a5d98a6ab450ef50466280a83
3
+ size 758599
generativehierarchicalfeaturesfromsynthesizingimages/layout.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61f6fa3e23eac4b51992211a09abeba88ecdfe5c5d670387615bbf3d4cb6075e
3
+ size 506908
generativeinterventionsforcausallearning/c723740b-fba3-4566-b6b7-5e14a704e730_content_list.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d3af70296819e61d39ba3950655d448c8b229127e81c31ec8da6d46d8b992e0
3
+ size 91521
generativeinterventionsforcausallearning/c723740b-fba3-4566-b6b7-5e14a704e730_model.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9244670406e46781c88ccdd17ed0d20e1d66384c7197fe5b4ba12b1a59d6fd43
3
+ size 110788