visdom-wrapper
A wrapper to use visdom with python 'with' statement.
Setup
pip3 install visdom-wrapper
Example
import numpy as np
import time
import os.path
import getpass
from sys import platform as _platform
from six.moves import urllib
from visdom_wrapper import VizWrapper
from visdom import Visdom
# Images
for i in range(5):
var = np.random.randn(20, 3, 64, 64)
with VizWrapper("random_images") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.images(var,
opts=dict(title=viz_wrapper.name),
win=viz_wrapper.win)) # Indispensable
time.sleep(1)
# Change server port
VizWrapper.viz = Visdom(port=8098, server="http://localhost")
for i in range(5):
var = np.random.randn(10, 3, 64, 64)
with VizWrapper("random_images_1") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.images(var,
opts=dict(title=viz_wrapper.name),
win=viz_wrapper.win)) # Indispensable
time.sleep(1)
# Histogram
for i in range(5):
var = np.random.rand(10000)
with VizWrapper("histogram") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.histogram(X=var,
opts=dict(numbins=20),
win=viz_wrapper.win)) # Indispensable
time.sleep(1)
# Line updates
X = np.column_stack((np.arange(0, 10), np.arange(0, 10)))
Y = np.column_stack((np.linspace(5, 10, 10), np.linspace(5, 10, 10) + 5))
with VizWrapper("line") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.line(X=X,
Y=Y,
win=viz_wrapper.win)) # Indispensable
time.sleep(2)
X = np.column_stack((np.arange(10, 20), np.arange(10, 20)))
Y = np.column_stack((np.linspace(5, 10, 10), np.linspace(5, 10, 10) + 5))
with VizWrapper("line") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.line(X=X,
Y=Y,
win=viz_wrapper.win, # Indispensable
update='append'))
# Video
video = np.empty([256, 250, 250, 3], dtype=np.uint8)
for n in range(256):
video[n, :, :, :].fill(n)
with VizWrapper("vedio") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.video(tensor=video,
win=viz_wrapper.win)) # Indispensable
video_url = 'http://media.w3.org/2010/05/sintel/trailer.ogv'
# linux
if _platform == "linux" or _platform == "linux2":
videofile = '/home/%s/trailer.ogv' % getpass.getuser()
# MAC OS X
elif _platform == "darwin":
videofile = '/Users/%s/trailer.ogv' % getpass.getuser()
# download video
urllib.request.urlretrieve(video_url, videofile)
if os.path.isfile(videofile):
with VizWrapper("vedio_1") as viz_wrapper:
viz_wrapper.update_wins(
viz_wrapper.viz.video(videofile=videofile,
win=viz_wrapper.win)) # Indispensable
With visdom-wrapper, you can use visdom in a more convinent way.
- you don't have to create Visdom object explicitly.
- you don't have to manage visdom windows explicitly. VizWrapper with the same name will be updated to the same visdom window implicitly.
- all visdom apis are still avaiable and you can still configure visdom in a flexiable way.
Metadata
Release files for visdom-wrapper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| visdom-wrapper-0.1.0.tar.gz | 3.2 kB | Without provenance | Details for visdom-wrapper-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| visdom_wrapper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for visdom_wrapper-0.1.0-py3-none-any.whl |
Total release size: 7.5 kB
Release files / visdom-wrapper-0.1.0.tar.gz
| Download URL | visdom-wrapper-0.1.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd52049f06c305efd2c2cee61b58f5eb714cdc00a01b1c0a14218a7d48891af5
|
|
BLAKE2b-256 checksum How to use checksums |
8cc091bcdc7d41f892bf40833370159cba291073755b77381a779230e5a316d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
|
Release files / visdom_wrapper-0.1.0-py3-none-any.whl
| Download URL | visdom_wrapper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68306667ad90fa58d6d4ae78292449e0048307022a0444d7beed4fe08813e5da
|
|
BLAKE2b-256 checksum How to use checksums |
3bdb6d12a4faeff327b97333347ac4f29eb6a1f8ec4801ab767e452917f0ffe8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
|
Security for visdom-wrapper 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.