0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CRF 層を考慮した画像キャプショニングモデルの GRPO 強化学習における n-gram repeat と CIDEr 言語スコア

0
Last updated at Posted at 2026-06-13

計算を行った動機

現在、文章を生成する際に用いられる主力は、Transformer Decoder を自己回帰的に使うモデルである。しかし、自己回帰的な計算では、Transformer Decoderの計算回数は生成する文章のシーケンス長となり、計算資源と計算時間が必要になり、高価なシステムが必要になる。生成 AI が広まるにつれ安価なシステム構築要求も増えることが予想される。このためには、非自己回帰的な計算手法の開発が必要となる。非自己回帰的な計算手法は、一度だけ計算すれば良く、省資源で短い時間で計算可能である。そんな中、

により、CRF 層を考慮した非自己回帰的なモデルを試してみた。既出の論文では、画像キャプショニングについては述べられていなかったが、

CLIP + MLP_Connector + BERT + CRF 層

というモデルで、教師あり事前学習( SPT ) を行って、良い結果を得た。

このモデルは、キャプション(文章)を生成するための繰り返し計算は行わない。その代わり、CRF 層で シーケンス i- 1 から シーケンス i へのトークンの遷移確率を扱うので、まともに計算すると計算資源と計算量(時間)が大きくなる。そこで、CRF 層で扱う語彙数をbert の出力の放出確率が 上位 256 の語彙に絞って計算を行った。CRF 層の top-k 近似である。また、top-k 近似を行っても遷移確率が 256 * 256 の行列となり計算資源を消費するため、low_rank = 32 を導入して、遷移行列を ( 256 * 32 ) * ( 32 * 256 ) と 2つの ( 256 * 32 ) 行列で近似した。low-rank 近似である。

推論の計算時間は十分早いが、SPT では、生成したキャプションに繰り返しが見られた。また、キャプションの長さが短めであった。目標として、強化学習で繰り返しを減らし、キャプションの長さを保つことができないか計算を行った。

繰り返しの減少について報告

今回は、キャプション内の n-gram の繰り返しを減らすことができたので報告する。1-gram から 4-gram まで全部の繰り返しを repeat_penalty に含めると cider_score が減少し、3,4-gram だけを repeat_penalty に含めた場合、cider_score の減少を少なくできることが分かった。1-gram から 4-gram まですべてを repeat_penalty に含めた場合と、3-gram, 4-gram だけを含めた場合について強化学習の結果を報告する。

2つ目の追記では、繰り返しの減少と cider_score 改善の両立を報告する。

追記が2つありますが、2つ目の追記では、transformers 5 系に対応することにより、n-gram の繰り返しが減ると同時に cider_score が改善されていることを報告しています。

学習データについて、

学習を行うデータは、今回は、COCO train2017 を用いた。

SPT について

学習曲線

事前学習として、CLIP + MLP_Connector + BERT + CRF 層について、crf_loss と BERT の出力についてのクロスエントロピー(ce_loss )の和を損失とした SPT を行った。Loss、crf_loss, ce_loss, WER, BLEU の学習曲線を示す。

Screenshot from 2026-06-13 17-47-47.png

Screenshot from 2026-06-13 17-49-49.png

Screenshot from 2026-06-13 17-51-09.png

テストデータによるテストは、

CIDEr        0.910
rougeL       0.519
clip_score   0.277
bert_score   0.840
repeat_count 2.01

であった。repeat_count は、独自の関数で計測した指標である。意味としては、一つのキャプションに 1-gram から 4-gram までの繰り返しの和が何個あるかという指標と考えています。2.01 は、一つのキャプションに 1-gram から 4-gramまでの繰り返しが 平均 2.01 個あると考えています。

生成したキャプション

写真1
Screenshot from 2026-06-14 08-22-09.png

hypo: [CLS] a pair of scissors sitting on top of scissors. [SEP]
refe: [CLS] a selection of scissors, including pinking shears, under a glass shelf. [SEP]

