Open ppurwar opened 4 years ago
I tried the given example with tf 1.14.
` from tensorflow.keras.models import Sequential from keras_spp.spp.SpatialPyramidPooling import SpatialPyramidPooling from keras.layers import Convolution2D, Activation, MaxPooling2D, Dense
model = Sequential()
model.add(Convolution2D(32, 3, 3, border_mode='same', input_shape=(3, None, None))) model.add(Activation('relu')) model.add(Convolution2D(32, 3, 3)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Convolution2D(64, 3, 3, border_mode='same')) model.add(Activation('relu')) model.add(Convolution2D(64, 3, 3)) model.add(Activation('relu')) model.add(SpatialPyramidPooling([1, 2, 4])) model.add(Dense(num_classes)) model.add(Activation('softmax'))`
Error received:
`--------------------------------------------------------------------------- TypeError Traceback (most recent call last)
Hey @ppurwar, not sure if this is still relevant to you, but I've posted my implementation/modifications which make the SPP compatible with tf.keras.
See #26
I tried the given example with tf 1.14.
` from tensorflow.keras.models import Sequential from keras_spp.spp.SpatialPyramidPooling import SpatialPyramidPooling from keras.layers import Convolution2D, Activation, MaxPooling2D, Dense
model = Sequential()
model.add(Convolution2D(32, 3, 3, border_mode='same', input_shape=(3, None, None))) model.add(Activation('relu')) model.add(Convolution2D(32, 3, 3)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Convolution2D(64, 3, 3, border_mode='same')) model.add(Activation('relu')) model.add(Convolution2D(64, 3, 3)) model.add(Activation('relu')) model.add(SpatialPyramidPooling([1, 2, 4])) model.add(Dense(num_classes)) model.add(Activation('softmax'))`
Error received:
`--------------------------------------------------------------------------- TypeError Traceback (most recent call last)