Input shape for 1D convolution network in keras

I am quite new to keras and I have a problem in understanding shapes.

I wanted to create 1D Conv Keras model as follows:

num_sensors = 2
num_classes = 4
model_m = Sequential()
model_m.add(Conv1D(100, 10, activation='relu', input_shape=(TIME_PERIODS, num_sensors)))
model_m.add(Conv1D(100, 10, activation='relu'))
model_m.add(Conv1D(160, 10, activation='relu'))
model_m.add(Conv1D(160, 10, activation='relu'))
model_m.add(Dense(num_classes, activation='softmax'))

The input data I have is 888 different panda data frame where each frame is of shape (511, 3) where 511 is numbers of signal points and 0th column is sensor1 values, 1st column is sensor2 values and 2nd column is labelled signals. Now how I should combine all my 888 different panda data frame so I have x_train and y_train from X and Y using Sklearn train_test_split. Also, I think the input shape I am defining for the model is wrong.

enter image description here

The context of the problem I am trying to solve e.g. input: time-based 2 sensors values say for 1 AM-2 AM hour from a user, output: the range of times e.g where the user was doing activity 1, activity 2, activity X on 1:10-1:15, 1:15-1:30, 1:30-2:00, The above plot show a sample training input and output.

Leave a Reply

Your email address will not be published. Required fields are marked *