Package: ipyplot
Share:IPyPlotis a small python package offering fast and efficient plotting of images inside Python Notebooks cells. It's using IPython with HTML for faster, richer and more interactive way of displaying big numbers of images.Displaying big numbers of images with Python in Notebooks always was a big pain for me as I always usedmatplotlibfor that task and never have I even considered if it can be done faster, easier or more efficiently.Especially in one of my recent projects I had to work with a vast number of document images in a very interactive way which led me to forever rerunning notebook cells and waiting for countless seconds formatplotlibto do it's thing..My frustration grew up to the point were I couldn't stand it anymore and started to look for other options..Best solution I found involved usingIPythonpackage in connection with simple HTML. Using that approach I built this simple python package calledIPyPlotwhich finally helped me cure my frustration and saved a lot of my time.Features:Easy, fast and efficient plotting of images in python within notebooksPlotting functions (seeexamples sectionto learn more):plot_images- simply plots all the images in a grid-like layoutplot_class_representations- similar toplot_imagesbut displays only the first image for each label/class (based on provided labels collection)plot_class_tabs- plots images in a grid-like manner in a separate tab for each label/class based on provided labelsSupported image formats:Sequence of local storage URLs, e.g.[your/dir/img1.jpg]Sequence of remote URLs, e.g.[http://yourimages.com/img1.jpg]Sequence ofPIL.ImageobjectsSequence of images asnumpy.ndarrayobjectsSupported sequence types:list,numpy.ndarray,pandas.SeriesMisc features:custom_textsparam to display additional texts like confidence score or some other information for each imageforce_b64flag to force conversion of images from URLs to base64 formatclick on image to enlargecontrol number of displayed images and their width throughmax_imagesandimg_widthparams"show html" button which reveals the HTML code used to generate plotsoption to set specific order of labels/tabs, filter them or ignore some of the labelsSupported notebook platforms:JupyterGoogle ColabAzure NotebooksKaggle NotebooksGetting StartedTo start using IPyPlot, seeexamples belowor go togear-images-examples.ipynbnotebook which takes you through most of the scenarios and options possible withIPyPlot.InstallationIPyPlotcan be installed throughPyPI:pip install ipyplotor directly from this repo usingpip:pip install git+https://github.com/karolzak/ipyplotUsage examplesIPyPlot offers 3 main functions which can be used for displaying images in notebooks:To start working withIPyPlotyou need to simply import it like this:importipyplotand use any of the available plotting functions shown below (notice execution times).images- should be a sequence of eitherstring(local or remote image file URLs),PIL.Imageobjects ornumpy.ndarrayobjects representing imageslabels- should be a sequence ofstringorintDisplay a collection of imagesimages=["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]ipyplot.plot_images(images,max_images=30,img_width=150)Display class representations (first image for each unique label)images=["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]labels=['label1','label2','label3']ipyplot.plot_class_representations(images,labels,img_width=150)Display images in separate, interactive tabs for each unique classimages=["docs/example1-tabs.jpg","docs/example2-images.jpg","docs/example3-classes.jpg",]labels=['class1','class2','class3']ipyplot.plot_class_tabs(images,labels,max_imgs_per_tab=10,img_width=150)To learn more about what you can do with IPyPlot go togear-images-examples.ipynbnotebook for more complex examples.