Welcome to the Keras Quick Start page! Whether you're new to deep learning or just want to get started quickly, Keras provides an intuitive API for building and training neural networks. Here's a concise overview to help you begin:
📦 Installation
To use Keras, ensure you have TensorFlow installed (Keras is integrated with TensorFlow):
pip install tensorflow
📌 Tip: For GPU acceleration, install the tensorflow-gpu
version instead.
🧠 Basic Workflow
- Import Keras
import tensorflow as tf from tensorflow.keras import layers, models
- Build a Model
model = models.Sequential([ layers.Dense(64, activation='relu', input_shape=(784,)), layers.Dense(10, activation='softmax') ])
- Compile the Model
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
- Train & Evaluate
model.fit(x_train, y_train, epochs=5) model.evaluate(x_test, y_test)
📈 Example: MNIST Classification
Here's a simple example using the MNIST dataset:
from tensorflow.keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train = x_train.reshape(-1, 784).astype('float32') / 255
x_test = x_test.reshape(-1, 784).astype('float32') / 255
model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)
🌐 Expand Your Knowledge
For more advanced tutorials, check out our TensorFlow Quick Start guide. You can also explore Keras documentation for detailed API references.