krasserm / fairseq-image-captioning

Transformer-based image captioning extension for pytorch/fairseq
Apache License 2.0
312 stars 55 forks source link

Preprocess issue #19

Closed vinod-13 closed 3 years ago

vinod-13 commented 3 years ago

Hi,

When it try to run preprocess.sh files.. getting an error stating "invalid option"

can you please help?

Screenshot from 2020-08-28 18-47-44

Regards, Vinod

krasserm commented 3 years ago

I'm unable to reproduce what you reported, even on a clean checkout following all instructions in README. Here's the initial (expected) output of ./preprocess_captions.sh ms-coco:

./preprocess_captions.sh ms-coco
Tokenize captions ...
100%|███████████████████████████████████████████████████████| 566747/566747 [00:33<00:00, 16998.62it/s]
Wrote tokenized captions to output/train-captions.tok.en.
Wrote caption image IDs to output/train-ids.txt.
Learn BPE from output/train-captions.tok.en ...
Apply BPE to output/train-captions.tok.en ...
Generate vocabulary and train dataset files ...
...

Do you use the latest version from Github and followed all setup instructions in README? Can you please provide more details about your environment?

krasserm commented 3 years ago

Closing this, please re-open if you still think this is a bug in this project.

vinod-13 commented 3 years ago

Hi Krasserm,

I am getting the same error still. Tried to reset again, but still preprocess step says - invalid option About my environment, i used the "environment.yml" and ran successfully.

I followed all steps, used the master branch.

Any help would suffice.

Regards, Vinod

vinod-13 commented 3 years ago

error-sep2

krasserm commented 3 years ago

I need more details from you for helping. Please try running the commands in preprocess_captions.sh individually so that I better locate the source of problem. For example, try running

export PYTHONPATH=.:./external/coco-caption

preprocess/preprocess_captions.sh --ms-coco-dir ms-coco --split train
preprocess/preprocess_captions.sh --ms-coco-dir ms-coco --split valid
preprocess/preprocess_captions.sh --ms-coco-dir ms-coco --split test

python preprocess/tokenize_captions_scst.py --ms-coco-dir coco

and see where you get the error. If you could further drill down this would be helpful.

vinod-13 commented 3 years ago

Hi,

I was able to solve it, i had some corrupted files in the system. Was able to confirgure and generate output as provided.

One help, i have random images not from the coco dataset. How can i generate prediction for it, say for example i have my own profile picture, how can i generate prediction on it. I saw you had place demo-id's in demo folder. Where were the demo pictures placed?

Regards, Vinod

krasserm commented 3 years ago

That's only possible with the grid-based feature extractor at the moment. For Faster-RCNN this is work in progress.

vinod-13 commented 3 years ago

You mean i cannot generate predictions for new images?

Can i know why is it so?

Regards, Vinod

Mas-Y commented 3 years ago

That's only possible with the grid-based feature extractor at the moment. For Faster-RCNN this is work in progress.

@krasserm How can i test using grid based feature extractor on my test images. can you provide the steps for it I have been trying to test this repo on my test images. It is unclear how i can do it. Your answer here says it can be done using grid based feature extractor. Please guide me through the steps for testing on own images

krasserm commented 3 years ago

There's no pre-trained model available using grid-based features so you first have to train one: generate grid-based features for MS-COCO images as described here, then run training with the --features grid option.

To run the trained model with your own test images, take a look at preprocess_images.py how to generate features for your test images with an InceptionV3 network. Use the generated features as input to the trained model.

There's no script available that does the necessary plumbing, so this will require some coding but shouldn't be too much effort. Hope that helps!