Code examples
Code examples
- Original Link : https://keras.io/examples/
- Last Checked at : 2024-11-26
Our code examples are short (less than 300 lines of code), focused demonstrations of vertical deep learning workflows.
All of our examples are written as Jupyter notebooks and can be run in one click in Google Colab, a hosted notebook environment that requires no setup and runs in the cloud. Google Colab includes GPU and TPU runtimes.
Computer Vision
Image classification
Image segmentation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Image segmentation with a U-Net-like architecture | 2019/03/20 | 2020/04/20 |
V3 | Multiclass semantic segmentation using DeepLabV3+ | 2021/08/31 | 2024/01/05 | |
V2 | Highly accurate boundaries segmentation using BASNet | 2023/05/30 | 2023/07/13 | |
V3 | Image Segmentation using Composable Fully-Convolutional Networks | 2023/06/16 | 2023/12/25 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Multiclass semantic segmentation using DeepLabV3+ | 2021/08/31 | 2024/01/05 | |
V3 | Image Segmentation using Composable Fully-Convolutional Networks | 2023/06/16 | 2023/12/25 | |
V2 | Highly accurate boundaries segmentation using BASNet | 2023/05/30 | 2023/07/13 | |
★ | V3 | Image segmentation with a U-Net-like architecture | 2019/03/20 | 2020/04/20 |
Object detection
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Object Detection with RetinaNet | 2020/05/17 | 2023/07/10 | |
V3 | Keypoint Detection with Transfer Learning | 2021/05/02 | 2023/07/19 | |
V3 | Object detection with Vision Transformers | 2022/03/27 | 2023/11/20 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Object detection with Vision Transformers | 2022/03/27 | 2023/11/20 | |
V3 | Keypoint Detection with Transfer Learning | 2021/05/02 | 2023/07/19 | |
V2 | Object Detection with RetinaNet | 2020/05/17 | 2023/07/10 |
3D
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | 3D image classification from CT scans | 2020/09/23 | 2024/01/11 | |
V3 | Monocular depth estimation | 2021/08/30 | 2024/08/13 | |
★ | V3 | 3D volumetric rendering with NeRF | 2021/08/09 | 2023/11/13 |
V3 | Point cloud segmentation with PointNet | 2020/10/23 | 2020/10/24 | |
V3 | Point cloud classification with PointNet | 2020/05/25 | 2024/01/09 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Monocular depth estimation | 2021/08/30 | 2024/08/13 | |
V3 | 3D image classification from CT scans | 2020/09/23 | 2024/01/11 | |
V3 | Point cloud classification with PointNet | 2020/05/25 | 2024/01/09 | |
★ | V3 | 3D volumetric rendering with NeRF | 2021/08/09 | 2023/11/13 |
V3 | Point cloud segmentation with PointNet | 2020/10/23 | 2020/10/24 |
OCR
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | OCR model for reading Captchas | 2020/06/14 | 2024/03/13 | |
V3 | Handwriting recognition | 2021/08/16 | 2024/09/01 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Handwriting recognition | 2021/08/16 | 2024/09/01 | |
V3 | OCR model for reading Captchas | 2020/06/14 | 2024/03/13 |
Image enhancement
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Convolutional autoencoder for image denoising | 2021/03/01 | 2021/03/01 | |
V3 | Low-light image enhancement using MIRNet | 2021/09/11 | 2023/07/15 | |
V3 | Image Super-Resolution using an Efficient Sub-Pixel CNN | 2020/07/28 | 2020/08/27 | |
V3 | Enhanced Deep Residual Networks for single-image super-resolution | 2022/04/07 | 2024/08/27 | |
V3 | Zero-DCE for low-light image enhancement | 2021/09/18 | 2023/07/15 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Enhanced Deep Residual Networks for single-image super-resolution | 2022/04/07 | 2024/08/27 | |
V3 | Low-light image enhancement using MIRNet | 2021/09/11 | 2023/07/15 | |
V3 | Zero-DCE for low-light image enhancement | 2021/09/18 | 2023/07/15 | |
V3 | Convolutional autoencoder for image denoising | 2021/03/01 | 2021/03/01 | |
V3 | Image Super-Resolution using an Efficient Sub-Pixel CNN | 2020/07/28 | 2020/08/27 |
Data augmentation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | CutMix data augmentation for image classification | 2021/06/08 | 2023/11/14 | |
V3 | MixUp augmentation for image classification | 2021/03/06 | 2023/07/24 | |
V3 | RandAugment for Image Classification for Improved Robustness | 2021/03/13 | 2023/12/12 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | RandAugment for Image Classification for Improved Robustness | 2021/03/13 | 2023/12/12 | |
V3 | CutMix data augmentation for image classification | 2021/06/08 | 2023/11/14 | |
V3 | MixUp augmentation for image classification | 2021/03/06 | 2023/07/24 |
Image & Text
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Image Captioning | 2021/05/29 | 2021/10/31 |
V2 | Natural language image search with a Dual Encoder | 2021/01/30 | 2021/01/30 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
★ | V3 | Image Captioning | 2021/05/29 | 2021/10/31 |
V2 | Natural language image search with a Dual Encoder | 2021/01/30 | 2021/01/30 |
Vision models interpretability
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Visualizing what convnets learn | 2020/05/29 | 2020/05/29 | |
V3 | Model interpretability with Integrated Gradients | 2020/06/02 | 2020/06/02 | |
V3 | Investigating Vision Transformer representations | 2022/04/12 | 2023/11/20 | |
V3 | Grad-CAM class activation visualization | 2020/04/26 | 2021/03/07 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Investigating Vision Transformer representations | 2022/04/12 | 2023/11/20 | |
V3 | Grad-CAM class activation visualization | 2020/04/26 | 2021/03/07 | |
V3 | Model interpretability with Integrated Gradients | 2020/06/02 | 2020/06/02 | |
V3 | Visualizing what convnets learn | 2020/05/29 | 2020/05/29 |
Image similarity search
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Near-duplicate image search | 2021/09/10 | 2023/08/30 | |
V3 | Semantic Image Clustering | 2021/02/28 | 2021/02/28 | |
V3 | Image similarity estimation using a Siamese Network with a contrastive loss | 2021/05/06 | 2022/09/10 | |
V3 | Image similarity estimation using a Siamese Network with a triplet loss | 2021/03/25 | 2021/03/25 | |
V3 | Metric learning for image similarity search | 2020/06/05 | 2020/06/09 | |
V2 | Metric learning for image similarity search using TensorFlow Similarity | 2021/09/30 | 2022/02/29 | |
V3 | Self-supervised contrastive learning with NNCLR | 2021/09/13 | 2024/01/22 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Self-supervised contrastive learning with NNCLR | 2021/09/13 | 2024/01/22 | |
V2 | Near-duplicate image search | 2021/09/10 | 2023/08/30 | |
V3 | Image similarity estimation using a Siamese Network with a contrastive loss | 2021/05/06 | 2022/09/10 | |
V2 | Metric learning for image similarity search using TensorFlow Similarity | 2021/09/30 | 2022/02/29 | |
V3 | Image similarity estimation using a Siamese Network with a triplet loss | 2021/03/25 | 2021/03/25 | |
V3 | Semantic Image Clustering | 2021/02/28 | 2021/02/28 | |
V3 | Metric learning for image similarity search | 2020/06/05 | 2020/06/09 |
Video
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Video Classification with a CNN-RNN Architecture | 2021/05/28 | 2023/12/08 | |
V3 | Next-Frame Video Prediction with Convolutional LSTMs | 2021/06/02 | 2023/11/10 | |
V3 | Video Classification with Transformers | 2021/08/06 | 2023/07/22 | |
V3 | Video Vision Transformer | 2022/01/12 | 2024/01/15 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Video Vision Transformer | 2022/01/12 | 2024/01/15 | |
V3 | Video Classification with a CNN-RNN Architecture | 2021/05/28 | 2023/12/08 | |
V3 | Next-Frame Video Prediction with Convolutional LSTMs | 2021/06/02 | 2023/11/10 | |
V3 | Video Classification with Transformers | 2021/08/06 | 2023/07/22 |
Performance recipes
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Gradient Centralization for Better Training Performance | 2021/06/18 | 2023/07/25 | |
V3 | Learning to tokenize in Vision Transformers | 2021/12/10 | 2023/08/14 | |
V3 | Knowledge Distillation | 2020/09/01 | 2020/09/01 | |
V3 | FixRes: Fixing train-test resolution discrepancy | 2021/10/08 | 2021/10/10 | |
V3 | Class Attention Image Transformers with LayerScale | 2022/09/19 | 2022/11/21 | |
V3 | Augmenting convnets with aggregated attention | 2022/01/22 | 2022/01/22 | |
V3 | Learning to Resize in Computer Vision | 2021/04/30 | 2023/12/18 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Learning to Resize in Computer Vision | 2021/04/30 | 2023/12/18 | |
V3 | Learning to tokenize in Vision Transformers | 2021/12/10 | 2023/08/14 | |
V3 | Gradient Centralization for Better Training Performance | 2021/06/18 | 2023/07/25 | |
V3 | Class Attention Image Transformers with LayerScale | 2022/09/19 | 2022/11/21 | |
V3 | Augmenting convnets with aggregated attention | 2022/01/22 | 2022/01/22 | |
V3 | FixRes: Fixing train-test resolution discrepancy | 2021/10/08 | 2021/10/10 | |
V3 | Knowledge Distillation | 2020/09/01 | 2020/09/01 |
Other
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Semi-supervision and domain adaptation with AdaMatch | 2021/06/19 | 2021/06/19 | |
V2 | Barlow Twins for Contrastive SSL | 2021/11/04 | 2021/12/20 | |
V2 | Consistency training with supervision | 2021/04/13 | 2021/04/19 | |
V2 | Distilling Vision Transformers | 2022/04/05 | 2022/04/08 | |
V2 | Focal Modulation: A replacement for Self-Attention | 2023/01/25 | 2023/02/15 | |
V2 | Using the Forward-Forward Algorithm for Image Classification | 2023/01/08 | 2024/09/17 | |
V2 | Masked image modeling with Autoencoders | 2021/12/20 | 2021/12/21 | |
V2 | Segment Anything Model with 🤗Transformers | 2023/07/11 | 2023/07/11 | |
V2 | Semantic segmentation with SegFormer and Hugging Face Transformers | 2023/01/25 | 2023/01/29 | |
V2 | Self-supervised contrastive learning with SimSiam | 2021/03/19 | 2023/12/29 | |
V2 | Supervised Contrastive Learning | 2020/11/30 | 2020/11/30 | |
V2 | When Recurrence meets Transformers | 2023/03/12 | 2024/11/12 | |
V2 | Efficient Object Detection with YOLOV8 and KerasCV | 2023/06/26 | 2023/06/26 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | When Recurrence meets Transformers | 2023/03/12 | 2024/11/12 | |
V2 | Using the Forward-Forward Algorithm for Image Classification | 2023/01/08 | 2024/09/17 | |
V2 | Self-supervised contrastive learning with SimSiam | 2021/03/19 | 2023/12/29 | |
V2 | Segment Anything Model with 🤗Transformers | 2023/07/11 | 2023/07/11 | |
V2 | Efficient Object Detection with YOLOV8 and KerasCV | 2023/06/26 | 2023/06/26 | |
V2 | Focal Modulation: A replacement for Self-Attention | 2023/01/25 | 2023/02/15 | |
V2 | Semantic segmentation with SegFormer and Hugging Face Transformers | 2023/01/25 | 2023/01/29 | |
V2 | Distilling Vision Transformers | 2022/04/05 | 2022/04/08 | |
V2 | Masked image modeling with Autoencoders | 2021/12/20 | 2021/12/21 | |
V2 | Barlow Twins for Contrastive SSL | 2021/11/04 | 2021/12/20 | |
V2 | Semi-supervision and domain adaptation with AdaMatch | 2021/06/19 | 2021/06/19 | |
V2 | Consistency training with supervision | 2021/04/13 | 2021/04/19 | |
V2 | Supervised Contrastive Learning | 2020/11/30 | 2020/11/30 |
Natural Language Processing
Text classification
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Text classification from scratch | 2019/11/06 | 2020/05/17 |
V3 | Review Classification using Active Learning | 2021/10/29 | 2024/05/08 | |
V3 | Text Classification using FNet (KerasHub) | 2022/06/01 | 2022/12/21 | |
V2 | Large-scale multi-label text classification | 2020/09/25 | 2020/12/23 | |
V3 | Text classification with Transformer | 2020/05/10 | 2024/01/18 | |
V3 | Text classification with Switch Transformer | 2020/05/10 | 2021/02/15 | |
V2 | Text classification using Decision Forests and pretrained embeddings | 2022/09/05 | 2022/09/05 | |
V3 | Using pre-trained word embeddings | 2020/05/05 | 2020/05/05 | |
V3 | Bidirectional LSTM on IMDB | 2020/05/03 | 2020/05/03 | |
V3 | Data Parallel Training with KerasHub and tf.distribute | 2023/07/07 | 2023/07/07 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Review Classification using Active Learning | 2021/10/29 | 2024/05/08 | |
V3 | Text classification with Transformer | 2020/05/10 | 2024/01/18 | |
V3 | Data Parallel Training with KerasHub and tf.distribute | 2023/07/07 | 2023/07/07 | |
V3 | Text Classification using FNet (KerasHub) | 2022/06/01 | 2022/12/21 | |
V2 | Text classification using Decision Forests and pretrained embeddings | 2022/09/05 | 2022/09/05 | |
V3 | Text classification with Switch Transformer | 2020/05/10 | 2021/02/15 | |
V2 | Large-scale multi-label text classification | 2020/09/25 | 2020/12/23 | |
★ | V3 | Text classification from scratch | 2019/11/06 | 2020/05/17 |
V3 | Using pre-trained word embeddings | 2020/05/05 | 2020/05/05 | |
V3 | Bidirectional LSTM on IMDB | 2020/05/03 | 2020/05/03 |
Machine translation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | English-to-Spanish translation with KerasHub | 2022/05/26 | 2024/04/30 | |
★ | V3 | English-to-Spanish translation with a sequence-to-sequence Transformer | 2021/05/26 | 2023/02/25 |
V3 | Character-level recurrent sequence-to-sequence model | 2017/09/29 | 2023/11/22 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | English-to-Spanish translation with KerasHub | 2022/05/26 | 2024/04/30 | |
V3 | Character-level recurrent sequence-to-sequence model | 2017/09/29 | 2023/11/22 | |
★ | V3 | English-to-Spanish translation with a sequence-to-sequence Transformer | 2021/05/26 | 2023/02/25 |
Entailment prediction
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Multimodal entailment | 2021/08/08 | 2021/08/15 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Multimodal entailment | 2021/08/08 | 2021/08/15 |
Named entity recognition
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Named Entity Recognition using Transformers | 2021/06/23 | 2024/04/05 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Named Entity Recognition using Transformers | 2021/06/23 | 2024/04/05 |
Sequence-to-sequence
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Text Extraction with BERT | 2020/05/23 | 2020/05/23 | |
V3 | Sequence to sequence learning for performing number addition | 2015/08/17 | 2024/02/13 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Sequence to sequence learning for performing number addition | 2015/08/17 | 2024/02/13 | |
V2 | Text Extraction with BERT | 2020/05/23 | 2020/05/23 |
Text similarity search
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Semantic Similarity with KerasHub | 2023/02/25 | 2023/02/25 | |
V3 | Semantic Similarity with BERT | 2020/08/15 | 2020/08/29 | |
V3 | Sentence embeddings using Siamese RoBERTa-networks | 2023/07/14 | 2023/07/14 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Sentence embeddings using Siamese RoBERTa-networks | 2023/07/14 | 2023/07/14 | |
V3 | Semantic Similarity with KerasHub | 2023/02/25 | 2023/02/25 | |
V3 | Semantic Similarity with BERT | 2020/08/15 | 2020/08/29 |
Language modeling
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | End-to-end Masked Language Modeling with BERT | 2020/09/18 | 2024/03/15 | |
V3 | Abstractive Text Summarization with BART | 2023/07/08 | 2024/03/20 | |
V2 | Pretraining BERT with Hugging Face Transformers | 2022/07/01 | 2022/08/27 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | End-to-end Masked Language Modeling with BERT | 2020/09/18 | 2024/03/15 | |
V3 | Abstractive Text Summarization with BART | 2023/07/08 | 2024/03/20 | |
V2 | Pretraining BERT with Hugging Face Transformers | 2022/07/01 | 2022/08/27 |
Parameter efficient fine-tuning
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Parameter-efficient fine-tuning of GPT-2 with LoRA | 2023/05/27 | 2023/05/27 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Parameter-efficient fine-tuning of GPT-2 with LoRA | 2023/05/27 | 2023/05/27 |
Other
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Training a language model from scratch with 🤗 Transformers and TPUs | 2023/05/21 | 2023/05/21 | |
V2 | MultipleChoice Task with Transfer Learning | 2023/09/14 | 2023/09/14 | |
V2 | Question Answering with Hugging Face Transformers | 2022/01/13 | 2022/01/13 | |
V2 | Abstractive Summarization with Hugging Face Transformers | 2022/07/04 | 2022/08/28 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | MultipleChoice Task with Transfer Learning | 2023/09/14 | 2023/09/14 | |
V2 | Training a language model from scratch with 🤗 Transformers and TPUs | 2023/05/21 | 2023/05/21 | |
V2 | Abstractive Summarization with Hugging Face Transformers | 2022/07/04 | 2022/08/28 | |
V2 | Question Answering with Hugging Face Transformers | 2022/01/13 | 2022/01/13 |
Structured Data
Structured data classification
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Structured data classification with FeatureSpace | 2022/11/09 | 2022/11/09 |
★ | V3 | FeatureSpace advanced use cases | 2023/07/01 | 2023/07/01 |
★ | V3 | Imbalanced classification: credit card fraud detection | 2019/05/28 | 2020/04/17 |
V3 | Structured data classification from scratch | 2020/06/09 | 2020/06/09 | |
V3 | Structured data learning with Wide, Deep, and Cross networks | 2020/12/31 | 2021/05/05 | |
V2 | Classification with Gated Residual and Variable Selection Networks | 2021/02/10 | 2021/02/10 | |
V2 | Classification with TensorFlow Decision Forests | 2022/01/25 | 2022/01/25 | |
V3 | Classification with Neural Decision Forests | 2021/01/15 | 2021/01/15 | |
V3 | Structured data learning with TabTransformer | 2022/01/18 | 2022/01/18 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
★ | V3 | FeatureSpace advanced use cases | 2023/07/01 | 2023/07/01 |
★ | V3 | Structured data classification with FeatureSpace | 2022/11/09 | 2022/11/09 |
V2 | Classification with TensorFlow Decision Forests | 2022/01/25 | 2022/01/25 | |
V3 | Structured data learning with TabTransformer | 2022/01/18 | 2022/01/18 | |
V3 | Structured data learning with Wide, Deep, and Cross networks | 2020/12/31 | 2021/05/05 | |
V2 | Classification with Gated Residual and Variable Selection Networks | 2021/02/10 | 2021/02/10 | |
V3 | Classification with Neural Decision Forests | 2021/01/15 | 2021/01/15 | |
V3 | Structured data classification from scratch | 2020/06/09 | 2020/06/09 | |
★ | V3 | Imbalanced classification: credit card fraud detection | 2019/05/28 | 2020/04/17 |
Recommendation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Collaborative Filtering for Movie Recommendations | 2020/05/24 | 2020/05/24 | |
V3 | A Transformer-based recommendation system | 2020/12/30 | 2020/12/30 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | A Transformer-based recommendation system | 2020/12/30 | 2020/12/30 | |
V3 | Collaborative Filtering for Movie Recommendations | 2020/05/24 | 2020/05/24 |
Timeseries
Timeseries classification
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Timeseries classification from scratch | 2020/07/21 | 2023/11/10 |
V3 | Timeseries classification with a Transformer model | 2021/06/25 | 2021/08/05 | |
V3 | Electroencephalogram Signal Classification for action identification | 2022/11/03 | 2022/11/05 | |
V3 | Event classification for payment card fraud detection | 2024/02/01 | 2024/02/01 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Event classification for payment card fraud detection | 2024/02/01 | 2024/02/01 | |
★ | V3 | Timeseries classification from scratch | 2020/07/21 | 2023/11/10 |
V3 | Electroencephalogram Signal Classification for action identification | 2022/11/03 | 2022/11/05 | |
V3 | Timeseries classification with a Transformer model | 2021/06/25 | 2021/08/05 |
Anomaly detection
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Timeseries anomaly detection using an Autoencoder | 2020/05/31 | 2020/05/31 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Timeseries anomaly detection using an Autoencoder | 2020/05/31 | 2020/05/31 |
Timeseries forecasting
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Traffic forecasting using graph neural networks and LSTM | 2021/12/28 | 2023/11/22 | |
V3 | Timeseries forecasting for weather prediction | 2020/06/23 | 2023/11/22 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Traffic forecasting using graph neural networks and LSTM | 2021/12/28 | 2023/11/22 | |
V3 | Timeseries forecasting for weather prediction | 2020/06/23 | 2023/11/22 |
Generative Deep Learning
Image generation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | Denoising Diffusion Implicit Models | 2022/06/24 | 2022/06/24 |
★ | V3 | A walk through latent space with Stable Diffusion | 2022/09/28 | 2022/09/28 |
V2 | DreamBooth | 2023/02/01 | 2023/02/05 | |
V2 | Denoising Diffusion Probabilistic Model | 2022/11/30 | 2022/12/07 | |
V2 | Teach StableDiffusion new concepts via Textual Inversion | 2022/12/09 | 2022/12/09 | |
V2 | Fine-tuning Stable Diffusion | 2022/12/28 | 2023/01/13 | |
V3 | Variational AutoEncoder | 2020/05/03 | 2024/04/24 | |
V3 | DCGAN to generate face images | 2019/04/29 | 2023/12/21 | |
V3 | WGAN-GP overriding `Model.train_step` | 2020/05/09 | 2023/08/03 | |
V3 | Conditional GAN | 2021/07/13 | 2024/01/02 | |
V3 | CycleGAN | 2020/08/12 | 2024/09/30 | |
V2 | Data-efficient GANs with Adaptive Discriminator Augmentation | 2021/10/28 | 2021/10/28 | |
V3 | Deep Dream | 2016/01/13 | 2020/05/02 | |
V3 | GauGAN for conditional image generation | 2021/12/26 | 2022/01/03 | |
V3 | PixelCNN | 2020/05/17 | 2020/05/23 | |
V2 | Face image generation with StyleGAN | 2021/07/01 | 2021/12/20 | |
V2 | Vector-Quantized Variational Autoencoders | 2021/06/27 | 2021/07/21 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | CycleGAN | 2020/08/12 | 2024/09/30 | |
V3 | Variational AutoEncoder | 2020/05/03 | 2024/04/24 | |
V3 | Conditional GAN | 2021/07/13 | 2024/01/02 | |
V3 | DCGAN to generate face images | 2019/04/29 | 2023/12/21 | |
V3 | WGAN-GP overriding `Model.train_step` | 2020/05/09 | 2023/08/03 | |
V2 | DreamBooth | 2023/02/01 | 2023/02/05 | |
V2 | Fine-tuning Stable Diffusion | 2022/12/28 | 2023/01/13 | |
V2 | Teach StableDiffusion new concepts via Textual Inversion | 2022/12/09 | 2022/12/09 | |
V2 | Denoising Diffusion Probabilistic Model | 2022/11/30 | 2022/12/07 | |
★ | V3 | A walk through latent space with Stable Diffusion | 2022/09/28 | 2022/09/28 |
★ | V3 | Denoising Diffusion Implicit Models | 2022/06/24 | 2022/06/24 |
V3 | GauGAN for conditional image generation | 2021/12/26 | 2022/01/03 | |
V2 | Face image generation with StyleGAN | 2021/07/01 | 2021/12/20 | |
V2 | Data-efficient GANs with Adaptive Discriminator Augmentation | 2021/10/28 | 2021/10/28 | |
V2 | Vector-Quantized Variational Autoencoders | 2021/06/27 | 2021/07/21 | |
V3 | PixelCNN | 2020/05/17 | 2020/05/23 | |
V3 | Deep Dream | 2016/01/13 | 2020/05/02 |
Style transfer
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Neural style transfer | 2016/01/11 | 2020/05/02 | |
V2 | Neural Style Transfer with AdaIN | 2021/11/08 | 2021/11/08 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Neural Style Transfer with AdaIN | 2021/11/08 | 2021/11/08 | |
V3 | Neural style transfer | 2016/01/11 | 2020/05/02 |
Text generation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
★ | V3 | GPT2 Text Generation with KerasHub | 2023/04/12 | 2023/04/17 |
V3 | GPT text generation from scratch with KerasHub | 2022/07/25 | 2022/07/25 | |
V3 | Text generation with a miniature GPT | 2020/05/29 | 2020/05/29 | |
V3 | Character-level text generation with LSTM | 2015/06/15 | 2020/04/30 | |
V2 | Text Generation using FNet | 2021/10/05 | 2021/10/05 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
★ | V3 | GPT2 Text Generation with KerasHub | 2023/04/12 | 2023/04/17 |
V3 | GPT text generation from scratch with KerasHub | 2022/07/25 | 2022/07/25 | |
V2 | Text Generation using FNet | 2021/10/05 | 2021/10/05 | |
V3 | Text generation with a miniature GPT | 2020/05/29 | 2020/05/29 | |
V3 | Character-level text generation with LSTM | 2015/06/15 | 2020/04/30 |
Graph generation
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Drug Molecule Generation with VAE | 2022/03/10 | 2022/03/24 | |
V2 | WGAN-GP with R-GCN for the generation of small molecular graphs | 2021/06/30 | 2021/06/30 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Drug Molecule Generation with VAE | 2022/03/10 | 2022/03/24 | |
V2 | WGAN-GP with R-GCN for the generation of small molecular graphs | 2021/06/30 | 2021/06/30 |
Other
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | A walk through latent space with Stable Diffusion 3 | 2024/11/11 | 2024/11/11 | |
V2 | Density estimation using Real NVP | 2020/08/10 | 2020/08/10 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | A walk through latent space with Stable Diffusion 3 | 2024/11/11 | 2024/11/11 | |
V2 | Density estimation using Real NVP | 2020/08/10 | 2020/08/10 |
Audio Data
Speech recognition
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Automatic Speech Recognition with Transformer | 2021/01/13 | 2021/01/13 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Automatic Speech Recognition with Transformer | 2021/01/13 | 2021/01/13 |
Other
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Automatic Speech Recognition using CTC | 2021/09/26 | 2021/09/26 | |
V2 | MelGAN-based spectrogram inversion using feature matching | 2021/09/02 | 2021/09/15 | |
V2 | Speaker Recognition | 2020/06/14 | 2023/07/19 | |
V2 | Audio Classification with the STFTSpectrogram layer | 2024/10/04 | 2024/10/04 | |
V2 | English speaker accent recognition using Transfer Learning | 2022/04/16 | 2022/04/16 | |
V2 | Audio Classification with Hugging Face Transformers | 2022/07/01 | 2022/08/27 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Audio Classification with the STFTSpectrogram layer | 2024/10/04 | 2024/10/04 | |
V2 | Speaker Recognition | 2020/06/14 | 2023/07/19 | |
V2 | Audio Classification with Hugging Face Transformers | 2022/07/01 | 2022/08/27 | |
V2 | English speaker accent recognition using Transfer Learning | 2022/04/16 | 2022/04/16 | |
V2 | Automatic Speech Recognition using CTC | 2021/09/26 | 2021/09/26 | |
V2 | MelGAN-based spectrogram inversion using feature matching | 2021/09/02 | 2021/09/15 |
Reinforcement Learning
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Actor Critic Method | 2020/05/13 | 2024/02/22 | |
V3 | Proximal Policy Optimization | 2021/06/24 | 2024/03/12 | |
V3 | Deep Q-Learning for Atari Breakout | 2020/05/23 | 2024/03/16 | |
V3 | Deep Deterministic Policy Gradient (DDPG) | 2020/06/04 | 2024/03/23 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Deep Deterministic Policy Gradient (DDPG) | 2020/06/04 | 2024/03/23 | |
V3 | Deep Q-Learning for Atari Breakout | 2020/05/23 | 2024/03/16 | |
V3 | Proximal Policy Optimization | 2021/06/24 | 2024/03/12 | |
V3 | Actor Critic Method | 2020/05/13 | 2024/02/22 |
Graph Data
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Graph attention network (GAT) for node classification | 2021/09/13 | 2021/12/26 | |
V2 | Node Classification with Graph Neural Networks | 2021/05/30 | 2021/05/30 | |
V2 | Message-passing neural network (MPNN) for molecular property prediction | 2021/08/16 | 2021/12/27 | |
V2 | Graph representation learning with node2vec | 2021/05/15 | 2021/05/15 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Message-passing neural network (MPNN) for molecular property prediction | 2021/08/16 | 2021/12/27 | |
V2 | Graph attention network (GAT) for node classification | 2021/09/13 | 2021/12/26 | |
V2 | Node Classification with Graph Neural Networks | 2021/05/30 | 2021/05/30 | |
V2 | Graph representation learning with node2vec | 2021/05/15 | 2021/05/15 |
Quick Keras Recipes
Keras usage tips
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Parameter-efficient fine-tuning of Gemma with LoRA and QLoRA | 2024/08/06 | 2024/08/06 | |
V3 | Float8 training and inference with a simple Transformer model | 2024/05/14 | 2024/05/14 | |
V3 | Keras debugging tips | 2020/05/16 | 2023/11/16 | |
V3 | Customizing the convolution operation of a Conv2D layer | 2021/03/11 | 2021/03/11 | |
V3 | Trainer pattern | 2022/09/19 | 2022/09/26 | |
V3 | Endpoint layer pattern | 2019/05/10 | 2023/11/22 | |
V3 | Reproducibility in Keras Models | 2023/05/05 | 2023/05/05 | |
V3 | Writing Keras Models With TensorFlow NumPy | 2021/08/28 | 2021/08/28 | |
V3 | Simple custom layer example: Antirectifier | 2016/01/06 | 2023/11/20 | |
V3 | Packaging Keras models for wide distribution using Functional Subclassing | 2023/12/13 | 2023/12/13 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Parameter-efficient fine-tuning of Gemma with LoRA and QLoRA | 2024/08/06 | 2024/08/06 | |
V3 | Float8 training and inference with a simple Transformer model | 2024/05/14 | 2024/05/14 | |
V3 | Packaging Keras models for wide distribution using Functional Subclassing | 2023/12/13 | 2023/12/13 | |
V3 | Endpoint layer pattern | 2019/05/10 | 2023/11/22 | |
V3 | Simple custom layer example: Antirectifier | 2016/01/06 | 2023/11/20 | |
V3 | Keras debugging tips | 2020/05/16 | 2023/11/16 | |
V3 | Reproducibility in Keras Models | 2023/05/05 | 2023/05/05 | |
V3 | Trainer pattern | 2022/09/19 | 2022/09/26 | |
V3 | Writing Keras Models With TensorFlow NumPy | 2021/08/28 | 2021/08/28 | |
V3 | Customizing the convolution operation of a Conv2D layer | 2021/03/11 | 2021/03/11 |
Serving
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Serving TensorFlow models with TFServing | 2023/01/02 | 2023/01/02 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Serving TensorFlow models with TFServing | 2023/01/02 | 2023/01/02 |
ML best practices
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V3 | Estimating required sample size for model training | 2021/05/20 | 2021/06/06 | |
V3 | Memory-efficient embeddings for recommendation systems | 2021/02/15 | 2023/11/15 | |
V3 | Creating TFRecords | 2021/02/27 | 2023/12/20 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V3 | Creating TFRecords | 2021/02/27 | 2023/12/20 | |
V3 | Memory-efficient embeddings for recommendation systems | 2021/02/15 | 2023/11/15 | |
V3 | Estimating required sample size for model training | 2021/05/20 | 2021/06/06 |
Other
Starter | Keras Version | Title | Date Created | Last Modified |
---|---|---|---|---|
V2 | Approximating non-Function Mappings with Mixture Density Networks | 2023/07/15 | 2023/07/15 | |
V2 | Probabilistic Bayesian Neural Networks | 2021/01/15 | 2021/01/15 | |
V2 | Knowledge distillation recipes | 2021/08/01 | 2021/08/01 | |
V2 | Evaluating and exporting scikit-learn metrics in a Keras callback | 2021/10/07 | 2023/11/17 | |
V2 | How to train a Keras model on TFRecord files | 2020/07/29 | 2020/08/07 |
Starter | Keras Version | Title | Date Created | Last Modified ▼ |
---|---|---|---|---|
V2 | Evaluating and exporting scikit-learn metrics in a Keras callback | 2021/10/07 | 2023/11/17 | |
V2 | Approximating non-Function Mappings with Mixture Density Networks | 2023/07/15 | 2023/07/15 | |
V2 | Knowledge distillation recipes | 2021/08/01 | 2021/08/01 | |
V2 | Probabilistic Bayesian Neural Networks | 2021/01/15 | 2021/01/15 | |
V2 | How to train a Keras model on TFRecord files | 2020/07/29 | 2020/08/07 |
Adding a new code example
We welcome new code examples! Here are our rules:
- They should be shorter than 300 lines of code (comments may be as long as you want).
- They should demonstrate modern Keras best practices.
- They should be substantially different in topic from all examples listed above.
- They should be extensively documented & commented.
New examples are added via Pull Requests to the keras.io repository.
They must be submitted as a .py
file that follows a specific format. They are usually generated from Jupyter notebooks.
See the tutobooks
documentation for more details.
If you would like to convert a Keras 2 example to Keras 3, please open a Pull Request to the keras.io repository.