CINXE.COM

Code examples

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="Keras documentation"> <meta name="author" content="Keras Team"> <link rel="shortcut icon" href="https://keras.io/img/favicon.ico"> <link rel="canonical" href="https://keras.io/examples/" /> <!-- Social --> <meta property="og:title" content="Keras documentation: Code examples"> <meta property="og:image" content="https://keras.io/img/logo-k-keras-wb.png"> <meta name="twitter:title" content="Keras documentation: Code examples"> <meta name="twitter:image" content="https://keras.io/img/k-keras-social.png"> <meta name="twitter:card" content="summary"> <title>Code examples</title> <!-- Bootstrap core CSS --> <link href="/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom fonts for this template --> <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700;800&display=swap" rel="stylesheet"> <!-- Custom styles for this template --> <link href="/css/docs.css" rel="stylesheet"> <link href="/css/monokai.css" rel="stylesheet"> <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-5DNGF4N'); </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-175165319-128', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Tag Manager --> <script async defer src="https://buttons.github.io/buttons.js"></script> </head> <body> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5DNGF4N" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <div class='k-page'> <div class="k-nav" id="nav-menu"> <a href='/'><img src='/img/logo-small.png' class='logo-small' /></a> <div class="nav flex-column nav-pills" role="tablist" aria-orientation="vertical"> <a class="nav-link" href="/about/" role="tab" aria-selected="">About Keras</a> <a class="nav-link" href="/getting_started/" role="tab" aria-selected="">Getting started</a> <a class="nav-link" href="/guides/" role="tab" aria-selected="">Developer guides</a> <a class="nav-link" href="/api/" role="tab" aria-selected="">Keras 3 API documentation</a> <a class="nav-link" href="/2.18/api/" role="tab" aria-selected="">Keras 2 API documentation</a> <a class="nav-link active" href="/examples/" role="tab" aria-selected="">Code examples</a> <a class="nav-sublink" href="/examples/vision/">Computer Vision</a> <a class="nav-sublink" href="/examples/nlp/">Natural Language Processing</a> <a class="nav-sublink" href="/examples/structured_data/">Structured Data</a> <a class="nav-sublink" href="/examples/timeseries/">Timeseries</a> <a class="nav-sublink" href="/examples/generative/">Generative Deep Learning</a> <a class="nav-sublink" href="/examples/audio/">Audio Data</a> <a class="nav-sublink" href="/examples/rl/">Reinforcement Learning</a> <a class="nav-sublink" href="/examples/graph/">Graph Data</a> <a class="nav-sublink" href="/examples/keras_recipes/">Quick Keras Recipes</a> <a class="nav-link" href="/keras_tuner/" role="tab" aria-selected="">KerasTuner: Hyperparameter Tuning</a> <a class="nav-link" href="/keras_hub/" role="tab" aria-selected="">KerasHub: Pretrained Models</a> <a class="nav-link" href="/keras_cv/" role="tab" aria-selected="">KerasCV: Computer Vision Workflows</a> <a class="nav-link" href="/keras_nlp/" role="tab" aria-selected="">KerasNLP: Natural Language Workflows</a> </div> </div> <div class='k-main'> <div class='k-main-top'> <script> function displayDropdownMenu() { e = document.getElementById("nav-menu"); if (e.style.display == "block") { e.style.display = "none"; } else { e.style.display = "block"; document.getElementById("dropdown-nav").style.display = "block"; } } function resetMobileUI() { if (window.innerWidth <= 840) { document.getElementById("nav-menu").style.display = "none"; document.getElementById("dropdown-nav").style.display = "block"; } else { document.getElementById("nav-menu").style.display = "block"; document.getElementById("dropdown-nav").style.display = "none"; } var navmenu = document.getElementById("nav-menu"); var menuheight = navmenu.clientHeight; var kmain = document.getElementById("k-main-id"); kmain.style.minHeight = (menuheight + 100) + 'px'; } window.onresize = resetMobileUI; window.addEventListener("load", (event) => { resetMobileUI() }); </script> <div id='dropdown-nav' onclick="displayDropdownMenu();"> <svg viewBox="-20 -20 120 120" width="60" height="60"> <rect width="100" height="20"></rect> <rect y="30" width="100" height="20"></rect> <rect y="60" width="100" height="20"></rect> </svg> </div> <form class="bd-search d-flex align-items-center k-search-form" id="search-form"> <input type="search" class="k-search-input" id="search-input" placeholder="Search Keras documentation..." aria-label="Search Keras documentation..." autocomplete="off"> <button class="k-search-btn"> <svg width="13" height="13" viewBox="0 0 13 13"><title>search</title><path d="m4.8495 7.8226c0.82666 0 1.5262-0.29146 2.0985-0.87438 0.57232-0.58292 0.86378-1.2877 0.87438-2.1144 0.010599-0.82666-0.28086-1.5262-0.87438-2.0985-0.59352-0.57232-1.293-0.86378-2.0985-0.87438-0.8055-0.010599-1.5103 0.28086-2.1144 0.87438-0.60414 0.59352-0.8956 1.293-0.87438 2.0985 0.021197 0.8055 0.31266 1.5103 0.87438 2.1144 0.56172 0.60414 1.2665 0.8956 2.1144 0.87438zm4.4695 0.2115 3.681 3.6819-1.259 1.284-3.6817-3.7 0.0019784-0.69479-0.090043-0.098846c-0.87973 0.76087-1.92 1.1413-3.1207 1.1413-1.3553 0-2.5025-0.46363-3.4417-1.3909s-1.4088-2.0686-1.4088-3.4239c0-1.3553 0.4696-2.4966 1.4088-3.4239 0.9392-0.92727 2.0864-1.3969 3.4417-1.4088 1.3553-0.011889 2.4906 0.45771 3.406 1.4088 0.9154 0.95107 1.379 2.0924 1.3909 3.4239 0 1.2126-0.38043 2.2588-1.1413 3.1385l0.098834 0.090049z"></path></svg> </button> </form> <script> var form = document.getElementById('search-form'); form.onsubmit = function(e) { e.preventDefault(); var query = document.getElementById('search-input').value; window.location.href = '/search.html?query=' + query; return False } </script> </div> <div class='k-main-inner' id='k-main-id'> <div class='k-location-slug'> <span class="k-location-slug-pointer">►</span> Code examples </div> <div class='k-content'> <h1 id="code-examples">Code examples</h1> <p>Our code examples are short (less than 300 lines of code), focused demonstrations of vertical deep learning workflows.</p> <p>All of our examples are written as Jupyter notebooks and can be run in one click in <a href="https://colab.research.google.com/notebooks/welcome.ipynb">Google Colab</a>, a hosted notebook environment that requires no setup and runs in the cloud. Google Colab includes GPU and TPU runtimes.</p> <p><div class="example-highlight">★</div> = Good starter example</p> <p><div class="example-highlight"><b>V3</b></div> = Keras 3 example</p> <h2 id="computer-vision"><a href="/examples/vision/">Computer Vision</a></h2> <h3 class="example-subcategory-title">Image classification</h3> <a href="/examples/vision/image_classification_from_scratch"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification from scratch </div> </div> </a> <a href="/examples/vision/mnist_convnet"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Simple MNIST convnet </div> </div> </a> <a href="/examples/vision/image_classification_efficientnet_fine_tuning"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification via fine-tuning with EfficientNet </div> </div> </a> <a href="/examples/vision/image_classification_with_vision_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with Vision Transformer </div> </div> </a> <a href="/examples/vision/attention_mil_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Classification using Attention-based Deep Multiple Instance Learning </div> </div> </a> <a href="/examples/vision/mlp_image_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with modern MLP models </div> </div> </a> <a href="/examples/vision/mobilevit"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> A mobile-friendly Transformer-based model for image classification </div> </div> </a> <a href="/examples/vision/xray_classification_with_tpus"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Pneumonia Classification on TPU </div> </div> </a> <a href="/examples/vision/cct"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Compact Convolutional Transformers </div> </div> </a> <a href="/examples/vision/convmixer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with ConvMixer </div> </div> </a> <a href="/examples/vision/eanet"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with EANet (External Attention Transformer) </div> </div> </a> <a href="/examples/vision/involution"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Involutional neural networks </div> </div> </a> <a href="/examples/vision/perceiver_image_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with Perceiver </div> </div> </a> <a href="/examples/vision/reptile"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Few-Shot learning with Reptile </div> </div> </a> <a href="/examples/vision/semisupervised_simclr"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Semi-supervised image classification using contrastive pretraining with SimCLR </div> </div> </a> <a href="/examples/vision/swin_transformers"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image classification with Swin Transformers </div> </div> </a> <a href="/examples/vision/vit_small_ds"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Train a Vision Transformer on small datasets </div> </div> </a> <a href="/examples/vision/shiftvit"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> A Vision Transformer without Attention </div> </div> </a> <a href="/examples/vision/image_classification_using_global_context_vision_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image Classification using Global Context Vision Transformer </div> </div> </a> <a href="/examples/vision/bit"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image Classification using BigTransfer (BiT) </div> </div> </a> <h3 class="example-subcategory-title">Image segmentation</h3> <a href="/examples/vision/oxford_pets_image_segmentation"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image segmentation with a U-Net-like architecture </div> </div> </a> <a href="/examples/vision/deeplabv3_plus"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Multiclass semantic segmentation using DeepLabV3+ </div> </div> </a> <a href="/examples/vision/basnet_segmentation"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Highly accurate boundaries segmentation using BASNet </div> </div> </a> <a href="/examples/vision/fully_convolutional_network"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image Segmentation using Composable Fully-Convolutional Networks </div> </div> </a> <h3 class="example-subcategory-title">Object detection</h3> <a href="/examples/vision/retinanet"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Object Detection with RetinaNet </div> </div> </a> <a href="/examples/vision/keypoint_detection"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Keypoint Detection with Transfer Learning </div> </div> </a> <a href="/examples/vision/object_detection_using_vision_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Object detection with Vision Transformers </div> </div> </a> <h3 class="example-subcategory-title">3D</h3> <a href="/examples/vision/3D_image_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> 3D image classification from CT scans </div> </div> </a> <a href="/examples/vision/depth_estimation"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Monocular depth estimation </div> </div> </a> <a href="/examples/vision/nerf"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> 3D volumetric rendering with NeRF </div> </div> </a> <a href="/examples/vision/pointnet_segmentation"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Point cloud segmentation with PointNet </div> </div> </a> <a href="/examples/vision/pointnet"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Point cloud classification </div> </div> </a> <h3 class="example-subcategory-title">OCR</h3> <a href="/examples/vision/captcha_ocr"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> OCR model for reading Captchas </div> </div> </a> <a href="/examples/vision/handwriting_recognition"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Handwriting recognition </div> </div> </a> <h3 class="example-subcategory-title">Image enhancement</h3> <a href="/examples/vision/autoencoder"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Convolutional autoencoder for image denoising </div> </div> </a> <a href="/examples/vision/mirnet"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Low-light image enhancement using MIRNet </div> </div> </a> <a href="/examples/vision/super_resolution_sub_pixel"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image Super-Resolution using an Efficient Sub-Pixel CNN </div> </div> </a> <a href="/examples/vision/edsr"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Enhanced Deep Residual Networks for single-image super-resolution </div> </div> </a> <a href="/examples/vision/zero_dce"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Zero-DCE for low-light image enhancement </div> </div> </a> <h3 class="example-subcategory-title">Data augmentation</h3> <a href="/examples/vision/cutmix"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> CutMix data augmentation for image classification </div> </div> </a> <a href="/examples/vision/mixup"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> MixUp augmentation for image classification </div> </div> </a> <a href="/examples/vision/randaugment"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> RandAugment for Image Classification for Improved Robustness </div> </div> </a> <h3 class="example-subcategory-title">Image & Text</h3> <a href="/examples/vision/image_captioning"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image captioning </div> </div> </a> <a href="/examples/vision/nl_image_search"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Natural language image search with a Dual Encoder </div> </div> </a> <h3 class="example-subcategory-title">Vision models interpretability</h3> <a href="/examples/vision/visualizing_what_convnets_learn"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Visualizing what convnets learn </div> </div> </a> <a href="/examples/vision/integrated_gradients"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Model interpretability with Integrated Gradients </div> </div> </a> <a href="/examples/vision/probing_vits"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Investigating Vision Transformer representations </div> </div> </a> <a href="/examples/vision/grad_cam"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Grad-CAM class activation visualization </div> </div> </a> <h3 class="example-subcategory-title">Image similarity search</h3> <a href="/examples/vision/near_dup_search"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Near-duplicate image search </div> </div> </a> <a href="/examples/vision/semantic_image_clustering"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Semantic Image Clustering </div> </div> </a> <a href="/examples/vision/siamese_contrastive"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image similarity estimation using a Siamese Network with a contrastive loss </div> </div> </a> <a href="/examples/vision/siamese_network"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Image similarity estimation using a Siamese Network with a triplet loss </div> </div> </a> <a href="/examples/vision/metric_learning"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Metric learning for image similarity search </div> </div> </a> <a href="/examples/vision/metric_learning_tf_similarity"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Metric learning for image similarity search using TensorFlow Similarity </div> </div> </a> <a href="/examples/vision/nnclr"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Self-supervised contrastive learning with NNCLR </div> </div> </a> <h3 class="example-subcategory-title">Video</h3> <a href="/examples/vision/video_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Video Classification with a CNN-RNN Architecture </div> </div> </a> <a href="/examples/vision/conv_lstm"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Next-Frame Video Prediction with Convolutional LSTMs </div> </div> </a> <a href="/examples/vision/video_transformers"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Video Classification with Transformers </div> </div> </a> <a href="/examples/vision/vivit"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Video Vision Transformer </div> </div> </a> <h3 class="example-subcategory-title">Performance recipes</h3> <a href="/examples/vision/gradient_centralization"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Gradient Centralization for Better Training Performance </div> </div> </a> <a href="/examples/vision/token_learner"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Learning to tokenize in Vision Transformers </div> </div> </a> <a href="/examples/vision/knowledge_distillation"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Knowledge Distillation </div> </div> </a> <a href="/examples/vision/fixres"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> FixRes: Fixing train-test resolution discrepancy </div> </div> </a> <a href="/examples/vision/cait"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Class Attention Image Transformers with LayerScale </div> </div> </a> <a href="/examples/vision/patch_convnet"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Augmenting convnets with aggregated attention </div> </div> </a> <a href="/examples/vision/learnable_resizer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Learning to Resize </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/vision/adamatch"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Semi-supervision and domain adaptation with AdaMatch </div> </div> </a> <a href="/examples/vision/barlow_twins"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Barlow Twins for Contrastive SSL </div> </div> </a> <a href="/examples/vision/consistency_training"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Consistency training with supervision </div> </div> </a> <a href="/examples/vision/deit"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Distilling Vision Transformers </div> </div> </a> <a href="/examples/vision/focal_modulation_network"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Focal Modulation: A replacement for Self-Attention </div> </div> </a> <a href="/examples/vision/forwardforward"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Using the Forward-Forward Algorithm for Image Classification </div> </div> </a> <a href="/examples/vision/masked_image_modeling"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Masked image modeling with Autoencoders </div> </div> </a> <a href="/examples/vision/sam"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Segment Anything Model with 🤗Transformers </div> </div> </a> <a href="/examples/vision/segformer"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Semantic segmentation with SegFormer and Hugging Face Transformers </div> </div> </a> <a href="/examples/vision/simsiam"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Self-supervised contrastive learning with SimSiam </div> </div> </a> <a href="/examples/vision/supervised-contrastive-learning"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Supervised Contrastive Learning </div> </div> </a> <a href="/examples/vision/temporal_latent_bottleneck"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> When Recurrence meets Transformers </div> </div> </a> <a href="/examples/vision/yolov8"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Efficient Object Detection with YOLOV8 and KerasCV </div> </div> </a> <hr> <h2 id="natural-language-processing"><a href="/examples/nlp/">Natural Language Processing</a></h2> <h3 class="example-subcategory-title">Text classification</h3> <a href="/examples/nlp/text_classification_from_scratch"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text classification from scratch </div> </div> </a> <a href="/examples/nlp/active_learning_review_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Review Classification using Active Learning </div> </div> </a> <a href="/examples/nlp/fnet_classification_with_keras_hub"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text Classification using FNet </div> </div> </a> <a href="/examples/nlp/multi_label_classification"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Large-scale multi-label text classification </div> </div> </a> <a href="/examples/nlp/text_classification_with_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text classification with Transformer </div> </div> </a> <a href="/examples/nlp/text_classification_with_switch_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text classification with Switch Transformer </div> </div> </a> <a href="/examples/nlp/tweet-classification-using-tfdf"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Text classification using Decision Forests and pretrained embeddings </div> </div> </a> <a href="/examples/nlp/pretrained_word_embeddings"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Using pre-trained word embeddings </div> </div> </a> <a href="/examples/nlp/bidirectional_lstm_imdb"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Bidirectional LSTM on IMDB </div> </div> </a> <a href="/examples/nlp/data_parallel_training_with_keras_hub"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Data Parallel Training with KerasHub and tf.distribute </div> </div> </a> <h3 class="example-subcategory-title">Machine translation</h3> <a href="/examples/nlp/neural_machine_translation_with_keras_hub"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> English-to-Spanish translation with KerasHub </div> </div> </a> <a href="/examples/nlp/neural_machine_translation_with_transformer"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> English-to-Spanish translation with a sequence-to-sequence Transformer </div> </div> </a> <a href="/examples/nlp/lstm_seq2seq"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Character-level recurrent sequence-to-sequence model </div> </div> </a> <h3 class="example-subcategory-title">Entailment prediction</h3> <a href="/examples/nlp/multimodal_entailment"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Multimodal entailment </div> </div> </a> <h3 class="example-subcategory-title">Named entity recognition</h3> <a href="/examples/nlp/ner_transformers"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Named Entity Recognition using Transformers </div> </div> </a> <h3 class="example-subcategory-title">Sequence-to-sequence</h3> <a href="/examples/nlp/text_extraction_with_bert"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Text Extraction with BERT </div> </div> </a> <a href="/examples/nlp/addition_rnn"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Sequence to sequence learning for performing number addition </div> </div> </a> <h3 class="example-subcategory-title">Text similarity search</h3> <a href="/examples/nlp/semantic_similarity_with_keras_hub"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Semantic Similarity with KerasHub </div> </div> </a> <a href="/examples/nlp/semantic_similarity_with_bert"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Semantic Similarity with BERT </div> </div> </a> <a href="/examples/nlp/sentence_embeddings_with_sbert"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Sentence embeddings using Siamese RoBERTa-networks </div> </div> </a> <h3 class="example-subcategory-title">Language modeling</h3> <a href="/examples/nlp/masked_language_modeling"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> End-to-end Masked Language Modeling with BERT </div> </div> </a> <a href="/examples/nlp/abstractive_summarization_with_bart"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Abstractive Text Summarization with BART </div> </div> </a> <a href="/examples/nlp/pretraining_BERT"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Pretraining BERT with Hugging Face Transformers </div> </div> </a> <h3 class="example-subcategory-title">Parameter efficient fine-tuning</h3> <a href="/examples/nlp/parameter_efficient_finetuning_of_gpt2_with_lora"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Parameter-efficient fine-tuning of GPT-2 with LoRA </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/nlp/mlm_training_tpus"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Training a language model from scratch with 🤗 Transformers and TPUs </div> </div> </a> <a href="/examples/nlp/multiple_choice_task_with_transfer_learning"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> MultipleChoice Task with Transfer Learning </div> </div> </a> <a href="/examples/nlp/question_answering"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Question Answering with Hugging Face Transformers </div> </div> </a> <a href="/examples/nlp/t5_hf_summarization"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Abstractive Summarization with Hugging Face Transformers </div> </div> </a> <hr> <h2 id="structured-data"><a href="/examples/structured_data/">Structured Data</a></h2> <h3 class="example-subcategory-title">Structured data classification</h3> <a href="/examples/structured_data/structured_data_classification_with_feature_space"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Structured data classification with FeatureSpace </div> </div> </a> <a href="/examples/structured_data/feature_space_advanced"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> FeatureSpace advanced use cases </div> </div> </a> <a href="/examples/structured_data/imbalanced_classification"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Imbalanced classification: credit card fraud detection </div> </div> </a> <a href="/examples/structured_data/structured_data_classification_from_scratch"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Structured data classification from scratch </div> </div> </a> <a href="/examples/structured_data/wide_deep_cross_networks"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Structured data learning with Wide, Deep, and Cross networks </div> </div> </a> <a href="/examples/structured_data/classification_with_grn_and_vsn"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Classification with Gated Residual and Variable Selection Networks </div> </div> </a> <a href="/examples/structured_data/classification_with_tfdf"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Classification with TensorFlow Decision Forests </div> </div> </a> <a href="/examples/structured_data/deep_neural_decision_forests"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Classification with Neural Decision Forests </div> </div> </a> <a href="/examples/structured_data/tabtransformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Structured data learning with TabTransformer </div> </div> </a> <h3 class="example-subcategory-title">Recommendation</h3> <a href="/examples/structured_data/collaborative_filtering_movielens"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Collaborative Filtering for Movie Recommendations </div> </div> </a> <a href="/examples/structured_data/movielens_recommendations_transformers"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> A Transformer-based recommendation system </div> </div> </a> <hr> <h2 id="timeseries"><a href="/examples/timeseries/">Timeseries</a></h2> <h3 class="example-subcategory-title">Timeseries classification</h3> <a href="/examples/timeseries/timeseries_classification_from_scratch"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Timeseries classification from scratch </div> </div> </a> <a href="/examples/timeseries/timeseries_classification_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Timeseries classification with a Transformer model </div> </div> </a> <a href="/examples/timeseries/eeg_signal_classification"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Electroencephalogram Signal Classification for action identification </div> </div> </a> <a href="/examples/timeseries/event_classification_for_payment_card_fraud_detection"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Event classification for payment card fraud detection </div> </div> </a> <h3 class="example-subcategory-title">Anomaly detection</h3> <a href="/examples/timeseries/timeseries_anomaly_detection"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Timeseries anomaly detection using an Autoencoder </div> </div> </a> <h3 class="example-subcategory-title">Timeseries forecasting</h3> <a href="/examples/timeseries/timeseries_traffic_forecasting"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Traffic forecasting using graph neural networks and LSTM </div> </div> </a> <a href="/examples/timeseries/timeseries_weather_forecasting"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Timeseries forecasting for weather prediction </div> </div> </a> <hr> <h2 id="generative-deep-learning"><a href="/examples/generative/">Generative Deep Learning</a></h2> <h3 class="example-subcategory-title">Image generation</h3> <a href="/examples/generative/ddim"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Denoising Diffusion Implicit Models </div> </div> </a> <a href="/examples/generative/random_walks_with_stable_diffusion"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> A walk through latent space with Stable Diffusion </div> </div> </a> <a href="/examples/generative/dreambooth"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> DreamBooth </div> </div> </a> <a href="/examples/generative/ddpm"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Denoising Diffusion Probabilistic Models </div> </div> </a> <a href="/examples/generative/fine_tune_via_textual_inversion"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Teach StableDiffusion new concepts via Textual Inversion </div> </div> </a> <a href="/examples/generative/finetune_stable_diffusion"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Fine-tuning Stable Diffusion </div> </div> </a> <a href="/examples/generative/vae"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Variational AutoEncoder </div> </div> </a> <a href="/examples/generative/dcgan_overriding_train_step"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GAN overriding Model.train_step </div> </div> </a> <a href="/examples/generative/wgan_gp"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> WGAN-GP overriding Model.train_step </div> </div> </a> <a href="/examples/generative/conditional_gan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Conditional GAN </div> </div> </a> <a href="/examples/generative/cyclegan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> CycleGAN </div> </div> </a> <a href="/examples/generative/gan_ada"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Data-efficient GANs with Adaptive Discriminator Augmentation </div> </div> </a> <a href="/examples/generative/deep_dream"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Deep Dream </div> </div> </a> <a href="/examples/generative/gaugan"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GauGAN for conditional image generation </div> </div> </a> <a href="/examples/generative/pixelcnn"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> PixelCNN </div> </div> </a> <a href="/examples/generative/stylegan"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Face image generation with StyleGAN </div> </div> </a> <a href="/examples/generative/vq_vae"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Vector-Quantized Variational Autoencoders </div> </div> </a> <h3 class="example-subcategory-title">Style transfer</h3> <a href="/examples/generative/neural_style_transfer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Neural style transfer </div> </div> </a> <a href="/examples/generative/adain"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Neural Style Transfer with AdaIN </div> </div> </a> <h3 class="example-subcategory-title">Text generation</h3> <a href="/examples/generative/gpt2_text_generation_with_keras_hub"> <div class="example-card"> <div class="example-highlight">★</div> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GPT2 Text Generation with KerasHub </div> </div> </a> <a href="/examples/generative/text_generation_gpt"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> GPT text generation from scratch with KerasHub </div> </div> </a> <a href="/examples/generative/text_generation_with_miniature_gpt"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Text generation with a miniature GPT </div> </div> </a> <a href="/examples/generative/lstm_character_level_text_generation"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Character-level text generation with LSTM </div> </div> </a> <a href="/examples/generative/text_generation_fnet"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Text Generation using FNet </div> </div> </a> <h3 class="example-subcategory-title">Graph generation</h3> <a href="/examples/generative/molecule_generation"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Drug Molecule Generation with VAE </div> </div> </a> <a href="/examples/generative/wgan-graphs"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> WGAN-GP with R-GCN for the generation of small molecular graphs </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/generative/random_walks_with_stable_diffusion_3"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> A walk through latent space with Stable Diffusion 3 </div> </div> </a> <a href="/examples/generative/real_nvp"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Density estimation using Real NVP </div> </div> </a> <hr> <h2 id="audio-data"><a href="/examples/audio/">Audio Data</a></h2> <h3 class="example-subcategory-title">Speech recognition</h3> <a href="/examples/audio/transformer_asr"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Automatic Speech Recognition with Transformer </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/audio/ctc_asr"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Automatic Speech Recognition using CTC </div> </div> </a> <a href="/examples/audio/melgan_spectrogram_inversion"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> MelGAN-based spectrogram inversion using feature matching </div> </div> </a> <a href="/examples/audio/speaker_recognition_using_cnn"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Speaker Recognition </div> </div> </a> <a href="/examples/audio/stft"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Audio Classification with the STFTSpectrogram layer </div> </div> </a> <a href="/examples/audio/uk_ireland_accent_recognition"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> English speaker accent recognition using Transfer Learning </div> </div> </a> <a href="/examples/audio/wav2vec2_audiocls"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Audio Classification with Hugging Face Transformers </div> </div> </a> <hr> <h2 id="reinforcement-learning"><a href="/examples/rl/">Reinforcement Learning</a></h2> <a href="/examples/rl/actor_critic_cartpole"> <div class="example-card"> <div class="example-card-title"> Actor Critic Method </div> </div> </a> <a href="/examples/rl/ppo_cartpole"> <div class="example-card"> <div class="example-card-title"> Proximal Policy Optimization </div> </div> </a> <a href="/examples/rl/deep_q_network_breakout"> <div class="example-card"> <div class="example-card-title"> Deep Q-Learning for Atari Breakout </div> </div> </a> <a href="/examples/rl/ddpg_pendulum"> <div class="example-card"> <div class="example-card-title"> Deep Deterministic Policy Gradient (DDPG) </div> </div> </a> <hr> <h2 id="graph-data"><a href="/examples/graph/">Graph Data</a></h2> <a href="/examples/graph/gat_node_classification"> <div class="example-card"> <div class="example-card-title"> Graph attention network (GAT) for node classification </div> </div> </a> <a href="/examples/graph/gnn_citations"> <div class="example-card"> <div class="example-card-title"> Node Classification with Graph Neural Networks </div> </div> </a> <a href="/examples/graph/mpnn-molecular-graphs"> <div class="example-card"> <div class="example-card-title"> Message-passing neural network (MPNN) for molecular property prediction </div> </div> </a> <a href="/examples/graph/node2vec_movielens"> <div class="example-card"> <div class="example-card-title"> Graph representation learning with node2vec </div> </div> </a> <hr> <h2 id="quick-keras-recipes"><a href="/examples/keras_recipes/">Quick Keras Recipes</a></h2> <h3 class="example-subcategory-title">Keras usage tips</h3> <a href="/examples/keras_recipes/parameter_efficient_finetuning_of_gemma_with_lora_and_qlora"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Parameter-efficient fine-tuning of Gemma with LoRA and QLoRA </div> </div> </a> <a href="/examples/keras_recipes/float8_training_and_inference_with_transformer"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Float8 training and inference with a simple Transformer model </div> </div> </a> <a href="/examples/keras_recipes/debugging_tips"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Keras debugging tips </div> </div> </a> <a href="/examples/keras_recipes/subclassing_conv_layers"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Customizing the convolution operation of a Conv2D layer </div> </div> </a> <a href="/examples/keras_recipes/trainer_pattern"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Trainer pattern </div> </div> </a> <a href="/examples/keras_recipes/endpoint_layer_pattern"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Endpoint layer pattern </div> </div> </a> <a href="/examples/keras_recipes/reproducibility_recipes"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Reproducibility in Keras Models </div> </div> </a> <a href="/examples/keras_recipes/tensorflow_numpy_models"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Writing Keras Models With TensorFlow NumPy </div> </div> </a> <a href="/examples/keras_recipes/antirectifier"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Simple custom layer example: Antirectifier </div> </div> </a> <a href="/examples/keras_recipes/packaging_keras_models_for_wide_distribution"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Packaging Keras models for wide distribution using Functional Subclassing </div> </div> </a> <h3 class="example-subcategory-title">Serving</h3> <a href="/examples/keras_recipes/tf_serving"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Serving TensorFlow models with TFServing </div> </div> </a> <h3 class="example-subcategory-title">ML best practices</h3> <a href="/examples/keras_recipes/sample_size_estimate"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Estimating required sample size for model training </div> </div> </a> <a href="/examples/keras_recipes/memory_efficient_embeddings"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Memory-efficient embeddings for recommendation systems </div> </div> </a> <a href="/examples/keras_recipes/creating_tfrecords"> <div class="example-card"> <div class="example-highlight"><b>V3</b></div> <div class="example-card-title"> Creating TFRecords </div> </div> </a> <h3 class="example-subcategory-title">Other</h3> <a href="/examples/keras_recipes/approximating_non_function_mappings"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Approximating non-Function Mappings with Mixture Density Networks </div> </div> </a> <a href="/examples/keras_recipes/bayesian_neural_networks"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Probabilistic Bayesian Neural Networks </div> </div> </a> <a href="/examples/keras_recipes/better_knowledge_distillation"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Knowledge distillation recipes </div> </div> </a> <a href="/examples/keras_recipes/sklearn_metric_callbacks"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> Evaluating and exporting scikit-learn metrics in a Keras callback </div> </div> </a> <a href="/examples/keras_recipes/tfrecord"> <div class="example-card"> <div class="example-highlight">V2</div> <div class="example-card-title"> How to train a Keras model on TFRecord files </div> </div> </a> <hr> <h2 id="adding-a-new-code-example">Adding a new code example</h2> <p>We welcome new code examples! Here are our rules:</p> <ul> <li>They should be shorter than 300 lines of code (comments may be as long as you want).</li> <li>They should demonstrate modern Keras best practices.</li> <li>They should be substantially different in topic from all examples listed above.</li> <li>They should be extensively documented &amp; commented.</li> </ul> <p>New examples are added via Pull Requests to the <a href="https://github.com/keras-team/keras-io">keras.io repository</a>. They must be submitted as a <code>.py</code> file that follows a specific format. They are usually generated from Jupyter notebooks. See the <a href="https://github.com/keras-team/keras-io/blob/master/README.md"><code>tutobooks</code> documentation</a> for more details.</p> <p>If you would like to convert a Keras 2 example to Keras 3, please open a Pull Request to the <a href="https://github.com/keras-team/keras-io">keras.io repository</a>.</p> </div> <div class='k-outline'> <div class='k-outline-depth-1'> <a href='#code-examples'>Code examples</a> </div> <div class='k-outline-depth-2'> ◆ <a href='#adding-a-new-code-example'>Adding a new code example</a> </div> </div> </div> </div> </div> </body> <footer style="float: left; width: 100%; padding: 1em; border-top: solid 1px #bbb;"> <a href="https://policies.google.com/terms">Terms</a> | <a href="https://policies.google.com/privacy">Privacy</a> </footer> </html>

Pages: 1 2 3 4 5 6 7 8 9 10