Skip to content
forked from xavysp/DexiNed

Tensorflow Implementation of DexiNed for Edge Detection WACV'20 (also in PyTorch )

License

Notifications You must be signed in to change notification settings

ythpy82421/DexiNed

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (paste your image here)
|   ├── lena_std.tif            # Sample 1
├── DexiNed-TF2                 # DexiNed in TensorFlow2 (in construction)   
├── figs                        # Images used in README.md
|   └── DexiNed_banner.png      # DexiNed banner
├── legacy                      # DexiNed in TensorFlow1 (presented in WACV2020)
├── utls                        # A series of tools used in this repo
|   └── image.py                # Miscellaneous tool functions
├── datasets.py                 # Tools for dataset managing 
├── dexi_utils.py               # New functions still not used in the currecnt version
├── losses.py                   # Loss function used to train DexiNed (BDCNloss2)
├── main.py                     # The main python file with main functions and parameter settings
                                # here you can test and train
├── model.py                    # DexiNed class in pythorch

Before to start please check dataset.py, from the first line of code you can see the datasets used for training/testing. The main.py, line 194, call the data for the training or testing, see the example of the code below:

    parser = argparse.ArgumentParser(description='DexiNed trainer.')
    parser.add_argument('--choose_test_data',
                        type=int,
                        default=1,
                        help='Already set the dataset for testing choice: 0 - 8')
    # ----------- test -------0--

    TEST_DATA = DATASET_NAMES[parser.parse_args().choose_test_data] # max 8
    test_inf = dataset_info(TEST_DATA, is_linux=IS_LINUX)
    test_dir = test_inf['data_dir']
    is_testing = True# current test -352-SM-NewGT-2AugmenPublish

    # Training settings
    TRAIN_DATA = DATASET_NAMES[0] # BIPED=0
    train_inf = dataset_info(TRAIN_DATA, is_linux=IS_LINUX)
    train_dir = train_inf['data_dir']

Test

As previously mentioned, 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 to test your own dataset or image choose "CLASSIC" and save your test data in "data" dir. 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 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, augmentation script, 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}
}

About

Tensorflow Implementation of DexiNed for Edge Detection WACV'20 (also in PyTorch )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%