Code for the ICCV 2021 paper "Pixel Difference Networks for Efficient Edge Detection" (Oral).

Related tags

Deep Learningpidinet
Overview

Pixel Difference Convolution

This repository contains the PyTorch implementation for "Pixel Difference Networks for Efficient Edge Detection" by Zhuo Su*, Wenzhe Liu*, Zitong Yu, Dewen Hu, Qing Liao, Qi Tian, Matti Pietikäinen and Li Liu** (* Authors have equal contributions, ** Corresponding author). [arXiv]

The writing style of this code is based on Dynamic Group Convolution.

Running environment

Training: Pytorch 1.9 with cuda 10.1 and cudnn 7.5 in an Ubuntu 18.04 system
Evaluation: Matlab 2019a

Ealier versions may also work~ :)

Dataset

We use the links in RCF Repository. The augmented BSDS500, PASCAL VOC, and NYUD datasets can be downloaded with:

wget http://mftp.mmcheng.net/liuyun/rcf/data/HED-BSDS.tar.gz
wget http://mftp.mmcheng.net/liuyun/rcf/data/PASCAL.tar.gz
wget http://mftp.mmcheng.net/liuyun/rcf/data/NYUD.tar.gz

To create BSDS dataset, please follow:

  1. create a folder /path/to/BSDS500,
  2. extract HED-BSDS.tar.gz to /path/to/BSDS500/HED-BSDS,
  3. extract PASCAL.tar.gz to /path/to/BSDS500/PASCAL,
  4. if you want to evaluate on BSDS500 val set, the val images can be downloaded from this link, please extract it to /path/to/BSDS500/HED-BSDS/val,
  5. cp the *.lst files in data/BSDS500/HED-BSDS to /path/to/BSDS500/HED-BSDS/, cp the *.lst files in data/BSDS500 to /path/to/BSDS500/.

To create NYUD dataset, please follow:

  1. create a folder /path/to/NYUD,
  2. extract NYUD.tar.gz to /path/to/NYUD,
  3. cp the *.lst files in data/NYUD to /path/to/NYUD/.

Training, and Generating edge maps

Here we provide the scripts for training the models appeared in the paper. For example, we refer to the PiDiNet model in Table 5 in the paper as table5_pidinet.

table5_pidinet

# train, the checkpoints will be save in /path/to/table5_pidinet/save_models/ during training
python main.py --model pidinet --config carv4 --sa --dil --resume --iter-size 24 -j 4 --gpu 0 --epochs 20 --lr 0.005 --lr-type multistep --lr-steps 10-16 --wd 1e-4 --savedir /path/to/table5_pidinet --datadir /path/to/BSDS500 --dataset BSDS

# generating edge maps using the original model
python main.py --model pidinet --config carv4 --sa --dil -j 4 --gpu 0 --savedir /path/to/table5_pidinet --datadir /path/to/BSDS500 --dataset BSDS --evaluate /path/to/table5_pidinet/save_models/checkpointxxx.tar

# generating edge maps using the converted model, it should output the same results just like using the original model
# the process will convert pidinet to vanilla cnn, using the saved checkpoint
python main.py --model pidinet_converted --config carv4 --sa --dil -j 4 --gpu 0 --savedir /path/to/table5_pidinet --datadir /path/to/BSDS500 --dataset BSDS --evaluate /path/to/table5_pidinet/save_models/checkpointxxx.tar --evaluate-converted

# test FPS on GPU
python throughput.py --model pidinet_converted --config carv4 --sa --dil -j 1 --gpu 0 --datadir /path/to/BSDS500 --dataset BSDS

It is similar for other models, please see detailed scripts in scripts.sh.

The performance of some of the models are listed below (click the items to download the checkpoints and training logs). FPS metrics are tested on a NVIDIA RTX 2080 Ti, showing slightly faster than that recorded in the paper (you probably get different FPS records in different runs, but they will not vary too much):

Model ODS OIS FPS Training logs
table5_baseline 0.798 0.816 101 log
table5_pidinet 0.807 0.823 96 log, running log
table5_pidinet-l 0.800 0.815 135 log
table5_pidinet-small 0.798 0.814 161 log
table5_pidinet-small-l 0.793 0.809 225 log
table5_pidinet-tiny 0.789 0.806 182 log
table5_pidinet-tiny-l 0.787 0.804 253 log
table6_pidinet 0.733 0.747 66 log, running_log
table7_pidinet 0.818 0.824 17 log, running_log

Evaluation

The matlab code used for evaluation in our experiments can be downloaded in matlab code for evaluation.

Possible steps:

  1. extract the downloaded file to /path/to/edge_eval_matlab,
  2. change the first few lines (path settings) in eval_bsds.m, eval_nyud.m, eval_multicue.m for evaluating the three datasets respectively,
  3. in a terminal, open Matlab like
matlab -nosplash -nodisplay -nodesktop

# after entering the Matlab environment, 
>>> eval_bsds
  1. you could change the number of works in parpool in /path/to/edge_eval_matlab/toolbox.badacost.public/matlab/fevalDistr.m in line 100. The default value is 16.

For evaluating NYUD, following RCF, we increase the localization tolerance from 0.0075 to 0.011. The Matlab code is based on the following links:

PR curves

Please follow plot-edge-pr-curves, files for plotting pr curves of PiDiNet are provided in pidinet_pr_curves.

Generating edge maps for your own images

python main.py --model pidinet_converted --config carv4 --sa --dil -j 4 --gpu 0 --savedir /path/to/savedir --datadir /path/to/custom_images --dataset Custom --evaluate /path/to/table5_pidinet/save_models/checkpointxxx.tar --evaluate-converted