写真2
Screenshot from 2026-06-14 08-22-30.png

hypo: [CLS] a person holding an umbrella is holding an umbrella. [SEP]
refe: [CLS] a person holding an open umbrella and a cell phone [SEP]

GRPO による強化学習

1,2,3,4-gram の repeat_count をすべて repeat_penalty の対象とした場合。

学習曲線

検証データについてのrepeat_penalty と cider_score の学習曲線を示す。

Screenshot from 2026-06-14 08-08-42.png

Screenshot from 2026-06-14 08-09-10.png

テストデータ

テストデータについての各言語スコアと repeat_count は

cider        0.696
rougeL       0.495
clip_score   0.266
bert_score   0.823
repeat_count 0.0500

であった。

生成したキャプション

写真1

hypo: [CLS] a close up scissors sitting on a table. [SEP]
refe: [CLS] a selection of scissors, including pinking shears, under a glass shelf. [SEP]

写真2

hypo: [CLS] a woman standing in front of an umbrella. [SEP]
refe: [CLS] a person holding an open umbrella and a cell phone [SEP]

1,2-gram は repeat_penalty に含めず、3,4-gram だけを repeat_penalty の対象にした場合。

学習曲線

検証データについての repeat_penalty と cider_score の学習曲線を示す。

Screenshot from 2026-06-14 08-10-00.png

Screenshot from 2026-06-14 08-10-30.png

テストデータ

テストデータについての各言語スコアと repeat_count は

cider        0.770
rougeL       0.494
clip_score   0.271
bert_score   0.830
repeat_cont  0.225

であった。

生成したキャプション

写真1

hypo: [CLS] a pair of scissors sitting on top of a table. [SEP]
refe: [CLS] a selection of scissors, including pinking shears, under a glass shelf. [SEP]

写真2

hypo: [CLS] a woman standing in front of an umbrella. [SEP]
refe: [CLS] a person holding an open umbrella and a cell phone [SEP]

比較

検証データについて

repepat_penalty の両者のグラフから分かるようにどちらも repeat_penalty の絶対値は減少している。一方、cider_scoreのグラフから分かるように、cider_score は、1,2,3,4-gram と全部を penalty の対象にした場合、0.75程度まで減少しているのに対して、3,4-gram のみを penalty の対象とした場合、0.8 程度への減少にとどまっている。

テストデータについて

テストデータについて、cider_score を見ると、1,2,3,4-gram 全部を penalty の対象とした場合、cider 0.696 であったのに対して、3,4-gram のみの場合、0.770 と良い数値である。repeat_count については、全部を penalty の対象とした場合、0.0500 であり、3,4-gram の場合が 0.225 である。通常のキャプションでも、1-gramの 繰り返しは許容されるべきであり、この数値で十分と考えられる。

repeat_penalty の計算

