Shania F.
Shania F.

Reputation: 1

How can I use a model of format .mat in PyTorch?

I've downloaded a trained NetVLAD model from https://www.di.ens.fr/willow/research/netvlad/. However, the model was trained in MatLab and is of the type .mat. How can I load this in PyTorch?

I was able to access the weights using the following code, but I'm not sure how to proceed from this point. Is there a way to load this in PyTorch with load_state_dict or something similar?

from scipy.io import loadmat

data = loadmat('vd16_pitts30k_conv5_3_vlad_preL2_intra_white.mat')

array_data = data['net']

Upvotes: 0

Views: 110

Answers (1)

Ander Biguri
Ander Biguri

Reputation: 35525

The weights have zero information about the structure of the network, its just an array of numbers. If you happen to have exactly the same network than MATLAB had, and know where to put each number, yes, you can do it, but there is no "direct and easy" way.

Upvotes: 1

Related Questions