Home

Awesome

Streaming Image Recognition by WebAssembly

Youtube: YoMo x WasmEdge

This project demonstrates how to process a video stream in real-time using WebAssembly and apply a pre-trained food classification model to each frame of the video in order to determine if food is present in that frame, all by integrating WasmEdge into YoMo serverless.

Open-source projects that we used:

Advantages:

Steps to run

1. Clone This Repository

$ git clone https://github.com/yomorun/yomo-wasmedge-tensorflow.git

2. Install YoMo CLI

$ curl -fsSL "https://get.yomo.run" | sh
$ yomo version
YoMo CLI version: v1.13.0

Details about YoMo CLI installation can be found here.

3. Install WasmEdge Dependencies

Install WasmEdge with its Tensorflow and image processing extensions

wget -qO- https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash -s -- -e all -p /usr/local

If you have any questions about installation, please refer to the official documentation. Currently, this project works on Linux machines only.

Install video and image processing dependencies

$ sudo apt-get update
$ sudo apt-get install -y ffmpeg libjpeg-dev libpng-dev

4. Write your Streaming Serverless function

Write app.go to integrate WasmEdge-tensorflow:

5. Run YoMo Zipper Server

$ yomo serve -c ./zipper/config.yaml

6. Run Streaming Serverless function

$ cd flow
$ go run -tags tensorflow,image app.go

7. Demonstrate video stream

Download this demo video: hot-dog.mp4, and store to source directory:

$ wget -P source 'https://github.com/yomorun/yomo-wasmedge-tensorflow/releases/download/v0.2.0/hot-dog.mp4'

then run:

$ go run ./source/main.go ./source/hot-dog.mp4

8. Result

YoMo-WasmEdge