Coder Social home page Coder Social logo

dc-net's Introduction

DC-Net

This is the official repo for our paper: "DC-Net: Divide-and-Conquer for Salient Object Detection".

Authors: Jiayi Zhu, Xuebin Qin and Abdulmotaleb Elsaddik

Contact: [email protected]

Usage

  1. Clone this repo.
git clone https://github.com/PiggyJerry/DC-Net.git
  1. Download the pre-trained model and put the model file to the directory DC-Net/saved_models:
name pretrain backbone resolution #params FPS download
DC-Net-R DUTS-TR ResNet-34 352*352 356.3MB 60 GoogleDrive/Baidu Pan
DC-Net-S DUTS-TR Swin-B 384*384 1495.0MB 29 GoogleDrive/Baidu Pan
DC-Net-R-HR DIS5K ResNet-34 1024*1024 356.3MB 55 GoogleDrive/Baidu Pan
  1. Download checkpoint from GoogleDrive/Baidu Pan and put it to the directory DC-Net/checkpoint.

  2. Unzip apex.zip to the directory 'DC-Net'.

  3. Train the model.

First, download the datasets to the directory DC-Net/datasets, then cd to the directory 'DC-Net', run the train process by command: python main-DC-Net.py. If you want to train DC-Net-S, please change the 362 line of main-DC-Net.py to hypar['type']='S'.

  1. Inference the model.

First, put test images to the directory DC-Net/testImgs, then cd to the directory 'DC-Net', run the inference process by command: python Inference.py. If you want to inference DC-Net-S, please change the 17 line of Inference.py to type='S'.

Predicted saliency maps

For DC-Net-R and DC-Net-S we provide the predicted saliency maps for low-resolution datasets DUTS-TE, DUT-OMRON, HKU-IS, ECSSD and PASCAL-S.

For DC-Net-R-HR we also provide the predicted saliency maps for high-resolution datasets DIS-TE, ThinObject5K, UHRSD, HRSOD and DAVIS-S.

name predicted saliency maps
DC-Net-R GoogleDrive/Baidu Pan
DC-Net-S GoogleDrive/Baidu Pan
DC-Net-R-HR GoogleDrive/Baidu Pan

How to modify the edge width of the edge map?

You just need to modify the 330 line of data_loader_cache.py, where the last hyperparameter $thickness$ of cv2.drawContours means the bilateral edge pixel, after processing by line 332, the bilateral edge pixel becomes inter unilateral edge pixel $edge\ width$, which is what we want. $edge\ width$=($thickness$+1)/2.

How to use Parallel-ResNet and Parallel-Swin-Transformer?

Same as the original ResNet and Swin-Transformer, you just need to modify the new hyperparameter parallel to how many encoders you want.

Citation

@article{zhu2023dc,
  title={DC-Net: Divide-and-Conquer for Salient Object Detection},
  author={Zhu, Jiayi and Qin, Xuebin and Elsaddik, Abdulmotaleb},
  journal={arXiv preprint arXiv:2305.14955},
  year={2023}
}

dc-net's People

Contributors

piggyjerry avatar

Stargazers

Ulrich Sebastien R avatar Zeng Cheng avatar  avatar Researcher.YuanYuhui avatar llxxc avatar Cừu Đen avatar  avatar An-zhi WANG avatar  avatar leo1 avatar  avatar Garimella Hari Pawan Kishore avatar  avatar

Watchers

Kostas Georgiou avatar  avatar

dc-net's Issues

非常不错的工作

这个sod的任务点应该是目前刷的最高的点了吧。真的很不容易。👍

save to image error

io.imsave(os.path.join(result_path,im_name+".png"),(result*255).permute(1,2,0).cpu().data.numpy().astype(np.uint8))

raise ValueError("Can't write images with one color channel.")

need .squeeze() reshape (WH1) to (WH) :
io.imsave(os.path.join(result_path,im_name+".png"),(result
255).permute(1,2,0).cpu().data.numpy().astype(np.uint8).squeeze())

the problem when run"main-DC-Net-R.py"

Hi author,thanks for your hard work! I have a problem when I run the "main-DC-Net-R.py":

D:\program\Anaconda\envs\DCNet\python.exe D:/PythonProject/DC-Net/main-DC-Net-R.py
building model...
D:\program\Anaconda\envs\DCNet\lib\site-packages\torchvision\models_utils.py:209: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
f"The parameter '{pretrained_param}' is deprecated since 0.13 and may be removed in the future, "
D:\program\Anaconda\envs\DCNet\lib\site-packages\torchvision\models_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=ResNet34_Weights.IMAGENET1K_V1. You can also use weights=ResNet34_Weights.DEFAULT to get the most up-to-date weights.
warnings.warn(msg)
Model Name: DC-Net-R
batch size: 32
--- create training dataloader ---
------------------------------ train --------------------------------
--->>> train dataset 0 / 1 DUTS-TR <<<---
-im- DUTS-TR ./datasets/DUTS-TR/im : 10553
-gt- DUTS-TR ./datasets/DUTS-TR/gt : 10553
1 train dataloaders created
--- create valid dataloader ---
------------------------------ valid --------------------------------
--->>> valid dataset 0 / 1 DUTS-TE <<<---
-im- DUTS-TE ./datasets/DUTS-TE/im : 5019
-gt- DUTS-TE ./datasets/DUTS-TE/gt : 5019
1 valid dataloaders created
--- build model ---
Number of parameters: 88956629
--- define optimizer ---
Selected optimization level O1: Insert automatic casts around Pytorch functions and Tensor methods.

Defaults for this optimization level are:
enabled : True
opt_level : O1
cast_model_type : None
patch_torch_functions : True
keep_batchnorm_fp32 : None
master_weights : None
loss_scale : dynamic
Processing user overrides (additional kwargs that are not None)...
After processing overrides, optimization options are:
enabled : True
opt_level : O1
cast_model_type : None
patch_torch_functions : True
keep_batchnorm_fp32 : None
master_weights : None
loss_scale : dynamic
Warning: multi_tensor_applier fused unscale kernel is unavailable, possibly because apex was installed without --cuda_ext --cpp_ext. Using Python fallback. Original ImportError was: ModuleNotFoundError("No module named 'amp_C'")
.\apex_init_.py:68: DeprecatedFeatureWarning: apex.amp is deprecated and will be removed by the end of February 2023. Use PyTorch AMP
warnings.warn(msg, DeprecatedFeatureWarning)

Could you tell me how to fix it ? I am looking forward to your reply.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.