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 (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...