Official Implementation of VAT

Overview

Semantic correspondence

PWC PWC PWC

Few-shot segmentation

PWC PWC PWC PWC PWC PWC

Cost Aggregation Is All You Need for Few-Shot Segmentation

For more information, check out project [Project Page] and the paper on [arXiv].

Network

Our model VAT is illustrated below:

alt text

Environment Settings

git clone https://github.com/Seokju-Cho/Volumetric-Aggregation-Transformer.git

cd Volumetric-Aggregation-Transformer

conda env create -f environment.yaml

Preparing Few-Shot Segmentation Datasets

Download following datasets:

1. PASCAL-5i

Download PASCAL VOC2012 devkit (train/val data):

wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar

Download PASCAL VOC2012 SDS extended mask annotations from our [Google Drive].

2. COCO-20i

Download COCO2014 train/val images and annotations:

wget http://images.cocodataset.org/zips/train2014.zip
wget http://images.cocodataset.org/zips/val2014.zip
wget http://images.cocodataset.org/annotations/annotations_trainval2014.zip

Download COCO2014 train/val annotations from our Google Drive: [train2014.zip], [val2014.zip]. (and locate both train2014/ and val2014/ under annotations/ directory).

3. FSS-1000

Download FSS-1000 images and annotations from our [Google Drive].

Create a directory '../Datasets_VAT' for the above three few-shot segmentation datasets and appropriately place each dataset to have following directory structure:

../                         # parent directory
└── Datasets_VAT/
    ├── VOC2012/            # PASCAL VOC2012 devkit
    │   ├── Annotations/
    │   ├── ImageSets/
    │   ├── ...
    │   └── SegmentationClassAug/
    ├── COCO2014/           
    │   ├── annotations/
    │   │   ├── train2014/  # (dir.) training masks (from Google Drive) 
    │   │   ├── val2014/    # (dir.) validation masks (from Google Drive)
    │   │   └── ..some json files..
    │   ├── train2014/
    │   └── val2014/
    └── FSS-1000/           # (dir.) contains 1000 object classes
        ├── abacus/   
        ├── ...
        └── zucchini/

Training

Training on PASCAL-5i:

  python train.py --config "config/pascal_resnet{50, 101}/pascal_resnet{50, 101}_fold{0, 1, 2, 3}/config.yaml"

Training on COCO-20i:

  python train.py --config "config/coco_resnet50/coco_resnet50_fold{0, 1, 2, 3}/config.yaml"

Training on FSS-1000:

  python train.py --config "config/fss_resnet{50, 101}/config.yaml"

Evaluation

alt text

  • Download pre-trained weights on Link

Result on PASCAL-5i:

  python test.py --load "/path_to_pretrained_model/pascal_resnet{50, 101}/pascal_resnet{50, 101}_fold{0, 1, 2, 3}/"

Result on COCO-20i:

  python test.py --load "/path_to_pretrained_model/coco_resnet50/coco_resnet50_fold{0, 1, 2, 3}/"

Results on FSS-1000:

  python test.py --load "/path_to_pretrained_model/fss_resnet{50, 101}/"

Acknowledgement

We borrow code from public projects (huge thanks to all the projects). We mainly borrow code from HSNet.

