ベースライン モデル
VGG は、大規模な画像認識用のネットワークです。VGG16 のアーキテクチャについては、https://arxiv.org/abs/1409.1556 を参照してください。
コンフィギュレーション ファイルを作成する
config.prototxt という名前のファイルを作成します。
workspace: "examples/decent_p/"
gpu: "0,1,2,3"
test_iter: 100
acc_name: "top-1"
model: "examples/decent_p/vgg.prototxt"
weights: "examples/decent_p/vgg.caffemodel"
solver: "examples/decent_p/solver.prototxt"
rate: 0.1
pruner {
method: REGULAR
}
モデル解析を実行する
$ ./vai_p_caffe ana –config config.prototxt
モデルをプルーニングする
$ ./vai_p_caffe prune –config config.prototxt
プルーニング済みモデルを微調整する
微調整には、次のソルバー設定を使用できます。
net: "vgg16/train_val.prototxt"
test_iter: 1250
test_interval: 1000
test_initialization: true
display: 100
average_loss: 100
base_lr: 0.004
lr_policy: "poly"
power: 1
gamma: 0.1
max_iter: 500000
momentum: 0.9
weight_decay: 0.0001
snapshot: 1000
snapshot_prefix: "vgg16/snapshot/res"
solver_mode: GPU
iter_size: 1
次のコマンドを使用して微調整を開始します。
$ ./vai_p_caffe finetune -config config.prototxt
推定所要時間: ImageNet の学習用データセット (ILSVRC2012) を使用した場合、30 エポックで約 70 時間 (120 万の画像、4 x NVIDIA Tesla V100)。
最終出力を生成する
プルーニングの反復を数回実行後、ベースラインに対して必要な演算が 33% に削減されたプルーニング モデルが取得されます。
次を実行してモデルを完成させます。
$ ./vai_p_caffe transform –model baseline.prototxt –weights finetuned_model.caffemodel -output
final.caffemodel
プルーニングの結果
- データセット
- ImageNet (ILSVRC2012)
- 入力サイズ
- 224 x 224
- GPU プラットフォーム
- 4 x NVIDIA Tesla V100
- FLOPs
- 30G
- パラメーター数
- 24M
回数 | FLOPs | パラメーター | Top-1/Top-5 精度 |
---|---|---|---|
0 | 100% | 100% | 0.7096/0.8984 |
1 | 50% | 57.3% | 0.7020/0.8970 |
2 | 9.7% | 35.8% | 0.6912/0.8913 |