「注意にもっと注意を払う:注意転送による畳み込みニューラルネットワークのパフォーマンスの向上」https://arxiv.org/abs/1612.03928のためのPytorchコード
ICLR2017の会議用紙:https://openreview.net/forum?id=sks9_ajex
これまでのところこのレポーには何がありますか:
来る:
このコードは、pytorch https://pytorch.orgを使用しています。元の実験はトーチオートグラードを使用して行われたことに注意してください。これまでのところ、CIFAR-10の実験がPytorchで正確に再現可能であり、Imagenetのためにそうするプロセスにあることを検証してきました(Pytorchでは、HyperParametersのため、結果は非常にわずかに悪化しています)。
bibtex:
@inproceedings{Zagoruyko2017AT,
author = {Sergey Zagoruyko and Nikos Komodakis},
title = {Paying More Attention to Attention: Improving the Performance of
Convolutional Neural Networks via Attention Transfer},
booktitle = {ICLR},
url = {https://arxiv.org/abs/1612.03928},
year = {2017}}
最初にPytorchをインストールし、Torchnetをインストールします。
pip install git+https://github.com/pytorch/tnt.git@master
次に、他のPythonパッケージをインストールします。
pip install -r requirements.txt
このセクションでは、論文の表1に結果を取得する方法について説明します。
まず、教師を訓練します:
python cifar.py --save logs/resnet_40_1_teacher --depth 40 --width 1
python cifar.py --save logs/resnet_16_2_teacher --depth 16 --width 2
python cifar.py --save logs/resnet_40_2_teacher --depth 40 --width 2
doでアクティベーションベースでトレーニングするには:
python cifar.py --save logs/at_16_1_16_2 --teacher_id resnet_16_2_teacher --beta 1e+3
KDでトレーニングするには:
python cifar.py --save logs/kd_16_1_16_2 --teacher_id resnet_16_2_teacher --alpha 0.9
AT+KDを減衰betaで追加して、すぐに最高の知識転送結果を得ることを計画しています。
resnet-18事前に処理されたモデルを、以下に基づいてアクティベーションを提供します。
| モデル | VALエラー |
|---|---|
| Resnet-18 | 30.4、10.8 |
| Resnet-18-Resnet-34-at | 29.3、10.0 |
ダウンロードリンク:https://s3.amazonaws.com/modelzoo-networks/resnet-18-at-export.pth
モデルの定義:https://github.com/szagoruyko/function-zoo/blob/master/resnet-18-at-export.ipynb
収束プロット:
ResNet-34の前提条件の重量をダウンロードします(詳細については、function-zooも参照):
wget https://s3.amazonaws.com/modelzoo-networks/resnet-34-export.pth
fb.resnet.torchに続くデータを準備し、トレーニングを実行します(例:2 GPUを使用):
python imagenet.py --imagenetpath ~/ILSVRC2012 --depth 18 --width 1
--teacher_params resnet-34-export.hkl --gpu_id 0,1 --ngpu 2
--beta 1e+3