Comments
  • Datasets not available on the google drive

    Datasets not available on the google drive

    Hi thanks for your work, I was trying to test your code but the datasets apparently were deleted or moved to another directory in google drive (COCO-20 and FS-1000). Can you update the URL where we can download them, please? Thanks in advance.

    opened by SantiDiazC 2
  • Minor Issues Downloading Some Datasets in VAT from Google Drive

    Minor Issues Downloading Some Datasets in VAT from Google Drive

    This is just a minor issue, but I still want to bring it up.

    When calling downlaod_from_google() method from ./data/download.py, the requests.Session().get(url, .......) method probably no longer returns any cookies (all I got is just an empty list) for PF-PASCAL and SPair-71k datasets, so no file is downloaded.

    I checked the actual absolute url = https://docs.google.com/uc?export=download&id='file-id from download.py'. It gives a warning page saying that the file is too big that google cannot perform virus scan, and it asks you to confirm if you still want to download the file.

    Seems like we still need to find another way to bypass the Google Drive Virus Scanning.

    PS: there's a workaround though: just manually download the datasets into ../Datasets_CATs/. (Datasets_CATs/ needs to be in the parent folder of Volumetric-Aggregation-Transformer)

    opened by Brahmagupta 2
  • Train error - Cuda out of memory

    Train error - Cuda out of memory

    Hi, First, thank you for sharing your work.

    I tried the following command to start training. python train.py --config "config/pascal_resnet50/pascal_resnet50_fold0/config.yaml"

    However, strangely training with base config file is not possible because of out of memory even though I use 3090 GPU.

    I don't know the reason but somewhere takes lots of GPU memory. Training only started when I reduce batchsize to 4 from 16.

    and..., This command doesn't work. Could you check ? conda env create -f environment.yaml

    opened by moonsh 2
  • Train & test code of semantic correspondence

    Train & test code of semantic correspondence

    Congratulations on this cool work! VAT achieves SOTA on multiple datasets including PF-WILLOW and Spair-71k. I am very interested in this task. However, I can not find training and test codes related to this task in the repo. I would appreciate it if you could include them in this repo. Thank you in advance.

    opened by liangsusan-git 2
  • rescaling the predicted keypoints coordinates

    rescaling the predicted keypoints coordinates

    I'm trying to visualize some test results by using /utils_training/utils.flow2kps method. and I figured your model is trying to map keypoints from target images to src images, i.e. making predictions of keypoints in src images. (if im not mistaken). but the Estimated_kps Im getting seem off and sometimes out of range (out side of the image regions). I also noticed both the source and target image in a pair are resized to a same image size. this is prbly something I missed

    I wonder how i can rescale the estimated_kps so it will correctly mark out the keypoints in the original images. (Orwhat size should i rescale the original image to use the predicted keypoints)

    opened by Brahmagupta 1
  • RuntimeError: one of the variables needed for gradient computation

    RuntimeError: one of the variables needed for gradient computation

    Hello.

    Thank you for this amazing work.

    I want to retrain your model, but when I traid I got this error. Do you have any experience with this error?

    RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [2, 128, 32, 32, 8, 8]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

    opened by SirojbekSafarov 2
  • Training time and logs

    Training time and logs

    Hi, Seokju-Cho

    Good work! This is a quite surprising job for few-shot segmentation.

    I am trying to re-train VAT on PASCAL, but I find that it may take about 5 days on 4 Tesla V100 GPUs for 300 epochs.

    • I wonder how long did it use in your experiments (with 3090 or other GPU)?
    • And could you share a copy of the training log of the experiment for reference?

    Thanks a lot!

    opened by Jarvis73 0
  • Unfair comparions?  : Saving the best model during training, Kfold experimneting and Image sizes

    Unfair comparions? : Saving the best model during training, Kfold experimneting and Image sizes

    Hi @Seokju-Cho

    Thank you for the code.

    I have several questions that would be great If you answer.

    As I see in the code, you are saving the best model by validating on validation data of the current fold(Pascal dataset) in every epoch of training. Am I right? In pascal dataset validation data are used for reporting the MIOU and should not be used during training.

    For reporting the model accuracy, most of the papers in few-shot segmentation are using Kfold experimenting. As I see in your code you report the accuracy just by one try. Is it right?

    The final question is image sizes for training and validation. As I see in your code, you are using 473 which is different than HSnet (400) and REPRI (417) net. As it is mentioned in Hsnet GitHub issues " https://github.com/juhongm999/hsnet/issues/6 ", The author claimed, "In our experiments, we found that larger image sizes typically (> 417) result in better mIoU results". You are better than HSnet by a small margin which can be due to image sizes. Am I right?

    Best

    opened by aminpdik 0
  • RuntimeError: stack expects a non-empty TensorList

    RuntimeError: stack expects a non-empty TensorList

    Got this error on running on the images folder

    Traceback (most recent call last): File "test.py", line 94, in test_miou, test_fb_iou = test(model, dataloader_test, args.nshot) File "test.py", line 44, in test average_meter.write_result('Test', 0) File "/content/Volumetric-Aggregation-Transformer/common/logger.py", line 51, in write_result loss_buf = torch.stack(self.loss_buf) RuntimeError: stack expects a non-empty TensorList

    opened by Usama3059 3
Owner
Hamacojr
Hamacojr
Official PyTorch implementation for paper Context Matters: Graph-based Self-supervised Representation Learning for Medical Images

Context Matters: Graph-based Self-supervised Representation Learning for Medical Images Official PyTorch implementation for paper Context Matters: Gra

null 49 Nov 23, 2022
The official implementation of NeMo: Neural Mesh Models of Contrastive Features for Robust 3D Pose Estimation [ICLR-2021]. https://arxiv.org/pdf/2101.12378.pdf

NeMo: Neural Mesh Models of Contrastive Features for Robust 3D Pose Estimation [ICLR-2021] Release Notes The offical PyTorch implementation of NeMo, p

Angtian Wang 76 Nov 23, 2022
StyleGAN2-ADA - Official PyTorch implementation

