【发布时间】:2020-04-14 19:47:26
【问题描述】:
我尝试运行 deeplearning4j 的 ZooModel 中提供的 ResNet50 计算图,但在调用 resNet 的 init() 方法时出现以下错误。我有 10 个班级,每张图片都是 64*64。
请提出正确的初始化方式。
代码
ResNet50Builder builder = ResNet50.builder();
ResNet50 resNet = builder.numClasses(10).cacheMode(CacheMode.NONE)
.workspaceMode(WorkspaceMode.NONE).inputShape(new int[] {3, 64, 64}).build();
ComputationGraph computationGraph = resNet.init();
异常堆栈跟踪:
Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidConfigException: Invalid configuration for layer (idx=77, name=res4a_branch2b, type=ConvolutionLayer) for height dimension: Invalid input configuration for kernel height. Require 0 < kH <= inHeight + 2*padH; got (kH=3, inHeight=2, padH=0)
Input type = InputTypeConvolutional(h=2,w=2,c=256), kernel = [3, 3], strides = [1, 1], padding = [0, 0], layer size (output channels) = 256, convolution mode = Same
at org.deeplearning4j.nn.conf.layers.InputTypeUtil.getOutputTypeCnnLayers(InputTypeUtil.java:327)
at org.deeplearning4j.nn.conf.layers.ConvolutionLayer.getOutputType(ConvolutionLayer.java:191)
at org.deeplearning4j.nn.conf.graph.LayerVertex.getOutputType(LayerVertex.java:131)
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.getLayerActivationTypes(ComputationGraphConfiguration.java:536)
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.addPreProcessors(ComputationGraphConfiguration.java:449)
at org.deeplearning4j.nn.conf.ComputationGraphConfiguration$GraphBuilder.build(ComputationGraphConfiguration.java:1201)
at org.deeplearning4j.zoo.model.ResNet50.init(ResNet50.java:91)
at org.deeplearning4j.examples.convolution.ResNet.run(ResNet.java:145)
at org.deeplearning4j.examples.convolution.ResNet.main(ResNet.java:306)
【问题讨论】:
标签: deep-learning deeplearning4j