Visualize torch tensors EASILY.
Project description
ShowTens : visualize torch tensors EASILY
ShowTens is a simple pytorch package that allows painless and flexible visualizations of image and video tensors.
<ADD VISUALIZATION VIDEO HERE>
Installation
pip install showtens or uv pip install showtens
Make sure torch is installed, as it is not automatically to allow you to choose the correct version for your system. See PyTorch installation instructions for more information.
Documentation
Documentation can be found at https://frotaur.github.io/ShowTens/
Usage
show methods work both in scripts (they open windows) and in jupyter notebooks (they display inline).
import torch
from showtens import show_image
image1 = torch.rand((3, 100, 100)) # (C,H,W) image
show_image(image1) # Displays the image using matplotlib
image2 = torch.rand((4, 4, 3, 100, 100)) # (B1,B2,C,H,W), two batch dimensions
# Will display as a 4*4 grid, 2 pixel padding, white padding color:
show_image(image2, columns=4, padding=2, pad_value=1.0)
from showtens import save_image
save_image(tensor=image1, folder="saved_images", name="imagetensor")
from showtens import save_video
video1 = torch.rand((60, 3, 200, 200))
save_video(tensor=video1, folder="saved_videos", name="videotensor", fps=30)
video2 = torch.rand((4, 60, 3, 200, 200)) # (B,T,C,H,W), batch of videos
save_video(tensor=video2, folder="saved_videos", name="videobatch", fps=30, columns=2) # 2*2 video grid
# Can also open the video in a new web browser window:
show_video(video2, fps=30) # Opens a new browser window with the video
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file showtens-0.4.tar.gz.
File metadata
- Download URL: showtens-0.4.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b637d83475b335c45d973ce07ab68fc7a5a151fbb62dc394fdd1e5c228ba874
|
|
| MD5 |
c5e96d1307c10d0d0bd0a93a2d45605a
|
|
| BLAKE2b-256 |
669fd10dc7a9d329b5242bc43af451d180887926934daf616adac9670a4db191
|
File details
Details for the file showtens-0.4-py3-none-any.whl.
File metadata
- Download URL: showtens-0.4-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da2ab73da2844a51630afcee5fbfbdce14d9862d0123087fddd78a08580f5ead
|
|
| MD5 |
9b663e47bdba395af47ab5320626a0c1
|
|
| BLAKE2b-256 |
0125d8848f3a34de6880966b11061f1e5a69fc9c2d3a49308e1850abba4b0235
|