repeat_penalty の計算は、次の関数で行った。

    def calc_ngram_repeat_fast(self, preds):
        # preds が書き換わらないよう、この関数内では元の値を保護する
        bsz, seq_len = preds.size()
        ngram_cnt = torch.zeros(bsz, device=preds.device, dtype=torch.float)
        
        base_ignore = [pad_token_id, eos_token_id, cls_token_id, sep_token_id]
        extra_ignore = [a_token_id, the_token_id, period_token_id, comma_token_id, and_token_id, in_token_id, \
                       we_token_id, i_token_id, he_token_id, she_token_id, it_token_id, they_token_id, \
                       dbl_token_id, sgl_token_id ]

        #we_token_id = tokenizer.encode( "we" )[1]
        #i_token_id = tokenizer.encode( "i" )[1]
        #he_token_id = tokenizer.encode( "he" )[1]
        #she_token_id = tokenizer.encode( "she" )[1]
        #it_token_id = tokenizer.encode( "it" )[1]
        #they_token_id = tokenizer.encode( "they" )[1]
        #period_token_id = tokenizer.encode( "." )[1]
        #comma_token_id = tokenizer.encode( "," )[1]
        #dbl_token_id = tokenizer.encode( '"' )[1]
        #sgl_token_id = tokenizer.encode( "'" )[1]

        ng = 4        
        
        for n in range(1, ng + 1 ):
        #for n in range(2, ng + 1 ):
            if seq_len < n:
                continue
    
            current_ignore_ids = base_ignore + (extra_ignore if n == 1 else [])
            # ignore_mask は bool なので preds に影響しません
            ignore_mask = torch.isin(preds, torch.tensor(current_ignore_ids, device=preds.device))
            
            # 【重要】unfoldの後に .clone() を入れてメモリを切り離す
            ngrams = preds.unfold(dimension=1, size=n, step=1).clone()
            num_ngrams = ngrams.size(1)
            
            ngram_ignore_mask = ignore_mask.unfold(dimension=1, size=n, step=1).any(dim=-1)
            
            if n > 1:
                # 語彙サイズに基づくハッシュ化
                vocab_size_max = max(preds.max().item(), 100000)
                weights = torch.pow(torch.tensor([vocab_size_max], device=preds.device), 
                                    torch.arange(n, device=preds.device)).long()
                hashed_ngrams = (ngrams.long() * weights).sum(dim=-1)
            else:
                hashed_ngrams = ngrams.squeeze(-1).long()
    
            # これで hashed_ngrams を書き換えても、clone 済みのデータなので preds は安全
            invalid_val = -1
            hashed_ngrams[ngram_ignore_mask] = invalid_val
    
            for b in range(bsz):
                b_ngrams = hashed_ngrams[b]
                valid_b_ngrams = b_ngrams[b_ngrams != invalid_val]
                
                if valid_b_ngrams.numel() == 0:
                    continue
                    
                unique_vals, counts = torch.unique(valid_b_ngrams, return_counts=True)
                
                mask = counts > self.repeat_thresh[n-1] 
                if mask.any():
                    # 超過した数だけを純粋に加算する
                    # 例: thresh=2 で 3回出たら、3 - 2 = 1回分のリピート
                    # 例: thresh=1 で 2回出たら、2 - 1 = 1回分のリピート
                    repeat_counts = counts[mask] - self.repeat_thresh[n-1]
                    ngram_cnt[b] += repeat_counts.sum().float() * self.repeat_weight[n-1]
        
        #penalty = - (ngram_cnt / seq_len).clamp(max=1.0)
        repeat_penalty = - torch.pow(ngram_cnt, 2.0) 
        
        return repeat_penalty[:, None]

n-gram については、1〜4 までを対象としている。repeat_thresh = ( 1, 1, 1, 1 )は、繰り返しをカウントする閾値である。repeat_weight = ( 1, 2, 3, 4 ) は、n-gram の繰り返しの回数 ngram_cnt に乗ずる重みである。1,2,3 ,4-gram 全部を考慮するときは重みを ( 1,2,3,4 ) に、3,4-gramのみの考慮の場合は、重みを ( 0,0,3,4 )にした。

この repeat_penalty は、私の場合、1,2,3,4-gram 全部を考慮した時 -60、3 4-gramのみを考慮した時 -14 とかになりました。reward に加えます。

reward = 各言語スコアの報酬 + rep_coef * repeat_penalty + len_coef * len_penalty  + unr_coef * unique_ngram_ratio 

repeat_penalty 以外は -2 から 2 くらいの範囲の数で、repeat_penalty が 0 から -80 くらいの間の数です。rep_coef は 0 とか 3 くらいの間の数です。参考になれば幸いです。

強化学習のプログラムを github に置いておきます。

このプログラムを動かすためには、Trsnsformers 5 系ではなく、4 系、4.57.3 とかが必要です。5系では、

sos_token_id = tokenizer.encode( [ "[unused0]" ] )[1]

ができないようです。