The results of our model look like this. The top image is the messy office table, the bottom image is the peaceful Saimaa lake in southeast of Finland.
Owner
Alex
A researcher in Oulu, Finland. Working on model compression and acceleration on Computer Vision.
Alex
Code for EMNLP 2021 main conference paper "Text AutoAugment: Learning Compositional Augmentation Policy for Text Classification"

Text-AutoAugment (TAA) This repository contains the code for our paper Text AutoAugment: Learning Compositional Augmentation Policy for Text Classific

LancoPKU 105 Jan 03, 2023
This is an official implementation for "Video Swin Transformers".

Video Swin Transformer By Ze Liu*, Jia Ning*, Yue Cao, Yixuan Wei, Zheng Zhang, Stephen Lin and Han Hu. This repo is the official implementation of "V

Swin Transformer 981 Jan 03, 2023
State-Relabeling Adversarial Active Learning

State-Relabeling Adversarial Active Learning Code for SRAAL [2020 CVPR Oral] Requirements torch = 1.6.0 numpy = 1.19.1 tqdm = 4.31.1 AL Results The

10 Jul 14, 2022
DimReductionClustering - Dimensionality Reduction + Clustering + Unsupervised Score Metrics

Dimensionality Reduction + Clustering + Unsupervised Score Metrics Introduction

11 Nov 15, 2022
PFLD pytorch Implementation

PFLD-pytorch Implementation of PFLD A Practical Facial Landmark Detector by pytorch. 1. install requirements pip3 install -r requirements.txt 2. Datas

zhaozhichao 669 Jan 02, 2023
Implementation of Perceiver, General Perception with Iterative Attention in TensorFlow

Perceiver This Python package implements Perceiver: General Perception with Iterative Attention by Andrew Jaegle in TensorFlow. This model builds on t

Rishit Dagli 84 Oct 15, 2022
Implementation of ICCV 2021 oral paper -- A Novel Self-Supervised Learning for Gaussian Mixture Model

SS-GMM Implementation of ICCV 2021 oral paper -- Self-Supervised Image Prior Learning with GMM from a Single Noisy Image with supplementary material R

HUST-The Tan Lab 4 Dec 05, 2022
GEA - Code for Guided Evolution for Neural Architecture Search

Efficient Guided Evolution for Neural Architecture Search Usage Create a conda e

6 Jan 03, 2023
Official Repository for Machine Learning class - Physics Without Frontiers 2021

PWF 2021 Física Sin Fronteras es un proyecto del Centro Internacional de Física Teórica (ICTP) en Trieste Italia. El ICTP es un centro dedicado a fome

36 Aug 06, 2022
Kinetics-Data-Preprocessing

Kinetics-Data-Preprocessing Kinetics-400 and Kinetics-600 are common video recognition datasets used by popular video understanding projects like Slow

Kaihua Tang 7 Oct 27, 2022
🌎 The Modern Declarative Data Flow Framework for the AI Empowered Generation.

🌎 JSONClasses JSONClasses is a declarative data flow pipeline and data graph framework. Official Website: https://www.jsonclasses.com Official Docume

Fillmula Inc. 53 Dec 09, 2022
PyTorch implementation of SIFT descriptor

This is an differentiable pytorch implementation of SIFT patch descriptor. It is very slow for describing one patch, but quite fast for batch. It can

Dmytro Mishkin 150 Dec 24, 2022
Code, pre-trained models and saliency results for the paper "Boosting RGB-D Saliency Detection by Leveraging Unlabeled RGB Images".

Boosting RGB-D Saliency Detection by Leveraging Unlabeled RGB This repository is the official implementation of the paper. Our results comming soon in

Xiaoqiang Wang 8 May 22, 2022
Code for the Paper "Diffusion Models for Handwriting Generation"

Code for the Paper "Diffusion Models for Handwriting Generation"

62 Dec 21, 2022
Simple PyTorch hierarchical models.

A python package adding basic hierarchal networks in pytorch for classification tasks. It implements a simple hierarchal network structure based on feed-backward outputs.

Rajiv Sarvepalli 5 Mar 06, 2022
Time Delayed NN implemented in pytorch

Pytorch Time Delayed NN Time Delayed NN implemented in PyTorch. Usage kernels = [(1, 25), (2, 50), (3, 75), (4, 100), (5, 125), (6, 150)] tdnn = TDNN

Daniil Gavrilov 79 Aug 04, 2022
A small fun project using python OpenCV, mediapipe, and pydirectinput

Here I tried a small fun project using python OpenCV, mediapipe, and pydirectinput. Here we can control moves car game when yellow color come to right box (press key 'd') left box (press key 'a') lef

Sameh Elisha 3 Nov 17, 2022
FIGARO: Generating Symbolic Music with Fine-Grained Artistic Control

FIGARO: Generating Symbolic Music with Fine-Grained Artistic Control by Dimitri von Rütte, Luca Biggio, Yannic Kilcher, Thomas Hofmann FIGARO: Generat

Dimitri 83 Jan 07, 2023
RINDNet: Edge Detection for Discontinuity in Reflectance, Illumination, Normal and Depth, in ICCV 2021 (oral)

RINDNet RINDNet: Edge Detection for Discontinuity in Reflectance, Illumination, Normal and Depth Mengyang Pu, Yaping Huang, Qingji Guan and Haibin Lin

Mengyang Pu 75 Dec 15, 2022
上海交通大学全自动抢课脚本,支持准点开抢与抢课后持续捡漏两种模式。2021/06/08更新。

Welcome to Course-Bullying-in-SJTU-v3.1! 2021/6/8 紧急更新v3.1 更新说明 为了更好地保护用户隐私,将原来用户名+密码的登录方式改为微信扫二维码+cookie登录方式,不再需要配置使用pytesseract。在使用扫码登录模式时,请稍等,二维码将马

87 Sep 13, 2022