Lobe Help

Everything you need to know to train great machine learning models with Lobe.

Lobe Help | Everything you need to train machine learning models with Lobe.

Export your model to industry standard formats to use in your app.

How do I use my model?

How do I use my model?

chevron-down

Your model is a collection of files that other programs can load to run predictions. These files store both the structure of your model and the weights that are a result of training.


You can use the model files locally in your app or in most major cloud platforms to create an API. Lobe also hosts your model as a local API to help kickstart your app development.


Which export option should I choose?

Which export option should I choose?

chevron-down

Lobe provides a few workflows for using models: calling a local API, adapting starter projects, or working with model files directly.

Integrate with an external app

If you are using Lobe with another app, check if it can call an API to get predictions over a network or if it can load and run model files directly.


Using an API for predictions

If your desired app can make POST requests, process JSON, and base64 encode images, you can build a network request to get predictions from your model.


If the app is running locally on the same machine or network as Lobe, such as Origami Studio, you can use the Lobe Connect local API without additional configuration. Lobe must be running with your project open for the Lobe Connect local API to function.


If your desired app is running in a different environment than Lobe, or you wish to have predictions without the Lobe app open, see the 'Create an API for flexibility' section below for hosting your model as an external API.


Loading model files directly

If your desired app can load and run external models, select the appropriate Model File export option for your app.


If Lobe doesn’t support that export yet, such as TensorRT or OpenVINO, look for officially supported converters supplied by the desired format. Most of the time a converter will exist from ONNX or TensorFlow model files into the end format. If you are running into difficulties for a particular model, please check out our subreddit community or use File > Report Issue for support.


See Where can I use my model? for more information on the model file exports.

Create an API for flexibility

Creating a REST API is one of the most versatile ways to hook up apps to use your model. You can call your model as a service from other products, deploy to a variety of cloud providers, or even run on your own computer or edge device like a Raspberry Pi.


To prototype or experiment with using an API, check out Lobe Connect. To set one up yourself to run in any location, check out REST Server for an example using Python and Flask with deployment instructions to Azure App Service.


To create an API using a Node server such as Express, use the TensorFlow.js export option and see the example code in the export package for loading and running the model on an image.

Use or customize a starter project

If your data can come from a browser and you care about privacy or cost, check out the Web Sample starter project that uses TensorFlow.js to run models directly in the browser. You can host your app as a static site for low costs compared to needing a server backend running the model as an API. We recommend using the Speed model from File > Project Settings for faster load times and prediction speed at the expense of potentially lower accuracy when running TensorFlow.js in the browser.


If you want to run your model in a mobile setting, see iOS App for a sample using CoreML for iPhone or iPad apps. Similarly, see Android App for a sample using TensorFlow Lite to run on an Android device. For mobile apps, we recommend using the Speed model from File > Project Settings for faster load times and prediction speed at the expense of potentially lower accuracy.

Classifying images on your computer

You can export your model as TensorFlow and use the Image Tools desktop app to run your model on a folder of images or a spreadsheet of image URLs.

Write an app from scratch

If you have more experience as a developer, you can export model files directly and use their underlying frameworks such as TensorFlow, CoreML, or ONNX.


Where applicable, we recommend using our libraries in Python and .NET for working with Lobe exports as they provide useful helper functions for loading and processing data, as well as formatting return values and even working with the local API for quickly prototyping.

See Where can I use my model? for more information on the model file export options.


Where can I use my model?

Where can I use my model?

chevron-down

We are continually expanding the ways you can use your model. Current recommendations:


Local Python app or hosted on Azure, Google Cloud, or AWS

Export your model as TensorFlow. TensorFlow’s SavedModel is a standard format used in Python applications running TensorFlow 1.x or 2.x, and can be deployed in TensorFlow web services to run inference on the cloud as an API. See our Python SDK for an example running the TensorFlow export.


Apple iOS

Export your model as Core ML to develop iOS, iPad, and Mac apps. Use the Speed model from File > Project Settings if you need low latency and a smaller memory footprint on iOS.


Android or Raspberry Pi