transformer 5系で、'[unused0]' を使いたい時は、special_token として登録すると可能のようです。'[unused0]', '[unused1]' は、元からあるtoken なので、vicab_size が増えないため、decoder で使っている bert に影響しないようです。

まとめ

CLIP + MLP_Connector + BERT + CRF 層の画像キャプショニングについて GRPO の強化学習により、SPT の重みで出現するキャプション内の n-gram 繰り返しを減少させることが可能であることが分かった。このとき、1,2,3,4-gram 全部を repeat penalty で考慮すると CIDEr の言語スコアが減少することが分かった。repeat penalty に考慮する n-gram を 3,4-gram のみにすると、CIDEr の言語スコアの減少を少なくできることが分かった。

repeat と length と cider_score に注目した強化学習(2026年6月24日追記)

repeat_penalty と length_reward ( length_penalty ) と cider_score の係数を調整して強化学習を行ったので、結果を報告する。

compute_length_reward という関数で、生成したキャプションと教師キャプションの正規化した長さの差の二乗を計算しています。 追記でない学習では、キャプションの長さを検出するための token にeos_token_id を使っていましたが、追記分では、検出するための token を pad_token_id に変更しました。このため、両者は直接は比較できません。

今回の追加分の GRPO による強化学習では、repeat に着目した場合と repeat と length と cider_score に着目した場合の学習結果について報告します。

repeat に着目した場合。

repeat_penalty を -10 程度、 repeat_norm_coef = 10.0, rep_coef = 2.63として、報酬に与える repeat_penalty の寄与 = repeat_penalty / repeat_norm_coef * rep_coef を、3程度とした。repeat_weight は ( 0, 0, 3, 4 )である。他の reward は、-2〜2 程度である。

検証データの学習曲線。

学習中の検証データによる、repeat_penalty と cider_score の学習曲線を示す。

Screenshot from 2026-06-24 12-02-23.png

Screenshot from 2026-06-24 12-02-57.png

テストデータによるスコア

テストデータによる、各言語スコアおよび clip_score と repeat_count を掲載する。

cider        0.759
rougeL       0.518
clip_score   0.273
bert_score   0.830
repeat_count 0.338

生成したキャプション

写真1

hypo: [CLS] a pair of scissors sitting on a table. [SEP]
refe: [CLS] a selection of scissors, including pinking shears, under a glass shelf. [SEP]

写真2

