---
title: 【DL輪読会】Domain Generalization by Learning and Removing Domainspecific Features
tags:  #@deep learning jp  
author: [Deep Learning JP](https://www.docswell.com/user/DeepLearning2023)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/PJXD5VX3EX.jpg?width=480
description: 2023/1/20 Deep Learning JP http://deeplearning.jp/seminar-2/
published: January 20, 23
canonical: https://www.docswell.com/s/DeepLearning2023/57VLLW-dldomain-generalization-by-learning-and-removing-domainspecific-features
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/PJXD5VX3EX.jpg)

DEEP LEARNING JP
[DL Papers]
Domain Generalization by Learning and Removing Domainspecific Features
Yuting Lin, Kokusai Kogyo Co., Ltd.(国際航業)
http://deeplearning.jp/
1


# Page. 2

![Page Image](https://bcdn.docswell.com/page/3JKX6QWNED.jpg)

書誌情報
• タイトル
– Domain Generalization by Learning and Removing Domain-specific Features
• 著者
– Yu Ding1, Lei Wang1, Bin Liang2, Shuming Liang2, Yang Wang2, Fang Chen2
– 1University of Wollongong 2University of Technology Sydney
• NeurIPS2022に採択
• Paper
– https://openreview.net/forum?id=37Rf7BTAtAM
• Code
– https://github.com/yulearningg/LRDG
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/LE356P1ZJ5.jpg)

Introduction
• 背景
– Domain shiftによる汎化性能の低下は深層学習の一つの課題
– CNNはdomainに依存するlocal特徴で認識してしまう傾向
• 本論文はunseen domainでも適用可能な学習手法domain generalizationに
注目
– 既存手法は、 domain依存な特徴は除去できていないことが課題
• Domain-specific情報は明示的に教えず、sourceからdomain-invariant情報のみで学習
• テクスチャなどの情報をlocalな特徴として、学習しない（ペナルティをかける）手法もあるが、他の
localな特徴の除去に保証がない
– domain依存な特徴明示的に排除（学習しないように）する手法を提案
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/8EDDVLX4EG.jpg)

概要
• 提案手法の概要
– domain-specific classifiers, encoder-decoder network, domain-invariant classifierで
構成される
– source domain毎にdomain-specific classifierを設け、対象domainに依存する情報を
抽出
• 他のsource domainに対応できないように
– 画像をdomain不変なspaceにmapping
– domain-invariant classifierで最終的に認識を行う
• Data augmentation的な手法と異なる点
– 学習データは増やさず、domain不変な中間表現を作成
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/V7PXV2PVE8.jpg)

提案手法
• Image-to-image translation手法にインスパイアされた
• 提案手法の全体図
出典：https://openreview.net/forum?id=37Rf7BTAtAM
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/2JVLZD2R7Q.jpg)

提案手法の詳細
• Learning domain-specific features
– N source domain 𝒟𝑠 = 𝐷𝑠1 , 𝐷𝑠2 , ⋯ , 𝐷𝑠𝑁 に対し、classifier ℱ𝑠 = 𝐹1 , 𝐹2 , ⋯ , 𝐹𝑁 を用意
– 𝐷𝑠𝑖 は𝐹𝑖 のみ対応可能：
• 𝐹𝑖 のみ認識可能：分類loss(cross entropy loss)を最小になるように学習をガイド
𝑎𝑟𝑔 min 𝔼𝐷𝑠𝑖 ~𝒟𝑠 𝔼
𝜃𝑖
𝑥𝑗𝑖 ,𝑦𝑗𝑖
~𝐷𝑠𝑖
𝐿𝐶 𝐹𝑖 𝑥𝑗𝑖 ; 𝜃𝑖 , 𝑦𝑗𝑖
• 他のclassifier（ 𝐹1 , 𝐹2 , ⋯ 𝐹𝑖−1 , 𝐹𝑖+1 , ⋯ 𝐹𝑁 )は認識できない：uncertainty loss(entropy loss)で学習
できないように
𝑎𝑟𝑔 max 𝔼𝐷𝑠𝑘 ~𝒟𝑠 ,𝑘≠𝑖 𝔼
𝜃𝑖
𝑥𝑗𝑘 ,𝑦𝑗𝑘
~𝐷𝑠𝑘
𝐿𝑈 𝐹𝑖 𝑥𝑗𝑘 ; 𝜃𝑖
– classifier ℱ𝑠 は予め学習したら、パラメータをフリーズ
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/5EGX4YR6JL.jpg)

