A PyTorch implementation of SIN: Superpixel Interpolation Network

Related tags

Deep LearningSIN
Overview

SIN: Superpixel Interpolation Network

This is is a PyTorch implementation of the superpixel segmentation network introduced in our PRICAI-2021 paper:

SIN: Superpixel Interpolation Network

Prerequisites

The training code was mainly developed and tested with python 3.6, PyTorch 1.4, CUDA 10, and Ubuntu 18.04.

Demo

The demo script run_demo.py provides the superpixels with grid size 16 x 16 using our pre-trained model (in /pretrained_ckpt). Please feel free to provide your own images by copying them into /demo/inputs, and run

python run_demo.py --data_dir=./demo/inputs --data_suffix=jpg --output=./demo 

The results will be generate in a new folder under /demo called spixel_viz.

Data preparation

To generate training and test dataset, please first download the data from the original BSDS500 dataset, and extract it to . Then, run

cd data_preprocessing
python pre_process_bsd500.py --dataset=
   
     --dump_root=
    
     
python pre_process_bsd500_ori_sz.py --dataset=
     
       --dump_root=
      
       
cd ..

      
     
    
   

The code will generate three folders under the , named as /train, /val, and /test, and three .txt files record the absolute path of the images, named as train.txt, val.txt, and test.txt.

Training

Once the data is prepared, we should be able to train the model by running the following command

python main.py --data=
   
     --savepath=
    

    
   

if we wish to continue a train process or fine-tune from a pre-trained model, we can run

python main.py --data=
   
     --savepath=
    
      --pretrained=
      

     
    
   

The code will start from the recorded status, which includes the optimizer status and epoch number.

The training log can be viewed from the tensorboard session by running

tensorboard --logdir=
   
     --port=8888

   

Testing

We provide test code to generate: 1) superpixel visualization and 2) the.csv files for evaluation.

To test on BSDS500, run

python run_infer_bsds.py --data_dir=
   
     --output=
    
      --pretrained=
     

     
    
   

To test on NYUv2, please follow the intruction on the superpixel benchmark to generate the test dataset, and then run

python run_infer_nyu.py --data_dir=
   
     --output=
    
      --pretrained=
     

     
    
   

To test on other datasets, please first collect all the images into one folder , and then convert them into the same format (e.g. .png or .jpg) if necessary, and run

python run_demo.py --data_dir=
   
     --data_suffix=
    
      --output=
     
       --pretrained=
      

      
     
    
   

Superpixels with grid size 16 x 16 will be generated by default. To generate the superpixel with a different grid size, we simply need to resize the images into the approporate resolution before passing them through the code. Please refer to run_infer_nyu.py for the details.

Evaluation

We use the code from superpixel benchmark for superpixel evaluation. A detailed instruction is available in the repository, please

(1) download the code and build it accordingly;

(2) edit the variables $SUPERPIXELS, IMG_PATH and GT_PATH in /eval_spixel/my_eval.sh,

(3) run

cp /eval_spixel/my_eval.sh 
   
    /examples/bash/
cd  
    
     /examples/
bash my_eval.sh

    
   

several files should be generated in the map_csv folders in the corresponding test outputs;

(4) run

cd eval_spixel
python copy_resCSV.py --src=
   
     --dst=
    

    
   

(5) open /eval_spixel/plot_benchmark_curve.m , set the our1l_res_path as and modify the num_list according to the test setting. The default setting is for our BSDS500 test set.;

(6) run the plot_benchmark_curve.m, the ASA Score, CO Score, and BR-BP curve of our method should be shown on the screen. If you wish to compare our method with the others, you can first run the method and organize the data as we state above, and uncomment the code in the plot_benchmark_curve.m to generate a similar figure shown in our papers.

Acknowledgement

The code is implemented based on superpixel_fcn. We would like to express our sincere thanks to the contributors.

Cite

If you use SIN in your work please cite our paper:

@article{yuan2021sin,
title={SIN: Superpixel Interpolation Network},
author={Qing Yuan, Songfeng Lu, Yan Huang, Wuxin Sha},
booktitle={PRICAI},
year={2021}
}

Paddle implementation for "Cross-Lingual Word Embedding Refinement by β„“1 Norm Optimisation" (NAACL 2021)

L1-Refinement Paddle implementation for "Cross-Lingual Word Embedding Refinement by β„“1 Norm Optimisation" (NAACL 2021) πŸ™ˆ A more detailed readme is co

Lincedo Lab 4 Jun 09, 2021
Code for "ShineOn: Illuminating Design Choices for Practical Video-based Virtual Clothing Try-on", accepted at WACV 2021 Generation of Human Behavior Workshop.

ShineOn: Illuminating Design Choices for Practical Video-based Virtual Clothing Try-on [ Paper ] [ Project Page ] This repository contains the code fo

Andrew Jong 97 Dec 13, 2022
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

32 Sep 21, 2022
PyTorch Implementation of Small Lesion Segmentation in Brain MRIs with Subpixel Embedding (ORAL, MICCAIW 2021)