Export your model as TensorFlow Lite to be used for mobile and IoT applications. Use the Speed model from File > Project Settings if you need low latency and a smaller memory footprint on the edge.


ONNX

Export your model as ONNX for cross-compatible applications, including edge devices.


Web Applications

Export your model as TensorFlow.js for browser-based JavaScript or server-side Node applications. Use the Speed model from File > Project Settings if you need low latency and a smaller memory footprint in the browser.


Lobe Connect

Lobe will host a local API to call your model via a REST endpoint. Use this option to mock a service that runs predictions while developing your app.

To run the local API:

  1. Capture an input image as a base64 string. Make sure the base64 string doesn't include the 'data:image/jpeg;base64,' prefix that sometimes is added.
  2. Do a POST request to the locally hosted API for your project with the details from the export sheet. Here is an example of what to request:
POST http://localhost:38101/v1/predict/project-uuid-from-export-window
Content-Type: application/json
{
"image": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwk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z61Z0RrE3GCklcpzkvW+QUjP+kY251OQINvNvcQy2WwvPeBKT4hjr18/aklcuEZKgbWq2OOTzKuPxQfbX4S4rxIII6ciSM8iKIMG1MSAh6WhbneeFKFnBUn1G/Qcv2qPvdnXJBYg3V2Glspd1uN69J2ARzyPfr+cNNsPGLClSWLml8pTqUiO6oKWOg3wPPmehoY8evbMwlNxmgy2huQiGlCdPdp0ge/I596VCdjiriiEj4eVbFhxJO3cKVt03HOlXRURKDK8lDMdh5LaCvA3I/b3qRLeyXdairUkHIBzkZ329KVKsy0hrOcUlS285CUZBP0H61T76rDuQD4FpyNSsKOAcnf1pUqEQIbxu+L7mqW+QlWlKcgAb4GwHSrIFFNpdeSAFDCNvLUR+gpUq0ugfSl8XuOswlhDqx368OHVuev6VRpDypc2DFdA7tKg3tkEgasZ9qVKlZmEy3Ro6W9IZThISg7k6h67+g5VNtRGkuLDZU3pQT4cDPp7UqVUiuBDbDjtFtKSjZwb+nP9q8fjNpTsVAuFJUc+4pUqwpi60nIIzkjJpUqVMY//9k="
}

Spreadsheets and local images

Export your model as a TensorFlow SavedModel to use with our helper code for running predictions on spreadsheets of image URLs or local image files.


Can I see example code?

Can I see example code?

chevron-down

When you export a model, the exported folder contains example code to use your model:

  • example/ directory: Lobe provides an example with a readme on how to load and run your model in the chosen export format.
  • signature.json file: the signature contains information about your model that your app will generally have to provide when loading the model. This includes details about the exposed inputs and outputs, their data types and shapes, and the labels corresponding to predicted confidence outputs. See the example/ directory for code on how to load and use the signature.


Can I see some starter projects?

Can I see some starter projects?

chevron-down

Lobe provides example projects on GitHub to help you get started.


iOS

A sample iOS application running the exported Core ML model: https://github.com/lobe/iOS-bootstrap


Android

A sample Android application running the exported TensorFlow Lite model: https://github.com/lobe/android-bootstrap


Web

An example React web application that runs predictions on images from your webcam in the browser: https://github.com/lobe/web-bootstrap


An example Flask server that runs your model as an API service: https://github.com/lobe/flask-server


.NET

A .NET library and example command line app to run predictions on images from your computer: https://github.com/lobe/lobe.net


Raspberry Pi

An example Python application that runs predictions on a Raspberry Pi: https://github.com/microsoft/trashclassifier


What is Lobe Connect?

What is Lobe Connect?

chevron-down

Lobe Connect is a local API to call your model via a REST endpoint. We recommend using Lobe Connect to prototype development with a REST service, connect to apps and tools locally, or run your model on devices connected to your same local network.

You need to have Lobe running with your project open for Lobe Connect to enable your local API.


Does Lobe have an SDK?

Does Lobe have an SDK?

chevron-down

Yes! Lobe provides a Python SDK and .NET SDK to run the exported models.


Train your app with Lobe
Download