英文:
How can I use a model of format .mat in PyTorch?
问题
我已经从 https://www.di.ens.fr/willow/research/netvlad/ 下载了一个经过训练的NetVLAD模型。然而,该模型是在MatLab中训练的,文件类型是*.mat*。我应该如何在PyTorch中加载它呢?
我能够使用以下代码访问权重,但是我不确定接下来该怎么做。是否有一种方法可以使用load_state_dict
或类似的方法在PyTorch中加载它?
from scipy.io import loadmat
data = loadmat('vd16_pitts30k_conv5_3_vlad_preL2_intra_white.mat')
array_data = data['net']
英文:
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']
答案1
得分: 1
权重对于网络的结构没有任何信息,它只是一个数字数组。如果你恰好有与MATLAB相同的网络,并且知道如何放置每个数字,那么是的,你可以做到,但没有“直接和简单”的方法。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论