为什么 Matlab R2010 无法加载 R2007 中的神经网络对象?
我有一个神经网络,已保存到 Matlab 2007 中的 .mat 文件中。
我正在尝试使用 load filename.mat
从文件加载神经网络。 这对于 R2007b 和 R2008 版本效果很好,但是当我尝试在 R2010b 中加载时,我收到以下消息:
警告:运行类时发生错误 加载对象方法。从加载的对象 MAT 文件是 loadobj 之前对象的副本 方法已运行。其余变量也 从 MAT 文件加载。
遇到的错误是:
引用不存在的字段“名称”
奇怪的是,保存神经网络的变量似乎存在,但它无法正常工作。 R2010 中没有使用神经网络的功能。
有没有人遇到过类似的问题?如何保存神经网络使其与 Matlab R2010 兼容?
或者更好的是,我怎样才能在 Matlab 2010 中正确加载它?
I have a Neural Network that I've save to a .mat file in Matlab 2007.
I'm trying to load the neural network from the file with load filename.mat
.
This worked great with versions R2007b and R2008, but when I try to load in R2010b I get the following message:
Warning: An error occurred when running a class's
loadobj method. The object that was loaded from the
MAT-file was a copy of the object before the loadobj
method was run. The rest of the variables were also
loaded from the MAT-file.
The encountered error was:
Reference to non-existent field 'name'
The weird thing is that it appears as if the variable holding the Neural Network exists, but it's not working properly. None of the functions that use the neural network work in R2010.
Has anyone encountered a similar problem ? How can I save the Neural Network so it will be compatible with Matlab R2010?
Or even better, how can I just load it properly in Matlab 2010?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,似乎其他人也遇到过这个问题(神经网络未在 MATLAB 2010 中加载),根据此 MATLAB Central 帖子,其中 Andreas Goser(Mathworks 技术支持经理)建议:
显然你需要技术支持可以提供的“一个固定的net.m文件”。我没有测试过,因为我自己没有这个问题。
仔细阅读错误消息,我会说您看到加载的变量包含存储在 .MAT 文件中的“原始”对象,很可能是一个结构。您可以运行
whos myvarname
来检查。要将此结构“恢复”为对象,需要通过其对象类型的重载loadobj
函数进行处理,该函数通常由 MATLAB 的load
函数自动调用。在这种情况下,R2010 中神经网络对象附带的loadobj
似乎不完全向后兼容......Yes, it seems other people have encountered this problem (neural networks not loading in MATLAB 2010), according to this MATLAB Central post, in which Andreas Goser (Technical Support Manager at Mathworks) suggests:
Apparently you need "a fixed net.m file" which technical support can provide. I haven't tested it, since I don't have that problem myself.
Carefully reading the error message, I would say that the variable you see loaded contains the "raw" object that was stored in the .MAT file, quite possibly a struct. You can run
whos myvarname
to check. To "revive" this struct into an object it needs to be processed by the overloadedloadobj
function for its object type, which is usually automatically called by MATLAB'sload
function. In this case theloadobj
that comes with the neuronal network object in R2010 seems to not be fully backwards compatible...我怀疑神经网络的底层对象自 2007b 以来已经发生了变化,并且 R2010b 中的定义与 MAT 文件中存储的数据不兼容。
我建议遵循乔纳斯的回答。或者,您可以尝试加载它并在中间 MATLAB 版本中重新保存它,或者保存神经网络对象中的数据并在 R2010b 中重建它。
I suspect that the underlying objects for the neural net have changed since 2007b and that the definition in R2010b is not compatible with the data stored in the MAT-file.
I recommend following Jonas's answer. Alternatively, you might try loading it and re-saving it in an intermediate MATLAB release, or saving the data from the neural net objects and rebuilding it in R2010b.