Abstract: Inspired by the way human eyes detect objects, we propose a new unified dual-branch decoder paradigm, termed the Difference-Aware Decoder (DAD), designed to explore the differences between foreground and background effectively, thereby enhancing the separation of objects of interest in optical images. The DAD operates in two stages, leveraging multi-level features from the encoder. In the first stage, it achieves coarse detection of foreground objects by utilizing high-level semantic features, mimicking the initial rough observation typical of human vision. In the second stage, the decoder refines segmentation by examining differences in low-level features, guided by the coarse map generated in the first stage.
This repository contains the code for our paper:
Towards Complex Backgrounds: A Unified Difference-Aware Decoder for Binary Segmentation.
To train the DAD model, follow these steps:
-
Set the task (COD/SOD/Poly/MSD), batch size, and specify the GPU for training. Execute the following commands:
python train.py --gpu_id 0 --task COD --batchsize 8 --backbone resnet python train.py --gpu_id 0 --task COD --batchsize 8 --backbone res2net python train.py --gpu_id 0 --task COD --batchsize 8 --backbone v2_b2 python train.py --gpu_id 0 --task SOD --batchsize 8 --backbone resnet python train.py --gpu_id 0 --task SOD --batchsize 8 --backbone res2net python train.py --gpu_id 0 --task SOD --batchsize 8 --backbone v2_b2 python train.py --gpu_id 0 --task Poly --batchsize 8 --backbone v2_b2 python train.py --gpu_id 0 --task MSD --batchsize 8 --backbone v2_b2
We provide inference code along with pretrained and trained models. You can download them using the links below:
-
Pretrained Models:
-
Trained Models:
To test the trained models, run the following command:
python test.py --task COD --backbone resnet --pth_path './Experiments/DAD/'
python test.py --task COD --backbone res2net --pth_path './Experiments/DAD/'
python test.py --task COD --backbone v2_b2 --pth_path './Experiments/DAD/'
python test.py --task SOD --backbone resnet --pth_path './Experiments/DAD/'
python test.py --task SOD --backbone res2net --pth_path './Experiments/DAD/'
python test.py --task SOD --backbone v2_b2 --pth_path './Experiments/DAD/'
We have released visual results for various tasks using different backbones. You can access them from the following links:
- PVT-v2-b2: Download
- PVT-v2-b2: Download
If you find our work useful, please consider citing our paper:
@article{li2022towards,
title={Towards complex backgrounds: A unified difference-aware decoder for binary segmentation},
author={Li, Jiepan and He, Wei and Zhang, Hongyan},
journal={arXiv preprint arXiv:2210.15156},
year={2022}
}