How to make Anyline work with just a few lines of JavaScript 2019-10-06T09:09:53+00:00

Project Description

How to make Anyline work with just a few lines of JavaScript

By David Dengg, Anyline Co-Founder and lead developer of the Anyline JavaScript SDK.

This week, we launched Anyline 11, our JavaScript SDK. This release lets us take ‘one giant leap’ from being an entirely mobile-based SDK to one that also works on web browsers. It’s a huge development which opens many new opportunities for different use cases.

For a full understanding of these new possibilities, check out the latest blog from our CEO Lukas Kinigadner.

In this guide, I get deep into the details of how the JavaScript SDK works, and what we did to bring it to market in under 2 months.

C++ in, JavaScript out

As you can imagine, Anyline is built from a huge shared code base of  C++. We use it for its versatility, as it can be used on all our existing platforms. In order for it to be understood by web browsers our challenge was therefore to recompile our C++ to JavaScript.

For this, we used the emscripten toolchain. This is a very modern compiler toolchain based around LLVM that turns C++ code into WebAssembly. WebAssembly can be loaded by all modern browsers and executes blazingly fast.

This process enabled us to automatically generate 90% of our JavaScript SDK from our C++ code – an incredible time saver.

Not all smooth sailing…

So far, so simple, right? Not quite. We did face some significant challenges. Firstly, we had to overcome some technical issues relating to Tensorflow, which we use for training of classification and detection networks. Tensorflow is at the heart of our SDK and its execution speed defines much of how fast our SDK feels overall. Because of that we switched to TensorflowJS to get WebGL accelerated inference.

We also had to make some changes inside our core, and compile the dependencies for WebAssembly before adjusting our internal architecture to match the web. Sorting these issues was a tedious process at times, but ultimately worth the effort.

Teamwork makes the dream work

Luckily, some forward planning from our team over the past year made key parts of this project move smoothly. For example, we decided to prepare the UI aspects of our JavaScript SDK a year ago – such as the cutout and visual feedback.

This meant that all of the UI functionality for the browser-based SDK was ready to go, so we could focus on ironing out the issues elsewhere and bring the product to market as quickly as we did.

Getting Started with the JavaScript SDK

With all this said, we’re delighted to be able to bring the JavaScript SDK to our users, and look forward to seeing it in action!

If you want to try it out, you can download the SDK here, and for more information on how it can work for specific use cases, don’t forget to check out Lukas’ blog.

 

Recent Posts

Sign up for our Newsletter!

Be the first to receive the latest news, release notes and updates!

SUBSCRIBE