Giter Site home page Giter Site logo

dexined's Introduction

PWC

Dense Extreme Inception Network: Towards a Robust CNN Model for Edge Detection (DexiNed)

- We have just updated the last version of DexiNed in Pytorch. The implementation with TF1 will fransfer to the "legacy" dir

This work presents a new Convolutional Neural Network (CNN) arquitecture for edge detection. Unlike of the state-of-the-art CNN based edge detectors, this models has a single training stage, but it is still able to overcome those models in the edge detection datasets. Moreover, Dexined does not need pre-trained weights, and it is trained from the scratch with fewer parameters tunning. To know more about DexiNed, read our first version of Dexined in arxiv. The last version of DexiNed is implemented in Pytorch, in TF2 it will be available soon.

Table of Contents

DexiNed-v1

This version was presented in WACV2020, this is the base DexiNed model implemented in TensorFlow 1

TensorFlow2

Dexined version on TF 2 is not ready

Requirements

Once the packages are installed, clone this repo as follow:

git clone https://github.com/xavysp/DexiNed.git
cd DexiNed

Project Architecture

├── data                        # sample images for testing
|   ├── lena_std.tif            # sample 1
|   └── stonehengeuk.jpg        # sample 2
├── figs                        # Images used in README.md
|   └── DexiNed_banner.png      # DexiNed banner
├── models                      # tensorflow model file  
|   └── dexined.py              # DexiNed class
├── utls                        # a series of tools used in this repo
|   └── dataset_manager.py      # tools for dataset managing
|   └── losses.py               # Loss function used to train DexiNed 
|   └── utls.py                 # miscellaneous tool functions
├── run_model.py                # the main python file with main functions and parameter settings
└── test.py                     # the script to run the test experiment
└── train.py                    # the script to run the train experiment

As described above, run_model.py has the parameters settings, whether DexiNed is used for training or testing, before those processes the parameters need to be set. As highlighted, DexiNed is trained just one time with our proposed dataset BIPED, so in "--train_dataset" as the default setting is BIDEP; however, in the testing stage (--test_dataset), any dataset can be used, even CLASSIC, which is an arbitrary image downloaded from the internet. However, to evaluate with single images or CLASSIC "--use_dataset" has to be in FALSE mode. Whenever a dataset is used to test or train on DexiNed the arguments have to have the list of training or testing files (--train_list, --test_list). Pay attention in the parameters' settings, and change whatever you want, like ''--image_width'' or ''--image_height''. To test the Lena image I set 512x51 (see "test" section).

parser.add_argument('--train_dataset', default='BIPED', choices=['BIPED','BSDS'])
parser.add_argument('--test_dataset', default='CLASSIC', choices=['BIPED', 'BSDS','MULTICUE','NYUD','PASCAL','CID'])
parser.add_argument('--dataset_dir',default=None,type=str)
parser.add_argument('--dataset_augmented', default=True,type=bool)
parser.add_argument('--train_list',default='train_rgb.lst', type=str)
parser.add_argument('--test_list', default='test_pair.lst',type=str)  

Test

The datasets.py has, among other things, The whole datasets configurations used in DexiNed for testing and training:

DATASET_NAMES = [
    'BIPED',
    'BSDS',
    'BSDS300',
    'CID',
    'DCD',
    'MULTICUE', #5
    'PASCAL',
    'NYUD',
    'CLASSIC'
] 

For example, if want t test your own dataset or image choose "CLASSIC". Before test the DexiNed model, it is necesarry to download the checkpoint here Checkpoint Pytorch and save this file into the DexiNed folder like: checkpoints/BIPED/14/(here the checkpoints from Drive), then run as follow:

python main.py --choose_test_data=-1 Make sure that in main.py the test setting be as: parser.add_argument('--is_testing', default=True, help='Script in testing mode.') DexiNed downsample the input image till 16 scales, please make sure that, in dataset_info fucn (datasets.py), the image width and height be multiple of 16, like 512, 960, and etc. **In the Checkpoint from Drive you will the find the last trained checkpoint, which has been trained in the last version of BIPED dataset that will be updated soon in Kaggle **

Train

python main.py 

Make sure that in main.py the train setting be as: parser.add_argument('--is_testing', default=False, help='Script in testing mode.')

Datasets

Dataset used for Training

- The BIPED dataset has been updated to the last version and it can be download from Kaggle

BIPED (Barcelona Images for Perceptual Edge Detection): This dataset is collected and annotated in the edge level for this work. See more details and download in: Option1, Option2 kaggle. The BIPED dataset has been updated, adding more annotations and correcting few mistakes, so those links have the renewed version of BIPED, if you want the older version you may ask us by email. The last performance (table below) will be updated soon.

Datasets used for Testing

Edge detection datasets

Non-edge detection datasets

Performance

The results below are from the last version of BIPEP. After WACV20, the BIPED images have been again checked and added annotations. All of those models have been trained again.

Methods ODS ODS AP
SED before .717 .731 .756
SED .000 .000 .000
HED before .823 .847 .869
HED .000 .000 .000
RCF before .843 .859 .882
RCF .000 .000 .000
BDCN before .839 .854 .887
BDCN .000 .000 .000
DexiNed(WACV'20) .859 .867 .905
DexiNed(Ours) .000 .000 .000
Evaluation performed to BIPED dataset. We will update the result soon.

Citation

If you like DexiNed, why not starring the project on GitHub!

GitHub stars

Please cite our paper if you find helpful in your academic/scientific publication,

@InProceedings{soria2020dexined,
    title={Dense Extreme Inception Network: Towards a Robust CNN Model for Edge Detection},
    author={Xavier Soria and Edgar Riba and Angel Sappa},
    booktitle={The IEEE Winter Conference on Applications of Computer Vision (WACV '20)},
    year={2020}
}

dexined's People

Contributors

xavysp avatar edgarriba avatar stephenwithav avatar dependabot[bot] 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.