Keras: Deep Learning for humans About Keras Getting started Developer guides Code examples Keras 3 API documentation Keras 2 API documentation KerasHub: Pretrained Models Keras RS KerasTuner: Hyperparam Tuning GET STARTED GUIDES API EXAMPLES KERAS HUB KERAS RS KERAS TUNER KERAS 3.0 RELEASED A superpower for ML developers Keras is a deep learning API designed for human beings, not machines. Keras focuses on debugging speed, code elegance & conciseness, maintainability, and deployability. When you choose Keras, your codebase is smaller, more readable, easier to iterate on. API DOCS GUIDES EXAMPLES Copied inputs = keras.Input(shape=(32, 32, 3)) x = layers.Conv2D(32, 3, activation="relu")(inputs) x = layers.Conv2D(64, 3, activation="relu")(x) residual = x = layers.MaxPooling2D(3)(x) x = layers.Conv2D(64, 3, padding="same")(x) x = layers.Activation("relu")(x) x = layers.Conv2D(64, 3, padding="same")(x) x = layers.Activation("relu")(x) x = x + residual x = layers.Conv2D(64, 3, activation="relu")(x) x = layers.GlobalAveragePooling2D()(x) outputs = layers.Dense(10, activation="softmax")(x) model = keras.Model(inputs, outputs, name="mini_resnet") keras.utils.plot_model(model, "mini_resnet.png") model.fit(dataset, epochs=10) Run quickstart Copied causal_lm = keras_hub.models.CausalLM.from_preset( "gemma2_instruct_2b_en", dtype="float16", ) prompt = """<start_of_turn>user Write python code to print the first 100 primes. <end_of_turn> <start_of_turn>model """ text_output = causal_lm.generate(prompt, max_length=512) text_to_image = keras_hub.models.TextToImage.from_preset( "stable_diffusion_3_medium", dtype="float16", ) prompt = "Astronaut in a jungle, detailed" image_output = text_to_image.generate(prompt) Run quickstart Welcome to multi-framework machine learning With its multi-backend approach, Keras gives you the freedom to work with JAX, TensorFlow, and PyTorch. Build models that can move seamlessly across these frameworks and leverage the strengths of each ecosystem. GET STARTED Developer Guides VIEW ALL Copied inputs = keras.Input(shape=(28, 28, 1)) x = inputs x = layers.Conv2D(16, 3, activation="relu")(x) x = layers.Conv2D(32, 3, activation="relu")(x) x = layers.MaxPooling2D(3)(x) x = layers.Conv2D(32, 3, activation="relu")(x) x = layers.Conv2D(16, 3, activation="relu")(x) x = layers.GlobalMaxPooling2D()(x) x = layers.Dropout(0.5) outputs = layers.Dense(10) model = keras.Model(inputs, outputs) model.summary() The Functional API Starting from the beginning and learn how to build models using the functional building pattern. VIEW GUIDE Copied model.compile( optimizer="rmsprop", loss="categorical_crossentropy", metrics=["accuracy"], ) history = model.fit( x_train, y_train, batch_size=64, epochs=2, validation_data=(x_val, y_val), ) Training & evaluation with the built-in methods Train and evaluate your model using model.fit(...). VIEW GUIDE Copied class MLPBlock(keras.layers.Layer): def __init__(self): super().__init__() self.dense_1 = layers.Dense(32) self.dense_2 = layers.Dense(32) self.dense_3 = layers.Dense(1) def call(self, inputs): x = self.dense_1(inputs) x = keras.activations.relu(x) x = self.dense_2(x) x = keras.activations.relu(x) return self.dense_3(x) Making new layers and models via subclassing Learn how to customize your model via subclassing Keras layers. VIEW GUIDE VIEW ALL KerasHub The KerasHub library provides Keras 3 implementations of popular model architectures, paired with a collection of pretrained checkpoints available on Kaggle Models. Models can be used for both training and inference, on any of the TensorFlow, JAX, and PyTorch backends. SEE ALL GEMMA Google’s family of lightweight language models built from the same research and technology used to create Gemini. VIEW DOCUMENTATION KAGGLE DETAILS LLAMA Meta’s flagship open text generation models available in a wide range of sizes and precisions. VIEW DOCUMENTATION KAGGLE DETAILS STABLE DIFFUSION Generate image content with this state of the art diffusion model from Stability AI. VIEW DOCUMENTATION KAGGLE DETAILS MISTRAL A generative language from the French company Mistral AI, making frontier models accessible to all. VIEW DOCUMENTATION KAGGLE DETAILS SEE ALL Code examples VIEW ALL Computer vision Take a look at our examples for doing image classification, object detection, video processing, and more. SEE EXAMPLE Natural Language Processing We also have many guides for doing NLP including text classification, machine translation, and language modeling. SEE EXAMPLE Generative Deep Learning Get started with generative deep learning with our wealth of guides involving state-of-the-art diffusion models, GANs, and transformer models. SEE EXAMPLE VIEW ALL Trusted for research and production Keras is used by CERN, NASA, NIH, and many more scientific organizations around the world (and yes, Keras is used at the Large Hadron Collider). Keras is used by Waymo to power self-driving vehicles. Keras partners with Kaggle and HuggingFace to meet ML developers in the tools they use daily. Stay in touch Sign up to our mailing list for regular updates and discussions about the Keras ecosystem. Listen in at our community meetings, and follow us on social media! JOIN GOOGLE GROUP JOIN COMMUNITY MEETING DISCORD GOOGLE AI FORUM Contributions welcome! We welcome your code, ideas, and feedback as we continue to grow. Visit our roadmap, contribution guide or GitHub for more information. VIEW ROADMAP CONTRIBUTION GUIDE GITHUB Terms | Privacy