I’m currently a student playing around with basic Deep Learning and tensorflow for a project.
I’ve installed and am running tensorflow on my RTX 3070, and use jupyter notebooks on anaconda for my code.
I’m currently playing around with an American Sign Language dataset, (one made up of 28×28 grayscale images of various letters in asl)
I’ve gotten simple models like:
from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense model = Sequential() model.add(Dense(units=512, activation='relu', input_shape=(784,))) model.add(Dense(units=512, activation='relu')) model.add(Dense(units=num_classes, activation='softmax'))
working to great effect on my GPU, but if I try a convolutional neural network on the same dataset, like this:
from tensorflow.keras.models import Sequential from tensorflow.keras.layers import ( Dense, Conv2D, MaxPool2D, Flatten, Dropout, BatchNormalization, ) model = Sequential() model.add(Conv2D(75, (3, 3), strides=1, padding="same", activation="relu", input_shape=(28, 28, 1))) model.add(BatchNormalization()) model.add(MaxPool2D((2, 2), strides=2, padding="same")) model.add(Conv2D(50, (3, 3), strides=1, padding="same", activation="relu")) model.add(Dropout(0.2)) model.add(BatchNormalization()) model.add(MaxPool2D((2, 2), strides=2, padding="same")) model.add(Conv2D(25, (3, 3), strides=1, padding="same", activation="relu")) model.add(BatchNormalization()) model.add(MaxPool2D((2, 2), strides=2, padding="same")) model.add(Flatten()) model.add(Dense(units=512, activation="relu")) model.add(Dropout(0.3)) model.add(Dense(units=num_classes, activation="softmax"))
and then I compile using:
model.compile(loss="categorical_crossentropy", metrics=["accuracy"])
and train using:
model.fit(x_train, y_train, epochs=20, verbose=1, validation_data=(x_valid, y_valid))
But if I run the above code, all I get is:
Epoch 1/20
as my output, and while when I define the model, I see that the majority of my GPU memory is being used (specifically 7.6/8GB), when i try training it, all of the memory just instantly disappears, as if there never was a model.
can anyone tell me what is wrong here?
submitted by /u/the_mashrur
[visit reddit] [comments]