0

I am currently trying to train a convolutional neural network with Tensorflow and Keras. I am new to convolutional neural networks The definition and compilation of the neural network is as follows:


def build_and_compile_model():
    model = models.Sequential()
    model.add(layers.Conv2D(1100, (3, 3), activation='relu', input_shape=(1100, 300, 1)))
    model.add(layers.MaxPooling2D((2, 2)))
    model.add(layers.Conv2D(550, (3, 3), activation='relu'))
    model.add(layers.Flatten())
    model.add(layers.Dense(100, activation='relu'))
    model.add(layers.Dense(1))
    model.summary()
    model.compile(loss='mean_absolute_error', optimizer=tf.keras.optimizers.Adam(0.001), metrics=[tf.keras.metrics.RootMeanSquaredError()])
    return model
model = build_and_compile_model()

I am aware the input size is quite large... The problem is that my computer freezes when running the above code, even before training, and I am not quite sure why. Searching for similar problems, I have unsuccessfully tried the following:

For all of them, their computer freezes during training but not compiling the model, so I thought about asking as there must be something fundamentally wrong with the model.

My PC is an ASUS X555LJ, i7, 12 Gb RAM. Version of tensorflow is 2.3.0.

Thanks in advance.

OMS
  • 57
  • 1
  • 9
  • Have you checked your RAM usage as it runs? It looks like you don't have a dedicated GPU so might try to allocate a lot of memory first? (just a guess) – chsws May 25 '21 at 14:45
  • Try commenting out lines and adding them back one at a time to see if you can isolate the problem to a particular line of code. – evergreen May 25 '21 at 15:22
  • Look at the model summary, in particular the number of parameters, it is just too large for your computer. – Dr. Snoopy May 25 '21 at 21:49

0 Answers0