81 Downloads
Updated2020年3月18日
进口商TensorFlow-Keras模型enable you to import a pretrained Keras model and weights. You can then use this model for prediction or transfer learning. Alternatively, you can import layer architecture as a Layer array or a LayerGraph object. You can then train this model.
从操作系统中打开Kerasimporter.mlPkginStall文件,也将从Matlab中启动您拥有的发布的安装过程。
This mlpkginstall file is functional for R2017b and beyond.
Usage Example:
1. Import Keras Layers
% Import the Layers
layers = importKerasLayers('digitsDAGnet.h5');
%加载数据集以训练分类器以识别数字
digitDatasetPath = fullfile(toolboxdir('nnet'), 'nndemos', ...
'nndatasets', 'DigitDataset');
digitData = imageDatastore(digitDatasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
%Partition the dataset into training & test images
RNG(1)%以获得可重复性
TrainingFilesplitratio = 0.6;
[traindigitdata,testdigitdata] = spliteachlabel(digitdata,...
trainingFileSplitRatio,'randomize');
%设置一些培训选项
选项= trainingOptions('sgdm','maxepochs',20,...
'InitialLearnRate',0.001);
%火车网络
convnet = trainNetwork(trainDigitData,layers,options);
%Read image for classification
i = imread(fullfile(digitdatasetpath,'5','image4009.png'));
数字
imshow(i)
%使用网络对图像进行分类
label = classify(convnet, I);
title(['Classification result ' char(label)])
2. Import a pretrained Keras Network
netfile = 'digitsDAGnet.h5';
classNames = {'0','1','2','3','4','5','6','7','8','9'};
network = importKerasNetwork(netfile, 'Classes', classNames);
%Read the image to classify
digitDatasetPath = fullfile(toolboxdir('nnet'), 'nndemos','nndatasets',...
'DigitDataset');
i = imread(fullfile(digitdatasetpath,'5','image4009.png'));
%使用网络对图像进行分类
label = classify(network, I);
%显示图像和分类结果
数字
imshow(i)
title(['Classification result ' char(label)])
JoséLuis桑托斯(查看资料)
我在这里有接下来的两个错误:
Warning: File 'resnet50_pascal_cards.h5' was saved in Keras version '2.3.1'. Import of Keras versions newer than '2.2.4' is
not yet supported. The imported model may not exactly match the model saved in the Keras file.
Error using importKerasNetwork (line 94)
无法导入网络。尚未支持重量分享。金宝app
Warning: File 'resnet50_pascal_cards_inference.h5' was saved in Keras version '2.3.1'. Import of Keras versions newer than
'2.2.4'尚未得到支持。金宝app导入的模型可能与在KERAS文件中保存的模型完全匹配。
Error using importKerasNetwork (line 94)
Keras网络没有输出层,因为模型文件不包含丢失信息。将输出层添加到导入
network, specify its type using the 'OutputLayerType' argument. To provide class names, use the 'ClassNames' argument.
这是什么?
谢谢
Mustafa Bingöl(查看资料)
虽然回归部件适用于进口Kerasnetwork函数,但分类部分无法稳定地工作。连续给出错误“参考不存在的字段”XXX层“。也没有使用ImportKerasLayers部分,因为TF的保存和负载重量无法正常工作。
tf.version=2.1.0
tf.keras.version=2.2.4-tf
Matlab.R2020a
James34602(查看资料)
Common Keras inference features are missing:
1.动态输入/输出轴
2. Permute layer
3.定时分布层
4.重塑层
James34602(查看资料)
Could Mathworks add TimeDistributed support?
尼古拉Franzoso(查看资料)
如何在GPU上加载网络?
谢谢
埃米尔克里斯蒂亚森(查看资料)
Saikat Sarkar(查看资料)
Error using importKerasNetwork (line 94). Unable to import network. Weight sharing is not yet supported. Any update on this ?
Seyed Mostafa Mousavi Kahaki(查看资料)
I'm also getting this error: "Importing Keras networks with more than 1 input or output layer is not yet supported". Are there any updates?
Diego Ribeiro de Oliveira Galdino(查看资料)
关于MIMO(多输入和多输出)网络怎么样?
Larry Riddle(查看资料)
Still looking for an offline installer or importer for this, I have a non-internet access Windows 10 system with 2018b & the Deep Learning Tb installed and this package will not install without 'Phoning home'. Any ideas?
Morgan(查看资料)
I have the same issue as Tengfei Feng. I suppose it is the Timedistributed(Dense) layer that causes the issue. Anyidea when this will be fixed?
Brian Broking(查看资料)
Is there anyway to get an Offline Installer for Linux? Or instructions on how to download this offline for Linux? I have a situation where this is needed without any networking.
Tengfei Feng(查看资料)
我只是收到错误的反馈'无法导入网络,因为尚未支持某些网络图层';金宝app我只是设计一个简单的模型,包括LSTM和TimedistRibuted(密集)层。所以如果未来可以支持这些功能,我会非常满意。金宝app
Ben Wetherill(查看资料)
Seconding Jeff Bailey's question regarding installing on off line matlab instance...
Umut Demir(查看资料)
你好,I keep getting "Reference to non-existent field 'class_name'." error. I could not find any source to fix this.
Yang Tao(查看资料)
你好,I wonder if there's a way to import a model containing custom layers? Thank.
杰夫巴利(查看资料)
How does one get a copy of the Deep Learning Toolbox Importer for TensorFlow-Keras Models for an offline, non-Internet system that has Matlab installed? The download button on this page only points to a matlab package install script that must be opened within Matlab.
Chijiang Duan(查看资料)
你好,
当我使用批量归一化层导入TF.keras模型时,我收到了此警告:
Warning: Unable to import layer. Keras layer 'BatchNormalization' with the specified settings is not yet
supported. The problem was: Layer 'bn_1': Unable to import layer. 'axis' values other than
-1 or 3 are not yet supported.
我非常确定Keras模型的Batchnormalization层中的“轴”参数已设置为-1。
Does anyone have any idea how should I solve this problem?
或者也许它只是导入功能的错误?
Thank you guys.
And great job for developing this great tool.
Chijiang
Ali Durmaz(查看资料)
嗨,大家好,
are there any plans to include padding value support in Conv2DTranspose?
I got the following warning:
Warning: Unable to import layer. Keras layer 'Conv2DTranspose' with the specified settings is not yet supported. The problem was: Layer
'conv2d_transose_3':无法导入图层。尚未支持填充值。金宝app
谢谢in advance for your help.
Best regards
Ali
Ali Özgür Argunsah(查看资料)
I got this error:
使用importKeraslayers时出错(第96行)
Unable to import layers from file 'mask_rcnn.h5'
because it contains no 'model_config' attribute.
知道如何解决吗?
Nathan Lepora(查看资料)
This would be great for us if it could support >1 output layers... any plans?
munaiyi munaiyi(查看资料)
SergeyLA(查看资料)
你好!Along with upgarde to keras 2.2.4 please add support for Keras models with layers like this one:
Model.Add(定时分布式(致密(Len(映射))))))
Or if Matlab approach for TimeDistributed layers is different one, please add comments how to make model with similar configuration.
Ting Su(查看资料)
Hi Bingzhao and Argo, MIMO (multiple input and multiple output) network is not supported yet. We will consider to support importing MIMO network in the future.
Ting Su(查看资料)
嗨Issac,Keras 2.2.4的问题是由克拉斯2.2.3中的破碎变化引发。我们很快就会提供解决方案。
Isaac Lenton(查看资料)
你好,I'm unable to import networks saved with keras==2.2.4. Downgrading to keras==2.1.0 seems to work fine.
炳昭山(查看资料)
你好!我还获得以下错误'尚未支持以上输入超过1个输入或输出层的keras网络。金宝app此外,真诚希望支持非图像输入层。金宝app谢谢!
建徐(查看资料)
我想创建一个专用图层来向数据添加噪点。但我的matlab版本是2017b,我没有这个例子“gaussiannoiselayer.m”。我真的想知道添加噪声层的编码结构。
非常感谢你!!
Kivanc Kose.(查看资料)
I am using the Linux installation of Matlab 2018a. Even if my toolbox configuration and version satisfies the requirements, the can not install the package.
The add-on explorer portal states "This add-on is not supported on your platform" and does not let me install the package.
Don Mathis(查看资料)
Chia-yi Tai,Keras和Matlab之间的比赛应至少为1E-4准确。也许你的预处理在两种情况下并不完全相同。请联系支持或MATLAB答案以金宝app获取更具体的响应。
Chia-Yi Tai(查看资料)
I have import keras training model and success classify images , but I got the different result between Python(tensorflow) and MATLAB classify answer , the model are exactly same and I also using resize and flip to match different , is it any others possible reason or it still have little different when neural network running,
thank you
argo yang(查看资料)
您好,当我通过Keras导入Yolo Model时,我还收到错误“尚未支持超过1个输入或输出层的导入Keras网络”。金宝app但是Mathworks有一个关于Yolonet.mat的文档,你如何获得Yolonet.mat?导入其他型号或由Matlab完全训练!
Thank you!
Wen Liu(查看资料)
你好!我还获得以下错误'尚未支持以上输入超过1个输入或输出层的keras网络。金宝appHope you could solve it next time by supporting Multi-input or Multi-output. Many thanks.
罗伯特(查看资料)
Goodday,
I get the following error 'Importing Keras networks with more than 1 input or output layer is not yet supported.' Any idea on when this will be supported? Many thanks.
GAUTAM SHREEDHA BHAT(查看资料)
嗨epic,通过输入向量的输入,I changed the command to this
model = importKerasNetwork('model16.json','WeightFile','model16.h5','OutputLayerType','classification','ImageInputSize',[1 37], 'classnames',classnames);
但是当我做到了时,它说'imageInputsize'不是一个识别的参数。是否有其他方法可以将输入传递为vector.kindly帮助
Don Mathis(查看资料)
Gautam, the MATLAB network will always have an inputImageLayer as the first layer. If your Keras network had vector inputs instead of image inputs, you would pass them to the MATLAB network as "row images", (height=1).
GAUTAM SHREEDHA BHAT(查看资料)
Does this only work for image inputs? The input I am using is not an image and when I check the classifier output in keras and matlab, They both are different. Can someone please clarify this?
Yufan He(查看资料)
希望你能让它支持prelu。金宝app
谢谢
Yodish(查看资料)
它与Windows 10合作吗?获取错误消息
dudy karl(查看资料)
是否有可能导入在keras.layers中定义的图层,如keras.layers.convlstm2d?
像TimedistRibute这样的包装员怎么样?有没有办法导入它或在Matlab中有类似的层吗?
Philipp Zelger(查看资料)
以前的Matlab版本是否有金宝app支持?
cui(查看资料)
David Kuske(查看资料)
cui(查看资料)
Nice to see it today! I'll try tomorry
David Kuske(查看资料)
到目前为止,在Matlab中使用一个带有LSTM回归的NN吗?我尝试了Matlab NN Toolbox,尚未支持。金宝app
Then I implemented it in Keras, now I cant Import my trained network for use :/.
David Kuske(查看资料)
When will LSTM support be implemented? thank you
Ting Su(查看资料)
Hi Talmo, Thanks for your feedback. We will contact you for more details of your use case on Reshape layers.
Talmo Pereira(查看资料)
Excellent toolbox! Any chance we could get support for Reshape layers? Makes it kind of hard to go from Dense layers to Conv2d/ConvTranspose2d otherwise.
Eftychios Pnevmatikakis(查看资料)
你好,I’m getting an error when trying to install this: “The support package is not compatible with your version of MATLAB or operating system.”
I’m on macOS Sierra 10.12.6 using Matlab R2017b