Skip to main content

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 torchand 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


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.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

showtens-0.3.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file showtens-0.3.1.tar.gz.

File metadata

  • Download URL: showtens-0.3.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for showtens-0.3.1.tar.gz
Algorithm Hash digest
SHA256 74c6def69dbbc014d66afb34f5cd47672b6a576517b8bfd96f1f29c773b86a54
MD5 68cbbbd584fb125520cf6ef72ab2a293
BLAKE2b-256 6ba5fb26e803aca50eba63834e081da7fc5f3bdce5872c675bfc1cb6a3d751bf

See more details on using hashes here.

File details

Details for the file showtens-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: showtens-0.3.1-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

Hashes for showtens-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17c204fb4625f801049f2a0a8c03eefeae5c49d851bac7eb568ed08768a3914c
MD5 9714503f6ba70ea58bc0a8c5a4dd34fa
BLAKE2b-256 6b51671d5945e06e6ef59edc0dd4161c33565fdefcad15cd457752f7b6f23f65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page