This repository is the official implementation of Video Object Segmentation with Adaptive Feature Bank and Uncertain-Region Refinement (NeurIPS 2020). It is designed for semi-supervised video object segmentation (VOS) task.
We built and tested the repository on Python 3.6.9 and Ubuntu 18.04 with one NVIDIA 1080Ti card (11GB Memory). Run on Windows or Mac is possible with minor modifications. An NVIDIA GPU card and CUDA environment are required. To install requirements, run:
pip3 install -r requirements.txt
Install the package torch_scatter by the official instructions. Our version is 2.0.4.
- Download and extract DAVIS17-TrainVal dataset.
- Download the pretrained DAVIS17 checkpoint.
- run:
python3 eval.py --level 1 --resume /path/to/checkpoint.pth/ --dataset /path/to/dir/
To reproduce the segmentation scores, you can use the official evaluation tool from DAVIS benchmark.
- Download and extract YouTube-VOS18 dataset.
- Download the pretrained YouTube-VOS18 checkpoint.
- run:
python3 eval.py --level 2 --resume /path/to/checkpoint.pth/ --dataset /path/to/dir/ --update-rate 0.05
Attention: Directly submit our results to the YouTube-VOS codalab for evaluation will pollute the leader board. We encourage you to submit your own results.
- Download and extract Long Videos dataset.
- Download the pretrained YouTube-VOS18 checkpoint above.
- run:
python3 eval.py --level 3 --resume /path/to/checkpoint.pth/ --dataset /path/to/dir/ --update-rate 0.05
To reproduce the segmentation scores, you can use the same tool from the DAVIS benchmark.
Prepare your video frames and the first frame annotation following the data structure of the long videos page. You can see the data structure without download it and you only need to provide the first frame annotation.
Run the same parameters as the long videos setting.
--gpu
: GPU id to run (default: 0).--viz
: Enable output overlays along with the estimated masks (default: False).--budget
: The number of features that can be stored in total (default: 300000 for 1080Ti).
By default, the segmentation results will be saved in ./output
.
- Download the following the datasets. You don't have to all, COCO is the largest one.
- Download the mask palette image (followed DAVIS), which provides the color map of objects.
- Run
unify_pretrain_dataset.py
to convert them into a uniform format (followed DAVIS).
python3 unify_pretrain_dataset.py --name NAME --src /path/to/dataset/dir/
- MSRA10K:
--name MSRA10K
- ECSSD:
--name ECSSD
- PASCAL-S:
--name PASCAl-s
- PASCAL VOC2012:
--name PASCALVOC2012
- COCO:
--name COCO
. API pycocotools is required.
You may need minor modifications in the dataset path. Descriptions of useful options,
--dst
: Path to the output dataset.--palette
: Path to the palette image.--workder
: The parallel threads number to accelerate the procedures (Default: 20).
After the conversion process, you can start pre-training the model:
python3 train.py --level 0 --dataset /path/to/pretrain/ --lr 1e-5 --scheduler-step 3 --total-epoch 12 --log
Pre-training process may takes days to weeks, you can download our checkpoint to save time.
Download the semi-supervised TrainVal 480p from the DAVIS website. Run
python3 train.py --level 1 --new --resume /path/to/PreTrain/checkpoint.pth --dataset /path/to/DAVIS17/ --lr 4e-6 --scheduler-step 200 --total-epoch 1000 --log
Download training set of the YouTube-VOS dataset. Run
python3 train.py --level 2 --new --resume /path/to/PreTrain/checkpoint.pth --dataset /path/to/YouTubeVOS/train --lr 4e-6 --scheduler-step 30 --total-epoch 150 --log
This repository is released for academic use only. If you want to use our codes for commercial products, please contact [email protected] in advance. If you use our codes, please cite our paper,
@inproceedings{liang2020video,
title={Video Object Segmentation with Adaptive Feature Bank and Uncertain-Region Refinement},
author={Liang, Yongqing and Li, Xin and Jafari, Navid and Chen, Qin},
booktitle={Advances in neural information processing systems (NeurIPS)},
year={2020}
}