From scratch - advanced

A step-by-step tutorial of how to create custom export app without using template from SDK (from scratch).

Introduction

It is more recommended way to use SDK export template class sly.app.Export to create custom export app (we learned it in the previous tutorial - learn more here). However, if your use case is not covered by our export template, you can create your own app from scratch without the template.

We will go through the following steps:

Step 0. Set up the working environment.

Step 1 How to write an export script.

Step 2. How to debug export app.

Step 3. Advanced debug.

Step 4. How to run it in Supervisely.

Everything you need to reproduce this tutorial is on GitHub: source code and additional app files.

Overview of the simple (illustrative) example we will use in tutorial

In this tutorial, we will create a custom export app that exports data from Supervisely into a .tar archive. See the overview of this example here

Step 0. Set up the working environment

Before we begin, please clone this export-custom-format repository and set up the working environment - here is a link with a description of the steps.

Step 1. How to write an export script

Find source code for this example here

Step 1. Import libraries

Step 2. Load environment variables

Load ENV variables for debug, has no effect in production

Get variables

Step 3. Write Export script

Step 2. How to debug export app

In this tutorial, we will be using the Run & Debug section of the VSCode to debug our export app.

The export template has 2 launch options for debugging: Debug and Advanced Debug. The settings for these options are configured in the launch.json file. Lets start from oprion #1 - Debug

launch.json

This option is a good starting point. In this case, the resulting archive or folder with the exported data will remain on your computer and be saved in the path that we defined in the local.env file (SLY_APP_DATA_DIR="results/").

Debug

Output of this python program:

Step 3. Advanced debug

In addition to the regular debug option, this template also includes setting for Advanced debugging.

launch.json

The advanced debugging option is somewhat identical, however it will upload result archive or folder with data to Team Files instead (Path to result archive - /tmp/supervisely/export/Supervisely App/<SESSION ID>/<PROJECT_ID>_<PROJECT_NAME>.tar). This option is an example of how production apps work in Supervisely platform.

Advanced debug

Output of this python program:

Step 4. How to run it in Supervisely

Submitting an app to the Supervisely Ecosystem isn’t as simple as pushing code to github repository, but it’s not as complicated as you may think of it either.

Please follow this link for instructions on adding your app. We have produced a step-by-step guide on how to add your application to the Supervisely Ecosystem.

Release custom export app

Last updated

Was this helpful?