TransWikia.com

How long does it typically take to train a MNIST data on a Mac Pro?

Data Science Asked by user697911 on November 27, 2020

My code is below:

# define a simple CNN model
def baseline_model():
    # create model
    model = Sequential()
    model.add(Conv2D(30, (5, 5), input_shape=(1, 28, 28), activation='relu'))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Conv2D(15, (3, 3), activation='relu'))
    model.add(MaxPooling2D(pool_size=(2, 2)))
    model.add(Dropout(0.2))
    model.add(Flatten())
    model.add(Dense(128, activation='relu'))
    model.add(Dense(50, activation='relu'))
    model.add(Dense(num_classes, activation='softmax'))
    # Compile model
    model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
    return model


# build the model
model = baseline_model()
# Fit the model
model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=500, batch_size=200)
# Final evaluation of the model
scores = model.evaluate(X_test, y_test, verbose=0)

My Mac’s capacity:

Grphics Radeon Pro 555 2048 MB
Intel HD Graphics 630 1536 MB

Memeory 16 GB 2133 MHz LPDDR3

Processor 2.8 GHz Intel Core i7

It is taking several hours to train this the MNIST image classification dataset on my computer. Is this normal?

One Answer

Did you try to do a model summary and check the size of your model. Yes, i may take hours as you are adding lot of layers. Try starting with 10 or 20 epochs and check the accuracy of your model gradually. May reduce your training time.

When you do the above exercise its better to have a validation data set, rather than fitting the model on the training data set time and again.

Answered by Sunil on November 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP