plenoptic.external.plot_MAD_results#
- plenoptic.external.plot_MAD_results(original_image, noise_levels=None, results_dir=None, ssim_images_dir=None, zoom=3, vrange='indep1', **kwargs)[source]#
Plot original MAD results, provided by Zhou Wang.
Plot the results of original MAD Competition, as provided in .mat files. The figure created shows the results for one reference image and multiple noise levels. The reference image is plotted on the first row, followed by a separate row for each noise level, which will show the initial (noisy) image and the four synthesized images, with their respective losses for the two metrics (MSE and SSIM).
We also return a dictionary that contains the losses, noise levels, and original image name for each plotted noise level.
This code can probably be adapted to other uses, but requires that all images are the same size and assumes they’re all 64 x 64 pixels.
- Parameters:
original_image (
str) – Which of the sample images to plot. Must be of the formf"samp{i}"whereiis an integer between 1 and 10 (inclusive).noise_levels (
list[int] |None(default:None)) – Which noise levels to plot. ifNone, will plot all. If a list, elements must be \(2^i\) where \(i\in [1, 10]\).results_dir (
str|Path|None(default:None)) – Path to the results directory containing the results.mat files. IfNone, we download them.ssim_images_dir (
str|Path|None(default:None)) – Path to the directory containing the .tif images used in SSIM paper. IfNone, we download them.zoom (
int|float(default:3)) – Ratio of display pixels to image pixels, passed toimshow. If >1, must be an integer. If <1, must be 1/d where d is a a divisor of the size of the largest image.vrange (
str(default:'indep1')) – How to map image values to colormap. In addition to the values accepted byimshow, we also accept"row0/1/2/3", which is the same as"auto0/1/2/3", except that we do it on a per-row basis (all images with same noise level).**kwargs (
Any) – Passed toimshow. Note that we call imshow separately on each image and so any argument that relies on imshow having access to all images will probably not work as expected.
- Return type:
- Returns:
fig – Figure containing the images.
results – Dictionary containing the errors for each noise level. To convert to a well-structured pandas DataFrame, run
pandas.DataFrame(results).T.
- Raises:
ValueError – If
original_imagetakes an illegal value.