# Error while running ResNet50 Zoomodel example

**URL:** <https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417>\
**Category:** DL4J\
**Created:** [April 14, 2020, 7:44pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417 "2020-04-14T19:44:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsharma82](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tsharma82](https://community.konduit.ai/u/tsharma82)\
**Post date:** [April 14, 2020, 7:44pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/1 "2020-04-14T19:44:18Z")

</div>

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.

**Code**

```java
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:**

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [April 14, 2020, 7:52pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/2 "2020-04-14T19:52:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tsharma82](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tsharma82](https://community.konduit.ai/u/tsharma82)\
**Post date:** [April 14, 2020, 8:12pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/3 "2020-04-14T20:12:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [April 15, 2020, 9:06am UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/4 "2020-04-15T09:06:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tsharma82](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tsharma82](https://community.konduit.ai/u/tsharma82)\
**Post date:** [April 15, 2020, 11:29am UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/5 "2020-04-15T11:29:31Z")

</div>

Thanks @treo. Got it.

---

<div class="post-metadata">

**Author:** ![yptheangel](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/yptheangel/32/128_2.png) [@yptheangel](https://community.konduit.ai/u/yptheangel)\
**Post date:** [April 16, 2020, 7:22am UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/6 "2020-04-16T07:22:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tsharma82](https://avatars.discourse-cdn.com/v4/letter/t/a9adbd/32.png) [@tsharma82](https://community.konduit.ai/u/tsharma82)\
**Post date:** [April 29, 2020, 8:24pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/7 "2020-04-29T20:24:56Z")

</div>

I was trying to train from scratch.

---

<div class="post-metadata">

**Author:** ![FanDev](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/fandev/32/231_2.png) [@FanDev](https://community.konduit.ai/u/FanDev)\
**Post date:** [January 26, 2021, 3:20pm UTC](https://community.konduit.ai/t/error-while-running-resnet50-zoomodel-example/417/8 "2021-01-26T15:20:11Z")

</div>

My network includes several dilated convolution with large dilation filter, which results in a relatively small image size. I can run it successfully in python/keras. Is there any workaround to make it work in DL4J? Thanks.