提案手法の詳細
• Removing domain-specific features
– Encoder-decoder形式で入力画像を新しい画像空間にmapping
– その画像空間は各classifierのuncertainty lossを最大化する → domain不変な画像
空間にmapping
𝑎𝑟𝑔 max 𝔼𝐷𝑠𝑖 ~𝒟𝑠 𝔼
𝜃𝑀
𝑥𝑗𝑖 ,𝑦𝑗𝑖
𝐿𝑈 𝐹𝑖 𝑀 𝑥𝑗𝑖 ; 𝜃𝑀 ; 𝜃𝑖
~𝐷𝑠𝑖
– Reconstruction loss(pixel-wise l2 loss)で、変な画像にmappingされないように
𝑎𝑟𝑔 min 𝔼𝐷𝑠𝑖 ~𝒟𝑠 𝔼
𝜃𝑀
𝑥𝑗𝑖 ,𝑦𝑗𝑖
~𝐷𝑠𝑖
𝐿𝑅 𝑀 𝑥𝑗𝑖 ; 𝜃𝑀 , 𝑥𝑗𝑖
– domain-invariant classifier Fで認識（タスク）を行う
𝑎𝑟𝑔 min 𝔼𝐷𝑠𝑖~𝒟𝑠 𝔼 𝑥 𝑖 ,𝑦𝑖 ~𝐷𝑖 𝐿𝐶 𝐹 𝑀 𝑥𝑗𝑖 ; 𝜃𝑀 ; 𝜃𝐹 , 𝑦𝑗𝑖
𝜃𝑀 ,𝜃𝐹
𝑗
𝑗
𝑠
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/4JQ8GMV27P.jpg)

提案手法の詳細
• 提案手法のLoss
– domain-specific classifier学習の段階
ℱ
ℱ
𝐿1 = 𝐿𝐶𝑠 + 𝜆1 𝐿𝑈𝑠
– domain-invariant classifier学習の段階
𝑀
𝐿2 = 𝐿𝐹𝐶 𝑀 + 𝜆2 𝐿𝑀
𝑈 + 𝜆3 𝐿𝑅
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/K7425VMPJ1.jpg)

提案手法の理論的な分析
• 提案手法の理論的な分析
–
–
–
–
完璧なlabeling function: 𝑓 ∶ 𝒳 → 𝒴
実際のfunction(hypothesis): ℎ ∶ 𝒳 → 𝒴
domain 𝒟おけるℎのリスク: ℛ ℎ = 𝔼𝑥~𝒟 ℒ ℎ 𝑥 − 𝑓 𝑥
Source domainが複数ある場合は混合分布で表現
𝑁
𝑖
ഥ: 𝐷
ഥ ∙ = σ𝑁
• Λ𝑆 = 𝐷
𝑖=1 𝜋𝑖 𝐷𝑆 ∙ , 0 ≤ 𝜋𝑖 ≤ 1, σ𝑖=1 𝜋𝑖 = 1
– 既往文献[1]により、Λ𝑆 と𝒟𝑡 のgeneralization risk boundは
– 𝒟𝑡 のupper boundは𝛾, 𝜖に依存
෡𝑠1 , 𝐷
෡𝑠2 , ⋯ , 𝐷
෡𝑠𝑁 , 𝒟
෡𝑡に
– 提案手法domain specific featureを排除し、 𝐷𝑠1 , 𝐷𝑠2 , ⋯ , 𝐷𝑠𝑁 , 𝒟𝑡 から 𝐷
mapping
෡𝑠𝑖 , 𝐷
෡𝑠𝑗 ≤ 𝐷𝑠𝑖 , 𝐷𝑠𝑗 → source domainの分布に接近し、𝜖が小さくなる
• 𝑑ℋ 𝐷
෡ 𝑡 もsource domainの分布に接近し、𝛾も小さくなる
• 𝒟
[1] Isabela Albuquerque, João Monteiro, Mohammad Darvishi, Tiago H Falk, and Ioannis Mitliagkas. Generalizing to unseen domains via distribution matching. arXiv preprint arXiv:1911.00804, 2020.
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/LJ1MW38XEG.jpg)

