Skip to content

Commit 879971b

Browse files
committed
Specify the ___location of pretrained resnet model.
1 parent 2eb03b6 commit 879971b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ There's something difference compared to neuraltalk2.
88
# Requirements
99
Python 2.7 (no [coco-caption](https://github.com/tylin/coco-caption) version for python 3), pytorch
1010

11-
# Pretrained FC model.
12-
Download pretrained model from [link](https://drive.google.com/drive/folders/0B7fNdx_jAqhtOVBabHRCQzJ1Skk?usp=sharing). You also need pretrained resnet which can be downloaded from [pytorch-resnet](https://github.com/ruotianluo/pytorch-resnet.git).
11+
# Pretrained models.
12+
You need pretrained resnet both for training and evaluation. The models can be downloaded from [here](https://drive.google.com/open?id=0B7fNdx_jAqhtbVYzOURMdDNHSGM), and should be placed in `data/imagenet_weights`.
13+
14+
We also provide pretrained fc model, and you can download it from [here](https://drive.google.com/drive/folders/0B7fNdx_jAqhtOVBabHRCQzJ1Skk?usp=sharing).
1315

1416
Then you can follow [this section](#markdown-header-caption-images-after-training).
1517

@@ -29,9 +31,6 @@ $ python scripts/prepro_labels.py --input_json .../dataset_coco.json --output_js
2931
$ python scripts/prepro_feats_npy.py --input_json .../dataset_coco.json --output_dir data/cocotalk --images_root ...
3032
```
3133

32-
(prepro_feats_npy.py uses the resnet converted from caffe
33-
[pytorch-resnet](https://github.com/ruotianluo/pytorch-resnet.git). )
34-
3534
You need to download [dataset_coco.json](http://cs.stanford.edu/people/karpathy/deepimagesent/caption_datasets.zip) from Karpathy's homepage.
3635

3736
This is telling the script to read in all the data (the images and the captions), allocate the images to different splits according to the split json file, extract the resnet101 features (both fc feature and last conv feature) of each image, and map all words that occur <= 5 times to a special `UNK` token. The resulting `json` and `h5` files are about 200GB and contain everything we want to know about the dataset.

dataloaderraw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import misc.resnet as resnet
2424

2525
resnet = resnet.resnet101()
26-
resnet.load_state_dict(torch.load('/home-nfs/rluo/rluo/model/pytorch-resnet/resnet101.pth'))
26+
resnet.load_state_dict(torch.load('./data/imagenet_weights/resnet101.pth'))
2727
my_resnet = myResnet(resnet)
2828
my_resnet.cuda()
2929
my_resnet.eval()

scripts/prepro_feats_npy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def main(params):
102102
parser.add_argument('--images_root', default='', help='root ___location in which images are stored, to be prepended to file_path in input json')
103103
parser.add_argument('--att_size', default=14, type=int, help='14x14 or 7x7')
104104
parser.add_argument('--model', default='resnet101', type=str, help='resnet101, resnet152')
105-
parser.add_argument('--model_root', default='/home-nfs/rluo/rluo/model/pytorch-resnet/', type=str, help='model root')
105+
parser.add_argument('--model_root', default='./data/imagenet_weights', type=str, help='model root')
106106

107107
args = parser.parse_args()
108108
params = vars(args) # convert to ordinary dict

0 commit comments

Comments
 (0)