Code Monkey home page Code Monkey logo

hed's Introduction

A PyTorch Reimplementation of HED

Introduction

This is a PyTorch reimplementation of Holistically-nested Edge Detection (HED). The code is evaluated on Python 3.6 with PyTorch 1.0 (CUDA9, CUDNN7) and MATLAB R2018b.

Instructions

Prepare
  1. Clone the repository:

    git clone https://github.com/xwjabc/hed.git
  2. Download and extract the data:

    cd hed
    wget https://cseweb.ucsd.edu/~weijian/static/datasets/hed/hed-data.tar
    tar xvf ./hed-data.tar
Train and Evaluate
  1. Train:

    python hed.py --vgg16_caffe ./data/5stage-vgg.py36pickle

    The results are in output folder. In the default settings, the HED model is trained for 40 epochs, which takes ~27hrs with one NVIDIA Geforce GTX Titan X (Maxwell).

  2. Evaluate:

    cd eval
    (echo "data_dir = '../output/epoch-39-test'"; cat eval_edge.m)|matlab -nodisplay -nodesktop -nosplash

    The evaluation process takes ~7hrs with Intel Core i7-5930K CPU @ 3.50GHz.

Besides, based on my observation, the evaluated performance is somewhat stable after 5 epochs (5 epochs: ODS=0.788 OIS=0.808 vs. 40 epochs: ODS=0.787 OIS=0.807).

Evaluate the Pre-trained Models
  1. Evaluate the my pre-trained version:

    python hed.py --checkpoint ./data/hed_checkpoint.pt --output ./output-mypretrain --test
    cd eval
    (echo "data_dir = '../output-mypretrain/test'"; cat eval_edge.m)|matlab -nodisplay -nodesktop -nosplash

    The result should be similar to ODS=0.787 OIS=0.807.

  2. Evaluate the official pre-trained version:

    python hed.py --caffe_model ./data/hed_pretrained_bsds.py36pickle --output ./output-officialpretrain --test
    cd eval
    (echo "data_dir = '../output-officialpretrain/test'"; cat eval_edge.m)|matlab -nodisplay -nodesktop -nosplash

    The result should be similar to ODS=0.788 OIS=0.806.

Acknowledgement

This reimplementation is based on lots of prior works. Thanks to Saining for the original Caffe implementation. Thanks to @meteorshowers for a PyTorch implementation where I adopt most of the code from. Thanks to @jmbuena for a fixed version of Piotr's Toolbox. Thanks to Berkeley Institute for Data Science which provides a mirror of BSDS500 dataset (the original link to the dataset seems broken).

hed's People

Contributors

xwjabc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.