{"id":88005,"date":"2021-09-02T09:00:20","date_gmt":"2021-09-02T16:00:20","guid":{"rendered":""},"modified":"2025-05-29T14:49:09","modified_gmt":"2025-05-29T21:49:09","slug":"onnx-runtime-web-running-your-machine-learning-model-in-browser","status":"publish","type":"post","link":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/","title":{"rendered":"ONNX Runtime Web\u2014running your machine learning model in browser"},"content":{"rendered":"\n<p>We are introducing <a href=\"https:\/\/github.com\/microsoft\/onnxruntime\/tree\/master\/js\/web#readme\" target=\"_blank\" rel=\"noreferrer noopener\">ONNX Runtime Web<\/a> (ORT Web), a new feature in ONNX Runtime to enable JavaScript developers to run and deploy machine learning models in browsers. It also helps enable new classes of on-device computation. ORT Web will be replacing the soon to be deprecated onnx.js, with improvements such as a more consistent developer experience between packages for server-side and client-side inferencing and improved inference performance and model coverage. This blog gives you a quick overview of ORT Web, as well as getting started resources for trying it out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a-glance-at-onnx-runtime-ort\">A glance at ONNX Runtime (ORT)<\/h2>\n\n\n\n<p><a href=\"https:\/\/onnxruntime.ai\/\">ONNX Runtime<\/a> is a high-performance cross-platform inference engine to run all kinds of machine learning models. It supports all the most popular training frameworks including TensorFlow, PyTorch, SciKit Learn, and more. ONNX Runtime aims to provide an easy-to-use experience for AI developers to run models on various hardware and software platforms. Beyond accelerating server-side inference, ONNX Runtime for Mobile is available since ONNX Runtime 1.5. Now ORT Web is a new offering with the ONNX Runtime 1.8 release, focusing on in-browser inference.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"in-browser-inference-with-ort-web\">In-browser inference with ORT Web<\/h2>\n\n\n\n<p>Running machine-learning-powered web applications in browsers has drawn a lot of attention from the AI community. It is challenging to make native AI applications portable to multiple platforms given the variations in programming languages and deployment environments. Web applications can easily enable cross-platform portability with the same implementation through the browser. Additionally, running machine learning models in browsers can accelerate performance by reducing server-client communications and simplify the distribution experience without needing any additional libraries and driver installations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how-does-it-work\">How does it work?<\/h3>\n\n\n\n<p>ORT Web accelerates model inference in the browser on both CPUs and GPUs, through WebAssembly (WASM) and WebGL backends separately. For CPU inference, ORT Web compiles the native ONNX Runtime CPU engine into the WASM backend by using Emscripten. WebGL is a popular standard for accessing GPU capabilities and adopted by ORT Web for achieving high performance on GPUs.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/08\/Figure-1.png\" alt=\"Figure 1: ORT Web Overview\"\/><figcaption class=\"wp-element-caption\"><em><strong>Figure 1:<\/strong> ORT web overview.<\/em><\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"webassembly-wasm-backend-for-cpu\">WebAssembly (WASM) backend for CPU<\/h3>\n\n\n\n<p>WebAssembly allows you to use server-side code on the client-side in the browser. Before WebAssembly only JavaScript was available in the browser. There are some advantages of WebAssembly compared to JavaScript such as faster load time and execution efficiency. Furthermore, WebAssembly supports multi-threading by utilizing SharedArrayBuffer, Web Worker, and <a href=\"https:\/\/github.com\/WebAssembly\/simd\" target=\"_blank\" rel=\"noreferrer noopener\">SIMD128<\/a> (128-bits Single Instruction Multiple Data) to accelerate bulk data processing. This makes WebAssembly&nbsp;an attractive technique to execute the model at near-native speed on the web.<\/p>\n\n\n\n<p>We leverage <a href=\"https:\/\/emscripten.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Emscripten<\/a>, an open-source compiler toolchain, to compile ONNXRuntime C++ code into WebAssembly so that they can be loaded in browsers. This allows us to reuse the ONNX Runtime core and native CPU engine. By doing that ORT Web WASM backend can run any ONNX model and support most functionalities native ONNX Runtime offers, including full ONNX operator coverage, <a href=\"https:\/\/www.onnxruntime.ai\/docs\/how-to\/quantization.html\" target=\"_blank\" rel=\"noreferrer noopener\">quantized ONNX model<\/a>, and&nbsp;mini runtime. We utilize multi-threading and features in WebAssembly to further accelerate model inferencing. Note that SIMD is a new feature and isn&#8217;t yet available in all browsers with WebAssembly support. The browsers supporting new WebAssembly features could be found on the <a href=\"https:\/\/webassembly.org\/roadmap\/\" target=\"_blank\" rel=\"noreferrer noopener\">webassembly.org<\/a>&nbsp;website.<\/p>\n\n\n\n<p>During initialization, ORT Web checks the capabilities of the runtime environment to detect whether multi-threading and SIMD features are available. If not, there is a fallback version based on the environment. Taking Mobilenet V2 as an example, the CPU inference performance can be accelerated by 3.4x with two threads together with SIMD enabled, comparing the pure WebAssembly without enabling these two features.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Figure-2-1024x112.webp\" alt=\"Figure 2: 3.4x performance acceleration on CPU with multi-threading and SIMD enabled in WebAssembly (Test machine: Processor Intel(R) Xeon(R) CPU E3-1230 v5 @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s))\"\/><figcaption class=\"wp-element-caption\"><em><strong>Figure 2:<\/strong> 3.4x performance acceleration on CPU with multi-threading and SIMD enabled in WebAssembly (Test machine: Processor Intel(R) Xeon(R) CPU E3-1230 v5 @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)).<\/em><\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"webgl-backend-for-gpu\">WebGL backend for GPU<\/h3>\n\n\n\n<p>WebGL is a JavaScript API that conforms to OpenGL ES 2.0 standard, which is supported by all major browsers and on various platforms including Windows, Linux, macOS, Android, and iOS. The GPU backend of ORT Web is built on WebGL and works with a variety of supported environments. This enables users to seamlessly port their deep learning models across different platforms.<\/p>\n\n\n\n<p>In addition to portability, the ORT WebGL backend offers superior inference performance by deploying the following optimizations: pack mode, data cache, code cache, and node fusion. Pack mode reduces up to 75 percent memory footprint while improving parallelism. To avoid creating the same GPU data multiple times, ORT Web reuses as much GPU data (texture) as possible. WebGL uses OpenGL Shading Language (GLSL) to construct shaders to execute GPU programs. However, shaders must be compiled at runtime, introducing unacceptably high overhead. The code cache addresses this issue by ensuring each shader will be compiled only once. WebGL backend is capable of quite a few typical node fusions and has plans to take advantage of the graph optimization infrastructure to support a large collection of graph-based optimizations.<\/p>\n\n\n\n<p>All ONNX operators are supported by the WASM backend but a subset by the WebGL backend. You can get <a href=\"https:\/\/github.com\/microsoft\/onnxruntime\/tree\/master\/js\/web#operators\" target=\"_blank\" rel=\"noreferrer noopener\">supported operators by each backend<\/a>. And below are the compatible platforms that each backend supports in ORT Web.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Figure-3.jpg\" alt=\"Figure 3: Compatible platforms that ORT Web supports.\"\/><figcaption class=\"wp-element-caption\"><em><strong>Figure 3:<\/strong> Compatible platforms that ORT Web supports.<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"get-started\">Get started<\/h2>\n\n\n\n<p>In this section, we\u2019ll show you how you can incorporate ORT Web to build machine-learning-powered web applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"get-an-onnx-model\">Get an ONNX model<\/h3>\n\n\n\n<p>Thanks to the framework interoperability of ONNX, you can convert a model trained in <a href=\"https:\/\/github.com\/onnx\/tutorials#converting-to-onnx-format\" target=\"_blank\" rel=\"noreferrer noopener\">any framework supporting ONNX<\/a> to ONNX format. <a href=\"https:\/\/pytorch.org\/docs\/stable\/onnx.html\" target=\"_blank\" rel=\"noreferrer noopener\">Torch.onnx.export<\/a> is the built-in API in PyTorch for model exporting to ONNX and <a href=\"https:\/\/github.com\/onnx\/tensorflow-onnx\" target=\"_blank\" rel=\"noreferrer noopener\">Tensorflow-ONNX<\/a> is a standalone tool for TensorFlow and TensorFlow Lite to ONNX model conversion. Also, there are various pre-trained ONNX models covering common scenarios in the <a href=\"https:\/\/github.com\/onnx\/models\" target=\"_blank\" rel=\"noreferrer noopener\">ONNX Model Zoo<\/a> for a quick start.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"inference-onnx-model-in-the-browser\">Inference ONNX model in the browser<\/h3>\n\n\n\n<p>There are two ways to use ORT-Web, through a <a href=\"https:\/\/github.com\/microsoft\/onnxruntime-inference-examples\/tree\/main\/js\/quick-start_onnxruntime-web-script-tag\" target=\"_blank\" rel=\"noreferrer noopener\">script tag<\/a> or <a href=\"https:\/\/github.com\/microsoft\/onnxruntime-inference-examples\/tree\/main\/js\/quick-start_onnxruntime-web-bundler\" target=\"_blank\" rel=\"noreferrer noopener\">a bundler<\/a>. The APIs in ORT Web to score the model are similar to the native ONNX Runtime, first creating an ONNX Runtime inference session with the model and then running the session with input data. By providing a consistent development experience, we aim to save time and effort for developers to integrate ML into applications and services for different platforms through ONNX Runtime.<\/p>\n\n\n\n<p>The following code snippet shows how to call ORT Web API to inference a model with different backends.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\nconst ort = require('onnxruntime-web');\n\n\/\/ create an inference session, using WebGL backend. (default is 'wasm')\nconst session = await ort.InferenceSession.create('.\/model.onnx', { executionProviders: ['webgl'] });\n\u2026\n\/\/ feed inputs and run\nconst results = await session.run(feeds);\n<\/pre><\/div>\n\n\n<p><em><strong>Figure 4:<\/strong> Code snippet of ORT Web APIs.<\/em><\/p>\n\n\n\n<p>Some advanced features can be configured via setting properties of object <a href=\"https:\/\/github.com\/microsoft\/onnxruntime\/blob\/master\/js\/common\/lib\/env.ts\" target=\"_blank\" rel=\"noreferrer noopener\">`ort.env`<\/a>, such as setting the maximum thread number and enabling\/disabling SIMD.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; auto-links: false; gutter: false; title: ; quick-code: false; notranslate\" title=\"\">\n\/\/ set maximum thread number for WebAssembly backend. Setting to 1 to disable multi-threads\nort.wasm.numThreads = 1;\n\n\/\/ set flag to enable\/disable SIMD (default is true)\nort.wasm.simd = false;\n<\/pre><\/div>\n\n\n<p><em><strong>Figure 5:<\/strong> Code snippet of properties setting in ORT Web.<\/em><\/p>\n\n\n\n<p>Pre- and post-processing needs to be handled in JS before inputs are fed into ORT Web for inference. <a href=\"https:\/\/microsoft.github.io\/onnxruntime-web-demo\/#\/\" target=\"_blank\" rel=\"noreferrer noopener\">ORT Web Demo<\/a> shows several interesting In-Browser vision scenarios powered by image models with ORT Web. You can find the <a href=\"https:\/\/github.com\/microsoft\/onnxruntime-web-demo\/\" target=\"_blank\" rel=\"noreferrer noopener\">code source<\/a> including image input processing and inference through ORT Web. Another <a href=\"https:\/\/github.com\/microsoft\/ML-For-Beginners\/tree\/main\/4-Classification\/4-Applied\" target=\"_blank\" rel=\"noreferrer noopener\">E2E tutorial<\/a> is created by the Cloud Advocate curriculum team about building a Cuisine Recommender Web App with ORT Web. It goes through exporting a Scikit-Learn model to ONNX as well as running this model with ORT Web using script tag.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/08\/Figure-6.png\" alt=\"Figure 6: A cuisine recommender web app with ORT Web.\"\/><figcaption class=\"wp-element-caption\"><em><strong>Figure 6:<\/strong> A cuisine recommender web app with ORT Web.<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"looking-forward\">Looking forward<\/h2>\n\n\n\n<p>We hope this has inspired you to try out ORT Web in your web applications. We would love to hear your suggestions and feedback. You can participate or leave comments in our GitHub repos (<a href=\"https:\/\/github.com\/microsoft\/onnxruntime\" target=\"_blank\" rel=\"noreferrer noopener\">ONNX Runtime<\/a>). We continue to work on and improve the performance, model coverage as well as adding new features. On-device training is another interesting possibility we want to research for ORT Web. Stay tuned for our updates.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are introducing ONNX Runtime Web (ORT Web), a new feature in ONNX Runtime to enable JavaScript developers to run and deploy machine learning models in browsers. It also helps enable new classes of on-device computation. ORT Web will be replacing the soon to be deprecated onnx.<\/p>\n","protected":false},"author":5562,"featured_media":88188,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"msxcm_post_with_no_image":false,"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","footnotes":""},"post_tag":[1869,1824,1866],"content-type":[361],"topic":[2238,2240],"programming-languages":[2260],"coauthors":[699,1860,1863],"class_list":["post-88005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-browser","tag-onnx-runtime","tag-web-inference","content-type-project-updates","topic-ai-machine-learning","topic-application-development","programming-languages-javascript","review-flag-1593580428-734","review-flag-1593580419-521","review-flag-1-1593580432-963","review-flag-2-1593580437-411","review-flag-3-1593580442-169","review-flag-4-1593580448-609","review-flag-5-1593580453-725","review-flag-6-1593580457-852","review-flag-8-1593580468-572","review-flag-disab-1706240524-342","review-flag-integ-1593580288-449","review-flag-lever-1593580265-989","review-flag-machi-1680214156-53","review-flag-ml-1680214110-748","review-flag-new-1593580248-669","review-flag-perce-1706214400-122"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog\" \/>\n<meta property=\"og:description\" content=\"We are introducing ONNX Runtime Web (ORT Web), a new feature in ONNX Runtime to enable JavaScript developers to run and deploy machine learning models in browsers. It also helps enable new classes of on-device computation. ORT Web will be replacing the soon to be deprecated onnx.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Open Source Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-02T16:00:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-29T21:49:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1135\" \/>\n\t<meta property=\"og:image:height\" content=\"744\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Emma Ning, Yulong Wang, Du Li\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@OpenAtMicrosoft\" \/>\n<meta name=\"twitter:site\" content=\"@OpenAtMicrosoft\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Emma Ning, Yulong Wang, Du Li\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 min read\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\"},\"author\":[{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/author\/emma-ning\/\",\"@type\":\"Person\",\"@name\":\"Emma Ning\"},{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/author\/yulong-wang\/\",\"@type\":\"Person\",\"@name\":\"Yulong Wang\"},{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/author\/du-li\/\",\"@type\":\"Person\",\"@name\":\"Du Li\"}],\"headline\":\"ONNX Runtime Web\u2014running your machine learning model in browser\",\"datePublished\":\"2021-09-02T16:00:20+00:00\",\"dateModified\":\"2025-05-29T21:49:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\"},\"wordCount\":1264,\"publisher\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\",\"keywords\":[\"Browser\",\"ONNX Runtime\",\"Web inference\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\",\"name\":\"ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog\",\"isPartOf\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\",\"datePublished\":\"2021-09-02T16:00:20+00:00\",\"dateModified\":\"2025-05-29T21:49:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\",\"contentUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg\",\"width\":1135,\"height\":744,\"caption\":\"graphical user interface, application\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/opensource.microsoft.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ONNX Runtime Web\u2014running your machine learning model in browser\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#website\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/\",\"name\":\"Microsoft Open Source Blog\",\"description\":\"Open dialogue about openness at Microsoft \u2013 open source, standards, interoperability\",\"publisher\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/opensource.microsoft.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\",\"name\":\"Microsoft Open Source Blog\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"contentUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"width\":259,\"height\":194,\"caption\":\"Microsoft Open Source Blog\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/OpenAtMicrosoft\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/","og_locale":"en_US","og_type":"article","og_title":"ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog","og_description":"We are introducing ONNX Runtime Web (ORT Web), a new feature in ONNX Runtime to enable JavaScript developers to run and deploy machine learning models in browsers. It also helps enable new classes of on-device computation. ORT Web will be replacing the soon to be deprecated onnx.","og_url":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/","og_site_name":"Microsoft Open Source Blog","article_published_time":"2021-09-02T16:00:20+00:00","article_modified_time":"2025-05-29T21:49:09+00:00","og_image":[{"width":1135,"height":744,"url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","type":"image\/jpeg"}],"author":"Emma Ning, Yulong Wang, Du Li","twitter_card":"summary_large_image","twitter_image":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","twitter_creator":"@OpenAtMicrosoft","twitter_site":"@OpenAtMicrosoft","twitter_misc":{"Written by":"Emma Ning, Yulong Wang, Du Li","Est. reading time":"5 min read"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#article","isPartOf":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/"},"author":[{"@id":"https:\/\/opensource.microsoft.com\/blog\/author\/emma-ning\/","@type":"Person","@name":"Emma Ning"},{"@id":"https:\/\/opensource.microsoft.com\/blog\/author\/yulong-wang\/","@type":"Person","@name":"Yulong Wang"},{"@id":"https:\/\/opensource.microsoft.com\/blog\/author\/du-li\/","@type":"Person","@name":"Du Li"}],"headline":"ONNX Runtime Web\u2014running your machine learning model in browser","datePublished":"2021-09-02T16:00:20+00:00","dateModified":"2025-05-29T21:49:09+00:00","mainEntityOfPage":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/"},"wordCount":1264,"publisher":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#organization"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage"},"thumbnailUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","keywords":["Browser","ONNX Runtime","Web inference"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/","url":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/","name":"ONNX Runtime Web\u2014running your machine learning model in browser | Microsoft Open Source Blog","isPartOf":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage"},"thumbnailUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","datePublished":"2021-09-02T16:00:20+00:00","dateModified":"2025-05-29T21:49:09+00:00","breadcrumb":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#primaryimage","url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","contentUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2021\/09\/Open-Surce-Featured-Img.jpg","width":1135,"height":744,"caption":"graphical user interface, application"},{"@type":"BreadcrumbList","@id":"https:\/\/opensource.microsoft.com\/blog\/2021\/09\/02\/onnx-runtime-web-running-your-machine-learning-model-in-browser\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/opensource.microsoft.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ONNX Runtime Web\u2014running your machine learning model in browser"}]},{"@type":"WebSite","@id":"https:\/\/opensource.microsoft.com\/blog\/#website","url":"https:\/\/opensource.microsoft.com\/blog\/","name":"Microsoft Open Source Blog","description":"Open dialogue about openness at Microsoft \u2013 open source, standards, interoperability","publisher":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/opensource.microsoft.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/opensource.microsoft.com\/blog\/#organization","name":"Microsoft Open Source Blog","url":"https:\/\/opensource.microsoft.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","contentUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","width":259,"height":194,"caption":"Microsoft Open Source Blog"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/OpenAtMicrosoft"]}]}},"msxcm_display_generated_audio":false,"msxcm_animated_featured_image":null,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Open Source Blog","distributor_original_site_url":"https:\/\/opensource.microsoft.com\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/88005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/users\/5562"}],"replies":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=88005"}],"version-history":[{"count":2,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/88005\/revisions"}],"predecessor-version":[{"id":97495,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/88005\/revisions\/97495"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/media\/88188"}],"wp:attachment":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=88005"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/post_tag?post=88005"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/content-type?post=88005"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/topic?post=88005"},{"taxonomy":"programming-languages","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/programming-languages?post=88005"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/coauthors?post=88005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}