Awesome
HGPU
Code for paper: Hierarchical Graph Pattern Understanding for Zero-Shot Video Object Segmentation
<center>Figure 1. Architecture of HGPU. Frames (I_k, I_{k+1}) and their corresponding optical flow (O_k) are used as inputs to generate high-order feature representations with multiple modalities by (a) HGPE. Motion-appearance features are parsed through (b) MAUD to output coarse-to-fine segmentation results.</center>Requirements
-
Python (3.6.12)
-
PyTorch (version:1.7.0)
-
Apex (https://github.com/NVIDIA/apex, version: 0.1)
-
Requirements in the requirements.txt files.
Training
Download Datasets
- Download the DAVIS-2017 dataset from DAVIS.
- Download the YouTube-VOS dataset from YouTube-VOS, the validation set is not mandatory to download.
- Download the YouTube2018-hed and davis-hed datasets.
- The optical flow files are obtained by RAFT, we provide demo code that can be run directly on path
flow
. We also provide optical flow of YouTube-VOS (18G) in GoogleDrive, optical flow of DAVIS can be found in GoogleDrive.
Dataset Format
Please ensure the datasets are organized as following format.
YouTube-VOS
|----train
|----Annotations
|----JPEGImages
|----YouTube-flow
|----YouTube-hed
|----meta.json
DAVIS
|----Annotations
|----ImageSets
|----JPEGImages
|----davis-flow
|----davis-hed
Run train.py
We provide multi-GPU parallel code based on apex.
Run CUDA_VISIBLE_DEVICES="0,1,2,3" python -m torch.distributed.launch --nproc_per_node 4 train_HGPU.py
for distributed training in Pytorch.
Note:
Please change your dada path in two codes (libs/utils/config_davis.py
in line 52, and libs/utils/config_youtubevos.py
in line 38)
Testing & Results
If you want to test the model results directly, you can follow the settings below.
- Pre-trained models and pre-calculated results.
-
Change your path in
test_HGPU.py
, then runpython test_HGPU.py
. -
Run
python apply_densecrf_davis.py
(change your path in line 16) for getting binary masks.
The code directory structure is as follows.
HGPU
|----flow
|----libs
|----model
|----HGPU
|----encoder_0.8394088008745166.pt
|----decoder_0.8394088008745166.pt
|....
|----apply_densecrf_davis.py
|----train_HGPU.py
|----test_HGPU.py
-
Evaluation code from DAVIS_Evaluation, the python version is available at PyDavis16EvalToolbox.
-
The YouTube-Objects dataset can be downloaded from here and annotation can be found here.
-
The Long-Videos dataset can be downloaded from here.
Supplementary
- PWCNet is used to compute optical flow estimation for HGPU training, and the pre-trained model and inference results are in here.
Acknowledge
- Zero-shot Video Object Segmentation via Attentive Graph Neural Networks, ICCV 2019 (https://github.com/carrierlxk/AGNN)
- Motion-Attentive Transition for Zero-Shot Video Object Segmentation, AAAI 2020 (https://github.com/tfzhou/MATNet)
- Video Object Segmentation Using Space-Time Memory Networks, ICCV 2019 (https://github.com/seoungwugoh/STM)
- Video Object Segmentation with Adaptive Feature Bank and Uncertain-Region Refinement, NeurIPS 2020 (https://github.com/xmlyqing00/AFB-URR)