ImagePairSequence
Introduction
The ImagePairSequence widget is a widget in Supervisely designed for displaying pairs of images and annotations. It is useful for comparing. For example, it can be used to compare ground truth and predictions in a grid format. It allows users to navigate through multiple pages of predictions and provides zooming functionality, making it convenient for visualizing annotated image results.
All images will be saved in the
Team Filesin theoffline-sessionsdirectory:/offline-sessions/{task_id}/app-template/sly/css/app/widgets/image_pair_sequence/{image_name}
Function signature
ImagePairSequence(
opacity=0.4,
enable_zoom=False,
sync_views=True,
slider_title="pairs",
widget_id=None,
)Parameters
opacity
Optional[float]
Objects opacity
enable_zoom
Optional[bool]
Enable zoom on ImagePairSequence
sync_views
Optional[bool]
Enable sync zoom on ImagePairSequence images
slider_title
Optional[str]
Measurement units in the widget controls
widget_id
Optional[str]
Id of the widget
slider_title
Measurement units in the widget controls.
type: Optional[str]
default value: epochs
enable_zoom
Enable zoom on ImagePairSequence.
type: Optional[bool]
default value: False
opacity
Objects opacity.
type: Optional[float]
default value: 0.4
sync_views
Enable sync zoom on ImagePairSequence images.
type: Optional[bool]
default value: True
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
By using the ImagePairSequence widget, you can set the images, annotations and titles to display on the left and right sides of the widget. You can also set a batch of images, annotations and titles to display on the left and right sides of the widget. The widget also provides methods for clearing the widget.
All the images will be saved in the Team Files in the offline-sessions directory:
/offline-sessions/{task_id}/app-template/sly/css/app/widgets/image_pair_sequence/{image_name}
append_left(path: str, ann: sly.Annotation, title: str)
Sets the image, annotation and title to display on the left side of ImagePairSequence.
append_right(path: str, ann: sly.Annotation, title: str)
Sets the image, annotation aand title to display on the right side of ImagePairSequence.
extend_left(paths: List[str], anns: Optional[List[sly.Annotation]], titles: Optional[List[str]])
Sets a batch of images, annotations and titles to display on the left side of ImagePairSequence.
extend_right(paths: List[str], anns: Optional[List[sly.Annotation]], titles: Optional[List[str]])
Sets a batch of images, annotations and titles to display on the right side of ImagePairSequence.
append_pair(left: Tuple[str, sly.Annotation, str], right: Tuple[str, sly.Annotation, str])
Sets a pair of images, annotations and titles to display on the ImagePairSequence.
extend_pairs(left: List[Tuple], right: List[Tuple])
Sets a batch of pairs of images, annotations and titles to display on the ImagePairSequence.
clean_up()
Clears the ImagePairSequence widget.
disable()
Disables the ImagePairSequence widget controls.
enable()
Enables the ImagePairSequence widget controls.
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/007_image_pair_sequence/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Get project ID and dataset ID from environment variables
Create static directory (optional)
Create Button widgets for controlling ImagePairSequence
Button widgets for controlling ImagePairSequencePrepare images and annotations for ImagePairSequence widget
ImagePairSequence widgetInitialize ImagePairSequence widget we will use in UI
ImagePairSequence widget we will use in UICreate app layout
Prepare a layout for app using Card widget with the content parameter and place widget that we've just created in the Container widget.
Create app using layout
Create an app object with layout parameter. We also pass the static_dir parameter to the app object so that the app can serve static files (optional).
Add function to add predictions
Run the app
Last updated
Was this helpful?