Error while running ResNet50 Zoomodel example

Hi Team,

I tried to run ResNet50 computation graph but got following error while calling init() method of resNet. I have 10 classes and each image is 64*64.

Please suggest the correct way of initializing.


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 Stack Trace:

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(
	at org.deeplearning4j.nn.conf.layers.ConvolutionLayer.getOutputType(
	at org.deeplearning4j.nn.conf.graph.LayerVertex.getOutputType(
	at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.getLayerActivationTypes(
	at org.deeplearning4j.nn.conf.ComputationGraphConfiguration.addPreProcessors(
	at org.deeplearning4j.nn.conf.ComputationGraphConfiguration$
	at org.deeplearning4j.zoo.model.ResNet50.init(
	at org.deeplearning4j.examples.convolution.ResNet.main(

The image is too small, which results in filters being too large after the first few convolutional layers.

Thanks @treo.
Can you suggest what all Neural Networks can be executed on these images? I was able to run LeNet through DL4J.

I can’t just list all models because I don’t know each architecture by heart. If you take a look at the configuration of the models you are interested in, you should be able to see it based on kernel sizes and strides. Or, if you don’t want to do the math, you can just try them out one by one.

The error you are seeing here is exactly what you’d be seeing in other cases where the input image is too small.

Thanks @treo. Got it.

@tsharma82 are you trying to do transfer learning by using pretrained ResNet50 or train from scratch?

I was trying to train from scratch.