Small Lesion Segmentation in Brain MRIs with Subpixel Embedding PyTorch implementation of Small Lesion Segmentation in Brain MRIs with Subpixel Embedd

22 Oct 21, 2022
AI4Good project for detecting waste in the environment

Detect waste AI4Good project for detecting waste in environment. www.detectwaste.ml. Our latest results were published in Waste Management journal in

108 Dec 25, 2022
Code for "Multi-Time Attention Networks for Irregularly Sampled Time Series", ICLR 2021.

Multi-Time Attention Networks (mTANs) This repository contains the PyTorch implementation for the paper Multi-Time Attention Networks for Irregularly

The Laboratory for Robust and Efficient Machine Learning 68 Dec 17, 2022
This repository includes code of my study about Asynchronous in Frequency domain of GAN images.

Exploring the Asynchronous of the Frequency Spectra of GAN-generated Facial Images Binh M. Le & Simon S. Woo, "Exploring the Asynchronous of the Frequ

4 Aug 06, 2022
Source code for CVPR 2021 paper "Riggable 3D Face Reconstruction via In-Network Optimization"

Riggable 3D Face Reconstruction via In-Network Optimization Source code for CVPR 2021 paper "Riggable 3D Face Reconstruction via In-Network Optimizati

130 Jan 02, 2023
Geometric Vector Perceptrons --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Implementation of equivariant GVP-GNNs as described in Learning from Protein Structure with Geometric Vector Perceptrons b

Dror Lab 142 Dec 29, 2022
[제 13회 νˆ¬λΉ…μŠ€ 컨퍼런슀] OK Mugle! - μž₯λ₯΄λΆ€ν„° λ©œλ‘œλ””κΉŒμ§€, Content-based Music Recommendation

Ok Mugle! 🎡 μž₯λ₯΄λΆ€ν„° λ©œλ‘œλ””κΉŒμ§€, Content-based Music Recommendation 'Ok Mugle!'은 제13회 νˆ¬λΉ…μŠ€ 컨퍼런슀(2022.01.15)μ—μ„œ μ§„ν–‰ν•œ μŒμ•… μΆ”μ²œ ν”„λ‘œμ νŠΈμž…λ‹ˆλ‹€. Description πŸ“– λ³Έ ν”„λ‘œμ νŠΈμ—μ„œλŠ” Kakao

SeongBeomLEE 5 Oct 09, 2022
PyTorch implementation of Pointnet2/Pointnet++

Pointnet2/Pointnet++ PyTorch Project Status: Unmaintained. Due to finite time, I have no plans to update this code and I will not be responding to iss

Erik Wijmans 1.2k Dec 29, 2022
Prototypical Pseudo Label Denoising and Target Structure Learning for Domain Adaptive Semantic Segmentation (CVPR 2021)

Prototypical Pseudo Label Denoising and Target Structure Learning for Domain Adaptive Semantic Segmentation (CVPR 2021, official Pytorch implementatio

Microsoft 247 Dec 25, 2022
A series of Python scripts to access measurements from Fluke 28X meters. Fluke IR Remote Interface required.

Fluke289_data_access A series of Python scripts to access measurements from Fluke 28X meters. Fluke IR Remote Interface required. Created from informa

3 Dec 08, 2022
Implementation for "Domain-Specific Bias Filtering for Single Labeled Domain Generalization"

DSBF Introduction This repository contains the implementation code for paper: Domain-Specific Bias Filtering for Single Labeled Domain Generalization

ScottYuan 7 Jan 05, 2023
SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab

CORNELLSASLAB SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab Instructions: This python code can be used to convert SAS out

2 Jan 26, 2022
Repository for publicly available deep learning models developed in Rosetta community

trRosetta2 This package contains deep learning models and related scripts used by Baker group in CASP14. Installation Linux/Mac clone the package git

81 Dec 29, 2022
JAX bindings to the Flatiron Institute Non-uniform Fast Fourier Transform (FINUFFT) library

JAX bindings to FINUFFT This package provides a JAX interface to (a subset of) the Flatiron Institute Non-uniform Fast Fourier Transform (FINUFFT) lib

Dan Foreman-Mackey 32 Oct 15, 2022
Fine-Tune EleutherAI GPT-Neo to Generate Netflix Movie Descriptions in Only 47 Lines of Code Using Hugginface And DeepSpeed

GPT-Neo-2.7B Fine-Tuning Example Using HuggingFace & DeepSpeed Installation cd venv/bin ./pip install -r ../../requirements.txt ./pip install deepspe

Nikita 180 Jan 05, 2023
[ICLR 2022] Contact Points Discovery for Soft-Body Manipulations with Differentiable Physics

CPDeform Code and data for paper Contact Points Discovery for Soft-Body Manipulations with Differentiable Physics at ICLR 2022 (Spotlight). @InProceed

(Lester) Sizhe Li 29 Nov 29, 2022
GND-Nets (Graph Neural Diffusion Networks) in TensorFlow.

GNDC For submission to IEEE TKDE. Overview Here we provide the implementation of GND-Nets (Graph Neural Diffusion Networks) in TensorFlow. The reposit

Wei Ye 3 Aug 08, 2022