GriffinLiang / vrd-dsr

Code for Visual Relationship Detection with Deep Structural Ranking (AAAI2018)
121 stars 32 forks source link

Question about params_emb #30

Open fangfchen opened 5 years ago

fangfchen commented 5 years ago

Hi, I find the code to load params_emb is :

Initial object embedding with word2vec with open('../data/vrd/params_emb.pkl') as f: emb_init = cPickle.load(f) net.statedict()['emb.weight'][1::].copy(torch.from_numpy(emb_init))

But why should use [1::]?

GriffinLiang commented 5 years ago

At first, 0 represents background. You can just use net.state_dict()['emb.weight'].copy_(torch.from_numpy(emb_init))

fangfchen commented 5 years ago

Thank you! Actually I meet the error when run the code: RuntimeError: The expanded size of the tensor (99) must match the existing size (100) at non-singleton dimension 0

And, what does the "0 represents background" mean? Could I understand it through some paper or blog?

GriffinLiang commented 5 years ago

Background is not included in this project. You can just ignore it.

fangfchen commented 5 years ago

OK, Thank you!