Comments (3)
Hi @dgm2, thank you!
My apologies for the delayed response. Sorry you are right. Most of them are independent.
However, you can have a look at the helper code inside the pytorch lightning utilities, one of the callback classes is specifically for generating latent traversals:
disent/disent/util/lightning/callbacks/_callback_vis_latents.py
Lines 197 to 261 in ff462ba
This method uses helper functions from disent.util.visualize.vis_img
to convert tensors to images, disent.util.visualize.vis_latents
to generate latent sequences, and disent.util.visualize.vis_util
to combine the images together into a grid or make sequential frames.
The code is more complicated than it need to be for most cases because of some additional handling and quirks. Maybe we can add a specific docs example for latent traversals.
from disent.
thanks!
the callback method returns stills, frames, image
how should I input these into plot_dataset_traversals
? or into visualize_dataset_traversal
or what is are corresponding values there? e.g. does stills
corresponds to grid
as input into plt_subplots_imshow
e.g. this example makes sense?
many thanks!
trainer = pl.Trainer(
max_steps=2048,
gpus=1 if torch.cuda.is_available() else None,
logger=False,
checkpoint_callback=False,
max_epochs=1
)
trainer.fit(module, dataloader)
# trainer.save_checkpoint("trained.ckpt")
viz = VaeLatentCycleLoggingCallback()
stills, frames_, image_ = viz.generate_visualisations(trainer_or_dataset=trainer, pl_module=trainer.lightning_module,
num_frames=4, num_stats_samples=15)
plt_scale = 4.5
offset = 0.75
factors, frames, _, _, c = stills.shape
plt_subplots_imshow(grid=stills, title=None, row_labels=None, subplot_padding=None,
figsize=(offset + (1 / 2.54) * frames * plt_scale, (1 / 2.54) * (factors + 0.45) * plt_scale),
show=False)
from disent.
Your example makes sense, but admittedly it has been a while since I last touched the code (I realize the current system is not optimal for these custom scripts, so this will need to be fixed in future).
stills
is should be an array of shape(num_latents, num_frames, 64, 64, 3)
containing individual latent traversals.frames
is a concatenated version ofstills
intended to create videos, so the individual stills over the factors dimension are combined together into an image grid. The final array is approx of shape(num_frames, ~(64 * grid_h), ~(64 * grid_w), 3)
.image
is a single image that you can plot that has all the latent traversals merged together into a grid, the x axis of this grid will correspond tonum_latents
and y axis tonum_frames
(or vice versa) so the shape will be approx:(~(64 * num_latents), ~(64 * num_frames), 3)
You can try and plot images directly with plt.imshow(image)
. Or create your own visualization/animation with the frames
or stills
from disent.
Related Issues (20)
- [BUG]: Verify Models HOT 1
- [BUG]: "AssertionError: Torch not compiled with CUDA enabled" HOT 2
- Windows, Macos & GPU Tests
- Standardise Loss Reduction Modes HOT 1
- Adopt a Lightning-Flash Style API for Frameworks HOT 1
- [Q]: What's the native way to split datasets into train, validation and test? HOT 4
- [Q]: Command to run with defaults? HOT 4
- [FEATURE]: Experiment Config Override Support & Custom Code Registry HOT 3
- [FEATURE]: Allow Metrics To Directly Accept Frameworks & Datasets HOT 1
- [DOCS]: Add Experiment Examples HOT 1
- [BUG]: Investigate Schedule Interaction With Validation & Test Data
- [FEATURE]: Model Saving and Checkpointing HOT 11
- [FEATURE]: Add to Registry from Configs HOT 1
- [FEATURE]: Simplifying your configs using hydra-zen HOT 2
- [BUG]: Automatic downloads not working for MPI3D and dSprites HOT 3
- Averaging in AdaGVAE HOT 2
- [FEATURE]: Add DMS metric HOT 5
- [FEATURE]: Add IRS Metric HOT 2
- [FEATURE]: wandb model checkpoint support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from disent.