In this paper, we propose EdgeNAT, a one-stage Transformer-based edge detector that effectively extracts object boundaries and meaningful edges. Our model leverages image global contextual information and detailed local cues by exploiting the multi-scale structure of the backbone network. Here are the code for this paper.
pip3 install -r requirements-base.txt # Installs torch
pip3 install -r requirements.txt # Installs NATTEN, MMCV, MMSEG, and others
You can download the initial weights from hear. The five .pth files of pre-training should be placed in the folder ./pretrained.
./tools/dist_train.sh configs/bsds/edgenat_l_320x320_40k_bsds.py 1 # EdgeNAT-L
./tools/dist_train.sh configs/bsds/edgenat_s0_320x320_40k_bsds.py 1 # EdgeNAT-S0
./tools/dist_train.sh configs/bsds/edgenat_s1_320x320_40k_bsds.py 1 # EdgeNAT-S1
./tools/dist_train.sh configs/bsds/edgenat_s2_320x320_40k_bsds.py 1 # EdgeNAT-S2
./tools/dist_train.sh configs/bsds/edgenat_s3_320x320_40k_bsds.py 1 # EdgeNAT-S3
./tools/dist_train.sh configs/bsds/edgenat_l_320x320_40k_bsds_pascal.py 1 # EdgeNAT-L
./tools/dist_train.sh configs/bsds/edgenat_s0_320x320_40k_bsds_pascal.py 1 # EdgeNAT-S0
./tools/dist_train.sh configs/bsds/edgenat_s1_320x320_40k_bsds_pascal.py 1 # EdgeNAT-S1
./tools/dist_train.sh configs/bsds/edgenat_s2_320x320_40k_bsds_pascal.py 1 # EdgeNAT-S2
./tools/dist_train.sh configs/bsds/edgenat_s3_320x320_40k_bsds_pascal.py 1 # EdgeNAT-S3
./tools/dist_train.sh configs/bsds/edgenat_l_320x320_40k_bsds.py 1 --load-from ./work_dirs/edgenat_l_320x320_40k_bsds_pascal/iter_XX000.pth # EdgeNAT-L
./tools/dist_train.sh configs/bsds/edgenat_s0_320x320_40k_bsds.py 1 --load-from ./work_dirs/edgenat_s0_320x320_40k_bsds_pascal/iter_XX000.pth # EdgeNAT-S0
./tools/dist_train.sh configs/bsds/edgenat_s1_320x320_40k_bsds.py 1 --load-from ./work_dirs/edgenat_s1_320x320_40k_bsds_pascal/iter_XX000.pth # EdgeNAT-S1
./tools/dist_train.sh configs/bsds/edgenat_s2_320x320_40k_bsds.py 1 --load-from ./work_dirs/edgenat_s2_320x320_40k_bsds_pascal/iter_XX000.pth # EdgeNAT-S2
./tools/dist_train.sh configs/bsds/edgenat_s3_320x320_40k_bsds.py 1 --load-from ./work_dirs/edgenat_s3_320x320_40k_bsds_pascal/iter_XX000.pth # EdgeNAT-S3
The code is evaluated on MATLAB R2018b.
cd eval
(echo "data_dir = '../output/epoch-x-test'"; cat eval_bsds.m)|matlab -nodisplay -nodesktop -nosplash
cd eval
(echo "data_dir = '../output/epoch-x-test'"; cat eval_nyud.m)|matlab -nodisplay -nodesktop -nosplash