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
Make sure torch
and torchvision
are installed, as the package depends on them.
Usage
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
# show_video not available yet
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
showtens-0.3.tar.gz
(11.1 kB
view details)
Built Distribution
File details
Details for the file showtens-0.3.tar.gz
.
File metadata
- Download URL: showtens-0.3.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ac3ba4769216196dc0d84a2cb924cf34c9b4ea1e05aa46832615d08a527269e |
|
MD5 | b9ca911319410ff66a071c55c3e4c883 |
|
BLAKE2b-256 | 5945cf999f6de43cbc208ec8f4945131fec199add22496e6b666da18f5131aa4 |
File details
Details for the file showtens-0.3-py3-none-any.whl
.
File metadata
- Download URL: showtens-0.3-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2deb2808e3e9613841ee89506e11bd79a67e9a13843d6fa94d8ec24dd5863208 |
|
MD5 | 5f545201ed3df0340e6896c5df0c80b1 |
|
BLAKE2b-256 | 50528eaf798553af2e561251060bd68dc1747aa5a45148af805edd0f7873518c |