Metadata-Version: 2.4
Name: showtens
Version: 0.4
Summary: Visualize torch tensors EASILY.
Project-URL: Homepage, https://github.com/frotaur/showtens
Project-URL: Bug Tracker, https://github.com/frotaur/showtens/issues
Author-email: Vassilis Papadopoulos <vassilis.physics@gmail.com>
License: MIT License
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: imageio
Requires-Dist: imageio-ffmpeg
Requires-Dist: matplotlib
Requires-Dist: numpy
Provides-Extra: torch
Requires-Dist: torch; extra == 'torch'
Description-Content-Type: text/markdown

# 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](https://pytorch.org/get-started/locally/) 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).

```python
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
```