Abstract: Training generative adversarial networks (GAN) using too little data typically leads to discriminator overfitting, causing training to diverge. We propose an adaptive discriminator augmentation mechanism that significantly stabilizes training in limited data regimes.

NVIDIA Research Projects 3.2k Dec 30, 2022
Official implementation of the ICLR 2021 paper

You Only Need Adversarial Supervision for Semantic Image Synthesis Official PyTorch implementation of the ICLR 2021 paper "You Only Need Adversarial S

Bosch Research 272 Dec 28, 2022
Official PyTorch implementation of Joint Object Detection and Multi-Object Tracking with Graph Neural Networks

This is the official PyTorch implementation of our paper: "Joint Object Detection and Multi-Object Tracking with Graph Neural Networks". Our project website and video demos are here.

Richard Wang 443 Dec 6, 2022
Official implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis https://arxiv.org/abs/2011.13775

CIPS -- Official Pytorch Implementation of the paper Image Generators with Conditionally-Independent Pixel Synthesis Requirements pip install -r requi

Multimodal Lab @ Samsung AI Center Moscow 201 Dec 21, 2022
Official pytorch implementation of paper "Image-to-image Translation via Hierarchical Style Disentanglement".

HiSD: Image-to-image Translation via Hierarchical Style Disentanglement Official pytorch implementation of paper "Image-to-image Translation

null 364 Dec 14, 2022
Official pytorch implementation of paper "Inception Convolution with Efficient Dilation Search" (CVPR 2021 Oral).

IC-Conv This repository is an official implementation of the paper Inception Convolution with Efficient Dilation Search. Getting Started Download Imag

Jie Liu 111 Dec 31, 2022
Official PyTorch Implementation of Unsupervised Learning of Scene Flow Estimation Fusing with Local Rigidity

UnRigidFlow This is the official PyTorch implementation of UnRigidFlow (IJCAI2019). Here are two sample results (~10MB gif for each) of our unsupervis

Liang Liu 28 Nov 16, 2022
Official implementation of our paper "LLA: Loss-aware Label Assignment for Dense Pedestrian Detection" in Pytorch.

LLA: Loss-aware Label Assignment for Dense Pedestrian Detection This project provides an implementation for "LLA: Loss-aware Label Assignment for Dens

null 35 Dec 6, 2022
Official implementation of Self-supervised Graph Attention Networks (SuperGAT), ICLR 2021.

SuperGAT Official implementation of Self-supervised Graph Attention Networks (SuperGAT). This model is presented at How to Find Your Friendly Neighbor

Dongkwan Kim 127 Dec 28, 2022
An official implementation of "SFNet: Learning Object-aware Semantic Correspondence" (CVPR 2019, TPAMI 2020) in PyTorch.

PyTorch implementation of SFNet This is the implementation of the paper "SFNet: Learning Object-aware Semantic Correspondence". For more information,

CV Lab @ Yonsei University 87 Dec 30, 2022
This project is the official implementation of our accepted ICLR 2021 paper BiPointNet: Binary Neural Network for Point Clouds.

BiPointNet: Binary Neural Network for Point Clouds Created by Haotong Qin, Zhongang Cai, Mingyuan Zhang, Yifu Ding, Haiyu Zhao, Shuai Yi, Xianglong Li

Haotong Qin 59 Dec 17, 2022
Official code implementation for "Personalized Federated Learning using Hypernetworks"

Personalized Federated Learning using Hypernetworks This is an official implementation of Personalized Federated Learning using Hypernetworks paper. [

Aviv Shamsian 121 Dec 25, 2022
StyleGAN2 - Official TensorFlow Implementation

StyleGAN2 - Official TensorFlow Implementation

NVIDIA Research Projects 10.1k Dec 28, 2022
Old Photo Restoration (Official PyTorch Implementation)

Bringing Old Photo Back to Life (CVPR 2020 oral)

Microsoft 11.3k Dec 30, 2022
Official implementation of "GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators" (NeurIPS 2020)

GS-WGAN This repository contains the implementation for GS-WGAN: A Gradient-Sanitized Approach for Learning Differentially Private Generators (NeurIPS

null 46 Nov 9, 2022
Official PyTorch implementation of Spatial Dependency Networks.

Spatial Dependency Networks: Neural Layers for Improved Generative Image Modeling Đorđe Miladinović   Aleksandar Stanić   Stefan Bauer   Jürgen Schmid

Djordje Miladinovic 34 Jan 19, 2022
Official implementation of YOGO for Point-Cloud Processing

You Only Group Once: Efficient Point-Cloud Processing with Token Representation and Relation Inference Module By Chenfeng Xu, Bohan Zhai, Bichen Wu, T

Chenfeng Xu 67 Dec 20, 2022