Skip to main content
Logo

PySODMetrics: A simple and efficient implementation of SOD metrics

Introduction

A simple and efficient implementation of SOD metrics.

Your improvements and suggestions are welcome.

Citation

If you use this library in your research, please consider citing the following paper:

@misc{PySODMetrics,
      title={Beyond Pixel Overlap: A Framework for Decomposing Segmentation Evaluation Metrics}, 
      author={Youwei Pang and Xiaoqi Zhao},
      year={2026},
      eprint={2607.00886},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2607.00886}, 
}
  • 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{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}
}

Metadata

Release files for pysodmetrics 1.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysodmetrics 1.7.1
File Size Uploaded Provenance Actions
pysodmetrics-1.7.1.tar.gz 34.7 kB With provenance Details for pysodmetrics-1.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysodmetrics 1.7.1
File Interpreter ABI Platform Actions
pysodmetrics-1.7.1-py3-none-any.whl Python 3 none any Details for pysodmetrics-1.7.1-py3-none-any.whl

Total release size: 69.2 kB

Release files / pysodmetrics-1.7.1.tar.gz

Download URL pysodmetrics-1.7.1.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
86f472659929b7caeba6b4854ea5f7524950d1dde5a2849c6b9104d9f3c9cd0d
BLAKE2b-256 checksum
How to use checksums
b7c9a95e8071243efd7a1bf71b272a0fd22b46982acea7fef851f0479480d9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Release files / pysodmetrics-1.7.1-py3-none-any.whl

Download URL pysodmetrics-1.7.1-py3-none-any.whl
Size 34.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85aac9f02ca75eec20f0607c5608a1cd1c2943260504d344345e3695d5820396
BLAKE2b-256 checksum
How to use checksums
1d31f629571b0ba16b215194a5c9df0a31f34ad5edd17e3e517fc78b2ba04938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

Security for pysodmetrics 1.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysodmetrics-1.7.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page