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}
}

Python calculations for the position of the sun and moon.

Astral This is 'astral' a Python module which calculates Times for various positions of the sun: dawn, sunrise, solar noon, sunset, dusk, solar elevat

Simon Kennedy 169 Dec 20, 2022
Collection of NLP model explanations and accompanying analysis tools

Thermostat is a large collection of NLP model explanations and accompanying analysis tools. Combines explainability methods from the captum library wi

126 Nov 22, 2022
Pytorch implementation of SimSiam Architecture

SimSiam-pytorch A simple pytorch implementation of Exploring Simple Siamese Representation Learning which is developed by Facebook AI Research (FAIR)

Saeed Shurrab 1 Oct 20, 2021
A novel framework to automatically learn high-quality scanning of non-planar, complex anisotropic appearance.

appearance-scanner About This repository is an implementation of the neural network proposed in Free-form Scanning of Non-planar Appearance with Neura

Xiaohe Ma 14 Oct 18, 2022
Roadmap to becoming a machine learning engineer in 2020

Roadmap to becoming a machine learning engineer in 2020, inspired by web-developer-roadmap.

Chris Hoyean Song 1.7k Dec 29, 2022
This is a clean and robust Pytorch implementation of DQN and Double DQN.

DQN/DDQN-Pytorch This is a clean and robust Pytorch implementation of DQN and Double DQN. Here is the training curve: All the experiments are trained

XinJingHao 15 Dec 27, 2022
Time should be taken seer-iously

TimeSeers seers - (Noun) plural form of seer - A person who foretells future events by or as if by supernatural means TimeSeers is an hierarchical Bay

279 Dec 26, 2022
Just playing with getting CLIP Guided Diffusion running locally, rather than having to use colab.

CLIP-Guided-Diffusion Just playing with getting CLIP Guided Diffusion running locally, rather than having to use colab. Original colab notebooks by Ka

Nerdy Rodent 336 Dec 09, 2022
Vision Deep-Learning using Tensorflow, Keras.

Welcome! I am a computer vision deep learning developer working in Korea. This is my blog, and you can see everything I've studied here. https://www.n

kimminjun 6 Dec 14, 2022
The UI as a mobile display for OP25

OP25 Mobile Control Head A 'remote' control head that interfaces with an OP25 instance. We take advantage of some data end-points left exposed for the

Sarah Rose Giddings 13 Dec 28, 2022
Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation'

OD-Rec Codes for SIGIR'22 Paper 'On-Device Next-Item Recommendation with Self-Supervised Knowledge Distillation' Paper, saved teacher models and Andro

Xin Xia 11 Nov 22, 2022
Watch faces morph into each other with StyleGAN 2, StyleGAN, and DCGAN!

FaceMorpher FaceMorpher is an innovative project to get a unique face morph (or interpolation for geeks) on a website. Yes, this means you can see fac

Anish 9 Jun 24, 2022
RMNA: A Neighbor Aggregation-Based Knowledge Graph Representation Learning Model Using Rule Mining

RMNA: A Neighbor Aggregation-Based Knowledge Graph Representation Learning Model Using Rule Mining Our code is based on Learning Attention-based Embed

宋朝都 4 Aug 07, 2022
Code for the paper Open Sesame: Getting Inside BERT's Linguistic Knowledge.

Open Sesame This repository contains the code for the paper Open Sesame: Getting Inside BERT's Linguistic Knowledge. Credits We built the project on t

9 Jul 24, 2022
[ArXiv 2021] One-Shot Generative Domain Adaptation

GenDA - One-Shot Generative Domain Adaptation One-Shot Generative Domain Adaptation Ceyuan Yang*, Yujun Shen*, Zhiyi Zhang, Yinghao Xu, Jiapeng Zhu, Z

GenForce: May Generative Force Be with You 46 Dec 19, 2022
Standalone pre-training recipe with JAX+Flax

Sabertooth Sabertooth is standalone pre-training recipe based on JAX+Flax, with data pipelines implemented in Rust. It runs on CPU, GPU, and/or TPU, b

Nikita Kitaev 26 Nov 28, 2022
PyTorch3D is FAIR's library of reusable components for deep learning with 3D data

Introduction PyTorch3D provides efficient, reusable components for 3D Computer Vision research with PyTorch. Key features include: Data structure for

Facebook Research 6.8k Jan 01, 2023
A Pytorch Implementation of Domain adaptation of object detector using scissor-like networks

A Pytorch Implementation of Domain adaptation of object detector using scissor-like networks Please follow Faster R-CNN and DAF to complete the enviro

2 Oct 07, 2022
Magic tool for managing internet connection in local network by @zalexdev

Megacut ✂️ A new powerful Python3 tool for managing internet on a local network Installation git clone https://github.com/stryker-project/megacut cd m

Stryker 12 Dec 15, 2022
Pytorch implementation of paper: "NeurMiPs: Neural Mixture of Planar Experts for View Synthesis"

NeurMips: Neural Mixture of Planar Experts for View Synthesis This is the official repo for PyTorch implementation of paper "NeurMips: Neural Mixture

James Lin 101 Dec 13, 2022