i am trying to run CNN_Spiking from nengo on my own dataset which is composed of jpg images. i made neccessary changes in code according to the size of my dataset images and run following code but got the follwoing error.pls suggest me the solution.
the following error appears
C:\ProgramData\Anaconda34\lib\site-packages\ipykernel_launcher.py:71: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(32, (3, 3), padding="valid")
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\errors_impl.py in exit(self, type_arg, value_arg, traceback_arg)
472 compat.as_text(c_api.TF_Message(self.status.status)),
--> 473 c_api.TF_GetCode(self.status.status))
474 # Delete the underlying status object from memory otherwise it stays alive
InvalidArgumentError: Shapes must be equal rank, but are 4 and 0 for 'soft_lif_7/Select_1' (op: 'Select') with input shapes: [?,?,?,?], [?,32,225,1], [].
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
in ()
70 #kmodel.add(GaussianNoise(0.1, input_shape=(3,3, img_rows, img_cols)))
71 kmodel.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid'))
---> 72 kmodel.add(SoftLIF(**softlif_params))
73 kmodel.add(Convolution2D(nb_filters, nb_conv, nb_conv))
74 kmodel.add(SoftLIF(**softlif_params))
C:\ProgramData\Anaconda34\lib\site-packages\keras\models.py in add(self, layer)
490 output_shapes=[self.outputs[0]._keras_shape])
491 else:
--> 492 output_tensor = layer(self.outputs[0])
493 if isinstance(output_tensor, list):
494 raise TypeError('All layers in a Sequential model '
C:\ProgramData\Anaconda34\lib\site-packages\keras\engine\topology.py in __call__(self, inputs, **kwargs)
615
616 # Actually call the layer, collecting output(s), mask(s), and shape(s).
--> 617 output = self.call(inputs, **kwargs)
618 output_mask = self.compute_mask(inputs, previous_mask)
619
C:\ProgramData\Anaconda34\lib\site-packages\nengo_extras\keras.py in call(self, x, mask)
23 j = K.softplus(x / self.sigma) * self.sigma
24 r = self.amplitude / (self.tau_ref + self.tau_rc*K.log(1 + 1/j))
---> 25 return K.switch(j > 0, r, 0)
26
27 def get_config(self):
C:\ProgramData\Anaconda34\lib\site-packages\keras\backend\tensorflow_backend.py in switch(condition, then_expression, else_expression)
2833 tile_shape = tf.where(shape_diff > 0, expr_shape, tf.ones_like(expr_shape))
2834 condition = tf.tile(condition, tile_shape)
-> 2835 x = tf.where(condition, then_expression, else_expression)
2836 return x
2837
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\ops\array_ops.py in where(condition, x, y, name)
2538 return gen_array_ops.where(condition=condition, name=name)
2539 elif x is not None and y is not None:
-> 2540 return gen_math_ops._select(condition=condition, x=x, y=y, name=name)
2541 else:
2542 raise ValueError("x and y must both be non-None or both be None.")
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\ops\gen_math_ops.py in _select(condition, x, y, name)
4526 if _ctx.in_graph_mode():
4527 _, _, _op = _op_def_lib._apply_op_helper(
-> 4528 "Select", condition=condition, t=x, e=y, name=name)
4529 _result = _op.outputs[:]
4530 _inputs_flat = _op.inputs
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
785 op = g.create_op(op_type_name, inputs, output_types, name=scope,
786 input_types=input_types, attrs=attr_protos,
--> 787 op_def=op_def)
788 return output_structure, op_def.is_stateful, op
789
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\ops.py in create_op(self, op_type, inputs, dtypes, input_types, name, attrs, op_def, compute_shapes, compute_device)
3160 op_def=op_def)
3161 self._create_op_helper(ret, compute_shapes=compute_shapes,
-> 3162 compute_device=compute_device)
3163 return ret
3164
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\ops.py in _create_op_helper(self, op, compute_shapes, compute_device)
3206 # compute_shapes argument.
3207 if op._c_op or compute_shapes: # pylint: disable=protected-access
-> 3208 set_shapes_for_outputs(op)
3209 # TODO(b/XXXX): move to Operation.__init__ once _USE_C_API flag is removed.
3210 self._add_op(op)
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\ops.py in set_shapes_for_outputs(op)
2425 return _set_shapes_for_outputs_c_api(op)
2426 else:
-> 2427 return _set_shapes_for_outputs(op)
2428
2429
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\ops.py in _set_shapes_for_outputs(op)
2398 shape_func = _call_cpp_shape_fn_and_require_op
2399
-> 2400 shapes = shape_func(op)
2401 if shapes is None:
2402 raise RuntimeError(
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\ops.py in call_with_requiring(op)
2328
2329 def call_with_requiring(op):
-> 2330 return call_cpp_shape_fn(op, require_shape_fn=True)
2331
2332 _call_cpp_shape_fn_and_require_op = call_with_requiring
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\common_shapes.py in call_cpp_shape_fn(op, require_shape_fn)
625 res = _call_cpp_shape_fn_impl(op, input_tensors_needed,
626 input_tensors_as_shapes_needed,
--> 627 require_shape_fn)
628 if not isinstance(res, dict):
629 # Handles the case where _call_cpp_shape_fn_impl calls unknown_shape(op).
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\common_shapes.py in _call_cpp_shape_fn_impl(op, input_tensors_needed, input_tensors_as_shapes_needed, require_shape_fn)
689 missing_shape_fn = True
690 else:
--> 691 raise ValueError(err.message)
692
693 if missing_shape_fn:
ValueError: Shapes must be equal rank, but are 4 and 0 for 'soft_lif_7/Select_1' (op: 'Select') with input shapes: [?,?,?,?], [?,32,225,1], [].
i am trying to run CNN_Spiking from nengo on my own dataset which is composed of jpg images. i made neccessary changes in code according to the size of my dataset images and run following code but got the follwoing error.pls suggest me the solution.
the following error appears C:\ProgramData\Anaconda34\lib\site-packages\ipykernel_launcher.py:71: UserWarning: Update your
Conv2D
call to the Keras 2 API:Conv2D(32, (3, 3), padding="valid")
InvalidArgumentError Traceback (most recent call last) C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\common_shapes.py in _call_cpp_shape_fn_impl(op, input_tensors_needed, input_tensors_as_shapes_needed, require_shape_fn) 685 graph_def_version, node_def_str, input_shapes, input_tensors, --> 686 input_tensors_as_shapes, status) 687 except errors.InvalidArgumentError as err:
C:\ProgramData\Anaconda34\lib\site-packages\tensorflow\python\framework\errors_impl.py in exit(self, type_arg, value_arg, traceback_arg) 472 compat.as_text(c_api.TF_Message(self.status.status)), --> 473 c_api.TF_GetCode(self.status.status)) 474 # Delete the underlying status object from memory otherwise it stays alive
InvalidArgumentError: Shapes must be equal rank, but are 4 and 0 for 'soft_lif_7/Select_1' (op: 'Select') with input shapes: [?,?,?,?], [?,32,225,1], [].
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)