実験設定
• データセット
–
–
–
–
PACS: Photo (P), Art Painting (A), Cartoon (C) and Sketch (S)
VLCS: PASCAL VOC 2007 (V), LabelMe (L), Caltech (C) and Sun (S)
Office-Home: Art (A), Clipart (C), Product (P), and Real-World (R)
そのうち、３つをsource domain、1つをtarget domain
• Network:
– Encoder-decoder: U-Net
– Classifier (ImageNet pretrained)
• AlexNet: PACS, VLCS
• ResNet18: PACS and Office-Home
• ResNet50: PACS
• 比較対象：
– domain-invariant based手法、data augmentation based手法、 meta-learning based手法
– Baseline: empirical risk minimization (ERM)
10


# Page. 11

![Page Image](https://bcdn.docswell.com/page/GJW36PZKJ2.jpg)

実験結果-定量評価
• PACSの検証結果
– Domain: Art painting, Cartoon, Photo, Sketch
– 全体的に評価する場合、提案手法の精度が最も高い
– Domain-specific/invariant情報両方を利用する手法と比較
• Art paintingとPhotoは共通するdomain-specific特徴があり、お互いのdomainの認識にポジティブな効果がある。一方、
Cartoon, Sketchにはネガティブに働く傾向
出典: https://deepai.org/publication/domain-generalization-via-gradient-surgery
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/4EZVYK1NJ3.jpg)

実験結果-定量評価
• VLCSの検証結果：精度が2nd
• Office-Homeの検証結果：精度が1st
• 提案手法の有効性は確認
出典: https://deepai.org/publication/domain-generalization-via-gradient-surgery
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/Y765DQL9EV.jpg)

実験結果-Domain divergence
• Source domain divergence
– H-divergenceで評価：
•
•
•
•
classifier(linearSVM)でsource domainを分類できるかで評価
Proxy A-distance: 2 1 − 2𝜀 , where 𝜀 = test error
Baseline: AlexNetの最終層をＳＶＭに入力
提案手法：domain-invariant classifierの最終層をＳＶＭに入力
– 提案手法（mapped source domain）はdomain分布を近づけることができた
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/G75Y3R1D74.jpg)

実験結果-Domain divergence
• Source-Target domain divergence
– Λ𝑆 と𝒟𝑡 のdivergenceで評価
𝑁
𝑖
ഥ: 𝐷
ഥ ∙ = σ𝑁
• Λ𝑆 = 𝐷
𝑖=1 𝜋𝑖 𝐷𝑆 ∙ , 0 ≤ 𝜋𝑖 ≤ 1, σ𝑖=1 𝜋𝑖 = 1
• 𝜋𝑖 は{0, 0.1, 0.2, · · · , 0.9, 1}からrandom samplingして評価
– 提案手法は、source domainとtarget domain間のdivergence
を削減できた
• 提案手法は、source domain間の分布の違い𝛾、
source-target domain間の分布の違い𝜖を削減し、
generalization risk boundを減らすことができた
14


# Page. 15

![Page Image](https://bcdn.docswell.com/page/9J2GZD9MJR.jpg)

まとめ
• 明示的にdomain-specific情報を除外する手法を提案
– ネットワークはdomain-specific classifiers, encoder-decoder network, domaininvariant classifierで構成
– 2-step形式で学習
• Limitation
– Source domainの数に応じてdomain-specific classifierを用意する必要がある
• novel domain-specific classifierが望ましい
– Target domainのdomain-specific情報を除外できない
• 潜在空間上で実施することが考えられる
15


