I'm new to Deep Learning and stackoverflow.
I'm trying to make simple encoder-decoder for my image which is quite big(192*288). Here's my try:
input_img = Input(shape=(55296,))
encoded = Dense(units=13824, activation='relu')(input_img)
decoded = Dense(units=55296, activation='relu')(encoded)
But don't know why I'm always getting this error:
ResourceExhaustedError: OOM when allocating tensor with shape[55296,13824] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc [Op:Add]
I know that it's because of my tensor size is bigger for my GPU. But it won't work for such simple architecture? I'm using google colab for this and when I change to TPU from GPU it's working but later when I try to fit the model, it'll run out of memory there as well. Please help me with this.
Edit:
I tried to use CNN and here's the architecture:
input_img = Input(shape=(192, 288, 1))
encode1 = Conv2D(64, (3, 3), activation='relu', padding='same')(input_img)
encode2 = MaxPooling2D((2, 2), padding='same')(encode1)
encode3 = Conv2D(32, (3, 3), activation='relu', padding='same')(encode2)
encode4 = MaxPooling2D((2, 2), padding='same')(encode3)
encode5 = Conv2D(64, (3, 3), activation='relu', padding='same')(encode4)
l = Flatten()(encode5)
l = Dense(3456, activation='relu')(l)
l = Dense(100, activation='relu')(l)
#DECODER
d = Dense(3456, activation='relu')(l)
d = Reshape((48,72,1))(d)
decode1 = Conv2D(32, (3, 3), activation='relu', padding='same')(d)
decode2 = UpSampling2D((2, 2))(decode1)
decode3 = Conv2D(32, (3, 3), activation='relu', padding='same')(decode2)
decode4 = UpSampling2D((2, 2))(decode3)
decode5 = Conv2D(64, (3, 3), activation='relu', padding='same')(decode4)
model = models.Model(input_img, decode5)
But This thing is also running out of memory while training. Can someone guide how can I make better architecture with less weights or I need a better system?