PyTorch toolbox to work with spherical surfaces.
Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the gallery for the big picture.
-
class
surfify.models.vae.SphericalVAE(input_channels=1, input_order=5, latent_dim=64, conv_flts=[32, 32, 64, 64], conv_mode='DiNe', dine_size=1, repa_size=5, repa_zoom=5, standard_ico=False, cachedir=None)[source]¶ Spherical VAE architecture.
Use either RePa - Rectangular Patch convolution method or DiNe - Direct Neighbor convolution method.
See also
Notes
Debuging messages can be displayed by changing the log level using
setup_logging(level='debug').References
Representation Learning of Resting State fMRI with Variational Autoencoder, NeuroImage 2021.
-
__init__(input_channels=1, input_order=5, latent_dim=64, conv_flts=[32, 32, 64, 64], conv_mode='DiNe', dine_size=1, repa_size=5, repa_zoom=5, standard_ico=False, cachedir=None)[source]¶ Init class.
- Parameters
input_channels : int, default 1
the number of input channels.
input_order : int, default 5
the input icosahedron order.
latent_dim : int, default 64
the size of the stochastic latent state of the SVAE.
conv_flts : list of int
the size of convolutional filters.
conv_mode : str, default ‘DiNe’
use either ‘RePa’ - Rectangular Patch convolution method or ‘DiNe’ - 1 ring Direct Neighbor convolution method.
dine_size : int, default 1
the size of the spherical convolution filter, ie. the number of neighbor rings to be considered.
repa_size : int, default 5
the size of the rectangular grid in the tangent space.
repa_zoom : int, default 5
a multiplicative factor applied to the rectangular grid in the tangent space.
standard_ico : bool, default False
optionaly use surfify tesselation.
cachedir : str, default None
set this folder to use smart caching speedup.
-
decode(z)[source]¶ The decoder.
- Parameters
z : Tensor (samples, <latent_dim>)
the stochastic latent state z.
- Returns
left_recon_x : Tensor (samples, <input_channels>, azimuth, elevation)
reconstructed left cortical texture.
right_recon_x : Tensor (samples, <input_channels>, azimuth, elevation)
reconstructed right cortical texture.
-
encode(left_x, right_x)[source]¶ The encoder.
- Parameters
left_x : Tensor (samples, <input_channels>, azimuth, elevation)
input left cortical texture.
right_x : Tensor (samples, <input_channels>, azimuth, elevation)
input right cortical texture.
- Returns
q(z | x) : Normal (batch_size, <latent_dim>)
a Normal distribution.
-
forward(left_x, right_x)[source]¶ The forward method.
- Parameters
left_x : Tensor (samples, <input_channels>, azimuth, elevation)
input left cortical texture.
right_x : Tensor (samples, <input_channels>, azimuth, elevation)
input right cortical texture.
- Returns
left_recon_x : Tensor (samples, <input_channels>, azimuth, elevation)
reconstructed left cortical texture.
right_recon_x : Tensor (samples, <input_channels>, azimuth, elevation)
reconstructed right cortical texture.
-
Follow us