はじめに
GAN Compression: Efficient Architectures for Interactive Conditional GANsの日本語訳です.
DeepLに丸投げしただけなので違和感あるところが多々あります.
少しでも参考になればよいと思います.
元の論文はこちらです.
https://arxiv.org/pdf/2003.08936.pdf#page=9&zoom=100,412,525
Abst
Conditional Generative Adversarial Networks (cGANs) have enabled controllable image synthesis for many computer vision and graphics applications. However, recent cGANs are 1-2 orders of magnitude more computationallyintensive than modern recognition CNNs. For example, GauGAN consumes 281G MACs per image, compared to 0.44G MACs for MobileNet-v3, making it difficult for interactive deployment. In this work, we propose a general-purpose compression framework for reducing the inference time and model size of the generator in cGANs. Directly applying existing CNNs compression methods yields poor performance due to the difficulty of GAN training and the differences in generator architectures. We address these challenges in two ways. First, to stabilize the GAN training, we transfer knowledge of multiple intermediate representations of the original model to its compressed model, and unify unpaired and paired learning. Second, instead of reusing existing CNN designs, our method automatically finds efficient architectures via neural architecture search (NAS). To accelerate the search process, we decouple the model training and architecture search via weight sharing. Experiments demonstrate the effectiveness of our method across different supervision settings (paired and unpaired), model architectures, and learning methods (e.g., pix2pix, GauGAN, CycleGAN). Without losing image quality, we reduce the computation of CycleGAN by more than 20× and GauGAN by 9×, paving the way for interactive image synthesis. The code and demo are publicly available.
条件付き生成的敵対的ネットワーク(cGAN)は, 多くのコンピュータービジョンおよびグラフィックスアプリケーションで制御可能な画像合成を可能にしました. ただし, 最近のcGANは, 最新の認識CNNよりも1〜2桁多く計算集約的です. たとえば, GauGANは, MobileNet-v3の0.44G MACと比較して, イメージごとに281G MACを消費するため, インタラクティブな展開が困難になります. この作業では, cGANのジェネレータの推論時間とモデルサイズを削減するための汎用圧縮フレームワークを提案します. 既存のCNN圧縮方法を直接適用すると, GANトレーニングの難しさとジェネレーターアーキテクチャの違いにより, パフォーマンスが低下します. これらの課題には2つの方法で対処します. まず, GANトレーニングを安定させるために, 元のモデルの複数の中間表現の知識を圧縮モデルに転送し, 対になっていない学習と対になっている学習を統合します. 次に, 既存のCNN設計を再利用する代わりに, 私たちの方法はニューラルアーキテクチャ検索(NAS)を介して効率的なアーキテクチャを自動的に見つけます. 検索プロセスを高速化するために, 重み共有を介してモデルトレーニングとアーキテクチャ検索を分離します. 実験は, さまざまな監視設定(ペアおよびペアなし), モデルアーキテクチャ, および学習方法(pix2pix, GauGAN, CycleGANなど)にわたる方法の有効性を示しています. 画質を損なうことなく, CycleGANの計算を20倍以上, GauGANの計算を9倍削減し, インタラクティブな画像合成への道を開きます. コードとデモは公開されています.
1. Introduction
Generative Adversarial Networks (GANs) [14] excel at synthesizing photo-realistic images. Their conditional extension, conditional GANs [44, 27, 69], allows controllable image synthesis and enables many computer vision and graphics applications such as interactively creating an image from a user drawing [45], transferring the motion of a dancing video stream to a different person [57, 8, 1], or creating VR facial animation for remote social interaction [59]. All of these applications require models to interact with humans and therefore demand low-latency on-device performance for better user experience. However, edge devices (mobile phones, tablets, VR headsets) are tightly constrained by hardware resources such as memory and battery. This computational bottleneck prevents conditional GANs from being deployed on edge devices. Different from image recognition CNNs [31, 53, 19, 25], image-conditional GANs are notoriously computationally intensive. For example, the widely-used CycleGAN model [69] requires more than 50G MACs∗ , 100× more than MobileNet [25]. A more recent model GauGAN [45], though generating photo-realistic high-resolution images, requires more than 250G MACs, 500× more than MobileNet [25, 49, 24].
序章
Generative Adversarial Networks (GANs) [14]は, 写真のようにリアルな画像を合成することに優れています. その条件拡張である条件付きGAN [44, 27, 69] は, 制御可能な画像合成を可能にし, ユーザーが描いた絵からインタラクティブに画像を作成したり [45], 踊っているビデオストリームの動きを別の人に転送したり [57, 8, 1], リモートソーシャルインタラクションのためのVRフェイシャルアニメーションを作成したり [59] など, 多くのコンピュータビジョンおよびグラフィックスアプリケーションを可能にします. これらのアプリケーションはすべて, 人間と対話するモデルを必要とするため, ユーザー体験を向上させるために低レイテンシのオンデバイス性能が求められます. しかし, エッジデバイス(携帯電話, タブレット, VRヘッドセット)は, メモリやバッテリーなどのハードウェアリソースに厳しい制約を受けます. この計算上のボトルネックが条件付きGANをエッジデバイスに展開することを妨げています. 画像認識CNN [31, 53, 19, 25] とは異なり, 画像条件付きGANは計算量が多いことで知られています. 例えば, 広く使われているCycleGANモデル[69]では, 50G以上のMAC∗が必要で, MobileNet[25]の100倍以上の計算量を必要とする. 最近のモデル GauGAN [45] は, フォトリアリスティックな高解像度画像を生成しているにもかかわらず, 250G以上のMACを必要とし, MobileNet [25, 49, 24]の500倍以上の計算量を必要とします.
In this work, we present GAN Compression, a generalpurpose compression method for reducing the inference time and computational cost for conditional GANs. We observe that compressing generative models faces two fundamental difficulties: GANs are unstable to train, especially under the unpaired setting; generators also differ from recognition CNNs, making it hard to reuse existing CNN designs. To address these issues, we first transfer the knowledge from the intermediate representations of the original teacher generator to its corresponding layers of its compressed student generator. We also find it beneficial to create pseudo pairs using the teacher model’s output for unpaired training. This transforms the unpaired learning to a paired learning. Second, we use neural architecture search (NAS) to automatically find an efficient network with significantly fewer computation costs and parameters. To reduce the training cost, we decouple the model training from architecture search by training a “oncefor-all network” that contains all possible channel number configurations. The once-for-all network can generate many sub-networks by weight sharing and enable us to evaluate the performance of each sub-network without retraining. Our method can be applied to various conditional GAN models regardless of model architectures, learning algorithms, and supervision settings (paired or unpaired). Through extensive experiments, we show that our method can reduce the computation of three widely-used conditional GAN models including pix2pix [27], CycleGAN [69], and GauGAN [45] by 9× to 21× regarding MACs, without loss of the visual fidelity of generated images (see Figure 1 for several examples). Finally, we deploy our compressed pix2pix model on a mobile device (Jetson Nano) and demonstrate an interactive edges2shoes application [demo].
本研究では, 条件付きGANの推論時間と計算コストを削減するための汎用的な圧縮手法であるGAN圧縮を提案する. 生成モデルの圧縮には, 2つの基本的な問題がある. GANは, 特にペアになっていない設定の下では, 学習が不安定である. また, 生成器は認識CNNとは異なり, 既存のCNNの設計を再利用することが難しい. これらの問題に対処するために, 我々はまず, 元の教師ジェネレータの中間表現から, 圧縮された生徒ジェネレータの対応する層に知識を移す. また, 教師モデルの出力を用いて疑似ペアを作成し, 不対の学習を行うことも有効であることがわかった. これにより, 非対になった学習が対になった学習に変換されます. 第二に, ニューラルアーキテクチャ探索(NAS)を用いて, 計算コストとパラメータを大幅に削減した効率的なネットワークを自動的に見つける. 学習コストを削減するために, 可能なすべてのチャンネル番号構成を含む「ワンスフォーオールネットワーク」を学習することで, モデル学習をアーキテクチャ探索から切り離している. このワンスフォーオールネットワークは, 重みを共有することで多くのサブネットワークを生成することができ, 再学習を行わずに各サブネットワークの性能を評価することができる. 我々の手法は, モデルアーキテクチャ, 学習アルゴリズム, スーパービジョンの設定(ペアまたはアンペア)に関係なく, 様々な条件付きGANモデルに適用可能である. 大規模な実験により, pix2pix [27], CycleGAN [69], GauGAN [45]を含む, 広く利用されている3つの条件付きGANモデルの計算量を, 生成された画像の視覚的忠実度を損なうことなく, MACに関して9倍から21倍に削減できることを示しました(いくつかの例については図1を参照). 最後に,我々の圧縮pix2pixモデルをモバイルデバイス(Jetson Nano)上に展開し,インタラクティブなEdge2shoesアプリケーション[demo]のデモを行う.
2. Related Work
Conditional GANs.
Generative Adversarial Networks (GANs) [14] are excel at synthesizing photo-realistic results [29, 5]. Its conditional form, conditional GANs [44, 27] further enables controllable image synthesis, allowing a user to synthesize images given various conditional inputs such as user sketches [27, 50], class labels [44, 5], or textual descriptions [47, 67]. Subsequent works further increased the resolution and realism of the results [58, 45]. Later, several algorithms were proposed to learn conditional GANs without paired data [55, 51, 69, 30, 62, 38, 11, 26, 32].
The high-resolution, photo-realistic synthesized results come at the cost of intensive computation. As shown in Figure 2, although the model size is of the same magnitude as the size of image recognition CNNs [19], conditional GANs require two orders of magnitudes more computations. This makes it challenging to deploy these models on edge devices given limited computational resources. In this work, we focus on efficient image-conditional GANs architectures for interactive applications.
関連業務
条件付きGAN
Generative Adversarial Networks (GAN) [14] は, フォトリアリスティックな結果を合成することに優れている [29, 5]. 条件付きGAN [44, 27]はさらに制御可能な画像合成を可能にし, ユーザがユーザスケッチ[27, 50], クラスラベル[44, 5], またはテキスト記述[47, 67]などの様々な条件入力を与えられた画像を合成することを可能にします. その後の研究では, 結果の解像度とリアリズムがさらに向上しました[58, 45]. その後, ペアデータなしで条件付きGANを学習するためのアルゴリズムがいくつか提案された [55, 51, 69, 30, 62, 38, 11, 26, 32].
高解像度でフォトリアリスティックな合成結果は, 集中的な計算を犠牲にして得られる. 図2に示すように, モデルサイズは画像認識CNN [19]と同じ大きさであるが, 条件付きGANは2桁の計算量を必要とする. このため,限られた計算資源の中でエッジデバイス上にこれらのモデルを展開することは困難である.本研究では, 対話型アプリケーションのための効率的な画像条件付きGANのアーキテクチャに焦点を当てている.
Image may be NSFW.
Clik here to view.
Model acceleration.
Extensive attention has been paid to hardware-efficient deep learning for various real-world applications [18, 17, 68, 56, 16]. To reduce redundancy in network weights, researchers proposed to prune the connections between layers [18, 17, 60]. However, the pruned networks require specialized hardware to achieve its full speedup. Several subsequent works proposed to prune entire convolution filters [21, 34, 39] to improve the regularity of computation. AutoML for Model Compression (AMC) [20] leverages reinforcement learning to determine the pruning ratio of each layer automatically. Liu et al. [40] later replaced the reinforcement learning by an evolutionary search algorithm. Recently, Shu et al. [52] proposed co-evolutionary pruning for CycleGAN by modifying the original CycleGAN algorithm. This method is tailored for a particular algorithm. The compressed model significantly increases FID under a moderate compression ratio (4.2×). In contrast, our model-agnostic method can be applied to conditional GANs with different learning algorithms, architectures, and both paired and unpaired settings. We assume no knowledge of the original cGAN learning algorithm. Experiments show that our general-purpose method achieves 21.1× compression ratio (5× better than CycleGAN-specific method [52]) while retaining the FID of original models.
モデルアクセラレーション.
さまざまな実世界でのアプリケーションのためのハードウェア効率の高い深層学習には大きな注目が集まっている [18, 17, 68, 56, 16]. ネットワーク重みの冗長性を減らすために, 研究者は層間の接続を刈り込むことを提案した [18, 17, 60]. しかし, 剪定されたネットワークは, 完全な高速化を達成するために特殊なハードウェアを必要とします. その後のいくつかの研究では, 計算の規則性を向上させるために, 畳み込みフィルタ全体を刈り込むことが提案されています[21, 34, 39]. AutoML for Model Compression (AMC) [20] は,強化学習を利用して各レイヤの剪定率を自動的に決定する.Liuら[40]は,後に強化学習を進化的探索アルゴリズムに置き換えた.最近, Shuら[52]は, オリジナルのCycleGANアルゴリズムを修正することで, CycleGANのための共進化的剪定を提案した. この方法は, 特定のアルゴリズムに合わせたものである. 圧縮モデルは, 適度な圧縮率(4.2×)の下でFIDを有意に増加させる. 対照的に, 我々のモデルにとらわれない方法は, 異なる学習アルゴリズム, アーキテクチャ, およびペアとアンペアの両方の設定を持つ条件付きGANに適用することができる. 我々は, 元のcGANの学習アルゴリズムを知らないことを前提としている. 実験の結果, 我々の汎用的な手法は, 元のモデルのFIDを保持しながら, 21.1倍の圧縮率(CycleGANに特化した手法[52]と比較して5倍の圧縮率)を達成していることを示している.
Knowledge distillation.
Hinton et al. [23] introduced the knowledge distillation for transferring the knowledge in a larger teacher network to a smaller student network. The student network is trained to mimic the behavior of the teacher network. Several methods leverage knowledge distillation for compressing recognition models [43, 9, 33]. Recently, Aguinaldo et al. [2] adopts this method to accelerate unconditional GANs. Different from them, we focus on conditional GANs. We experimented with several distillation methods [2, 63] on conditional GANs and only observed marginal improvement, insufficient for interactive applications. Please refer to our arXiv for more details.
知識の蒸留.
Hintonら[23]は, より大きな教師ネットワーク内の知識をより小さな学生ネットワークに伝達するための知識蒸留を導入した. 学生ネットワークは, 教師ネットワークの動作を模倣するように訓練される. 認識モデルを圧縮するために知識蒸留を利用する手法がいくつかある[43, 9, 33]. 最近では, Aguinaldoら[2]が無条件GANを高速化するためにこの方法を採用している. 彼らとは異なり, 我々は条件付きGANに焦点を当てている. 我々は条件付きGANについていくつかの蒸留法[2, 63]を用いて実験を行ったが, わずかな改善しか見られず, 対話型アプリケーションには不十分であった. 詳細はarXivを参照してください.
Neural architecture search.
Neural Architecture Search (NAS) has successfully designed neural network architectures that outperform hand-crafted ones for image recognition tasks [71, 35, 36]. To reduce the search cost, researchers recently proposed one-shot neural architecture search [37, 7, 61, 15, 24, 4, 6] in which different subnetworks can share the weights. However, little efforts has been paid to search efficient GAN architectures. We study efficient conditional GANs architectures using NAS.
ニューラルアーキテクチャ探索. ニューラルアーキテクチャ探索(NAS)は, 画像認識タスクのために, 手作業で作られたものを上回るニューラルネットワークアーキテクチャを設計することに成功している[71, 35, 36]. 探索コストを削減するために, 最近では, 異なるサブネットワークが重みを共有できるワンショット・ニューラル・アーキテクチャ探索 [37, 7, 61, 15, 24, 4, 6] が提案されている. しかし, 効率的なGANアーキテクチャを探索するための研究はほとんど行われていない. 本研究では, NASを用いて効率的な条件付きGANアーキテクチャを研究している.
おわりに
とりあえず手法の前まで.
数式で手こずってます.近日中に続きを公開します.