Home > other >  SpatialPyramidPooling application problems
SpatialPyramidPooling application problems

Time:01-07

The code is as follows:
The model=tf. Keras. Sequential ()
Model. The add (tf) keras. The layers. Conv2D (filters=32, kernel_size=(3, 3), input_shape=(None, None, 1), the activation='relu'))
Model. The add (tf) keras. The layers. Conv2D (filters=32, kernel_size=(3, 3), the activation='relu'))
Model. The add (tf) keras. The layers. MaxPool2D (pool_size=(2, 2)))
Model. The add (tf) keras. The layers. Conv2D (filters=64, kernel_size=(3, 3), the activation='relu'))
Model. The add (tf) keras. The layers. Conv2D (filters=32, kernel_size=(3, 3), the activation='relu'))
Model. The add (SpatialPyramidPooling ([1, 2, 4]))
# model. The add (tf) keras. The layers. Flatten ())
Model. The add (tf) keras. The layers. Dense (10, activation='softmax'))

Model.com from running (optimizer='Adam', loss='categorical_crossentropy', the metrics=[' accuracy '])

Error message:
Raise ValueError (' The last dimension of The inputs to ` Dense ` '
ValueError: The last dimension of The inputs to ` Dense ` should be defined. The Found ` None `.


That is to say, in the model. The add (tf. Keras. The layers. The Dense (10, activation='softmax')) code, say there is no defined shape, can you tell me how to deal with?
  • Related