misas

Model Interpretation through Sensitivity Analysis for Segmentation

https://github.com/chfc-cmi/misas

Science Score: 57.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (8.1%) to scientific vocabulary

Keywords from Contributors

ecology mesh interactive
Last synced: 7 months ago · JSON representation ·

Repository

Model Interpretation through Sensitivity Analysis for Segmentation

Basic Info
Statistics
  • Stars: 6
  • Watchers: 2
  • Forks: 2
  • Open Issues: 4
  • Releases: 4
Created almost 6 years ago · Last pushed over 3 years ago
Metadata Files
Readme Contributing License Citation

README.md

Model Interpretation through Sensitivity Analysis for Segmentation

Input alterations currently include: - rotation - cropping - brightness - contrast - zooming - flipping (dihedral) - resizing - MR artifacts (via torchio)

Install

pip install misas

Cite

If you use misas in your research, please cite: > Ankenbrand, M. J., Shainberg, L., Hock, M., Lohr, D., & Schreiber, L. M. Sensitivity analysis for interpretation of machine learning based segmentation models in cardiac MRI. BMC Medical Imaging, 21(27). https://doi.org/10.1186/s12880-021-00551-1

If you use the simulated MR artifacts, please also cite torchio: > F. Pérez-García, R. Sparks, and S. Ourselin. TorchIO: a Python library for efficient loading, preprocessing, augmentation and patch-based sampling of medical images in deep learning. Computer Methods and Programs in Biomedicine (June 2021), p. 106236. ISSN: 0169-2607. https://doi.org/10.1016/j.cmpb.2021.106236

How to use

Example with kaggle data

python from misas.core import * from misas.core import default_cmap, default_cmap_true_mask from misas.fastai_model import Fastai2_model from PIL import Image, ImageEnhance, ImageOps from functools import partial from tqdm.notebook import tqdm import matplotlib.pyplot as plt import numpy as np

python def label_func(x): pass def acc_seg(input, target): pass def diceComb(input, targs): pass def diceLV(input, targs): pass def diceMY(input, targs): pass

python img = lambda: Image.open("example/kaggle/images/1-frame014-slice005.png").convert("RGB") trueMask = lambda: Image.open("example/kaggle/masks/1-frame014-slice005.png").convert("I") trainedModel = Fastai2_model("chfc-cmi/cmr-seg-tl", "cmr_seg_base", force_reload=False) fig, ax = plt.subplots(figsize=(8,8)) ax.imshow(np.array(img())) ax.imshow(np.array(trueMask()), cmap=default_cmap_true_mask, alpha=.5, interpolation="nearest") ax.axes.xaxis.set_visible(False) ax.axes.yaxis.set_visible(False)

Using cache found in /home/csa84mikl/.cache/torch/hub/chfc-cmi_cmr-seg-tl_master

Rotation

python plot_series(get_rotation_series(img(), trainedModel))

  0%|          | 0/7 [00:00<?, ?it/s]

