facebookresearch / grid-feats-vqa

Grid features pre-training code for visual question answering
https://arxiv.org/abs/2001.03615
Apache License 2.0
268 stars 46 forks source link

how to change the command line to give path of pretrained model #29

Closed ifmaq1 closed 3 years ago

ifmaq1 commented 3 years ago

I want to load a pretrained model X-152++ and calculate its grid-features. I put the pretrained model X-152pp.pth in xyz directory. How should I load it to calculate its features as I am not loading model from output directory.

How do I need to change this command line python extract_grid_feature.py -config-file configs/X-152-grid.yaml --dataset

Also, when I write CUDA_VISIBLE_DEVICES=0 python3.6 extract_grid_feature.py --config-file configs/X-152-grid.yaml --dataset coco_2015_test OUTPUT_DIR xyz

it downloads

[03/20 20:14:59 d2.checkpoint.catalog]: Catalog entry catalog://ImageNetPretrained/FAIR/X-152-32x8d-IN5k points to https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/25093814/X-152-32x8d-IN5k.pkl

and later loads the model like this and starts calculating features for the dataset

[03/20 20:01:31 detectron2]: Full config saved to xyz/config.yaml [03/20 20:01:31 d2.utils.env]: Using a generated random seed 31780998 [03/20 20:01:36 fvcore.common.checkpoint]: Loading checkpoint from catalog://ImageNetPretrained/FAIR/X-152-32x8d-IN5k [03/20 20:01:36 d2.checkpoint.catalog]: Catalog entry catalog://ImageNetPretrained/FAIR/X-152-32x8d-IN5k points to https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/25093814/X-152-32x8d-IN5k.pkl [03/20 20:01:36 fvcore.common.file_io]: URL https://dl.fbaipublicfiles.com/detectron/ImageNetPretrained/25093814/X-152-32x8d-IN5k.pkl cached in /home/ifrahmaqsood/.torch/fvcore_cache/detectron/ImageNetPretrained/25093814/X-152-32x8d-IN5k.pkl

It doesn't take the model that is saved under xyz folder

could you help me, how can I overcome this problem

ifmaq1 commented 3 years ago

Any solution?

zhmd commented 3 years ago

Not an expert with detectron, but I think something like this might work:

CUDA_VISIBLE_DEVICES=0 python3.6 extract_grid_feature.py --config-file configs/X-152-grid.yaml --dataset coco_2015_test MODEL.WEIGHTS ./xyz/X-152pp.pth

It seems that they didn't check weights from output directory, so you need to override MODEL.WEIGHTS via command-line flags.

waizei commented 3 years ago

i can't find commits @ffff8ac,what version of detectron2 do you use?

waizei commented 3 years ago

Not an expert with detectron, but I think something like this might work:

CUDA_VISIBLE_DEVICES=0 python3.6 extract_grid_feature.py --config-file configs/X-152-grid.yaml --dataset coco_2015_test MODEL.WEIGHTS ./xyz/X-152pp.pth

It seems that they didn't check weights from output directory, so you need to override MODEL.WEIGHTS via command-line flags.

i can't find commits @ffff8ac,what version of detectron2 do you use?

endernewton commented 3 years ago

https://github.com/facebookresearch/detectron2/tree/ffff8acc35ea88ad1cb1806ab0f00b4c1c5dbfd9 This one?