ruotianluo / ImageCaptioning.pytorch

I decide to sync up this repo and self-critical.pytorch. (The old master is in old master branch for archive)
MIT License
1.44k stars 412 forks source link

关于self-critical #160

Open zhouhaonan011 opened 2 years ago

zhouhaonan011 commented 2 years ago

您好,您的这份代码有着很出色的效果,我很敬佩您能写出这样的作品。有许多精妙的地方因为我个人水平问题,我有些看不懂,没有办法进行模仿:

captioning/utils/rewards.py,这个文件里是用来做强化学习的奖励的,可以是Cider,也可以是Bleu。这点我大概琢磨出来了。可是当我试图使用指标SPICE和METEOR作为奖励进行训练时,我却始终无法正确实现。

我试图按照rewards.py中的格式,在line 67和104后面加入 if opt.spice_rewardweight > 0: , average_score = average_score.computescore(gts, res) print('SPICE scores:', ) 或者 if opt.metor_rewardweight > 0: , meteor_scores = METEOR.computescore(gts, res) print('METEOR scores:', ) 但是这些都无法正常训练。请您帮忙看看,我需要怎么做能实现使用指标SPICE和METEOR作为奖励进行强化学习训练

ruotianluo commented 2 years ago

确实是不行的,meteor和spice都需要原词,而cider和bleu和一直用index。我现在的视线就是用的index,所以不能直接用meteor或者spice。 改的话不是不可以,但是需要extra work。

活着你可以参考一下m2transformer. Best Regards,

Ruotian Luo

On Jun 23, 2022, at 8:49 PM, chuanxilu @.***> wrote:

您好,您的这份代码有着很出色的效果,我很敬佩您能写出这样的作品。有许多精妙的地方因为我个人水平问题,我有些看不懂,没有办法进行模仿:

captioning/utils/rewards.py,这个文件里是用来做强化学习的奖励的,可以是Cider,也可以是Bleu。这点我大概琢磨出来了。可是当我试图使用指标SPICE和METEOR作为奖励进行训练时,我却始终无法正确实现。

我试图按照rewards.py中的格式,在line 67和104后面加入 if opt.spice_reward_weight > 0: , average_score = average_score.computescore(gts, res) print('SPICE scores:', ) 或者 if opt.metor_reward_weight > 0: , meteor_scores = METEOR.computescore(gts, res) print('METEOR scores:', ) 但是这些都无法正常训练。请您帮忙看看,我需要怎么做能实现使用指标SPICE和METEOR作为奖励进行强化学习训练

— Reply to this email directly, view it on GitHub https://github.com/ruotianluo/ImageCaptioning.pytorch/issues/160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD2H44ND2FLY2O2KULDZEWLVQUHZZANCNFSM5ZWG7P2Q. You are receiving this because you are subscribed to this thread.

zhouhaonan011 commented 2 years ago

确实是不行的,meteor和spice都需要原词,而cider和bleu和一直用index。我现在的视线就是用的index,所以不能直接用meteor或者spice。 改的话不是不可以,但是需要extra work。 活着你可以参考一下m2transformer. Best Regards, =============================================== Ruotian Luo On Jun 23, 2022, at 8:49 PM, chuanxilu @.***> wrote: 您好,您的这份代码有着很出色的效果,我很敬佩您能写出这样的作品。有许多精妙的地方因为我个人水平问题,我有些看不懂,没有办法进行模仿: captioning/utils/rewards.py,这个文件里是用来做强化学习的奖励的,可以是Cider,也可以是Bleu。这点我大概琢磨出来了。可是当我试图使用指标SPICE和METEOR作为奖励进行训练时,我却始终无法正确实现。 我试图按照rewards.py中的格式,在line 67和104后面加入 if opt.spice_reward_weight > 0: , average_score = average_score.computescore(gts, res) print('SPICE scores:', ) 或者 if opt.metor_reward_weight > 0: , meteor_scores = METEOR.computescore(gts, res) print('METEOR scores:', ) 但是这些都无法正常训练。请您帮忙看看,我需要怎么做能实现使用指标SPICE和METEOR作为奖励进行强化学习训练 — Reply to this email directly, view it on GitHub <#160>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD2H44ND2FLY2O2KULDZEWLVQUHZZANCNFSM5ZWG7P2Q. You are receiving this because you are subscribed to this thread.

感谢您的回复,我这就按照您说的去学习一下m2transformer