CINXE.COM

Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih - Google Developers Blog

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title> Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih - Google Developers Blog </title> <meta property="og:title" content="Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih- Google Developers Blog" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="description" content="KerasHub is a new unified library for pretrained models fostering a more cohesive ecosystem for developers." /> <meta content="summary_large_image" name="twitter:card"/> <meta content="Google for Developers Blog - News about Web, Mobile, AI and Cloud" property="twitter:title"/> <meta property="og:title" content="Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih" /> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Google for Developers Blog", "item": "https://developers.googleblog.com/" },{ "@type": "ListItem", "position": 2, "name": "Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih", "item": "http://developers.googleblog.com/id/introducing-keras-hub-for-pretrained-models/" }] } </script> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "Article", "headline": "Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih", "description": "KerasHub adalah library terpadu baru untuk model yang sudah terlatih yang mendorong ekosistem yang lebih kohesif bagi developer.", "image": "https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Keras-GfD.2e16d0ba.fill-800x400.png", "datePublished": "2024-10-22", "author": [ { "@type": "Person", "name": "Divyashree Sreepathihalli", "url": "/id/search/?author=Divyashree+Sreepathihalli" }, { "@type": "Person", "name": "Luciano Martins", "url": "/id/search/?author=Luciano+Martins" } ] } </script> <meta content="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Keras-GfD.2e16d0ba.fill-1200x600.png" property="og:image"/> <!-- Google Tag Manager --> <script type="text/javascript" src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/js/analytics.js"></script> <!-- End Google Tag Manager --> <link href="//www.gstatic.com/glue/v27_1/glue.min.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/css/dgc_blog.css"> <link rel="icon" href="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/images/favicon.ico" type="image/x-icon"> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preload" href="https://fonts.googleapis.com/css2?family=Product+Sans&family=Google+Sans+Display:ital@0;1&family=Google+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Google+Sans+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap" as="style"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Product+Sans&family=Google+Sans+Display:ital@0;1&family=Google+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Google+Sans+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400&display=swap"> <link href="https://www.gstatic.com/glue/cookienotificationbar/cookienotificationbar.min.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/css/blog_detail.css" /> <link rel="stylesheet" href="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/pygmentify/css/default.min.css"> </head> <body id="main-content" class="glue-body "> <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WVTLDSL " height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <!-- HTML --> <header class="dgc-header"> <div class="dgc-header-inner"> <button class="hamburger" aria-haspopup="true" aria-expanded="false" aria-label="Buka Menu"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#menu"></use> </svg> </button> <div class="product-name-wrapper"> <a href="https://developers.google.com/" class="site-logo-link" data-label="Site logo"> <img src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/images/g-dev.svg" class="site-logo" alt="Google for Developers"> </a> </div> <div class="desktop-nav-wrapper"> <div class="upper-tabs-wrapper"> <div class="upper-tabs"> <nav class="tabs" aria-label="Tab Atas"> <div class="tab" dropdown> <a href="//developers.google.com/products" class="top-nav-title"> Produk </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="true" aria-label="Menu dropdown untuk Produk" class="dropdown-toggle"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#arrow-drop-down"></use> </svg> </a> <div class="tabs-dropdown" aria-label="Submenu"> <div class="tabs-dropdown-content"> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Develop">Develop</li> <li class="nav-item"> <a href="//developer.android.com"> <div class="nav-item-title"> Android </div> </a> </li> <li class="nav-item"> <a href="//developer.chrome.com"> <div class="nav-item-title"> Chrome </div> </a> </li> <li class="nav-item"> <a href="//chromeos.dev/"> <div class="nav-item-title"> ChromeOS </div> </a> </li> <li class="nav-item"> <a href="//cloud.google.com"> <div class="nav-item-title"> Cloud </div> </a> </li> <li class="nav-item"> <a href="//firebase.google.com"> <div class="nav-item-title"> Firebase </div> </a> </li> <li class="nav-item"> <a href="//flutter.dev"> <div class="nav-item-title"> Flutter </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/assistant"> <div class="nav-item-title"> Google Assistant </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/maps"> <div class="nav-item-title"> Google Maps Platform </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/workspace"> <div class="nav-item-title"> Google Workspace </div> </a> </li> <li class="nav-item"> <a href="//www.tensorflow.org"> <div class="nav-item-title"> TensorFlow </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/youtube"> <div class="nav-item-title"> YouTube </div> </a> </li> </ul> </div> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Tumbuh">Tumbuh</li> <li class="nav-item"> <a href="//firebase.google.com"> <div class="nav-item-title"> Firebase </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/google-ads"> <div class="nav-item-title"> Google Ads </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/analytics"> <div class="nav-item-title"> Google Analytics </div> </a> </li> <li class="nav-item"> <a href="//developer.android.com/distribute"> <div class="nav-item-title"> Google Play </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/search"> <div class="nav-item-title"> Search </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/web/fundamentals/engage-and-retain/push-notifications"> <div class="nav-item-title"> Web Push and Notification APIs </div> </a> </li> </ul> </div> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Hasilkan Uang">Hasilkan uang</li> <li class="nav-item"> <a href="//developers.google.com/admob"> <div class="nav-item-title"> AdMob </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/google-ads/api"> <div class="nav-item-title"> Google Ads API </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/pay"> <div class="nav-item-title"> Google Pay </div> </a> </li> <li class="nav-item"> <a href="//developer.android.com/google/play/billing/"> <div class="nav-item-title"> Google Play Billing </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/interactive-media-ads"> <div class="nav-item-title"> Interactive Media Ads </div> </a> </li> </ul> </div> </div> </div> </div> <div class="tab"> <a href="//developers.google.com/solutions/catalog" class="top-nav-title"> Solusi </a> </div> <div class="tab"> <a href="//developers.google.com/events" class="top-nav-title"> Acara </a> </div> <div class="tab"> <a href="//developers.google.com/learn" class="top-nav-title"> Pelajari </a> </div> <div class="tab" dropdown> <a href="//developers.google.com/community" class="top-nav-title"> Komunitas </a> <a href="#" role="button" aria-haspopup="true" aria-expanded="true" aria-label="Menu dropdown untuk Komunitas" class="dropdown-toggle"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#arrow-drop-down"></use> </svg> </a> <div class="tabs-dropdown" aria-label="Submenu"> <div class="tabs-dropdown-content"> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Grup">Grup</li> <li class="nav-item"> <a href="//developers.google.com/community/gdg"> <div class="nav-item-title"> Google Developer Groups </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/gdsc"> <div class="nav-item-title"> Google Developer Student Clubs </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/womentechmakers"> <div class="nav-item-title"> Woman Techmakers </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/experts"> <div class="nav-item-title"> Google Developer Experts </div> </a> </li> <li class="nav-item"> <a href="//www.techequitycollective.com/"> <div class="nav-item-title"> Tech Equity Collective </div> </a> </li> </ul> </div> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Program">Program</li> <li class="nav-item"> <a href="//developers.google.com/community/accelerators"> <div class="nav-item-title"> Accelerator </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/gdsc-solution-challenge"> <div class="nav-item-title"> Solution Challenge </div> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/devfest"> <div class="nav-item-title"> DevFest </div> </a> </li> </ul> </div> <div class="tabs-dropdown-column"> <ul class="tabs-dropdown-section"> <li class="nav-title" aria-label="Menu Cerita">Cerita</li> <li class="nav-item"> <a href="//developers.google.com/community/stories"> <div class="nav-item-title"> Semua Cerita </div> </a> </li> </ul> </div> </div> </div> </div> <div class="tab"> <a href="//developers.google.com/profile/u/me" class="top-nav-title"> Program Developer </a> </div> <div class="tab"> <a href="//developers.googleblog.com/" class="top-nav-title"> Blog </a> </div> </nav> </div> </div> </div> </div> <div class="dgc-header-search"> <div class="search-wrapper glue-page"> <div class="glue-grid"> <form id="search-form" action="/id/search/" method="get" class="search-content glue-grid__col glue-grid__col--span-4-sm glue-grid__col--span-9-md glue-grid__col--span-7-lg"> <div class="search-input-wrapper"> <svg role="presentation" aria-hidden="true" class="glue-icon search-icon"> <use href="/glue-icon/#search"></use> </svg> <input type="text" name="query" placeholder="Telusuri semua artikel..." aria-label="Penelusuran" class="search-input-field" /> </div> <button class="glue-button glue-button--high-emphasis"> Penelusuran </button> </form> <div class="language-selector glue-grid__col glue-grid__col--span-4-sm glue-grid__col--span-3-md glue-grid__col--span-5-lg" aria-label="Pilih preferensi bahasa Anda"> <button type="button" aria-controls="lang-menu-header" aria-haspopup="true"> <svg role="presentation" aria-hidden="true" class="glue-icon lang-icon"> <use href="/glue-icon/#language"></use> </svg> <span class="lang-label">Bahasa Indonesia</span> <svg role="presentation" aria-hidden="true" class="glue-icon lang-icon"> <use href="/glue-icon/#arrow-drop-down"></use> </svg> </button> <div id="lang-menu-header" class="lang-menu hidden" role="menu"> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" href="/en/introducing-keras-hub-for-pretrained-models/">English</a> </li> <li role="presentation"> <a role="menuitem" lang="es" href="/es/introducing-keras-hub-for-pretrained-models/">Español (Latam)</a> </li> <li role="presentation"> <a role="menuitem" lang="id" aria-current="true" href="/id/introducing-keras-hub-for-pretrained-models/">Bahasa Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" href="/ja/introducing-keras-hub-for-pretrained-models/">日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" href="/ko/introducing-keras-hub-for-pretrained-models/">한국어</a> </li> <li role="presentation"> <a role="menuitem" lang="pt-br" href="/pt-br/introducing-keras-hub-for-pretrained-models/">Português (Brasil)</a> </li> <li role="presentation"> <a role="menuitem" lang="zh-hans" href="/zh-hans/introducing-keras-hub-for-pretrained-models/">简体中文</a> </li> </ul> </div> </div> </div> </div> </div> </header> <div class="mobile-drawer" top-level-nav> <nav class="nav-content" aria-label="Menu samping"> <div class="mobile-header"> <button class="nav-close-btn nav-btn" aria-label="Tutup navigasi"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#close"></use> </svg> </button> <button class="nav-back-btn nav-btn hidden" aria-label="Kembali ke Menu"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#arrow-back"></use> </svg> </button> <div class="product-name-wrapper"> <a href="https://developers.google.com/" class="site-logo-link" data-label="Site logo"> <img src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/images/g-dev.svg" class="site-logo" alt="Google for Developers"> </a> </div> </div> <div class="nav-wrapper"> <div class="mobile-nav-top"> <ul class="nav-list"> <li class="nav-item"> <a href="//developers.google.com/products" class="nav-title" data-label="Tab: Products"> <span class="nav-text" tooltip=""> Produk </span> </a> <ul class="nav-responsive-tabs"> <li class="nav-item"> <span tabindex="0" class="nav-title products-btn" data-label="More Products"> <span class="nav-text" menu="Products"> Lebih banyak </span> <span class="nav-icon" menu="Products"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#arrow-forward"></use> </svg> </span> </span> </li> </ul> </li> <li class="nav-item"> <a href="//developers.google.com/solutions/catalog" class="nav-title" data-label="Tab: Solutions"> <span class="nav-text" tooltip=""> Solusi </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/events" class="nav-title" data-label="Tab: Events"> <span class="nav-text" tooltip=""> Acara </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/learn" class="nav-title" data-label="Tab: Learn"> <span class="nav-text" tooltip=""> Pelajari </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community" class="nav-title" data-label="Tab: Community"> <span class="nav-text" tooltip=""> Komunitas </span> </a> <ul class="nav-responsive-tabs"> <li class="nav-item"> <span tabindex="0" class="nav-title community-btn" data-label="More Community"> <span class="nav-text" menu="Community"> Lebih banyak </span> <span class="nav-icon" menu="Community"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#arrow-forward"></use> </svg> </span> </span> </li> </ul> </li> <li class="nav-item"> <a href="//developers.google.com/profile/u/me" class="nav-title" data-label="Tab: Developer Program"> <span class="nav-text" tooltip=""> Program Developer </span> </a> </li> <li class="nav-item"> <a href="//developers.googleblog.com/" class="nav-title" data-label="Tab: Blog"> <span class="nav-text" tooltip=""> Blog </span> </a> </li> </ul> </div> <div class="mobile-nav-bottom"> <ul class="nav-list products-submenu" menu="Products" aria-label="Menu samping"> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Develop </span> </span> </li> <li class="nav-item"> <a href="//developer.android.com" class="nav-title"> <span class="nav-text"> Android </span> </a> </li> <li class="nav-item"> <a href="//developer.chrome.com" class="nav-title"> <span class="nav-text"> Chrome </span> </a> </li> <li class="nav-item"> <a href="//chromeos.dev/" class="nav-title"> <span class="nav-text"> ChromeOS </span> </a> </li> <li class="nav-item"> <a href="//cloud.google.com" class="nav-title"> <span class="nav-text"> Cloud </span> </a> </li> <li class="nav-item"> <a href="//firebase.google.com" class="nav-title"> <span class="nav-text"> Firebase </span> </a> </li> <li class="nav-item"> <a href="//flutter.dev" class="nav-title"> <span class="nav-text"> Flutter </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/assistant" class="nav-title"> <span class="nav-text"> Google Assistant </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/maps" class="nav-title"> <span class="nav-text"> Google Maps Platform </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/workspace" class="nav-title"> <span class="nav-text"> Google Workspace </span> </a> </li> <li class="nav-item"> <a href="//www.tensorflow.org" class="nav-title"> <span class="nav-text"> TensorFlow </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/youtube" class="nav-title"> <span class="nav-text"> YouTube </span> </a> </li> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Tumbuh </span> </span> </li> <li class="nav-item"> <a href="//firebase.google.com" class="nav-title"> <span class="nav-text"> Firebase </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/google-ads" class="nav-title"> <span class="nav-text"> Google Ads </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/analytics" class="nav-title"> <span class="nav-text"> Google Analytics </span> </a> </li> <li class="nav-item"> <a href="//developer.android.com/distribute" class="nav-title"> <span class="nav-text"> Google Play </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/search" class="nav-title"> <span class="nav-text"> Search </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/web/fundamentals/engage-and-retain/push-notifications" class="nav-title"> <span class="nav-text"> Web Push and Notification APIs </span> </a> </li> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Hasilkan uang </span> </span> </li> <li class="nav-item"> <a href="//developers.google.com/admob" class="nav-title"> <span class="nav-text"> AdMob </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/google-ads/api" class="nav-title"> <span class="nav-text"> Google Ads API </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/pay" class="nav-title"> <span class="nav-text"> Google Pay </span> </a> </li> <li class="nav-item"> <a href="//developer.android.com/google/play/billing/" class="nav-title"> <span class="nav-text"> Google Play Billing </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/interactive-media-ads" class="nav-title"> <span class="nav-text"> Interactive Media Ads </span> </a> </li> </ul> <ul class="nav-list community-submenu hidden" menu="Community" aria-label="Menu samping"> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Grup </span> </span> </li> <li class="nav-item"> <a href="//developers.google.com/community/gdg" class="nav-title"> <span class="nav-text"> Google Developer Groups </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/gdsc" class="nav-title"> <span class="nav-text"> Google Developer Student Clubs </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/womentechmakers" class="nav-title"> <span class="nav-text"> Woman Techmakers </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/experts" class="nav-title"> <span class="nav-text"> Google Developer Experts </span> </a> </li> <li class="nav-item"> <a href="//www.techequitycollective.com/" class="nav-title"> <span class="nav-text"> Tech Equity Collective </span> </a> </li> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Program </span> </span> </li> <li class="nav-item"> <a href="//developers.google.com/community/accelerators" class="nav-title"> <span class="nav-text"> Accelerator </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/gdsc-solution-challenge" class="nav-title"> <span class="nav-text"> Solution Challenge </span> </a> </li> <li class="nav-item"> <a href="//developers.google.com/community/devfest" class="nav-title"> <span class="nav-text"> DevFest </span> </a> </li> <li class="nav-item nav-heading"> <span class="nav-title"> <span class="nav-text"> Cerita </span> </span> </li> <li class="nav-item"> <a href="//developers.google.com/community/stories" class="nav-title" aria-label="All Stories"> <span class="nav-text"> Semua Cerita </span> </a> </li> </ul> </div> </div> </nav> <select aria-label="Ganti bahasa" name="lang-selector" id="lang-selector-nav" class="glue-form__dropdown glue-mobile-nav__lang-dropdown" onchange="window.location.href=this.value" > <option value="/en/introducing-keras-hub-for-pretrained-models/" lang="en" > English </option> <option value="/es/introducing-keras-hub-for-pretrained-models/" lang="es" > Español (Latam) </option> <option value="/id/introducing-keras-hub-for-pretrained-models/" lang="id" selected > Bahasa Indonesia </option> <option value="/ja/introducing-keras-hub-for-pretrained-models/" lang="ja" > 日本語 </option> <option value="/ko/introducing-keras-hub-for-pretrained-models/" lang="ko" > 한국어 </option> <option value="/pt-br/introducing-keras-hub-for-pretrained-models/" lang="pt-br" > Português (Brasil) </option> <option value="/zh-hans/introducing-keras-hub-for-pretrained-models/" lang="zh-hans" > 简体中文 </option> </select> </div> <div class="backdrop"></div> <div class="blog-detail-container"> <section class="tags-container glue-page glue-spacer-5-top"> <div class="glue-eyebrow"><a href="/id/search/?product_categories=Gemma">Gemma</a></div> </section> <section class="heading-container glue-page glue-spacer-1-top"> <h1 class="glue-headline glue-headline--headline-1">Memperkenalkan Keras Hub: Pusat library terpadu untuk model yang sudah terlatih</h1> </section> <section class="summary-container glue-page glue-spacer-4-top"> <div class="date-time"> <div class="published-date glue-font-weight-medium">OKT 22, 2024</div> </div> </section> <section class="glue-page glue-grid glue-spacer-1-top"> <section class="author-container glue-grid__col glue-grid__col--span-4-sm glue-grid__col--span-10-md"> <div class="author-obj"> <a class="glue-font-weight-medium" href="/id/search/?author=Divyashree+Sreepathihalli">Divyashree Sreepathihalli</a> <span class="glue-font-weight-medium role">Software Engineer</span> </div> <div class="author-obj"> <a class="glue-font-weight-medium" href="/id/search/?author=Luciano+Martins">Luciano Martins</a> <span class="glue-font-weight-medium role">Developer Advocate</span> <span class="glue-font-weight-medium team">Google AI</span> </div> </section> <section class="social-container glue-grid__col glue-grid__col--span-4-sm glue-grid__col--span-2-md"> <button id="social-button" class="glue-button glue-button--low-emphasis glue-button--icon" aria-haspopup="true" aria-expanded="false"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#share"></use> </svg> <span>Bagikan</span> </button> <ul id="social-menu" class="glue-elevation-level-1" role="menu" aria-labelledby="social-button"> <li> <a href="https://www.facebook.com/sharer/sharer.php?u={url}" title="Share on Facebook" target="_blank" rel="noopener"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--social glue-icon--32px"> <use href="/glue-icon/#post-facebook"></use> </svg> <span>Facebook</span> </a> </li> <li> <a href="https://twitter.com/intent/tweet?text={url}" title="Share on Twitter" target="_blank" rel="noopener"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--social glue-icon--32px"> <use href="/glue-icon/#twitter-x"></use> </svg> <span>Twitter</span> </a> </li> <li> <a href="https://www.linkedin.com/shareArticle?url={url}&amp;mini=true" title="Share on LinkedIn" target="_blank" rel="noopener"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--social glue-icon--32px"> <use href="/glue-icon/#post-linkedin"></use> </svg> <span>LinkedIn</span> </a> </li> <li> <a href="mailto:name@example.com?subject=Check%20out%20this%20site&body=Check%20out%20{url}" title="Send via Email"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--social glue-icon--32px"> <use href="/glue-icon/#email"></use> </svg> <span>Mail</span> </a> </li> <li> <a href="#" title="Get shareable link" data-link="" data-copy-text="Salin Link" data-copied-text="Disalin!"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--social glue-icon--32px"> <use href="/glue-icon/#link"></use> </svg> <span></span> </a> </li> </ul> </section> </section> <section class="blocks-container glue-page glue-spacer-3-top"> <div class="block"> <img class="banner-image" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Keras-GfD-Banner.original.png" alt="Keras on Google for Developers - banner" /> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Dunia deep learning berkembang begitu cepat, dengan model yang sudah terlatih menjadi semakin penting untuk berbagai macam tugas. Keras, yang dikenal dengan API-nya yang mudah digunakan dan berfokus pada aksesibilitas, berada di posisi terdepan dalam gerakan ini dengan library khusus seperti KerasNLP untuk model berbasis teks dan KerasCV untuk model computer vision.</p><p data-block-key="as7cn">Namun, karena model-model tersebut semakin mengaburkan batasan antar modalitas – bayangkan LLM chat yang kuat dengan input gambar atau tugas visi yang memanfaatkan encoder teks – mempertahankan domain yang terpisah ini semakin tidak praktis. Pemisahan antara NLP dan CV bisa menghambat pengembangan dan deployment model yang benar-benar multimodal, yang mengarah pada upaya yang berlebihan dan pengalaman pengguna yang terfragmentasi.</p> </div> <div class="inner-block-content"> <div class="image-wrapper"> <img class="regular-image" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/image3_ljbDif4.original.png" alt="keras-team/keras-hub, a unified, comprehensive library for pretrained models" /> </div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Untuk mengatasi hal ini, kami sangat senang dapat mengumumkan evolusi besar dalam ekosistem Keras: <a href="https://keras.io/keras_hub/">KerasHub</a>, sebuah library terpadu dan komprehensif untuk model yang sudah terlatih, yang akan mempermudah akses ke arsitektur NLP dan CV terbaru. KerasHub adalah repositori pusat, di sini Anda bisa mengeksplorasi dan memanfaatkan model-model termutakhir seperti BERT untuk analisis teks dan EfficientNet untuk klasifikasi gambar, semuanya dalam framework Keras yang konsisten dan familier.</p><h3 data-block-key="620os"><br/><b>Pengalaman developer yang terpadu</b></h3><p data-block-key="fklj1">Penggabungan ini tidak hanya menyederhanakan penemuan dan penggunaan model, tetapi juga mendorong ekosistem yang lebih kohesif. Dengan KerasHub, Anda bisa memanfaatkan fitur-fitur canggih, seperti publikasi dan berbagi model secara mudah, penyempurnaan LoRA untuk adaptasi yang hemat sumber daya, kuantisasi untuk performa yang dioptimalkan, dan pelatihan multi-host yang tangguh untuk menangani set data berskala besar, semuanya bisa diterapkan di berbagai macam modalitas. Ini menandai langkah signifikan menuju demokratisasi akses ke alat AI yang kuat dan mempercepat pengembangan aplikasi multimodal yang inovatif.</p><h3 data-block-key="6vq37"><br/><b>Langkah pertama dengan KerasHub</b></h3><p data-block-key="8n85p">Mari kita mulai dengan menginstal KerasHub pada sistem Anda. Dari sana, Anda bisa menjelajahi banyak koleksi <a href="https://keras.io/api/keras_hub/models/">model yang sudah tersedia</a> dan berbagai implementasi arsitektur populer. Kemudian, Anda dapat dengan mudah memuat dan menggabungkan model-model yang sudah terlatih ini ke dalam project Anda sendiri dan menyempurnakannya untuk performa yang optimal sesuai dengan kebutuhan spesifik Anda.</p><h3 data-block-key="4cu9q"><br/><b>Menginstal KerasHub</b></h3><p data-block-key="8btr5">Untuk menginstal rilis KerasHub terbaru dengan Keras 3, cukup jalankan:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="shell"><span></span>$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--upgrade<span class="w"> </span>keras-hub </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Sekarang Anda bisa mulai menjelajahi model-model yang tersedia. Penyiapan lingkungan standar untuk mulai bekerja dengan Keras 3 tidak berubah sama sekali untuk mulai menggunakan KerasHub:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">os</span> <span class="c1"># Define the Keras 3 backend you want to use - &quot;jax&quot;, &quot;tensorflow&quot; or &quot;torch&quot;</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">&quot;KERAS_BACKEND&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;jax&quot;</span> <span class="c1"># Import Keras 3 and KerasHub modules</span> <span class="kn">import</span> <span class="nn">keras</span> <span class="kn">import</span> <span class="nn">keras_hub</span> </pre></div> </div> <div class="inner-block-content rich-content"> <h2 data-block-key="u50tg">Menggunakan computer vision dan model bahasa natural dengan KerasHub</h2><p data-block-key="728q8">Sekarang Anda siap memulai KerasHub untuk mengakses dan menggunakan model-model yang tersedia di ekosistem Keras 3. Di bawah ini adalah beberapa contohnya:</p><h3 data-block-key="6b0r3"><b><br/>Gemma</b></h3><p data-block-key="87ia"><a href="https://ai.google.dev/gemma/docs/base">Gemma</a> adalah kumpulan model terbuka yang canggih, tetapi mudah diakses, yang dikembangkan oleh Google. Dengan memanfaatkan penelitian dan teknologi yang sama di balik model Gemini, model dasar Gemma unggul dalam berbagai tugas pembuatan teks. Ini termasuk menjawab pertanyaan, meringkas informasi, dan terlibat dalam penalaran logis. Selain itu, model ini bisa disesuaikan untuk memenuhi kebutuhan khusus.</p><p data-block-key="fgnpl">Dalam contoh ini Anda menggunakan Keras dan KerasHub untuk memuat dan mulai membuat konten menggunakan parameter Gemma2 2B. Untuk detail selengkapnya tentang varian Gemma, lihat <a href="https://www.kaggle.com/models/google/gemma/">kartu model Gemma</a> di Kaggle.</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="c1"># Load Gemma 2 2B preset from Kaggle models </span> <span class="n">gemma_lm</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">GemmaCausalLM</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span><span class="s2">&quot;gemma_2b_en&quot;</span><span class="p">)</span> <span class="c1"># Start generating contents with Gemma 2 2B</span> <span class="n">gemma_lm</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span><span class="s2">&quot;Keras is a&quot;</span><span class="p">,</span> <span class="n">max_length</span><span class="o">=</span><span class="mi">32</span><span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <h3 data-block-key="u50tg"><b>PaliGemma</b></h3><p data-block-key="cj0hi"><a href="https://ai.google.dev/gemma/docs/paligemma">PaliGemma</a> adalah model ringkas dan terbuka yang mampu memahami gambar dan teks. Mengambil inspirasi dari <a href="https://arxiv.org/abs/2310.09199">PaLI-3</a> dan dibangun di atas komponen open source, seperti <a href="https://arxiv.org/abs/2303.15343">model visi SigLIP</a> dan <a href="https://arxiv.org/abs/2403.08295">model bahasa Gemma</a>, PaliGemma bisa memberikan jawaban yang detail dan mendalam untuk pertanyaan-pertanyaan mengenai gambar. Ini memungkinkan pemahaman konten visual yang lebih mendalam, yang memungkinkan kemampuan seperti pembuatan teks untuk gambar dan video pendek, mengidentifikasi objek, dan bahkan membaca teks di dalam gambar.</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">os</span> <span class="c1"># Define the Keras 3 backend you want to use - &quot;jax&quot;, &quot;tensorflow&quot; or &quot;torch&quot;</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">&quot;KERAS_BACKEND&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;jax&quot;</span> <span class="c1"># Import Keras 3 and KerasHub modules</span> <span class="kn">import</span> <span class="nn">keras</span> <span class="kn">import</span> <span class="nn">keras_hub</span> <span class="kn">from</span> <span class="nn">keras.utils</span> <span class="kn">import</span> <span class="n">get_file</span><span class="p">,</span> <span class="n">load_img</span><span class="p">,</span> <span class="n">img_to_array</span> <span class="c1"># Import PaliGemma 3B fine tuned with 224x224 images</span> <span class="n">pali_gemma_lm</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">PaliGemmaCausalLM</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span> <span class="s2">&quot;pali_gemma_3b_mix_224&quot;</span> <span class="p">)</span> <span class="c1"># Download a test image and prepare it for usage with KerasHub</span> <span class="n">url</span> <span class="o">=</span> <span class="s1">&#39;https://storage.googleapis.com/keras-cv/models/paligemma/cow_beach_1.png&#39;</span> <span class="n">img_path</span> <span class="o">=</span> <span class="n">get_file</span><span class="p">(</span><span class="n">origin</span><span class="o">=</span><span class="n">url</span><span class="p">)</span> <span class="n">img</span> <span class="o">=</span> <span class="n">img_to_array</span><span class="p">(</span><span class="n">load_img</span><span class="p">(</span><span class="n">image_path</span><span class="p">))</span> <span class="c1"># Create the prompt with the question about the image</span> <span class="n">prompt</span> <span class="o">=</span> <span class="s1">&#39;answer where is the cow standing?&#39;</span> <span class="c1"># Generate the contents with PaliGemma</span> <span class="n">output</span> <span class="o">=</span> <span class="n">pali_gemma_lm</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span> <span class="n">inputs</span><span class="o">=</span><span class="p">{</span> <span class="s2">&quot;images&quot;</span><span class="p">:</span> <span class="n">img</span><span class="p">,</span> <span class="s2">&quot;prompts&quot;</span><span class="p">:</span> <span class="n">prompt</span><span class="p">,</span> <span class="p">}</span> <span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Untuk detail selengkapnya mengenai model yang sudah terlatih yang tersedia di Keras 3, lihat <a href="https://www.kaggle.com/organizations/keras/models">daftar model di Keras</a> pada Kaggle.</p><h3 data-block-key="fcv95"><br/><b>Stability.ai Stable Diffusion 3</b></h3><p data-block-key="56ia0">Anda juga memiliki model computer vision yang tersedia dan dapat digunakan. Sebagai contoh, Anda bisa menggunakan stability.ai <a href="https://stability.ai/news/stable-diffusion-3">Stable Diffusion 3</a> dengan KerasHub:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">from</span> <span class="nn">PIL</span> <span class="kn">import</span> <span class="n">Image</span> <span class="kn">from</span> <span class="nn">keras.utils</span> <span class="kn">import</span> <span class="n">array_to_img</span> <span class="kn">from</span> <span class="nn">keras_hub.models</span> <span class="kn">import</span> <span class="n">StableDiffusion3TextToImage</span> <span class="n">text_to_image</span> <span class="o">=</span> <span class="n">StableDiffusion3TextToImage</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span> <span class="s2">&quot;stable_diffusion_3_medium&quot;</span><span class="p">,</span> <span class="n">height</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">1024</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;float16&quot;</span><span class="p">,</span> <span class="p">)</span> <span class="c1"># Generate images with SD3</span> <span class="n">image</span> <span class="o">=</span> <span class="n">text_to_image</span><span class="o">.</span><span class="n">generate</span><span class="p">(</span> <span class="s2">&quot;photograph of an astronaut riding a horse, detailed, 8k&quot;</span><span class="p">,</span> <span class="p">)</span> <span class="c1"># Display the generated image</span> <span class="n">img</span> <span class="o">=</span> <span class="n">array_to_img</span><span class="p">(</span><span class="n">image</span><span class="p">)</span> <span class="n">img</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Untuk detail selengkapnya tentang model computer vision yang sudah terlatih yang tersedia di Keras 3, silakan lihat <a href="https://keras.io/api/keras_hub/models/">daftar model di Keras</a>.</p><h2 data-block-key="6bgmm"><br/>Apa yang berubah untuk developer KerasNLP?</h2><p data-block-key="b4vep">Transisi dari KerasNLP ke KerasHub adalah proses yang mudah. Proses ini hanya membutuhkan pembaruan pernyataan import dari <code>keras_nlp</code> ke <code>keras_hub</code>.</p><p data-block-key="8mod1">Contoh: Sebelumnya jika Anda mengimpor keras_nlp untuk menggunakan model BERT seperti di bawah ini</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">keras_nlp</span> <span class="c1"># Load a BERT model </span> <span class="n">classifier</span> <span class="o">=</span> <span class="n">keras_nlp</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">BertClassifier</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span> <span class="s2">&quot;bert_base_en_uncased&quot;</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Sesuaikan import, dan Anda siap menggunakan KerasHub:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">keras_hub</span> <span class="c1"># Load a BERT model </span> <span class="n">classifier</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">BertClassifier</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span> <span class="s2">&quot;bert_base_en_uncased&quot;</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <h2 data-block-key="u50tg">Apa yang berubah untuk developer KerasCV?</h2><p data-block-key="deqts">Jika saat ini Anda adalah pengguna KerasCV, melakukan update ke KerasHub akan memberi Anda manfaat berikut:</p><p data-block-key="4blku"></p><ul><li data-block-key="8g3j5"><b>Pemuatan Model yang Sederhana:</b> KerasHub menawarkan API yang konsisten untuk memuat model, yang bisa menyederhanakan kode jika Anda bekerja dengan KerasCV dan KerasNLP.</li></ul><p data-block-key="8nte9"></p><ul><li data-block-key="f8le9"><b>Fleksibilitas Framework:</b> Jika Anda tertarik menjelajahi framework yang berbeda, seperti JAX atau PyTorch, KerasHub mempermudah penggunaan model KerasCV dan KerasNLP dengan framework tersebut.</li></ul><p data-block-key="4mdot"></p><ul><li data-block-key="76h9c"><b>Repositori Terpusat:</b> Menemukan dan mengakses model akan semakin mudah dengan repositori model terpadu KerasHub dan merupakan tempat di mana arsitektur baru akan ditambahkan di masa mendatang.</li></ul><h3 data-block-key="e5gb4"><br/><b>Bagaimana cara menyesuaikan kode saya dengan KerasHub?</b></h3><h3 data-block-key="13otm">Model</h3><p data-block-key="107ui">Model-model KerasCV saat ini sedang dipindahkan ke KerasHub. Meskipun sebagian besar sudah tersedia, beberapa masih dalam proses. Harap perhatikan bahwa model <a href="https://www.kaggle.com/models/keras/centerpillar">Centerpillar</a> tidak akan dipindahkan. Anda semestinya dapat menggunakan model visi apa pun di KerasHub:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">keras_hub</span> <span class="c1"># Load a model using preset</span> <span class="n">Model</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.&lt;</span><span class="n">model_name</span><span class="o">&gt;.</span><span class="n">from_preset</span><span class="p">(</span><span class="s1">&#39;preset_name`)</span> <span class="c1"># or load a custom model by specifying the backbone and preprocessor</span> <span class="n">Model</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.&lt;</span><span class="n">model_name</span><span class="o">&gt;</span><span class="p">(</span><span class="n">backbone</span><span class="o">=</span><span class="n">backbone</span><span class="p">,</span> <span class="n">preprocessor</span><span class="o">=</span><span class="n">preprocessor</span><span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">KerasHub memperkenalkan fitur-fitur baru yang menarik untuk developer KerasCV, menawarkan fleksibilitas yang lebih besar dan kemampuan yang semakin luas. Ini termasuk:</p><h3 data-block-key="fela8"><br/>Prapemrosesan bawaan</h3><p data-block-key="6sjsv">Setiap model disertai dengan praprosesor khusus yang menangani tugas-tugas rutin termasuk mengubah ukuran, mengubah skala, dan lainnya, sehingga mempermudah alur kerja Anda.</p><p data-block-key="ai30i">Sebelumnya, prapemrosesan input dilakukan secara manual sebelum memberikan input ke model.</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="c1"># Preprocess inputs for example</span> <span class="k">def</span> <span class="nf">preprocess_inputs</span><span class="p">(</span><span class="n">image</span><span class="p">,</span> <span class="n">label</span><span class="p">):</span> <span class="c1"># Resize rescale or do more preprocessing on inputs</span> <span class="k">return</span> <span class="n">preprocessed_inputs</span> <span class="n">backbone</span> <span class="o">=</span> <span class="n">keras_cv</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">ResNet50V2Backbone</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span> <span class="s2">&quot;resnet50_v2_imagenet&quot;</span><span class="p">,</span> <span class="p">)</span> <span class="n">model</span> <span class="o">=</span> <span class="n">keras_cv</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">ImageClassifier</span><span class="p">(</span> <span class="n">backbone</span><span class="o">=</span><span class="n">backbone</span><span class="p">,</span> <span class="n">num_classes</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="p">)</span> <span class="n">output</span> <span class="o">=</span> <span class="n">model</span><span class="p">(</span><span class="n">preprocessed_input</span><span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Saat ini, prapemrosesan model tugas terintegrasi di dalam preset yang sudah ditetapkan. Input menjalani prapemrosesan, di sini gambar contoh mengalami pengubahan ukuran dan penskalaan ulang dalam praprosesor. Praprosesor adalah komponen intrinsik model tugas. Meskipun demikian, Anda memiliki opsi untuk menggunakan praprosesor yang dipersonalisasi.</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="n">classifier</span> <span class="o">=</span> <span class="n">keras_hub</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">ImageClassifier</span><span class="o">.</span><span class="n">from_preset</span><span class="p">(</span><span class="s1">&#39;resnet_18_imagenet&#39;</span><span class="p">)</span> <span class="n">classifier</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">inputs</span><span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <h3 data-block-key="u50tg">Fungsi loss</h3><p data-block-key="5qhd">Mirip dengan lapisan augmentasi, fungsi loss yang sebelumnya ada di KerasCV sekarang tersedia di Keras melalui <code>keras.losses.&lt;loss_function&gt;</code>. Sebagai contoh, jika saat ini Anda menggunakan <a href="https://keras.io/api/keras_cv/losses/focal_loss/">fungsi FocalLoss</a>:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">keras</span> <span class="kn">import</span> <span class="nn">keras_cv</span> <span class="n">keras_cv</span><span class="o">.</span><span class="n">losses</span><span class="o">.</span><span class="n">FocalLoss</span><span class="p">(</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.25</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">from_logits</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">label_smoothing</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> <span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <p data-block-key="u50tg">Anda hanya perlu menyesuaikan kode definisi fungsi loss Anda agar menggunakan <code>keras.losses</code> sebagai ganti <code>keras_cv.losses</code>:</p> </div> <div class="inner-block-content code-block"> <div class="highlight"><pre class="python"><span></span><span class="kn">import</span> <span class="nn">keras</span> <span class="n">keras</span><span class="o">.</span><span class="n">losses</span><span class="o">.</span><span class="n">FocalLoss</span><span class="p">(</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.25</span><span class="p">,</span> <span class="n">gamma</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">from_logits</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">label_smoothing</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span> <span class="p">)</span> </pre></div> </div> <div class="inner-block-content rich-content"> <h2 data-block-key="u50tg"><b>Memulai dengan KerasHub</b></h2><p data-block-key="e16fi">Masuki dunia KerasHub sekarang juga:</p><p data-block-key="e3thf"></p><ul><li data-block-key="22sc3"><b>Mulai dengan dokumentasi:</b><a href="https://keras.io/keras_hub/"> https://keras.io/keras_hub/</a></li></ul><p data-block-key="3nqt6"></p><ul><li data-block-key="bsh6s"><b>Periksa panduan memulai untuk KerasHub:</b> <a href="https://keras.io/guides/keras_hub/">https://keras.io/guides/keras_hub/</a></li></ul><p data-block-key="56fd8"></p><ul><li data-block-key="atjro"><b>Bereksperimen dengan model yang sudah terlatih:</b> <a href="https://keras.io/api/keras_hub/models/">https://keras.io/api/keras_hub/models/</a></li></ul><p data-block-key="dqjhr"></p><ul><li data-block-key="6vhaq"><b>Jelajahi kode sumber dan berkontribusi:</b><a href="https://github.com/keras-team/keras-hub/"> https://github.com/keras-team/keras-hub/</a></li></ul><p data-block-key="elc5i"></p><ul><li data-block-key="19vfn"><b>Masuk ke Keras di Kaggle:</b> <a href="https://www.kaggle.com/organizations/keras">https://www.kaggle.com/organizations/keras</a></li></ul><p data-block-key="3adku"><br/>Bergabunglah dengan komunitas Keras dan buka kekuatan model deep learning yang terpadu, mudah diakses, dan efisien. Masa depan AI adalah multimodal, dan KerasHub adalah pintu gerbang Anda menuju masa depan tersebut!</p> </div> </div> </section> <section class="navigation-container glue-page glue-spacer-6-top"> <div class="posted-in-section"> <div class="posted-in-section__heading"> <span class="glue-caption"> diposting di: </span> </div> <div class="posted-in-section__tags"> <ul> <li> <a href="/id/search/?product_categories=Gemma" class="glue-caption">Gemma</a> </li> <li> <a href="/id/search/?technology_categories=AI" class="glue-caption">AI</a> </li> <li> <a href="/id/search/?content_type_categories=Announcements" class="glue-caption">Announcements</a> </li> <li> <a href="/id/search/?content_type_categories=Best+Practices" class="glue-caption">Best Practices</a> </li> <li> <a href="/id/search/?tag=Keras" class="glue-caption">Keras</a> </li> <li> <a href="/id/search/?tag=Learn" class="glue-caption">Learn</a> </li> <li> <a href="/id/search/?tag=multimodal" class="glue-caption">multimodal</a> </li> <li> <a href="/id/search/?tag=PaliGemma" class="glue-caption">PaliGemma</a> </li> <li> <a href="/id/search/?tag=quantization" class="glue-caption">quantization</a> </li> <li> <a href="/id/search/?tag=Stable Diffusion" class="glue-caption">Stable Diffusion</a> </li> <li> <a href="/id/search/?tag=multi-host training" class="glue-caption">multi-host training</a> </li> <li> <a href="/id/search/?tag=deep learning" class="glue-caption">deep learning</a> </li> <li> <a href="/id/search/?tag=fine-tuning" class="glue-caption">fine-tuning</a> </li> <li> <a href="/id/search/?tag=LoRA" class="glue-caption">LoRA</a> </li> </ul> </div> </div> <div class="buttons-section"> <div class="buttons-section__left"> <a href="/id/evolving-the-responsible-generative-ai-toolkit-with-new-tools-for-every-llm/" class="glue-button--icon glue-elevation-level-1 " aria-label="Sebelumnya"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#chevron-left"></use> </svg> </a> <span class="caption ">Sebelumnya</span> </div> <div class="buttons-section__right"> <span class="caption ">Berikutnya</span> <a href="/id/compare-mode-in-google-ai-studio/" class="glue-button--icon glue-elevation-level-1 " aria-label="Berikutnya"> <svg role="presentation" aria-hidden="true" class="glue-icon"> <use href="/glue-icon/#chevron-right"></use> </svg> </a> </div> </div> </section> <section class="related-posts-container glue-page glue-spacer-6-top glue-spacer-3-bottom"> <span class="glue-headline glue-headline--headline-3">Postingan Terkait</span> <div class="related-posts-container__carousel glue-page glue-spacer-5-top"> <div class="glue-carousel glue-carousel--cards glue-carousel-related-posts" aria-label="Postingan Terkait"> <!-- Previous --> <button class="glue-carousel__button glue-carousel__button--prev" aria-label="Ke slide sebelumnya"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--32px"> <use href="/glue-icon/#chevron-left"></use> </svg> </button> <!-- Next --> <button class="glue-carousel__button glue-carousel__button--next" aria-label="Ke slide berikutnya"> <svg role="presentation" aria-hidden="true" class="glue-icon glue-icon--32px"> <use href="/glue-icon/#chevron-right"></use> </svg> </button> <!-- List --> <div class="glue-carousel__viewport"> <div class="glue-carousel__list"> <a class="glue-card glue-carousel__item" href="/id/enhancing-ai-powered-developer-tools-with-gemini-api/"> <div aria-label="Enhancing AI Powered Developer Tools with Gemini API" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Enhancing AI Powered Developer Tools with Gemini API" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Gemini-API-Sublayer.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">Gemini</span> <span class="glue-label">AI</span> <span class="glue-label">Cloud</span> <span class="glue-label">Case Studies</span> <span class="glue-label">Announcements</span> </div> <p class="glue-headline glue-headline--headline-5">Enhancing AI Powered Developer Tools with Gemini API</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">14 Nov. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> <a class="glue-card glue-carousel__item" href="/id/announcing-the-winners-of-the-gemini-api-developer-competition/"> <div aria-label="Announcing the Winners of the Gemini API Developer Competition!" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Announcing the Winners of the Gemini API Developer Competition!" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Gemini_Competition_G4D_-_meta.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">Mobile</span> <span class="glue-label">Web</span> <span class="glue-label">Case Studies</span> <span class="glue-label">Community</span> </div> <p class="glue-headline glue-headline--headline-5">Announcing the Winners of the Gemini API Developer Competition!</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">21 Nov. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> <a class="glue-card glue-carousel__item" href="/id/inference-with-gemma-using-dataflow-and-vllm/"> <div aria-label="Inferensi dengan Gemma menggunakan Dataflow dan vLLM" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Inferensi dengan Gemma menggunakan Dataflow dan vLLM" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Gemma-Dataflow-ML-vLLM.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">Gemma</span> <span class="glue-label">AI</span> <span class="glue-label">Cloud</span> <span class="glue-label">How-To Guides</span> <span class="glue-label">Problem-Solving</span> </div> <p class="glue-headline glue-headline--headline-5">Inferensi dengan Gemma menggunakan Dataflow dan vLLM</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">13 Nov. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> <a class="glue-card glue-carousel__item" href="/id/farewell-and-thank-you-for-the-continued-partnership-francois-chollet/"> <div aria-label="Selamat tinggal dan terima kasih atas kemitraan yang berkelanjutan, Francois Chollet!" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Selamat tinggal dan terima kasih atas kemitraan yang berkelanjutan, Francois Chollet!" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/GfD-Keras-Metadata_2.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">AI</span> <span class="glue-label">Announcements</span> </div> <p class="glue-headline glue-headline--headline-5">Selamat tinggal dan terima kasih atas kemitraan yang berkelanjutan, Francois Chollet!</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">13 Nov. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> <a class="glue-card glue-carousel__item" href="/id/advancing-multilingual-ai-with-gemma-2-and-a-150k-challenge/"> <div aria-label="Menuju Pemahaman Global – Memajukan AI Multibahasa dengan Gemma 2 dan Tantangan $150.000" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Menuju Pemahaman Global – Memajukan AI Multibahasa dengan Gemma 2 dan Tantangan $150.000" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/Gemma-Header.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">Gemma</span> <span class="glue-label">AI</span> <span class="glue-label">Announcements</span> </div> <p class="glue-headline glue-headline--headline-5">Menuju Pemahaman Global – Memajukan AI Multibahasa dengan Gemma 2 dan Tantangan $150.000</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">3 Okt. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> <a class="glue-card glue-carousel__item" href="/id/join-us-at-the-women-in-ai-summit-2024/"> <div aria-label="Join us at the Women in AI Summit 2024!" class="glue-card__inner"> <picture class="glue-card__asset"> <img alt="Join us at the Women in AI Summit 2024!" src="https://storage.googleapis.com/gweb-developer-goog-blog-assets/images/WAI-2024-Feature.2e16d0ba.fill-800x400.png"> </picture> <div class="glue-card__content"> <div class="glue-card__tags glue-spacer-2-top"> <span class="glue-label">AI</span> <span class="glue-label">Community</span> <span class="glue-label">Events</span> </div> <p class="glue-headline glue-headline--headline-5">Join us at the Women in AI Summit 2024!</p> <div class="glue-card__cta-custom glue-spacer-3-top"> <span class="glue-cta">22 Nov. 2024</span> <svg aria-hidden="true" class="glue-icon glue-icon--24px" role="presentation"> <use href="/glue-icon/#arrow-forward"></use> </svg> </div> </div> </div> </a> </div> </div> <!-- Navigation dots --> <div class="glue-carousel__navigation" aria-label="Choose a page" data-glue-carousel-navigation-label="Selected tab $glue_carousel_page_number$ of $glue_carousel_page_total$"> </div> </div> </div> </section> </div> <div class="footer-linkboxes__wrapper"> <nav class="footer-linkboxes" aria-label="Link footer"> <ul class="footer-linkboxes__list"> <li class="footer-linkbox"> <span class="footer-linkbox-heading"> Terhubung </span> <ul class="footer-linkbox-list"> <li class="footer-linkbox-list__item"> <a href="//googledevelopers.blogspot.com" class="footer-linkbox-list__link"> Blog </a> </li> <li class="footer-linkbox-list__item"> <a href="https://goo.gle/googlefordevs" class="footer-linkbox-list__link"> Instagram </a> </li> <li class="footer-linkbox-list__item"> <a href="https://goo.gle/gdevs-li" class="footer-linkbox-list__link"> LinkedIn </a> </li> <li class="footer-linkbox-list__item"> <a href="https://goo.gle/gdevs-tw" class="footer-linkbox-list__link"> Twitter </a> </li> <li class="footer-linkbox-list__item"> <a href="https://goo.gle/developers" class="footer-linkbox-list__link"> YouTube </a> </li> </ul> </li> <li class="footer-linkbox"> <span class="footer-linkbox-heading"> Program </span> <ul class="footer-linkbox-list"> <li class="footer-linkbox-list__item"> <a href="//www.womentechmakers.com" class="footer-linkbox-list__link"> Women Techmakers </a> </li> <li class="footer-linkbox-list__item"> <a href="//developers.google.com/community/gdg" class="footer-linkbox-list__link"> Google Developer Groups </a> </li> <li class="footer-linkbox-list__item"> <a href="//developers.google.com/community/experts" class="footer-linkbox-list__link"> Google Developer Experts </a> </li> <li class="footer-linkbox-list__item"> <a href="//developers.google.com/community/accelerators" class="footer-linkbox-list__link"> Accelerators </a> </li> <li class="footer-linkbox-list__item"> <a href="//developers.google.com/community/gdsc" class="footer-linkbox-list__link"> Google Developer Student Clubs </a> </li> </ul> </li> <li class="footer-linkbox"> <span class="footer-linkbox-heading"> Konsol developer </span> <ul class="footer-linkbox-list"> <li class="footer-linkbox-list__item"> <a href="//console.developers.google.com" class="footer-linkbox-list__link"> Google API Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//console.cloud.google.com" class="footer-linkbox-list__link"> Google Cloud Platform Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//play.google.com/apps/publish" class="footer-linkbox-list__link"> Google Play Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//console.firebase.google.com" class="footer-linkbox-list__link"> Firebase Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//console.actions.google.com" class="footer-linkbox-list__link"> Actions on Google Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//cast.google.com/publish" class="footer-linkbox-list__link"> Cast SDK Developer Console </a> </li> <li class="footer-linkbox-list__item"> <a href="//chrome.google.com/webstore/developer/dashboard" class="footer-linkbox-list__link"> Chrome Web Store Dashboard </a> </li> </ul> </li> </ul> </nav> </div> <div class="footer-utility__wrapper"> <div> <nav class="footer-sites" aria-label="Situs Google Developers lainnya"> <a href="https://developers.google.com/" class="site-logo-link" data-label="Site logo"> <img src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/images/g-dev.svg" class="site-logo" alt="Google for Developers"> </a> <ul class="footer-sites-list"> <li class="footer-sites-item"> <a href="//developer.android.com" class="footer-sites-link"> Android </a> </li> <li class="footer-sites-item"> <a href="//developer.chrome.com/home" class="footer-sites-link"> Chrome </a> </li> <li class="footer-sites-item"> <a href="//firebase.google.com" class="footer-sites-link"> Firebase </a> </li> <li class="footer-sites-item"> <a href="//cloud.google.com" class="footer-sites-link"> Google Cloud Platform </a> </li> <li class="footer-sites-item"> <a href="//developers.google.com/products" class="footer-sites-link"> All products </a> </li> <li class="footer-sites-item"> <button aria-hidden="true" class="glue-cookie-notification-bar-control footer-sites-link"> Manage cookies </button> </li> </ul> </nav> <nav class="footer-utility-links"> <ul class="footer-utility-list"> <li class="footer-utility-item"> <a href="//developers.google.com/terms/site-terms" class="footer-utility-link"> Persyaratan </a> </li> <li class="footer-utility-item"> <a href="//policies.google.com/privacy" class="footer-utility-link"> Privasi </a> </li> </ul> <div class="language-selector footer" aria-label="Pilih preferensi bahasa Anda"> <button type="button" aria-controls="lang-selector-footer" aria-haspopup="true"> <svg role="presentation" aria-hidden="true" class="glue-icon lang-icon"> <use href="/glue-icon/#language"></use> </svg> <span class="lang-label">Bahasa Indonesia</span> <svg role="presentation" aria-hidden="true" class="glue-icon lang-icon"> <use href="/glue-icon/#arrow-drop-down"></use> </svg> </button> <div id="lang-selector-footer" class="lang-menu hidden" role="menu"> <ul role="presentation"> <li role="presentation"> <a role="menuitem" lang="en" href="/en/introducing-keras-hub-for-pretrained-models/">English</a> </li> <li role="presentation"> <a role="menuitem" lang="es" href="/es/introducing-keras-hub-for-pretrained-models/">Español (Latam)</a> </li> <li role="presentation"> <a role="menuitem" lang="id" aria-current="true" href="/id/introducing-keras-hub-for-pretrained-models/">Bahasa Indonesia</a> </li> <li role="presentation"> <a role="menuitem" lang="ja" href="/ja/introducing-keras-hub-for-pretrained-models/">日本語</a> </li> <li role="presentation"> <a role="menuitem" lang="ko" href="/ko/introducing-keras-hub-for-pretrained-models/">한국어</a> </li> <li role="presentation"> <a role="menuitem" lang="pt-br" href="/pt-br/introducing-keras-hub-for-pretrained-models/">Português (Brasil)</a> </li> <li role="presentation"> <a role="menuitem" lang="zh-hans" href="/zh-hans/introducing-keras-hub-for-pretrained-models/">简体中文</a> </li> </ul> </div> </div> </nav> </div> </div> <script src="https://www.youtube.com/player_api"></script> <script src="//www.gstatic.com/glue/v27_1/glue.min.js"></script> <script type="text/javascript" src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/js/dgc_blog.js"></script> <script src="https://www.gstatic.com/glue/cookienotificationbar/cookienotificationbar.min.js" data-glue-cookie-notification-bar-category="2A" data-glue-cookie-notification-bar-site-id="developers.googleblog.com"> </script> <script src="https://storage.googleapis.com/gweb-developer-goog-blog-cms-assets/f677f1b8-8552-4a23-83cc-57c36dbaf782/js/blog_detail.js"></script> </body> </html>

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