Intro to Python SDK
Let's try Supervisely SDK for Python and create your first python script for Supervisely automation.
In this example we will show you how it is easy to communicate with your Supervisely instance (Community or your private Enterprise installation) from python code. The tutorial illustrates basic upload-download scenario:
create project and dataset on server
upload image
programmatically create annotation (two bounding boxes and tag) and upload it to image
download image and annotation
You can try this example for yourself: VSCode project config, original image, and python script for this tutorial are ready on GitHub.
Watch the video tutorial here:
Installation
Run the following command (learn more here)
Input data
Python code
Import and authentication
Import Supervisely, initialize API with your credentials and test authentication (learn the basics of authentication here). In this example, we use the server address of Community Edition. Change it if you have a private instance of Supervisely.
Create project on server
Let's create an empty project animals
with one dataset cats
, then one class cat
of shape Rectangle and one tag scene
with string value and upload them into the project. Now we can use created classes and tags for labeling.
Upload image
Let's upload local image images/my-cats.jpg
to dataset.
Create annotation and upload to image
Download data
You can download the whole script using this link
Result
In less than 50 lines of code (including lots of comments) you can easily automate Supervisely using Python and integrate it with your software stack.
That’s just a taste of what you can do with the Supervisely SDK for Python. For more, take a look at the reference and Supervisely Annotation JSON format.
Last updated