[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.

python results = eval_rotation_series(img(), trueMask(), trainedModel) plt.plot(results['deg'], results['c1']) plt.plot(results['deg'], results['c2']) plt.axis([0,360,0,1])

  0%|          | 0/72 [00:00<?, ?it/s]

(0.0, 360.0, 0.0, 1.0)

You can use interactive elements to manually explore the impact of rotation

python from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets

python rotation_series = get_rotation_series(img(),trainedModel,step=10)

  0%|          | 0/37 [00:00<?, ?it/s]

python def plot_rotation_frame(deg): return plot_frame(*rotation_series[int(deg/10)], figsize=(10,10))

python interact( plot_rotation_frame, deg=widgets.IntSlider(min=0, max=360, step=10, value=90, continuous_update=False) )

interactive(children=(IntSlider(value=90, continuous_update=False, description='deg', max=360, step=10), Outpu…

<function __main__.plot_rotation_frame(deg)>

There are lots of other transformations to try (e.g. cropping, brightness, contrast, …) as well as MR specific artifacts.

Overview

This is the schematic overview of how misas works. Created with the amazing Excalidraw. schema

Logo

The logo was designed by Markus J. Ankenbrand using: - Open box / Boite ouverte by SimpleIcons via openclipart.org - Cutter icon by SimpleIcons via openclipart.org, original by Marco Olgio, via WikiMedia - Hack Font - Inkscape

Attribution

This project is inspired by the awesome “Is it a Duck or Rabbit” tweet by @minimaxir. Also check out the corresponding repo.

html <blockquote class="twitter-tweet"><p lang="en" dir="ltr">Is it a Duck or a Rabbit? For Google Cloud Vision, it depends how the image is rotated. <a href="https://t.co/a30VzjEXVv">pic.twitter.com/a30VzjEXVv</a></p>&mdash; Max Woolf (@minimaxir) <a href="https://twitter.com/minimaxir/status/1103676561809539072?ref_src=twsrc%5Etfw">March 7, 2019</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Changes

0.1.0 <2022-07-14>

  • Re-write internal function to use pillow instead of fastai (version 1)

0.0.4 <2021-01-14>

  • Initial release

Owner

  • Name: Cellular and Molecular Imaging - Comprehensive Heart Failure Center - University Hospital Würzburg
  • Login: chfc-cmi
  • Kind: organization
  • Location: Am Schwarzenberg 15, 97078 Würzburg, Germany

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite both the software and the paper (see preferred-citation).
authors:
  - family-names: Ankenbrand
    given-names: "Markus J"
    orcid: 0000-0002-6620-807X
    affiliation: "Chair for Cellular and Molecular Imaging, Comprehensive Heart Failure Center, University Hospital Würzburg, Germany"
    email: markus.ankenbrand@uni-wuerzburg.de
  - family-names: Shainberg
    given-names: Liliia
    affiliation: "Chair for Cellular and Molecular Imaging, Comprehensive Heart Failure Center, University Hospital Würzburg, Germany"
  - family-names: Hock
    given-names: Michael
    affiliation: "Chair for Cellular and Molecular Imaging, Comprehensive Heart Failure Center, University Hospital Würzburg, Germany"
  - family-names: Lohr
    given-names: David
    orcid: 0000-0002-6509-3776
    affiliation: "Chair for Cellular and Molecular Imaging, Comprehensive Heart Failure Center, University Hospital Würzburg, Germany"
  - family-names: Schreiber
    given-names: "Laura M"
    orcid: 0000-0002-8827-1838
    affiliation: "Chair for Cellular and Molecular Imaging, Comprehensive Heart Failure Center, University Hospital Würzburg, Germany"
title: misas
version: 0.0.4
doi: 10.5281/zenodo.4438133
date-released: 2021-01-14
repository-code: https://github.com/chfc-cmi/misas
keywords:
  - Deep Learning
  - Neural Networks
  - Cardiac Magnetic Resonance
  - Sensitivity Analysis
  - Transformations
  - Augmentation
  - Segmentation
license: MIT
url: https://chfc-cmi.github.io/misas/
preferred-citation:
  type: article
  scope: Cite this paper if you used misas in your research
  authors:
    - family-names: Ankenbrand
      given-names: Markus J
    - family-names: Shainberg
      given-names: Liliia
    - family-names: Hock
      given-names: Michael
    - family-names: Lohr
      given-names: David
    - family-names: Schreiber
      given-names: Laura M
  title: "Sensitivity analysis for interpretation of machine learning based segmentation models in cardiac MRI"
  year: 2021
  journal: BMC Medical Imaging
  volume: 21
  issue: 27
  doi: 10.1186/s12880-021-00551-1
  url: https://bmcmedimaging.biomedcentral.com/articles/10.1186/s12880-021-00551-1

GitHub Events

Total
Last Year

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 220
  • Total Committers: 7
  • Avg Commits per committer: 31.429
  • Development Distribution Score (DDS): 0.341
Past Year
  • Commits: 3
  • Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Markus Ankenbrand m****s@a****e 145
Liliia s****j@g****m 34
lauraccch l****o@g****m 17
x x 16
dependabot[bot] 4****] 4
x 1****r 3
Markus J. Ankenbrand i****g@i****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 9
  • Total pull requests: 9
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 25 days
  • Total issue authors: 4
  • Total pull request authors: 1
  • Average comments per issue: 0.78
  • Average comments per pull request: 0.78
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 9
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • iimog (5)
  • wagon-master (2)
  • lauraccch (1)
  • fepegar (1)
Pull Request Authors
  • dependabot[bot] (9)
Top Labels
Issue Labels
Pull Request Labels
dependencies (9)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 25 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 7
  • Total maintainers: 1
pypi.org: misas

Model Interpretation through Sensitivity Analysis for Segmentation

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 25 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 19.1%
Average: 20.3%
Stargazers count: 20.3%
Dependent repos count: 21.7%
Downloads: 30.2%
Maintainers (1)
Last synced: 8 months ago

Dependencies

.github/workflows/deploy.yaml actions
  • fastai/workflows/quarto-ghp master composite
.github/workflows/test.yaml actions
  • fastai/workflows/nbdev-ci master composite