fovi.arch.architectures
- fovi.arch.architectures.alexnet2023(cfg, device='cuda')[source]
Build a standard (non-foveated) AlexNet-2023 model from configuration.
- Parameters:
cfg – Configuration object containing model and training parameters.
device (str, optional) – Device to build the model on. Defaults to ‘cuda’.
- Returns:
The configured AlexNet-2023 model.
- Return type:
nn.Module
- fovi.arch.architectures.fovi_alexnet2023(cfg, device='cuda')[source]
Build a foveated KNN-based AlexNet-2023 model from configuration.
This model uses KNN-based convolutions instead of standard convolutions, enabling foveated processing with non-uniform spatial sampling.
- Parameters:
cfg – Configuration object containing model, saccades, and training parameters.
device (str, optional) – Device to build the model on. Defaults to ‘cuda’.
- Returns:
The configured foveated AlexNet-2023 model wrapped with projector.
- Return type:
nn.Module
- fovi.arch.architectures.fovi_resnet(cfg, in_conv_stride=2, in_pool_stride=2, depthwise_sep_conv=False, layers=[2, 2, 2, 2], device='cuda')[source]
Build a foveated KNN-based ResNet model from configuration.
This model uses KNN-based convolutions instead of standard convolutions, enabling foveated processing with non-uniform spatial sampling.
- Parameters:
cfg – Configuration object containing model, saccades, and training parameters.
in_conv_stride (int, optional) – Stride for the initial convolution. Defaults to 2.
in_pool_stride (int, optional) – Stride for the initial pooling. Defaults to 2.
depthwise_sep_conv (bool, optional) – Whether to use depthwise separable convolutions. Defaults to False.
layers (list, optional) – Number of blocks in each layer. Defaults to [2, 2, 2, 2].
device (str, optional) – Device to build the model on. Defaults to ‘cuda’.
- Returns:
The configured foveated ResNet model wrapped with projector.
- Return type:
nn.Module
- fovi.arch.architectures.fovi_vit(cfg, embed_dim, num_heads, device='cuda')[source]
Build a foveated KNN-based Vision Transformer from configuration.
This model uses KNN-based tokenization instead of standard patch embedding, creating tokens based on spatial relationships in the foveated coordinate system.
- Parameters:
- Returns:
The configured foveated ViT model wrapped with projector.
- Return type:
nn.Module
- fovi.arch.architectures.fovi_vit_base(*args, **kwargs)[source]
Foveated ViT-Base configuration (l layers, 768 dim, 12 heads)
- fovi.arch.architectures.fovi_vit_small(*args, **kwargs)[source]
Foveated ViT-Small configuration (l layers, 384 dim, 6 heads)
- fovi.arch.architectures.fovi_vit_tiny(*args, **kwargs)[source]
Foveated ViT-Tiny configuration (l layers, 192 dim, 3 heads)
- fovi.arch.architectures.vit(cfg, embed_dim, num_heads, device='cuda')[source]
Build a standard Vision Transformer from configuration.
This model uses the classic ViT architecture with standard patch embedding.
- Parameters:
- Returns:
The configured ViT model wrapped with projector.
- Return type:
nn.Module
- fovi.arch.architectures.vit_base(*args, **kwargs)[source]
ViT-Base configuration (l layers, 768 dim, 12 heads)
- fovi.arch.architectures.vit_small(*args, **kwargs)[source]
ViT-Small configuration (l layers, 384 dim, 6 heads)
- fovi.arch.architectures.vit_tiny(*args, **kwargs)[source]
ViT-Tiny configuration (l layers, 192 dim, 3 heads)
- fovi.arch.architectures.vit_custom(cfg, device='cuda')[source]
Custom non-foveated ViT configuration
- fovi.arch.architectures.fovi_vit_custom(cfg, device='cuda')[source]
Custom Foveated ViT configuration.
- fovi.arch.architectures.fovi_dinov3(cfg, device='cuda')[source]
pre-trained dinov3 – architectural differences in the dinov3 model are specified via cfg.pretrained_model.path
- fovi.arch.architectures.arch_wrapper(backbone, cfg, device='cuda')[source]
Build a SaccadeNet-ready architecture from an arbitrary backbone network.
Wraps a backbone network with MLP projection heads for downstream tasks and optionally for self-supervised learning.
- Parameters:
backbone (nn.Module) – The backbone network to wrap.
cfg – Configuration object containing model and training parameters.
device (str, optional) – Device to place the model on. Defaults to ‘cuda’.
- Returns:
The wrapped model ready for SaccadeNet training.
- Return type:
- class fovi.arch.architectures.ArchitectureRegistry[source]
Bases:
objectRegistry for architecture builder functions.
This registry stores builder functions that can construct architecture instances from a configuration object. This allows external repositories to register custom architectures without modifying the core architecture code.
- register(name, builder_fn)[source]
Register an architecture builder function.
- Parameters:
name (str) – Architecture name to register
builder_fn (callable) – Function that takes cfg and device and returns an architecture instance
- get(name)[source]
Get an architecture builder by name.
- Parameters:
name (str) – Architecture name to retrieve
- Returns:
Builder function for the architecture
- Return type:
callable
- Raises:
ValueError – If architecture name is not found in registry