Package: misas
Model Interpretation through Sensitivity Analysis for SegmentationInput alterations currently include: - rotation - cropping -
brightness - contrast - zooming - flipping (dihedral) - resizing - MR
artifacts (viatorchio)Installpip install misasCiteIf you usemisasin 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-1If you use the simulated MR artifacts, please also citetorchio: > 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.106236How to useExample with kaggle datafrommisas.coreimport*frommisas.coreimportdefault_cmap,default_cmap_true_maskfrommisas.fastai_modelimportFastai2_modelfromPILimportImage,ImageEnhance,ImageOpsfromfunctoolsimportpartialfromtqdm.notebookimporttqdmimportmatplotlib.pyplotaspltimportnumpyasnpdeflabel_func(x):passdefacc_seg(input,target):passdefdiceComb(input,targs):passdefdiceLV(input,targs):passdefdiceMY(input,targs):passimg=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_masterRotationplot_series(get_rotation_series(img(),trainedModel))0%|          | 0/7 [00:00<?, ?it/s]

[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.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
rotationfromipywidgetsimportinteract,interactive,fixed,interact_manualimportipywidgetsaswidgetsrotation_series=get_rotation_series(img(),trainedModel,step=10)0%|          | 0/37 [00:00<?, ?it/s]defplot_rotation_frame(deg):returnplot_frame(*rotation_series[int(deg/10)],figsize=(10,10))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.OverviewThis is the schematic overview of howmisasworks. Created with the
amazingExcalidraw.LogoThe logo was designed by Markus J. Ankenbrand using: -Open box / Boite
ouvertebySimpleIconsviaopenclipart.org-Cutter
iconbySimpleIconsviaopenclipart.org, original by Marco Olgio, viaWikiMedia-Hack Font-InkscapeAttributionThis project is inspired by the awesome“Is it a Duck or Rabbit”
tweetby@minimaxir. Also check out thecorresponding
repo.<blockquoteclass="twitter-tweet"><plang="en"dir="ltr">Is it a Duck or a Rabbit? For Google Cloud Vision, it depends how the image is rotated.<ahref="https://t.co/a30VzjEXVv">pic.twitter.com/a30VzjEXVv</a></p>&mdash;Max Woolf (@minimaxir)<ahref="https://twitter.com/minimaxir/status/1103676561809539072?ref_src=twsrc%5Etfw">March 7, 2019</a></blockquote><scriptasyncsrc="https://platform.twitter.com/widgets.js"charset="utf-8"></script>Is it a Duck or a Rabbit? For Google Cloud Vision, it depends how the image is rotated.pic.twitter.com/a30VzjEXVv— Max Woolf (@minimaxir)March 7, 2019<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>Changes0.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