Skip to content

Padding needed when using other data to support odd number of input data #25

@maystroh

Description

@maystroh

First of all, I would like to thank you to publish the code of the interesting study you made. I'm trying to do something similar with PPG signals so I tried your code on my data but I got an issue:

Traceback (most recent call last):
  File "ecg/train.py", line 117, in <module>
    train(args, params)
  File "ecg/train.py", line 103, in train
    callbacks=[checkpointer, reduce_lr, stopping])
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1039, in fit
    validation_steps=validation_steps)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training_arrays.py", line 199, in fit_loop
    outs = f(ins_batch)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 2715, in __call__
    return self._call(inputs)
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 2675, in _call
    fetched = self._callable_fn(*array_vals)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1439, in __call__
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/errors_impl.py", line 528, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [16,15437,32] vs. [16,15438,32]
	 [[{{node add_4/add}} = Add[T=DT_FLOAT, _class=["loc:@training/Adam/gradients/add_4/add_grad/Reshape_1"], _device="/job:localhost/replica:0/task:0/device:GPU:0"](max_pooling1d_4/Squeeze, conv1d_9/add)]]
	 [[{{node loss/mul/_1985}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_20932_loss/mul", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]
srun: error: cn09: task 0: Exited with exit code 1

I've modified the line 62 in network.py in order to pad the inputs of the pooling layer

shortcut = MaxPooling1D(pool_size=subsample_length, padding='same')(layer)

This solved the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions