I got this error message:
Invalid argument: Shape [4194304,1048576] is too large (more than 1099511627776 entries)
note that:
4194304 = 2048 * 2048
1048576 = 1024 * 1024
How did keras compute this shape? why is it too large?
The shape [4194304, 1048576]
is computed as follows:
Applying 16 convolutions of size [3, 3]
with the same
border mode to the inputs of size [1024, 1024, 3]
gives us output of size [1024, 1024, 16]
. After max pooling of size 2 it becomes [512, 512, 16]
which when flattened is 512 * 512 * 16 = 4194304
. 1048576
comes from 1024 * 1024
as you specified in the Dense
layer constructor.
I think you should reconsider the architecture of you model. You can use inputs of smaller size, add several pooling layers, reduce dimensionality applying 1 x 1
convolutions. And I doubt that 1024 * 1024
is a reasonable number of nodes in a fully connected layer.