0

I have tried many times and read the answer to the question similar to me, but still did not solve.

Error when checking input: expected acc_input to have 4 dimensions, but got array with shape (200, 3, 1)

model.fit(x=[acc_,gyro_],y=[scaled_labels],batch_size=1,validation_split=0.2, epochs=2,verbose=1,shuffle=False)

The first layer of my network is the Input layer

acc_input_tensor = Input(shape=(200,3,1),name = 'acc_input')
gyro_input_tensor = Input(shape=(200,3,1),name= 'gyro_input')

The input is the acceleration and gyroscope data. 200 refers to 200 sets of data, 3 refers to the acceleration of the measured value of x,y,z. I put the acceleration data and gyro data reshape into (200 * 3 * 1)

acc_ = np.reshape(acc,(200,3,1))
gyro_ = np.reshape(gyro,(200,3,1))

The input is three-dimensional data, the given data input is three-dimensional, why there are four-dimensional requirements? How to modify it?

This is the model I created

xianglala
  • 41
  • 2

1 Answers1

0

Not sure what type of network your using, but input_shape does not include length of data. it should just be this

acc_input_tensor = Input(shape=(3,1),name = 'acc_input')
gyro_input_tensor = Input(shape=(3,1),name= 'gyro_input')
DJK
  • 8,924
  • 4
  • 24
  • 40
  • Thank you for your answer!I use the acceleration data in one cycle as input(200*3),acc_input_tensor = Input(shape=(200,3),name = 'acc_input') gyro_input_tensor = Input(shape=(200,3),name= 'gyro_input') This is still a mistake to modify – xianglala Aug 19 '17 at 07:20
  • I'm talking (200 * 3) reshape into (20 * 30*1) into the convolution layer,Convolution layers require three-dimensional data – xianglala Aug 19 '17 at 07:22
  • The input shape to convolution depends on they type of convolution layer your using, but in any event `shape=()` doesn't not take the size of the first dimension, only the second,third,fourth... and so on. – DJK Aug 19 '17 at 21:56