This is the PyTorch implementation of our edge detection method, RCF.
If you are using the code/model/data provided here in a publication, please consider citing:
@article{liu2019richer,
title={Richer Convolutional Features for Edge Detection},
author={Liu, Yun and Cheng, Ming-Ming and Hu, Xiaowei and Bian, Jia-Wang and Zhang, Le and Bai, Xiang and Tang, Jinhui},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
volume={41},
number={8},
pages={1939--1946},
year={2019},
publisher={IEEE}
}
@article{liu2022semantic,
title={Semantic edge detection with diverse deep supervision},
author={Liu, Yun and Cheng, Ming-Ming and Fan, Deng-Ping and Zhang, Le and Bian, JiaWang and Tao, Dacheng},
journal={International Journal of Computer Vision},
volume={130},
pages={179--198},
year={2022},
publisher={Springer}
}
Clone the RCF repository:
git clone https://github.com/yun-liu/RCF-PyTorch.git
Download the ImageNet-pretrained model (Google Drive or Baidu Yun), and put it into the $ROOT_DIR
folder.
Download the datasets as below, and extract these datasets to the $ROOT_DIR/data/
folder.
wget http://mftp.mmcheng.net/liuyun/rcf/data/bsds_pascal_train_pair.lst
wget http://mftp.mmcheng.net/liuyun/rcf/data/HED-BSDS.tar.gz
wget http://mftp.mmcheng.net/liuyun/rcf/data/PASCAL.tar.gz
Run the following command to start the training:
python train.py --save-dir /path/to/output/directory/
Download the pretrained model (BSDS500+PASCAL: Google Drive or Baidu Yun), and put it into the $ROOT_DIR
folder.
Run the following command to start the testing:
python test.py --checkpoint bsds500_pascal_model.pth --save-dir /path/to/output/directory/
This pretrained model should achieve an ODS F-measure of 0.812.
For more information about RCF and edge quality evaluation, please refer to this page: yun-liu/RCF
We have released the code and data for plotting the edge PR curves of many existing edge detectors here.
Caffe based RCF: yun-liu/RCF
Jittor based RCF: yun-liu/RCF-Jittor