如何解决MATLAB深度学习:自定义CNN网络定义中的错误
我想使用Matlab深度学习工具箱创建自定义CNN网络,但显示以下错误。图层定义良好,但是net = layerGraph(layers);
命令显示错误。
Gr=128; Gt=32;
vecInput = imageInputLayer([Gr,Gt,3],'Name','input');
Conv2d1 = convolution2dLayer(3,16,'Padding','same'); %size: 128*32*16
BN1 = batchNormalizationLayer('Name','BN1');
relu1 = reluLayer('Name','relu1');
pool1 = averagePooling2dLayer(2,'Stride',2,'pool1'); %size: 64*16*16
Conv2d2 = convolution2dLayer(3,32,'same'); %size: 64*16*32
BN2 = batchNormalizationLayer('Name','BN2');
relu2 = reluLayer('Name','relu2');
pool2 = averagePooling2dLayer(3,'pool2'); %size: 32*8*32
Conv2d3 = convolution2dLayer(3,'same'); %size: 32*8*2
BN3 = batchNormalizationLayer('Name','BN2');
relu3 = reluLayer('Name','relu3');
fc1 = fullyConnectedLayer(1024,'fc1');
relu4 = reluLayer('Name','relu4');
fc2 = fullyConnectedLayer(4096,'fc2');
relu5 = reluLayer('Name','relu5');
reglayer = regressionLayer('Name','output');
layers = [
vecInput
Conv2d1
BN1
relu1
pool1
Conv2d2
BN2
relu2
pool2
Conv2d3
BN3
relu3
fc1
relu4
fc2
relu5
reglayer];
net = layerGraph(layers); %This command is showing error
错误消息:
Error using nnet.internal.cnn.util.validateLayersForLayerGraph>iAssertUniqueAndNonEmptyLayerNames
(line 87)
Layer names in layer array must be nonempty.
Error in nnet.internal.cnn.util.validateLayersForLayerGraph (line 48)
iAssertUniqueAndNonEmptyLayerNames(larray,existingLayers);
Error in layerGraph>iPostProcessParsingResultsForConstructor (line 90)
inputArguments.Layers = nnet.internal.cnn.util.validateLayersForLayerGraph(results.Layers);
Error in layerGraph (line 46)
inputArguments = iPostProcessParsingResultsForConstructor(parser.Results);
Error in test_builnet (line 45)
net = layerGraph(layers);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。