hypo: [CLS] a woman standing in front of an umbrella. [SEP]
refe: [CLS] a person holding an open umbrella and a cell phone [SEP]
hypo: [CLS] a woman is getting ready to hit a ball. [SEP]
refe: [CLS] a woman preparing to swing a baseball bat. [SEP]
hypo: [CLS] a group of people pulling a carriage pen. [SEP]
refe: [CLS] four horses are pulling a small green carriage. [SEP]
hypo: [CLS] a man sitting on top of an umbrella. [SEP]
refe: [CLS] a person carrying some bags looking at a bunch of green benches. [SEP]
hypo: [CLS] a woman sitting in front of a laptop computer. [SEP]
refe: [CLS] beautiful woman behind a laptop computer at a white table. [SEP]
hypo: [CLS] a red fire truck sitting on the street. [SEP]
refe: [CLS] a large fire hydrant on a truck [SEP]
hypo: [CLS] a red fire hydrant sitting on the street. [SEP]
refe: [CLS] a water hydrant on a pavement and a potted plant [SEP]
hypo: [CLS] a couple of sheep graz milk bucket together. [SEP]
refe: [CLS] sheep eat from a blue bowl with the sheepdog behind them. [SEP]
hypo: [CLS] a large bus driving down the street. [SEP]
refe: [CLS] a green and light blue bus traveling down a highway. [SEP]
hypo: [CLS] a close up sandwich on a plate. [SEP]
refe: [CLS] a white plate that has a sandwich cut in half [SEP]
hypo: [CLS] a piece of cake sitting on a plate. [SEP]
refe: [CLS] cake on a plate with a bottle of milk that has a straw [SEP]
hypo: [CLS] a group of people walking baggage back airplane. [SEP]
refe: [CLS] a group of people getting on a small plane. [SEP]
hypo: [CLS] a woman sitting in front of a desk. [SEP]
refe: [CLS] a women leans over her desk towards a laptop. [SEP]
hypo: [CLS] a man and a woman couch remote. [SEP]
refe: [CLS] two people seated on a couch, one with glasses and holding remotes. [SEP]
hypo: [CLS] a black and white photograph's head. [SEP]
refe: [CLS] a cat wearing a holiday hat reclines on an blanket while being petted. [SEP]
hypo: [CLS] a living room with a couches window. [SEP]
refe: [CLS] there is a beige couch and orange pillows in this living room [SEP]
hypo: [CLS] a cow cows in the grass field. [SEP]
refe: [CLS] several cows laying in the grass on a sunny day. [SEP]
hypo: [CLS] a man is riding wetsuit board. [SEP]
refe: [CLS] a man on a surfboard on the water. [SEP]
hypo: [CLS] a couple of signs sitting on the street. [SEP]
refe: [CLS] a pole filled with many various city street signs. [SEP]
hypo: [CLS] a white bus driving down the street. [SEP]
refe: [CLS] a bus is driving down a busy road. [SEP]
hypo: [CLS] a man is a pizza season pizza food. [SEP]
refe: [CLS] two people standing in a kitchen preparing food. [SEP]
hypo: [CLS] a group of docked parked in the water. [SEP]
refe: [CLS] several boats dry docked on a pier in a harbor area. [SEP]
hypo: [CLS] a close up filled with a vegetables. [SEP]
refe: [CLS] meat and vegetables are in a white bowl. [SEP]
hypo: [CLS] a clock tower on top of a building. [SEP]
refe: [CLS] well lit skyscrapers and a clock tower in the evening. [SEP]
hypo: [CLS] a pizza sitting on top of a plate. [SEP]
refe: [CLS] a small pizza with several ingredients missing one slice. [SEP]
hypo: [CLS] a close up next to be toilet. [SEP]
refe: [CLS] the toilet is empty and the seat is up [SEP]
hypo: [CLS] a couple of people on the waves their. [SEP]
refe: [CLS] an aerial view of two people on surfboards in the water. [SEP]
hypo: [CLS] a group of people on the street. [SEP]
refe: [CLS] an advertisement is seen on the side of a very tall building. [SEP]
hypo: [CLS] a group of cows in the grass. [SEP]
refe: [CLS] several cows grazing in a field under a tree. [SEP]
hypo: [CLS] a cow is standing in front of a. [SEP]
refe: [CLS] a long horned cow standing next to two decorative circles [SEP]
hypo: [CLS] a stop sign on the side of a building. [SEP]
refe: [CLS] a north bound trains sign pointing to the left in a station. [SEP]
hypo: [CLS] a group of people in front of food. [SEP]
refe: [CLS] people in line being served food by a woman behind the counter. [SEP]
hypo: [CLS] a couple of people sitting on a boat. [SEP]
refe: [CLS] a man, woman and two dogs are moving along in a motor boat. [SEP]
hypo: [CLS] a couple of a video game in front. [SEP]
refe: [CLS] a room with a woman standing in front of a television playing a video game. [SEP]
hypo: [CLS] a white toilet sits on a bathroom. [SEP]
refe: [CLS] a white toilet with a wooden seat on black tile floor. [SEP]
hypo: [CLS] a man on a tennis racquet. [SEP]
refe: [CLS] a man running across a tennis court holding a racquet. [SEP]
hypo: [CLS] a train that is on the station. [SEP]
refe: [CLS] the platform and tracks at a railroad intersection [SEP]
hypo: [CLS] a group of people playing on the ball. [SEP]
refe: [CLS] this is two men in a soccer match [SEP]
hypo: [CLS] a baseball player is to swing at the ball. [SEP]
refe: [CLS] a baseball player winding up to swing the bat. [SEP]
hypo: [CLS] a woman standing in front of a motorcycle. [SEP]
refe: [CLS] a women stands next to a yellow motorcycle. [SEP]
hypo: [CLS] a bird sitting on top of a tree. [SEP]
refe: [CLS] a bird flying towards a branch on tree. [SEP]

