Slide 1

Slide 1 text

COMPUTER VISION AT THE EDGE WITH WEBASSEMBLY Miguel Angel Cabrera @miguelaeh_ Angel M De Miguel @_angelmm Pipeless

Slide 2

Slide 2 text

COMPUTER VISION (CV) Pipeless

Slide 3

Slide 3 text

A SIMPLE CV APP Model Inference Runtime GPU Output Pipeline Input Pipeline Post-processing Pre-processing CPU video streams video streams Pipeless 60 FPS / 16ms per frame Raw frame Video

Slide 4

Slide 4 text

CHALLENGES OF COMPUTER VISION ● Parallelize frame processing? ● Latency? Pipeless Performance and stability ● How do you start with computer vision? ● What languages and frameworks can you use? Development experience ● How to distribute a computer vision platform? ● How to share processing logic? Distribution

Slide 5

Slide 5 text

PIPELESS.AI Pipeless is an open-source framework that takes care of everything you need to develop and deploy computer vision applications in just minutes https://github.com/pipeless-ai/pipeless Pipeless

Slide 6

Slide 6 text

ARCHITECTURE webcam, RTSP, WebRTC, … f f f f actionable data streams (JSON payloads) Pipeless pre-process post-process process (inference) frame data OpenVINO CoreML ONNX … Raw RGB structured JSON

Slide 7

Slide 7 text

Pipeless pre-process.py process.json post-process.py PIPELESS HELLO WORLD

Slide 8

Slide 8 text

Pipeless

Slide 9

Slide 9 text

Pipeless Pipeless Original: ● FPS: 24 ● Duration: 9s Processing: ● FPS: 31 ● Duration: 7s

Slide 10

Slide 10 text

WASM? Pipeless

Slide 11

Slide 11 text

PIPELESS 6 MONTHS AGO… Pipeless ● A Python project ● Filters (user-defined) were written in Python ● Performance issues (processing frames in parallel) ● Big size artifacts Pipeless

Slide 12

Slide 12 text

● Provide tools to simplify filters' development. ● Develop filters in multiple languages. CHALLENGES OF COMPUTER VISION Pipeless Performance and stability Developer Experience ● Ensure filters perform properly and you can parallelize them. ● Filters run in any environment / device. ● Simplify filter distribution and sharing them. Distribution

Slide 13

Slide 13 text

Pipeless

Slide 14

Slide 14 text

PIPELESS 🖤 WASM Pipeless pre-process post-process process (inference) frame data OpenVINO CoreML ONNX … Raw RGB structured JSON ● Define filters as Wasm components, so you can use different languages. ● Instantiate multiple filters in parallel and isolate them. ● Filters run in any environment where Pipeless run. ● Define a proper interface (with the Component Model) and compose filters, making small and shareable units.

Slide 15

Slide 15 text

PIPELESS EVOLUTION Python Rust + Pyo3 Rust + Pyo3 + Wasm (exp) Pipeless

Slide 16

Slide 16 text

IMPLEMENTATION DETAILS Pipeless

Slide 17

Slide 17 text

STATEFUL VS STATELESS A component per thread. N-cores run in parallel. A single component, with internal state, shared among all threads and with sequential sorted processing. Pipeless lock run release Stateless run run run Stateful

Slide 18

Slide 18 text

PYTHON ON WASM Pipeless Python user code componetize-py ● (Computer Vision) users love Python. ● Wasm unlocks parallel processing (avoid GIL limitations) at the cost of memory. ● Running a Python script in Wasm is significantly slower.

Slide 19

Slide 19 text

AVOID COPYING FRAMES Latency is critical. Copying raw frames to WASM memory is too slow… ptr host-ref HashMap frame resize, normalize, draw, permute, etc. Pipeless common operations API invoke with host-ref WIT

Slide 20

Slide 20 text

DEMO Pipeless

Slide 21

Slide 21 text

Pipeless Original: ● FPS: 24 ● Duration: 9s Processing: ● FPS: ~8 ● Duration: 29s

Slide 22

Slide 22 text

Benefits ● Securely run untrusted code ● Easy to share filters ● Multi-language support ● Get rid of Python GIL limitations Challenges ● Python components are slow ● Missing support for critical libraries ● Complex workarounds for no-copy RECAP A bright future awaits us with Wasm! Pipeless

Slide 23

Slide 23 text

THANKS! Miguel Angel Cabrera @miguelaeh_ Angel M De Miguel @_angelmm Pipeless ⭐ Star Pipeless on GitHub! https://github.com/pipeless-ai/pipeless