SnapML

Lens Studio

You can use Fritz AI Studio to train your own SnapML model without code for Lens Studio 3. To get started, create a new project in your Fritz AI Studio account.

Next, you'll need to collect and label data then train a model. You can read all about these steps in this Studio Quickstart Guide. You can export trained models as part of a pre-built Lens Studio project directly from the Models table in Fritz AI Studio.

Lens Studio Project Export

Once downloaded, unzip the project archive and open the .lsproj file in Snap Lens Studio. To test your model, complete the following steps:

note

If you already have a SnapML template and have only downloaded a model file, drag and drop your model file into the Resources pane of Lens Studio before proceeding to Step 1 below.

warning

The following instructions are for Image Segmentation projects. Instructions for other feature types may be slightly different. Specific instructions for your SnapML template can be found in the Public/README.js file included with each project archive.

1. Import your model

Import Model

Upon opening the Lens Studio project file, you will be shown a "Model Import" dialog box. You do not need to change any of these settings. Just click "Import".

2. Add your model to the ML Component

MLComponent

Select the "ML Component" object from the Objects list in the top left corner of Lens Studio. Then, in the Inspect on the right, change the value of Model from "None" to the model included in your project.

3. Set the model's input texture

Model Input Texture

Again with the "ML Component" object selected, in the Inspector under the model's Inputs change the value of "Texture" from None to "Device Camera Texture". This will feed input from the camera to your model as input.

4. Create an output texture for your model

Model Output Texture

Below the input Texture you configured in Step 3, click the "Create Output Texture" button in the model output options. This texture will be used by other Lens Studio elements to access the output of your model.

5. Connect the model output texture to the Fritz Segmentation Texture material

Fritz Segmentation Texture

From the Resources list in the bottom left corner of Lens Studio, select the "Fritz Segmentation Texture" material. In the Inspector on the right, click the Model Output option under Graph Parameters and set the value to the output texture you created in Step 4.

6. Add a Photo or Video to test your model

Preview

In the Preview tool on the far right side of Lens Studio, open the Source drop-down menu by selecting the name of the default source (Person 2 in the image above). By selecting either the Photo or Video open to the left of the Search bar, you can upload images or videos of objects your model is trained to segment. This will allow you to quickly and easily test your model.