Menu

Deep learning for NeuroImaging in Python.

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.unet.SphericalUNet(in_order, in_channels, out_channels, depth=5, start_filts=32, conv_mode='DiNe', dine_size=1, repa_size=5, repa_zoom=5, dynamic_repa_zoom=False, up_mode='interp', standard_ico=False, cachedir=None)[source]

The Spherical U-Net architecture.

The architecture is built upon specific spherical surface convolution, pooling, and transposed convolution modules. It has an encoder path and a decoder path, with a user-defined resolution steps. Different from the standard U-Net, all 3x3 convolution are replaced with the RePa or DiNe convolution, 2x2 up-convolution with surface transposed convolution or surface upsampling, and 2x2 max pooling with surface max/mean pooling. In addition to the standard U-Net, before each convolution layer’s rectified linear units (ReLU) activation function, a batch normalization layer is added. At the final layer, 1x1 convolution is replaced by vertex-wise filter. The number of feature channels are double after each surface pooling layer and halve at each transposed convolution or up sampling layer.

See also

SphericalGUNet

Notes

Debuging messages can be displayed by changing the log level using setup_logging(level='debug').

References

Zhao F, et al., Spherical U-Net on Cortical Surfaces: Methods and Applications, IPMI, 2019.

Examples

>>> import torch
>>> from surfify.models import SphericalUNet
>>> from surfify.utils import icosahedron
>>> vertices, triangles = icosahedron(order=2)
>>> model = SphericalUNet(
        in_order=2, in_channels=2, out_channels=4, depth=2,
        start_filts=8, conv_mode="DiNe", dine_size=1, up_mode="interp",
        standard_ico=False)
>>> x = torch.zeros((10, 2, len(vertices)))
>>> out = model(x)
>>> out.shape

Init SphericalUNet.

Parameters:

in_order : int

the input icosahedron order.

in_channels : int

input features/channels.

out_channels : int

output features/channels.

depth : int, default 5

number of layers in the UNet.

start_filts : int, default 32

number of convolutional filters for the first conv.

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

control the rectangular grid spacing in the tangent space by applying a multiplicative factor of 1 / repa_zoom.

dynamic_repa_zoom : bool, default False

dynamically adapt the RePa zoom by applying a multiplicative factor of log(order + 1) + 1.

up_mode : str, default ‘interp’

type of upsampling: ‘transpose’ for transpose convolution (1 ring), ‘interp’ for nearest neighbor linear interpolation, ‘maxpad’ for max pooling shifted zero padding, and ‘zeropad’ for classical zero padding.

standard_ico : bool, default False

optionaly use surfify tesselation.

cachedir : str, default None

set this folder to use smart caching speedup.

forward(x)[source]

Forward method.

Follow us

© 2025, nidl developers