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 413 forks source link

Python-3 support #36

Open kmario23 opened 6 years ago

kmario23 commented 6 years ago

Hi @ruotianluo , I looked at the coco-caption codebase. It seems that we need some modifications like xrange -> range etc., to port the code to Python-3.

So, I'd like to know if you have any plans to port the pycoco tools to Python-3 so that we can use this current codebase for training models in Python-3?

ruotianluo commented 6 years ago

It's harder than that. I tried and failed for some metric.

kmario23 commented 6 years ago

I see. Let me try to do that and issue a PR if I manage to do it successfully!

salaniz commented 6 years ago

I have implemented Python 3 support for the coco caption metrics: https://github.com/salaniz/pycocoevalcap

I decided against a PR and in favor of a fork of my own because the pycocotools that come with the original repository have diverged with the newest version present in the coco API repository here: https://github.com/cocodataset/cocoapi

Therefore, I am using the pycocotools from the API repository together with my updated caption evaluation code.

You can have a look at the changes. They are all pretty obvious, except maybe the Meteor one which took me a while to debug. If you have any problems, let me know. Also feel free to make a PR with my changes. I have not tested if my code is backward compatible with Python 2.7.

ruotianluo commented 6 years ago

cool, I'll take a look.

sdsy888 commented 5 years ago

I have implemented Python 3 support for the coco caption metrics: https://github.com/salaniz/pycocoevalcap

I decided against a PR and in favor of a fork of my own because the pycocotools that come with the original repository have diverged with the newest version present in the coco API repository here: https://github.com/cocodataset/cocoapi

Therefore, I am using the pycocotools from the API repository together with my updated caption evaluation code.

You can have a look at the changes. They are all pretty obvious, except maybe the Meteor one which took me a while to debug. If you have any problems, let me know. Also feel free to make a PR with my changes. I have not tested if my code is backward compatible with Python 2.7.

hi, thank you for your work! Does your new repo support Chinese language evaluation?

salaniz commented 5 years ago

My repository simply adds Python 3 support, but leaves everything else unchanged. So it is really up to how well the metrics and the tokenizer from the original coco-caption repo generalize to the Chinese language. I do not know if that's the case.

ruotianluo commented 5 years ago

I added py3 support here https://github.com/ruotianluo/self-critical.pytorch/tree/py3 .

kmario23 commented 5 years ago

@ruotianluo thanks a lot! It seems the doc is still to be updated, right?

ruotianluo commented 5 years ago

@kmario23 I'm not yet 100% percent sure if it's correct. It seems working well on my side now.