This extension offers a powerful and versatile solution for visualizing images, plots, and tensors during Python debugging. It is designed to enhance your debugging workflow with a rich set of features.
A built-in, enhanced image viewer with the following capabilities:
Visualize plots from various sources, including:
matplotlib.pyplot.Figure
matplotlib.pyplot.Axis
- Plotly Figures (requires saving backend, see here).
Inspect tensors from PyTorch and NumPy.
numpy.ndarray
is treated as a tensor if it has 4 channels or 3 channels but does not qualify as a single image. Requiresscikit-image
.
Monitor image, plot, or tensor variables and refresh the view at each breakpoint.
- Supports custom Python expressions (use with caution to avoid side effects).
- Hover over variables to view their shape (unrelated to the image viewer, but useful nonetheless).
- Open local image files (supports PNG, JPG, BMP, TIFF) in the viewer.
I find this feature useful for label images, as they often have small values (0, 1, etc.), which the default viewer does not enhance. - A colorbar for heatmap images with adjustable value clipping.
- Interactive Python cell support: Use the Variables tab and click the arrow next to a variable name to view the image.
Setting | Description | Default Value |
---|---|---|
svifpd.autoFetchImages |
Controls whether images are automatically fetched.
|
true |
svifpd.restrictImageTypes |
Restricts the types that are considered images.
|
true |
Problem: Memory usage increases significantly when using the extension.
Solution: Enable the restrictImageTypes
setting (default: true
).
This extension builds upon the foundational work of john-guo. While none of the original code remains, his project served as a valuable inspiration for this extension. Thank you, John!
- Node.js: Ensure you have Node.js installed.
- Yarn: Install Yarn as the package manager.
- Rust: Required for building the webview.
- Install dependencies:
yarn install
- Build the project:
yarn build