Home

Awesome

Video Instance Segmentation via Multi-scale Spatio-temporal Split Attention Transformer

Omkar Thawakar, Sanath Narayan, Jiale Cao, Hisham Cholakkal, Rao Muhammad Anwer, Muhammad Haris Khan, Salman Khan, Michael Felsberg, Fahad Shahbaz Khan [ ECCV 2022 ]

paper

:rocket: News

<hr />

Abstract

State-of-the-art transformer-based video instance segmentation (VIS) approaches typically utilize either single-scale spatio-temporal features or per-frame multi-scale features during the attention computations. We argue that such an attention computation ignores the multi-scale spatio-temporal feature relationships that are crucial to tackle target appearance deformations in videos. To address this issue, we propose a transformer-based VIS framework, named MS-STS VIS, that comprises a novel multi-scale spatio-temporal split (MS-STS) attention module in the encoder. The proposed MS-STS module effectively captures spatio-temporal feature relationships at multiple scales across frames in a video. We further introduce an attention block in the decoder to enhance the temporal consistency of the detected instances in different frames of a video. Moreover, an auxiliary discriminator is introduced during training to ensure better foreground-background separability within the multi-scale spatio-temporal feature space. We conduct extensive experiments on two benchmarks: Youtube-VIS (2019 and 2021). Our MS-STS VIS achieves state-of-the-art performance on both benchmarks. When using the ResNet50 backbone, our MS-STS achieves a mask AP of 50.1%, outperforming the best reported results in literature by 2.7% and by 4.8% at higher overlap threshold of AP75, while being comparable in model size and speed on Youtube-VIS 2019 val. set. When using the Swin Transformer backbone, MS-STS VIS achieves mask AP of 61.0% on Youtube-VIS 2019 val. set.

Architecture

<p align="center"><img src="images/Architecture_diagram_png.png" width="1000"/></p>

Installation

First, clone the repository locally:

git clone https://github.com/OmkarThawakar/MSSTS-VIS.git

Then, create environment and install dependencies:

conda env create env.yml

Install dependencies and pycocotools for VIS:

pip install -r requirements.txt
pip install git+https://github.com/youtubevos/cocoapi.git#"egg=pycocotools&subdirectory=PythonAPI"

Compiling CUDA operators:

cd ./models/ops
sh ./make.sh
# unit test (should see all checking is True)
python test.py

Data Preparation

Download and extract 2019 version of YoutubeVIS train and val images with annotations from CodeLab or YouTubeVIS, and download COCO 2017 datasets. We expect the directory structure to be the following:

MSSTS-VIS
├── datasets
│   ├── coco_keepfor_ytvis19.json
...
ytvis
├── train
├── val
├── annotations
│   ├── instances_train_sub.json
│   ├── instances_val_sub.json
coco
├── train2017
├── val2017
├── annotations
│   ├── instances_train2017.json
│   ├── instances_val2017.json

The modified coco annotations 'coco_keepfor_ytvis19.json' for joint training can be downloaded from [google]. Taken from SeqFormer.

Training

We performed the experiment on NVIDIA Tesla V100 GPU. All models are trained with total batch size of 10.

To train model on YouTube-VIS 2019 with 8 GPUs , run:

GPUS_PER_NODE=8 ./tools/run_dist_launch.sh 8 ./configs/r50_mssts_ablation.sh

To train model on YouTube-VIS 2019 and COCO 2017 jointly, run:

GPUS_PER_NODE=8 ./tools/run_dist_launch.sh 8 ./configs/r50_mssts.sh

To train swin model on multiple nodes, run:

On node 1:

MASTER_ADDR=<IP address of node 1> NODE_RANK=0 GPUS_PER_NODE=8 ./tools/run_dist_launch.sh 16 ./configs/swin_mssts.sh

On node 2:

MASTER_ADDR=<IP address of node 1> NODE_RANK=1 GPUS_PER_NODE=8 ./tools/run_dist_launch.sh 16 ./configs/swin_mssts.sh

Inference & Evaluation

Evaluating on YouTube-VIS 2019:

python3 inference.py  --masks --backbone [backbone] --model_path /path/to/model_weights --save_path results.json 

To get quantitative results, please zip the json file and upload to the codalab server.

Qualitative results on YouTube-VIS 2019/2021 val. set

<img src="images/17.gif" width="270"/><img src="images/12.gif" width="270"/><img src="images/3.gif" width="270"/> <img src="images/14.gif" width="270"/><img src="images/21.gif" width="270"/><img src="images/18.gif" width="270"/> <img src="images/13.gif" width="270"/><img src="images/39.gif" width="270"/><img src="images/40.gif" width="270"/> <img src="images/5.gif" width="270"/><img src="images/36.gif" width="270"/><img src="images/24.gif" width="270"/>

Model zoo

Quatitative results on YouTube-VIS 2019.

ModelAPAP50AP75AR1AR10ModelResults
MS-STS_r5050.173.256.646.157.7r50r50_results
MS-STS_r10151.173.259.048.358.7r101r101_results
MS-STS_swin61.085.268.654.766.4swinswin_results
<hr />

Citation

@article{mssts2022,
      title={Video Instance Segmentation via Multi-scale Spatio-temporal Split Attention Transformer}, 
      author={Omkar Thawakar and Sanath Narayan and Jiale Cao and Hisham Cholakkal and Rao Muhammad Anwer and Muhammad Haris Khan and Salman Khan and Michael Felsberg and Fahad Shahbaz Khan},
      journal={Proc. European Conference on Computer Vision (ECCV)},
      year={2022},
}

Contact

Please contact me at omkar.thawakar@mbzuai.ac.ae for any queries.

Acknowledgement

This repo is based on SeqFormer , Deformable DETR and VisTR. Thanks for their wonderful works.