Image Captioning survey
=================
# Dataset paper
**STAIR Captions: Constructing a Large-Scale Japanese Image Caption Dataset**[[link](https://www.aclweb.org/anthology/P17-2066/) , [ja](https://www.anlp.jp/proceedings/annual_meeting/2017/pdf_dir/P8-7.pdf)]
image2textの大規模データセットであるMSCOCOの日本語版。
画像一枚に対し、captioinは5つ、クラウドソーシングとアルバイトを駆使して作成。
caption文には以下の制約がある
- 15文字以上であること
- である調
- 画像外については書かない
- 単文
- 感情はいらない
論文内では日本語で学習させたモデルとMSCOCOを学習して生成された英文を翻訳するモデルの比較を行った。
結果は日本語で学習されたモデルの圧勝となった。
データセットdownload page
- japanese annotation data [[link](https://github.com/STAIR-Lab-CIT/STAIR-captions)]
- MSCOCO image dataset[[link](http://cocodataset.org/#download)]
- 2014年版を使用
- MSCOCO image captioning leaderboard[[link](https://competitions.codalab.org/competitions/3221)]
[この論文を引用している論文リスト](https://scholar.google.co.jp/scholar?cites=11816486581897492538&as_sdt=2005&sciodt=0,5&hl=ja)
さらーっと見たけど日本語特有の手法とかはなさそう。
マルチリンガルとかの論文が多め。なのでMSCOCOの手法から見ていくにょ\^_\^
# 過去手法(~ transformer手前まで)
## Deep Visual-Semantic Alignments for Generating Image Descriptions[[link](https://arxiv.org/abs/1412.2306)]
VGG+RNNのモデルVGGの出力(画像情報)をRNNのbiasとして使用する。
## Show and Tell: A Neural Image Caption Generator [[link](https://arxiv.org/abs/1411.4555)]
NNを用いた最初の手法?。
画像をCNN Encoderによりベクトル表現に圧縮し、これを文章を生成するLSTM Decoderに入力することで文章を生成する。
単語ベクトルにはword2vecを使用しようとしたが、大きな利益は得られなかった。
CNN Encoderにはbatch norm付きincarptionのImageNetの事前学習済みモデルを使用した。
BeamSearchで最適化する。
## Show and Attend, Tell: Neural Image Caption Generation with Visual Attention [[link](https://arxiv.org/abs/1502.03044)]
上記のNICにattention機構を加えて、注目領域を特定する。
CNN Encoder(VGG pretrain)の特徴量表現とLSTMの出力をattention機構に入力する。
hardとsoftの2つのattention手法が提案されている。
hardは画像内のある1部分に対して注視し、softでは大まかな位置を注視する。
## Knowing When to Look: Adaptive Attention via A Visual Sentinel for Image Captioning[[link](https://arxiv.org/abs/1612.01887)]
キャプション生成において、視覚的情報が必要な部分が全てではない(the, ofとか)。Attention機構を改造
image encoder : resnet
提案手法の図

画像情報とLSTMの出力からattention機構を用いてcontext vectorを獲得。その後context vectorとLSTMの出力に対してβと(1-β)で重み付け和をとる。これにより画像情報の必要としない位置tにおいて視覚情報を削れる。
実装上ではβはattentionのmapに内包される
## Self-critical Sequence Training for Image Captioning[[link](https://arxiv.org/abs/1612.00563)]
強化学習の枠組み, [[CIDEr](http://katsura-jp.hatenablog.com/entry/2019/04/13/220348)]を報酬とし、これを最大化するように学習を行う。
通常の報酬最大化では学習が安定しないため、現時点パラメータでの最良のスコアよりも高いものを増やし、低いものを減らすように学習。
牛久先生の[[slide](https://www.slideshare.net/YoshitakaUshiku/selfcritical-sequence-training-for-image-captioning-cv-cvpr-2017)]
## Bottom-up and top-down attention for image captioning and visual question answeringa[[link](https://arxiv.org/abs/1707.07998)]
**bottom-up attention model**
通常CVの分野ではグリッド単位に対してattentionを適用するが、この手法ではfaster-RCNNなど物体検出モデルを使用することでオブジェクトなどの領域単位でattentionを当てることができる。
image captionとVQAで評価。
通常のcrossentropy loss に加えREINFORCE learningでも比較を行っている(REINFORCEの勝ち)。
image encoder : faster R-CNN
faster RCNNはvisual gunomeデータセットで事前学習
decoder : LSTM

最初はconcatnate
[詳細](https://qiita.com/terandard/items/f90b159baa3ac659994a)
特徴量抽出したデータのダウンロード[link](https://github.com/peteanderson80/bottom-up-attention)
# transformerがせめて来てから
こわいよ~ attention is all you need
## Captioning Transformer with Stacked Attention Modules[[link](https://www.mdpi.com/2076-3417/8/5/739), [pdf](https://www.mdpi.com/2076-3417/8/5/739/pdf)]
image encoder : ResNext101
decoder : transformer
- imageの入力の仕方
- second layerのみ入力
- second layer入力に加え単語ベクトルと組み合わせる?
- decoderの最初の入力に使用する
- 各decoder layerでのpredict
- 1~6のlayerでensembleすると良くなる

## 物体間の関係性を考慮したTransformerに基づくキャプション生成[[link](https://www.anlp.jp/proceedings/annual_meeting/2019/pdf_dir/A4-10.pdf)]
言語処理学会2019の論文。
image encoder : faster R-CNNの特徴量をtransformer encoderに突っ込んだもの
decoder : transformer

3つのencode手法を提案3が一番良さそう。
bottom upよりは結果は低い
## Multimodal Transformer with Multi-View Visual Representation for Image Captioning[[link](https://arxiv.org/abs/1905.07841)]
複数のdetectorを用いてimage featureとする。
それらをconcatとしたaligen multi viewとそれぞれをMHAを用いてencodeするunaligen multi viewを比較(後者のほうが強い)。
detectorの数を増やすとより強くなる
## OmniNet: A unified architecture for multi-modal multi-task learning[[link](https://arxiv.org/abs/1907.07804v1)]
image captioning, VQA, POStagging, video activity recongnitionの4つのタスクを同時に行うことで個別で学習したモデルの制度を維持したまま、モデルの圧縮を成功させた。
## Unified Vision-Language Pre-Training for Image Captioning and VQA[[link](https://arxiv.org/abs/1909.11059v3)]
## Attention on Attention for Image Captioning[[link](https://arxiv.org/abs/1908.06954v2)]
Attentionはglobalな情報を使用するが必要としている情報がない場合や、attentionによって得られたvectorがクエリと関連していない可能性がある。
## Unsupervised Image Captioning[[link](https://arxiv.org/abs/1811.10787v2)]
## M$^2$: Meshed-Memory Transformer for Image Captioning[[link](https://arxiv.org/abs/1912.08226v1)]
現時点のleaderboard1位
画像のROPとは別にmemory(学習パラメータ)を用意する。モチベーションとしては画像からの情報では賄えない部分もある。
decoder部分ではエンコーダの各層の出力を使用する、cross attention機構を導入。
# とても最近の手法
## Show, Recall, and Tell: Image Captioning with Recall Mechanism[[link](https://arxiv.org/abs/2001.05876)]
image retrieval moduleとrecall-word slot(RWS),semantic guided(SG)を用いた手法

### image retrieval model
事前学習(?)としてcaptionのsentence vectorと画像のRCNNのROPの平均vectrorに対し、triplet lossを用いて学習を行う。
より近い5つのcaptionの単語を推薦する。
### RWS, SG
image retrieval moduleのword vecotrに対しattentionを用いて重要単語を抽出
pointer generation機構を使用する。
# 学習テクニック
## exposure bias
学習時時刻tに対する入力は正解ラベル(teacher forcing)だが、テスト時は出力単語(free running)であるため途中で出力を間違えるとエラーが蓄積する。
- scheduled sampling
- 学習時、ランダムに生成単語と正解単語を選ぶ
- 最初は正解単語を入力するが徐々に生成単語に変更していく
- professor forcing
- teacher forcingとfree runningのRNNの隠れ表現をdiscrimintorを用いて近づけていく
# 評価指標
- BLEU1~4
- ROUGE-L
- CIDEr
- METEOR
# 所感置き場
最近では強化学習を使用した枠組みを入れることが前提
通常のimage classification modelを使用するよりもobject detectionを行ったモデルのほうが良さげ
各物体の特徴量として見れるため、都合が良い。またこれらをtransformerに突っ込むことで画像間の相互情報を見ることも可能に
# 参考文献
画像キャプションと動作認識の最前線 [[slideshare](https://www.slideshare.net/stairlab/17-108339737)]