Multiview images
Last updated
Was this helpful?
Last updated
Was this helpful?
This easy-to-follow tutorial will show you how to upload multiview images and label groups to Supervisely using Python SDK and get the advantage of the multiview image annotaion in the Supervisely Labeling Toolbox, which allows you to label images quickly and efficiently on one screen. You will learn how to enable multiview in the project settings, upload multiview images and explore the multiview in the labeling interface.
In this tutorial, we will show you how to do it programmatically using Python, but you can also do it manually in the Web UI using Import Images Groups app from Supervisely Ecosystem or using our Import Wizard in the Web UI. Here is an illustrated example of how to do it:
Everything you need to reproduce this tutorial is on GitHub: source code and additional app files.
Step 1. Prepare ~/supervisely.env
file with credentials. Learn more here.
Step 2. Clone the repository with source code and demo data and create a Virtual Environment.
Step 3. Open the repository directory in Visual Studio Code.
Step 4. Change the Workspace ID in the local.env
file by copying the ID from the context menu.
Step 5. Start debugging src/main.py
.
Supervisely instance version >= 6.9.14 Supervisely SDK version >= 6.72.214
In the tutorial, Supervisely Python SDK version is not directly defined in the requirements.txt. But when developing your app, we recommend defining the SDK version in the requirements.txt.
here is the structure of the directory with images (src/images
):
You can also enable multiview in the Image Labeling Tool interface:
And now we're ready to upload images.
In this tutorial, we'll be using the api.image.upload_multiview_images
method to upload multiview images to Supervisely.
dataset_id
int
ID of the dataset to upload
group_name
str
Name of the group (tag value)
paths
Optional[List[str]]
List of paths to the images (optional)
metas
Optional[List[Dict]]
List of image metas (optional)
progress_cb
Optional[Union[tqdm, Callable]]
Function for tracking upload progress (optional)
links
Optional[List[str]]
List of links to the images (optional)
conflict_resolution
Literal["rename", "skip", "replace"]
Conflict resolution strategy (optional)
force_metadata_for_links
Optional[bool]
Force metadata for links (optional)
So, the method uploads images to Supervisely and returns a list of ImageInfo
objects.
Available starting from version v6.73.236
of the Supervisely Python SDK.
If you already have images uploaded to Supervisely and you want to group them for multiview, you can use the api.image.group_images_for_multiview
method.
Default tag name is multiview
. You can change it by passing the multiview_tag_name
argument.
If the tag does not exist, it will be created automatically.
Automatically enables multiview mode in the project settings.
So now, that we've uploaded all the images, let's take a look at the labeling interface.
As you can see, the images in the Labeling tool are grouped in the same way as in your images in folders (images from one folder are combined into one group). When importing, each image from the folders will be assigned tags with the same values, which allows them to be grouped into one group.
Multiview labeling can be very useful when annotating objects of multiple classes simultaneously on several images. You don't need to shift your attention to find the necessary class every time you switch between images, allowing you to increase efficiency and save time and effort.
Available starting from version v6.73.293
of the Supervisely Python SDK.
There are many cases when you need to group labels together. For example, if you have some labels captured from different perspectives that represent one object on different images and you want to analyze the object as a whole and not as separate instances, you can join them into a single group.
Label group - is a simple group of objects, that displays the relationship between objects and helps you to quickly locate the object on different images and to avoid labeling the same object multiple times.
Using the api.annotation.append_labels_group
method, you can upload labels as a group to images.
dataset_id
int
Destination Dataset ID
image_ids
List[int]
Multiview images IDs
labels
List[Label]
group of labels (should be the same length as images_ids)
project_meta
Optional[ProjectMeta]
Project Meta (optional). Provide to avoid extra API calls
group_name
Optional[str]
Group name (optional). Labels will be assigned by tag with this value.
Let's group it all together and upload local images and labels to Supervisely using this method.
Our sample data directory structure:
⬇️ You can download this sample here: data.zip
Follow the code below to upload images and labels to Supervisely.
In this tutorial, you learned how to upload multiview images and label groups to Supervisely using Python SDK and get the advantage of the multiview image annotation in the labeling interface, which allows you to label images quickly and efficiently on one screen. Let's recap the steps we did:
Create a new project and dataset.
Set multiview settings for the project using the api.project.set_multiview_settings
method.
Upload images using the api.image.upload_multiview_images
method.
Group existing images for multiview using the api.image.group_images_for_multiview
method.
Upload label groups using the api.annotation.append_labels_group
method.
And that's it! Now you can upload your multview images to Supervisely using Python SDK.