Skip to main content

Visualization tool for generative models

Project description

GEnerative MOdel VIsualization (gemovi)

Installation

Note! Packages found in requirements-pinned.txt are fully pinned, meaning you will get the exact same versions as the ones used in development and there is a high likelihood that everything works nicely (if gemovi is the only package you install). However, several versions of each package are probably also compatible. The only exception to this is the packages found in requirements-unreleased.txt, which must come from git until their next PyPI release.

In any case, after cloning this package, you can install it as follows:

# *Please* use a virtual environment. It will make package management easier
# and you will not have to worry about messing up your system Python.
# Any python virtual environment manager will do, but I use (mini)conda
conda create -n gemovi-env python=3.10 -y
conda activate gemovi-env

git clone https://gitlab.com/ntjess/gemovi.git
# See discussion above about installing pinned requirements
pip install -r ./gemovi/requirements-pinned.txt
# Use "train" if you want to train a model as well as visualize
pip install -e  "./gemovi[train]"
# Note that one of PyQt5, PyQt6, PySide2, PySide6 is also required. This
# check will fail if you do not have one of these installed.
python -c "import pyqtgraph"

# Finally check if the visualization entrypoint works
python -m gemovi.viz --help

Usage

gemovi supports training and visualizing various forms of VAEs (along with DCGAN -- a deep convolutional generative adversarial network). It supports a config file very much like PyTorch-VAE to specify where data lives, how large to make the input images, etc. While most parameters are only relevant during training, some, such as model hyperparameters, are useful to spawn the rigth network during visualization and weight loading.

Training

Assume you have training images stored in path/to/images. This folder should be full of supported image formats, i.e., .jpg, .png, etc. You can train a VAE with the following command:

python -m gemovi.vae.train --config path/to/config.yaml

where path/to/config.yaml is a config file that looks like this. If your config file lives in gemovi/common/configs/, you can simply pass the filename instead of the full path.

Note that you must specify data_params>data_path to be path/to/images and trainer_params>model_name to be the desired VAE architecture. If your hardware is different from a 1-GPU setup, be sure to change trainer_params>{accelerator,devices} accordingly.

If you wish to resume training from a previous run, specify the saved .ckpt file in trainer_params>ckpt_path.

Note this procedure is almost exactly the same for a DCGAN. The only difference is the top-level command:

python -m gemovi.dcgan.train --config path/to/config.yaml

Assuming trainer_params>log_dir was unchanged, your current directory should begin populating with model checkpoints, sample reconstructions, and tensorboard logs under ./lightning_logs.

Visualization

[Note: If the fire package is installed, the --help command will print much more detailed argument information.]

Assume you trained a MSSIMVAE previously with python -m gemovi.vae.train --config path/to/config.yaml. You can visualize the latent space with the following command:

python -m gemovi.viz --model_class MSSIMVAE --config_file path/to/config.yaml --weights_file path/to/checkpoint.ckpt

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

gemovi-0.1.0.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

gemovi-0.1.0-py3-none-any.whl (55.9 kB view details)

Uploaded Python 3

File details

Details for the file gemovi-0.1.0.tar.gz.

File metadata

  • Download URL: gemovi-0.1.0.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for gemovi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 856df724768d1d6d90629da2536b1dcad63c27583669ccd352beebc007ac0445
MD5 d771029d7423185a739dbb763a245f46
BLAKE2b-256 fcc8c2ede83cb1f643e19ea591190acc5e81d4b8eea39b324a91d7ae491bec5d

See more details on using hashes here.

File details

Details for the file gemovi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gemovi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 55.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for gemovi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c42206d65b433591d52cab537ac7a76dce4f65b856c397781d1796ffbf8024a2
MD5 b69edff144ae01fc2d2a90210c14f161
BLAKE2b-256 b7f83ac2142cb66e53b939cf340d2f9a4bb0e2b76ee88ac8b877c11b56ef8fda

See more details on using hashes here.

Supported by

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