Local Files


    • landing


    • interactive compatible javascript


    • Try it yourself!

      The document you are reading is not a common website but an interactive programming environment called a "notebook". It is a collection of interactive cells that can be freely created and edited. There are two types of cells, code and markdown cells.

      The following cell is a code cell. Code cells let you write and evaluate Javascript code. You can evaluate the cell by pressing "Shift + Enter" or the "Run" button.



    • Congratulations! You just ran your first little program using Weblab. As you can see, Weblab displays the last expression in a code cell as its output. To learn more about code and markdown cells check out the Getting Started guide.


    • Machine learning

      One advantage of using a notebook to run your code, is that you can immediatly visualize its output. This is particularly handy when you are processing data, for example for a machine learning application. To see how this works we will have a look at an example of the tensorflow project where we use a pre-trained neural network to classify images.


    • Image classification with a pre-trained neural network

      The goal of this example is to classify images that are taken from either the internet or captured by the webcam. Neural networks are great for image classification but their training requires a lot of data and computational effort. Luckily we can skip the training process and use an existing, pre-trained neural network called MobileNet for our classification.

      To use the model we import the tensorflowjs library and the mobilenet model as follows:



    • In addition, the contents of the model need to be loaded in order to use it. This is done in the following cell. Be aware that the await keyword is required to obtain the results from asynchronous functions.



    • To do the classification we first need an image. We can load an image from a remote url by creating an image element in our notebook.



    • Okay, the image looks obvious. Let's see how the neural network performs! For that we simply pass the image element to the mobilenet classification function.



    • The classification seems really good. You actually need to be a dog expert to check whether it's right.


    • Classify webcam pictures

      Let's make it even more interesting. For the next part we classify pictures that we take with your webcam. If you don't want to activate your webcam you can just leave this part.

      To use the webcam, we create a webcam object as follows:



    • Everytime the next cell is evaluated the webcam will take a picture which is then classified. So try evaluating the next cell while holding some object like a water bottle, cell phone or keyboard in front of your camera.