Skip to main content

A simple and efficient metric implementation for grayscale/binary image segmentation like salient object detection, camouflaged object detection, and medical image segmentation.

Project description

Logo

PySODMetrics: A simple and efficient implementation of SOD metrics

[!important]

Our exploration in this field continues with PyIRSTDMetrics, a project born from the same core motivation. ​​Think of them as twin initiatives: this project maps the landscape of current evaluation, while its sibling takes the next step to expand upon and rethink it. We'd love your star! 🌟

Introduction

A simple and efficient implementation of SOD metrics.

Your improvements and suggestions are welcome.

Related Projects

  • PySODEvalToolkit: A Python-based Evaluation Toolbox for Salient Object Detection and Camouflaged Object Detection

Supported Metrics

Metric Sample-based Whole-based Related Class
MAE soft,si-soft MAE
S-measure $S_{m}$ soft Smeasure
weighted F-measure ($F^{\omega}_{\beta}$) soft WeightedFmeasure
Human Correction Effort Measure soft HumanCorrectionEffortMeasure
Context-Measure ($C_{\beta}$, $C^{\omega}_{\beta}$) soft ContextMeasure, CamouflageContextMeasure
Multi-Scale IoU max,avg,adp,bin MSIoU
E-measure ($E_{m}$) max,avg,adp Emeasure
F-measure (old) ($F_{\beta}$) max,avg,adp Fmeasure (Will be removed!)
F-measure (new) ($F_{\beta}$, $F_{1}$) max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+FmeasureHandler
BER max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+BERHandler
Dice max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+DICEHandler
FPR max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+FPRHandler
IoU max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+IOUHandler
Kappa max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+KappaHandler
Overall Accuracy max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+OverallAccuracyHandler
Precision max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+PrecisionHandler
Recall max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+RecallHandler
Sensitivity max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+SensitivityHandler
Specificity max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+SpecificityHandler
TNR max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+TNRHandler
TPR max,avg,adp,bin,si-max,si-avg,si-adp,si-bin bin,si-max,si-avg,si-bin FmeasureV2+TPRHandler

NOTE:

  • Sample-based si- variants calculate the sample-specific mean/maximum based on the sample-based fm sequence with a shape of (num_targets, 256).
  • Whole-based si- variants calculate the mean/maximum based on the average fm sequence across all targets from all samples.
  • Because the *adp variants are specialized for sample-based computation, they do not support whole-based computation.

Usage

The core files are in the folder py_sod_metrics.

  • [Latest, but may be unstable] Install from the source code: pip install git+https://github.com/lartpang/PySODMetrics.git
  • [More stable] Install from PyPI: pip install pysodmetrics

Examples

Reference

@inproceedings{Fmeasure,
    title={Frequency-tuned salient region detection},
    author={Achanta, Radhakrishna and Hemami, Sheila and Estrada, Francisco and S{\"u}sstrunk, Sabine},
    booktitle=CVPR,
    number={CONF},
    pages={1597--1604},
    year={2009}
}

@inproceedings{MAE,
    title={Saliency filters: Contrast based filtering for salient region detection},
    author={Perazzi, Federico and Kr{\"a}henb{\"u}hl, Philipp and Pritch, Yael and Hornung, Alexander},
    booktitle=CVPR,
    pages={733--740},
    year={2012}
}

@inproceedings{Smeasure,
    title={Structure-measure: A new way to evaluate foreground maps},
    author={Fan, Deng-Ping and Cheng, Ming-Ming and Liu, Yun and Li, Tao and Borji, Ali},
    booktitle=ICCV,
    pages={4548--4557},
    year={2017}
}

@inproceedings{Emeasure,
    title="Enhanced-alignment Measure for Binary Foreground Map Evaluation",
    author="Deng-Ping {Fan} and Cheng {Gong} and Yang {Cao} and Bo {Ren} and Ming-Ming {Cheng} and Ali {Borji}",
    booktitle=IJCAI,
    pages="698--704",
    year={2018}
}

@inproceedings{wFmeasure,
    title={How to evaluate foreground maps?},
    author={Margolin, Ran and Zelnik-Manor, Lihi and Tal, Ayellet},
    booktitle=CVPR,
    pages={248--255},
    year={2014}
}

@inproceedings{MSIoU,
    title = {Multiscale IOU: A Metric for Evaluation of Salient Object Detection with Fine Structures},
    author = {Ahmadzadeh, Azim and Kempton, Dustin J. and Chen, Yang and Angryk, Rafal A.},
    booktitle = ICIP,
    year = {2021},
}

@inproceedings{SizeInvarianceVariants,
    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 = ICML,
    year = {2024}
}

@inproceedings{HumanCorrectionEffortMeasure,
    title = {Highly Accurate Dichotomous Image Segmentation},
    author = {Xuebin Qin and Hang Dai and Xiaobin Hu and Deng-Ping Fan and Ling Shao and Luc Van Gool},
    booktitle = ECCV,
    year = {2022}
}

@article{ContextMeasure,
    title={Context-measure: Contextualizing Metric for Camouflage},
    author={Wang, Chen-Yang and Ji, Gepeng and Shao, Song and Cheng, Ming-Ming and Fan, Deng-Ping},
    journal={arXiv preprint arXiv:2512.07076},
    year={2025}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysodmetrics-1.6.0.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysodmetrics-1.6.0-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file pysodmetrics-1.6.0.tar.gz.

File metadata

  • Download URL: pysodmetrics-1.6.0.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysodmetrics-1.6.0.tar.gz
Algorithm Hash digest
SHA256 9a6b1d6e12a32595c89b6cd0cb3492ef0be099bd74d44afe48c7290ebfb740ea
MD5 39cdbd1f249d7fb81cbbd607900c3321
BLAKE2b-256 c7deb4b10927f2f2f7bdb4feb69211de5cb8bb0c0f8eb04549394109b0888342

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysodmetrics-1.6.0.tar.gz:

Publisher: python-publish.yml on lartpang/PySODMetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysodmetrics-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: pysodmetrics-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysodmetrics-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 935dea5f0a8f805b6db8f1898605a58e4724f6a2ba599a8f2e23e9592863e841
MD5 e788b4511383cdf7e0ad6c24ad214856
BLAKE2b-256 70c58b8e61a3ae6e504b71393dd81a8cfcc55e78b4e4a9b102d82fc9972d98c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysodmetrics-1.6.0-py3-none-any.whl:

Publisher: python-publish.yml on lartpang/PySODMetrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page