repeat と length と cider_score に注目した場合

repeat に関する設定は、「repeat に注目した場合」に準じるが repeat_weight を ( 1, 2, 3, 4 )とした。length の寄与を -0.25 程度だったところを -1.0 程度に、 cider_score の寄与を 0.16 程度だったところを 3.2 程度とした。

検証データの学習曲線

学習中の検証データによる、repeat_penalty と cider_score の学習曲線を示す。

Screenshot from 2026-06-24 12-16-11.png

Screenshot from 2026-06-24 12-16-34.png

テストデータによるスコア

テストデータによる、各言語スコアおよび clip_score と repeat_count を掲載する。

cider        0.830
rougeL       0.514
clip_score   0.273
bert_score   0.832
repeat_count 0.234

生成したキャプション

写真1

hypo: [CLS] a pair of scissors sitting on a table. [SEP]
refe: [CLS] a selection of scissors, including pinking shears, under a glass shelf. [SEP]

写真2

hypo: [CLS] a woman standing in front of an umbrella. [SEP]
refe: [CLS] a person holding an open umbrella and a cell phone [SEP]
hypo: [CLS] a woman is getting ready to hit a ball. [SEP]
refe: [CLS] a woman preparing to swing a baseball bat. [SEP]
hypo: [CLS] a group of people pulling their old people. [SEP]
refe: [CLS] four horses are pulling a small green carriage. [SEP]
hypo: [CLS] a person is in front of a sidewalk. [SEP]
refe: [CLS] a person carrying some bags looking at a bunch of green benches. [SEP]
hypo: [CLS] a woman sitting in front of a laptop computer. [SEP]
refe: [CLS] beautiful woman behind a laptop computer at a white table. [SEP]
hypo: [CLS] a red fire truck sitting on the street. [SEP]
refe: [CLS] a large fire hydrant on a truck [SEP]
hypo: [CLS] a red fire hydrant sitting on a sidewalk. [SEP]
refe: [CLS] a water hydrant on a pavement and a potted plant [SEP]
hypo: [CLS] a couple of sheep graz milk bucket together. [SEP]
refe: [CLS] sheep eat from a blue bowl with the sheepdog behind them. [SEP]
hypo: [CLS] a large school bus driving down the street. [SEP]
refe: [CLS] a green and light blue bus traveling down a highway. [SEP]
hypo: [CLS] a white plate topped sitting on a plate. [SEP]
refe: [CLS] a white plate that has a sandwich cut in half [SEP]
hypo: [CLS] a platecake topped sitting on a plate. [SEP]
refe: [CLS] cake on a plate with a bottle of milk that has a straw [SEP]
hypo: [CLS] a group of people walking baggage back airplane. [SEP]
refe: [CLS] a group of people getting on a small plane. [SEP]
hypo: [CLS] a woman sitting in front of a desk. [SEP]
refe: [CLS] a women leans over her desk towards a laptop. [SEP]
hypo: [CLS] a man and a woman couch to video game. [SEP]
refe: [CLS] two people seated on a couch, one with glasses and holding remotes. [SEP]
hypo: [CLS] a close up of a cat head hat. [SEP]
refe: [CLS] a cat wearing a holiday hat reclines on an blanket while being petted. [SEP]
hypo: [CLS] a living room with a couch and a table. [SEP]
refe: [CLS] there is a beige couch and orange pillows in this living room [SEP]
hypo: [CLS] a cow cows in front of a field. [SEP]
refe: [CLS] several cows laying in the grass on a sunny day. [SEP]
hypo: [CLS] a man riding a surfboard large wave. [SEP]
refe: [CLS] a man on a surfboard on the water. [SEP]
hypo: [CLS] a close up of sign labels colored pole. [SEP]
refe: [CLS] a pole filled with many various city street signs. [SEP]
hypo: [CLS] a large bus driving down a city street. [SEP]
refe: [CLS] a bus is driving down a busy road. [SEP]
hypo: [CLS] a person cooking just apron let while putting. [SEP]
refe: [CLS] two people standing in a kitchen preparing food. [SEP]
hypo: [CLS] a group of docked parked in the water. [SEP]
refe: [CLS] several boats dry docked on a pier in a harbor area. [SEP]
hypo: [CLS] a bowl that has spoon variety soup noodles. [SEP]
refe: [CLS] meat and vegetables are in a white bowl. [SEP]
hypo: [CLS] a large clock tower on top of a building. [SEP]
refe: [CLS] well lit skyscrapers and a clock tower in the evening. [SEP]
hypo: [CLS] a pizza sitting on top of a plate. [SEP]
refe: [CLS] a small pizza with several ingredients missing one slice. [SEP]
hypo: [CLS] a white toilet sits next to be toilet. [SEP]
refe: [CLS] the toilet is empty and the seat is up [SEP]
hypo: [CLS] two people are surfing in the waves their. [SEP]
refe: [CLS] an aerial view of two people on surfboards in the water. [SEP]
hypo: [CLS] a large ben has pedestrians in the street. [SEP]
refe: [CLS] an advertisement is seen on the side of a very tall building. [SEP]
hypo: [CLS] a group of cows grazing wire to area. [SEP]
refe: [CLS] several cows grazing in a field under a tree. [SEP]
hypo: [CLS] a cow cows in front of a building. [SEP]
refe: [CLS] a long horned cow standing next to two decorative circles [SEP]
hypo: [CLS] a stop sign on the side of a building. [SEP]
refe: [CLS] a north bound trains sign pointing to the left in a station. [SEP]
hypo: [CLS] a group of people in front of food. [SEP]
refe: [CLS] people in line being served food by a woman behind the counter. [SEP]
hypo: [CLS] a couple of people sitting on a boat. [SEP]
refe: [CLS] a man, woman and two dogs are moving along in a motor boat. [SEP]
hypo: [CLS] a couple of a video game in front. [SEP]
refe: [CLS] a room with a woman standing in front of a television playing a video game. [SEP]
hypo: [CLS] a white toilet sits on top of a. [SEP]
refe: [CLS] a white toilet with a wooden seat on black tile floor. [SEP]
hypo: [CLS] a man on a tennis racquet. [SEP]
refe: [CLS] a man running across a tennis court holding a racquet. [SEP]
hypo: [CLS] a train is on the next to track. [SEP]
refe: [CLS] the platform and tracks at a railroad intersection [SEP]
hypo: [CLS] two soccer player is playing on the ball. [SEP]
refe: [CLS] this is two men in a soccer match [SEP]
hypo: [CLS] a baseball player is a bat on the ball. [SEP]
refe: [CLS] a baseball player winding up to swing the bat. [SEP]
hypo: [CLS] a woman standing in front of a motorcycle. [SEP]
refe: [CLS] a women stands next to a yellow motorcycle. [SEP]
hypo: [CLS] a bird bird sitting on a tree branch. [SEP]
refe: [CLS] a bird flying towards a branch on tree. [SEP]

比較

検証データによる学習曲線

repeat_penalty に関しては、両者とも repeat_penalty の絶対値が減少し、repeatを減らしていることがわかる。

cider_score については、「repeat に着目」より「repeat, length, ciderに着目」の方が良いことがわかる。

テストデータによる各スコア

cider も repeat_count も、「repeat, length, ciderに着目」の方が良いことが分かる。

生成したキャプション

どちらが良いとは、一概には言えない。

まとめ。

数字的には、「repeat に着目」より「repeat, length, cider に着目」の方が良いと考えられる。生成したキャプションについては、判断が難しい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?