This is the official code for the paper "Size-invariance Matters: Rethinking Metrics and Losses for Imbalanced Multi-object Salient Object Detection" accepted by International Conference on Machine Learning (ICML2024). The paper is available here.
Paper Title: Size-invariance Matters: Rethinking Metrics and Losses for Imbalanced Multi-object Salient Object Detection
Authors: Feiran Li, Qianqian Xu*, Shilong Bao, Zhiyong Yang, Runmin Cong, Xiaochun Cao, Qingming Huang*
Clone this repository:
git clone https://github.com/Ferry-Li/SI-SOD.gitInstall the required libraries:
pip install -r requirements.txtIn our paper, eight benchmark datasets are included in the experiments. The statics and download links of each dataset are displayed in the table below.
| Dataset | Link | Description |
|---|---|---|
| DUTS | DUTS | DUTS-TR: 10,553 images DUTS-TE: 5,019 images |
| ECSSD | ECSSD | 1,000 images |
| DUT-OMRON | DUT-OMRON | 5,168 images |
| HKU-IS | HKU-IS | 4,447 images |
| MSOD | MSOD | 300 images, all multiple objects |
| PASCAL-S | PASCAL-S | 850 images |
| SOD | SOD | 300 images |
| XPIE | XPIE | 10,000 images |
Before training and evaluation, there are a few steps of data pre-processing.
- Step1: Dataset preparation
The dataset directory should be organized as following:
dataset
├── DUT-OMRON
│ ├── image
│ │ └── im005.jpg
| | ...
│ ├── list.txt
│ └── mask
│ └── im005.png
| ...
├── DUTS
│ ├── DUTS-TE
│ │ ├── image
| | | └── ...
│ │ ├── list.txt
│ │ └── mask
| | | └── ...
│ └── DUTS-TR
| └── ...
├── ......
- Step 2: Dataset preprocessing
cd src
python datasets/preprocess.py --config configs/datasets.yaml --dataset DUTS-TR
# change the '--dataset DUTS-TR' to other datasets you may useYou can edit the specific path of the dataset in configs/datasets.yaml, and other parameters in datastes/preprocess.py.
Specifically, --epsilon in the datasets/preprocess.py is designed to remove noise (whose scale is smaller than epsilon) in the mask. When the value of --epsilon is large (over 100 for instance), there may be some masks with all pixels equal to 0. In this case, you can follow the error massage and directly delete the corresponding sample in the list.txt.
The training config file is stored at configs/train.yaml, where you can modify the settings of dataset, model, loss, optimizer, and training process. Detailed description of each parameter is commented in the config file. Please carefully read and check the config file before training.
To begin training, you can run the following command:
python run.py --config configs/train.yamlSpecifically, we provide a well-trained checkpoint of (Size-Invariant) EDN and PoolNet here.
Also, the pre-trained backbone used during training can be downloaded here.
The testing config file is stored at configs/test.yaml, where you can modify the settings of dataset, model, evaluation metrics, and testing process. Detailed description of each parameter is commented in the config file. Please carefully read and check the config file before testing.
To begin testing, you can run the following command:
python run.py --config configs/test.yaml --testIf you find this work or repository useful, please cite the following:
@inproceedings{li2024sizeinvariance,
title={Size-invariance Matters: Rethinking Metrics and Losses for Imbalanced Multi-object Salient Object Detection},
author={Feiran Li and Qianqian Xu and Shilong Bao and Zhiyong Yang and Runmin Cong and Xiaochun Cao and Qingming Huang},booktitle={The Forty-first International Conference on Machine Learning},
year={2024}
}If you have any detailed questions or suggestions, feel free to email us: lifeiran@iie.ac.cn! Thanks for your interest in our work!
