With the same purpose and features as DexiNed, LDC is a straightforward CNN based model for edge detection. LDC has just ~0.7M parameters, it can reduce your time of training and testing. This model is trained only on datasets prepared for edge detection BIPED, MDBD, and RINDNet---we have prepared this dataset here BRIND. Before using this repo, we highly recommend read our paper in LDC: Lightweight Dense CNN for Edge Detection. Check the results below.
Check the banner in HR
- Python >= 3.7
- Pytorch >=1.6
- OpenCV
- Kornia
- Other package like Numpy, h5py, PIL, json.
Once the packages are installed, clone this repo as follow:
git clone https://github.com/xavysp/LDC.git
cd LDC
├── data # Sample images for testing (paste your image here)
| ├── (Some images) # Images to test LDC
├── img # Images used in README.md
| └── banner.png # LDC banner
├── utls # A series of tools used in this repo
| └── img_processing.py # Miscellaneous tool functions
├── datasets.py # Tools for dataset managing
├── losses2.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
├── modelB4.py # LDC (4 blocks) class in pythorch
└── modelB5.py # LDC (5 blocks) class in pythorch
In dataset.py you will find most of the dataset used in edge, contour, and boundary detection. If you have your own dataset copy and paste in data folder and run the code bellow
python main.py --choose_test_data=-1
Check the dateset you have for training, set them in dataset.py and main.py---line 216-350. Then run the following code:
python main.py
If you like LDC, why not starring the project on GitHub!
Please cite our paper if you find helpful in your academic/scientific publication,
@ARTICLE{xsoria2022ldc,
author={Soria, Xavier and Pomboza-Junez, Gonzalo and Sappa, Angel Domingo},
journal={IEEE Access},
title={LDC: Lightweight Dense CNN for Edge Detection},
year={2022},
volume={10},
number={},
pages={68281-68290},
doi={10.1109/ACCESS.2022.3186344}}