Guest User

Untitled

a guest
Jun 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. model.fit(mono_X, mono_Y, epochs=10, batch_size=None, verbose=2)
  2.  
  3. ValueError when checking input: expected input_47 to have 4 dimensions, but got array with shape (32760, 1)
  4.  
  5. spectra = Input(shape=(72, 40, 1))
  6.  
  7. # conv1a
  8. c1a = Conv2D(48, (3,5), activation='relu', padding = 'same')(spectra)
  9. c1a = BatchNormalization()(c1a)
  10. c1a = MaxPooling2D(pool_size=(5, 5), strides = 1)(c1a)
  11. # conv1b
  12. c1b = Conv2D(32, (3,9), activation='relu', padding = 'same')(spectra)
  13. c1b = BatchNormalization()(c1b)
  14. c1b = MaxPooling2D(pool_size=(5, 5), strides = 1)(c1b)
  15. # conv1c
  16. c1c = Conv2D(16, (3,15), activation='relu', padding = 'same')(spectra)
  17. c1c = BatchNormalization()(c1c)
  18. c1c = MaxPooling2D(pool_size=(5, 5), strides = 1)(c1c)
  19. # conv1d
  20. c1d = Conv2D(16, (3,21), activation='relu', padding = 'same')(spectra)
  21. c1d = BatchNormalization()(c1d)
  22. c1d = MaxPooling2D(pool_size=(5, 5), strides = 1)(c1d)
  23.  
  24. # stack the layers
  25. merged = keras.layers.concatenate([c1a, c1b, c1c, c1d], axis=3)
  26.  
  27. # conv2
  28. c2 = Conv2D(224, (5,5), activation='relu')(merged)
  29. c2 = BatchNormalization()(c2)
  30. c2 = MaxPooling2D(pool_size=(5, 5), strides = 1)(c2)
  31.  
  32. # output softmax
  33. out = Dense(15, activation='softmax')(c2)
  34.  
  35. # create Model
  36. model = Model(spectra, out)
  37.  
  38. # apply optimization and loss function
  39. adam = Adam(lr=0.002, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0, amsgrad=False)
  40. model.compile(optimizer=adam,
  41. loss='categorical_crossentropy',
  42. metrics=['accuracy'])
  43.  
  44. ValueError: Input 0 is incompatible with layer conv2d_203: expected ndim=4, found ndim=3
Add Comment
Please, Sign In to add comment