I am trying to train this network on a dataset with different dimensions. My images are 16*16 large and I have only 2 categories. In CapsNet, input_shape is (16, 16, 1) and n_class is 2. I get the following exception:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Negative dimension size caused by subtracting 9 from 8 for 'primarycap_conv2d/convolution' (op: 'Conv2D') with input shapes: [?,8,8,256], [9,9,256,256].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "capsulenet.py", line 245, in
routings=args.routings)
File "capsulenet.py", line 47, in CapsNet
primarycaps = PrimaryCap(conv1, dim_capsule=8, n_channels=32, kernel_size=9, strides=2, padding='valid')
File "E:\workspace\Objekterkennung\CapsNet-Keras\capsulelayers.py", line 187, in PrimaryCap
name='primarycap_conv2d')(inputs)
File "E:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py", line 619, in call
output = self.call(inputs, **kwargs)
File "E:\ProgramData\Anaconda3\lib\site-packages\keras\layers\convolutional.py", line 168, in call
dilation_rate=self.dilation_rate)
File "E:\ProgramData\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 3341, in conv2d
data_format=tf_data_format)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 780, in convolution
return op(input, filter)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 868, in call
return self.conv_op(inp, filter)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 520, in call
return self.call(inp, filter)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_ops.py", line 204, in call
name=self.name)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_nn_ops.py", line 1042, in conv2d
data_format=data_format, dilations=dilations, name=name)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3392, in create_op
op_def=op_def)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1734, in init
control_input_ops)
File "E:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1570, in _create_c_op
raise ValueError(str(e))
ValueError: Negative dimension size caused by subtracting 9 from 8 for 'primarycap_conv2d/convolution' (op: 'Conv2D') with input shapes: [?,8,8,256], [9,9,256,256].
I don't know which other parameters I need to change to fit this network to my dataset. Can you help me with figuring out what I need to change?
I am trying to train this network on a dataset with different dimensions. My images are 16*16 large and I have only 2 categories. In CapsNet, input_shape is (16, 16, 1) and n_class is 2. I get the following exception:
I don't know which other parameters I need to change to fit this network to my dataset. Can you help me with figuring out what I need to change?