ailia JS

AI inference library that runs machine learning models in the browser. Run ONNX models directly from JavaScript using WebAssembly.

Getting Started

Deploy the runtime files and run your first inference in the browser.

1

Clone the samples

The ailia JS library itself is published in the ailia-js repository. Clone the sample repository ailia-models-js and initialize its submodules to fetch the library (ailia.js, ailia_s.wasm, ailia_simd_s.wasm, etc.) along with it.

git clone https://github.com/ailia-ai/ailia-models-js.git
cd ailia-models-js
git submodule init
git submodule update

The SIMD or non-SIMD WebAssembly binary is selected automatically depending on the execution environment.

Library Sample repository
2

Run the sample

Since wasm files cannot be loaded via file://, start a local server and access it from your browser. Samples such as face detection (BlazeFace) and object detection (YOLOX) run directly in the browser.

python3 -m http.server 8080
# → open http://localhost:8080

To try it without any setup, the live sample site runs the demos directly in your browser.

Sample site Get Started tutorial

System Requirements

ailia JS runs the ailia inference engine on WebAssembly, enabling browser-native AI inference with no installation required.

Supported Browsers

  • Chrome / Edge
  • Safari
  • Firefox
  • Modern browsers with WebAssembly support

SIMD Acceleration

  • Windows: supported
  • macOS: supported
  • Android: supported
  • iOS: supported on 16.4+ (earlier versions fall back to non-SIMD)

Model Format

  • ONNX (.onnx)
  • Model definition (.onnx.prototxt)
  • Models from ailia-models

Distribution

  • Published on GitHub (ailia-js)
  • Provided as an ES6 module
  • Usable from old-style JavaScript

Features

Edge AI in the browser. Inference runs entirely on the client, without sending data to a server.

WebAssembly-based

  • The ailia inference engine compiled to wasm
  • Full ailia API access from JavaScript
  • No installation required

SIMD acceleration

  • Automatic SIMD / non-SIMD selection
  • BlazeFace inference: 21ms → 8ms
  • (measured on M2 Mac / Chrome)

Use cases

  • Background removal for video chat
  • Microphone noise reduction / VAD
  • Face detection / face recognition
  • QR code detection

Sample models

  • Face detection (BlazeFace)
  • Hand detection (BlazeHand / BlazePalm)
  • Object detection (YOLOX)
  • Object detection (MobileNetV2-SSDLite)

Use the API in Your Project

A minimal sample that loads an ONNX model and runs inference with preprocessing and postprocessing callbacks.

import {Ailia} from './ailia.js';

// Initialize the module (SIMD support is detected automatically)
await Ailia.initialize();

// Create an instance and load the model and weights
const ailia = new Ailia();
ailia.loadModelAndWeights(modelFileContents, weightsFileContents);

// Define preprocessing and postprocessing callbacks
const preprocess = (inputBuffers) => {
  inputBuffers.byIndex[0].buffer.Float32.set(inputData);
};
const postprocess = (outputBuffers) => {
  return Array.from(outputBuffers.byIndex[0].buffer.Float32);
};

// Run inference with the input shapes
const result = ailia.run(preprocess, postprocess, [[1, 1, width, height]]);

// Call the destructor when done
ailia.destroy();

API Reference

JavaScript API

Tutorial

FAQ

Frequently asked questions about ailia JS.

How can I get ailia JS?

The library itself can be downloaded from the ailia-js repository. For the samples, clone ailia-models-js and run git submodule init and git submodule update to fetch the library along with them.

Is SIMD supported?

Yes. Two binaries are bundled — a SIMD build (ailia_simd_s.wasm) and a non-SIMD build (ailia_s.wasm) — and the best one is selected automatically for the execution environment. With SIMD enabled, BlazeFace inference time drops from 21ms to 8ms (measured on M2 Mac / Chrome).

Browsers on Windows, macOS, and Android support SIMD. iOS also supports WebAssembly SIMD since iOS 16.4 (Safari 16.4). On earlier iOS versions the non-SIMD build is used automatically.

What models can I run?

Models in the ONNX format are supported. Load the model definition file (.onnx.prototxt) and the weights file (.onnx) with loadModelAndWeights(). ailia-models-js ships with sample models such as BlazeFace, BlazeHand, and YOLOX, and models published in ailia-models can also be used.

Are images or audio sent to a server?

No. All inference runs inside the browser (WebAssembly), so input data is never sent to a server. This makes ailia JS a good fit for privacy-sensitive use cases such as background removal for video chat and microphone noise reduction.

Can I use it outside of ES6 modules?

Yes. ailia JS is provided as an ES6 module, but it can also be adapted for old-style JavaScript.

How is licensing handled?

The evaluation license can be used for development and evaluation. For commercial distribution, please apply for a commercial license. See the ailia license terms for details.

Materials

Related Articles

Articles from the ailia Tech Blog.

Released ailia SDK 1.2.16: Addition of ailia.js
medium.com/axinc-ai
ailia.JS: Machine Learning Library for Browsers (JA)
tech.ailia.ai