Skip to content

supervisely-ecosystem/serve-InSPyReNet

Repository files navigation

Overview

This app deploys pretrained InSPyReNet model as a Supervisely Application for Salient Instance Segmentation tasks.

Models under a Salient Instance Segmentation task are usually used for separating foreground from background. They predict a mask for the foreground object. These models are class-agnostic, which means they can't predict a class label for an object.

The app allows you to apply the model to an image inside the Supervisely platform or beyond it (using the Inference Session API).

In our experience, InSPyReNet could give near perfect predictions, but it uses a lot of CUDA memory comparing to other models at this task.

Pretrained models

The app can deploy pretrained model in two regimes:

  • Swin-B HD with HD resolution (up to 1280 px in the longer image side). Good with large images, but may make empty or incorrect predictions for small images.
  • Swin-B 384x384, which is inferred in constant 384x384 resolution and allocates less CUDA memory. Choose it if you have small images or you don't need to predict very small details in the image.

Note: Swin-B HD could require a GPU with large CUDA memory at inference (about 6 GB for an HD image).

Trained on a massive collection of datasets for Salient Object Detection: DUTS-TR, HRSOD-TR, UHRSD-TR, DIS-TR, DUTS-TE, DUT-OMRON, ECSSD,HKU-IS, PASCAL-S, DAVIS-S, HRSOD-TE,UHRSD-TE, FSS-1000, MSRA-10K, DIS-VD, DIS-TE1, DIS-TE2, DIS-TE3, DIS-TE4

Prediction preview:

Input Prediction
bird inspyrenet

How To Run

  1. Start the application from Ecosystem
  2. Open the app in your browser

  1. Select the model you want to deploy
  2. Click "SERVE" button.
  3. ✅ That's it! Now you can use other apps with your model.

Inference Settings

  • bbox_padding: (default 66%) when applying the model to a crop of an image (ROI), this bbox_padding will expand the crop at the boundaries, getting more image context to the model (may lead to more accurate preditctions). The value can be measured either in pixels (e.g. 100px) or in percentages (e.g. 10%)
  • pixel_confidence_threshold: (default 150). The model predicts a "soft" masks, i.e. the mask values are in range 0-255, but the mask in Supervisely is a Bitmap and has only two values: 0-1 (one bit). With this threshold we will treat the pixels in the mask as 0 if they are below the threshold and as 1 if above.

Related Apps

You can use deployed model in the following Supervisely Applications ⬇️

  • Apply Object Segmentor to Images Project - apply a salient segmentation model to labeled rectangles (bbox). A padding can be added to extend the boundaries.

  • Apply NN to Images Project - app allows to play with different inference options and visualize predictions in real time. Once you choose inference settings you can apply model to all images in your project to visually analyse predictions and perform automatic data pre-labeling.

  • Apply NN to Videos Project - app allows to label your videos using served Supervisely models.

  • NN Image Labeling - integrate any deployed NN to Supervisely Image Labeling UI. Configure inference settings and model output classes. Press Apply button (or use hotkey) and detections with their confidences will immediately appear on the image.

Acknowledgment