Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Simple package that leverages IPython and HTML for more efficient, reach and interactive plotting of images in Jupyter Notebooks
IPyPlot is 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 used matplotlib
for 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 for matplotlib
to 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 using IPython
package in connection with simple HTML. Using that approach I built this simple python package called IPyPlot which finally helped me cure my frustration and saved a lot of my time.
plot_images
- simply plots all the images in a grid-like layoutplot_class_representations
- similar to plot_images
but 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 labels[your/dir/img1.jpg]
[http://yourimages.com/img1.jpg]
PIL.Image
objectsnumpy.ndarray
objectslist
, numpy.ndarray
, pandas.Series
custom_texts
param to display additional texts like confidence score or some other information for each imageforce_b64
flag to force conversion of images from URLs to base64 formatmax_images
and img_width
paramsTo start using IPyPlot, see examples below or go to gear-images-examples.ipynb notebook which takes you through most of the scenarios and options possible with IPyPlot.
IPyPlot can be installed through PyPI:
pip install ipyplot
or directly from this repo using pip
:
pip install git+https://github.com/karolzak/ipyplot
IPyPlot offers 3 main functions which can be used for displaying images in notebooks:
To start working with IPyPlot
you need to simply import it like this:
import ipyplot
and use any of the available plotting functions shown below (notice execution times).
string
(local or remote image file URLs), PIL.Image
objects or numpy.ndarray
objects representing imagesstring
or int
images = [
"docs/example1-tabs.jpg",
"docs/example2-images.jpg",
"docs/example3-classes.jpg",
]
ipyplot.plot_images(images, max_images=30, img_width=150)
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)
images = [
"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 to gear-images-examples.ipynb notebook for more complex examples.
FAQs
Simple package that leverages IPython and HTML for more efficient, reach and interactive plotting of images in Jupyter Notebooks
We found that ipyplot demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.