yhenon / keras-spp

Spatial pyramid pooling layers for keras
MIT License
394 stars 143 forks source link

Not working dim_ordering, if you image_data_format(), SPP layer shape become <None, None> #27

Open ffalam opened 3 years ago

ffalam commented 3 years ago

Hi, This code is not working for dim_ordering. I changed it to image_data_format() , now its working but the problem is that after adding spp layer, the output dimension becomes < None, None> . So can not add a dense layer after that.

The error is:

ValueError: The last dimension of the inputs to Dense should be defined. Found None.

Any idea how to solve this problem ?

urnotcoward commented 2 years ago

Have you solved this problem? I also encountered the same problem!!!

chengpei-wu commented 2 years ago

Have you solved this problem? I also encountered the same problem!!!

I meet the same problem, have you solved it?

chengpei-wu commented 2 years ago

Have you solved this problem? I also encountered the same problem!!!

I meet the same problem, have you solved it? I replace the code outputs = K.concatanate(outputs) by outputs = K.reshape(outputs, self.num_outputs_per_channel * self.nb_channels) (it was annotated) in the last code lines before return. it works, but I don't know whether it is right for SPP layer

abdurrashid402 commented 1 year ago

Hi Please I also meet the same problem . Need Help

`ValueError                                Traceback (most recent call last)
[<ipython-input-14-a398c7a76a74>](https://localhost:8080/#) in <cell line: 3>()
      1 # uses theano ordering. Note that we leave the image size as None to allow multiple image sizes
      2 model = Sequential()
----> 3 model.add(Convolution2D(32, 3, 3, input_shape=(1, None, None)))
      4 model.add(Activation('relu'))
      5 model.add(Convolution2D(32, 3, 3))

2 frames
[/usr/local/lib/python3.10/dist-packages/keras/layers/convolutional/base_conv.py](https://localhost:8080/#) in _get_input_channel(self, input_shape)
    414         channel_axis = self._get_channel_axis()
    415         if input_shape.dims[channel_axis].value is None:
--> 416             raise ValueError(
    417                 "The channel dimension of the inputs should be defined. "
    418                 f"The input_shape received is {input_shape}, "

ValueError: The channel dimension of the inputs should be defined. The input_shape received is (None, 1, None, None), where axis -1 (0-based) is the channel dimension, which found to be `None`.`