fovi.demo
Demo utilities for FoviNet.
This module provides helper functions for quickly loading and preparing images for model inference demonstrations.
- fovi.demo.get_image_as_batch(path='shark.png', device='cuda')[source]
Load an image and prepare it as a normalized batch tensor.
Loads an image, crops it to a square (center crop), converts to tensor, and applies ImageNet normalization.
- Parameters:
- Returns:
- Normalized image tensor of shape (1, 3, H, W) where
H and W are equal (square crop of the minimum dimension).
- Return type:
- fovi.demo.load_image_for_sampling(path, device='cuda', normalize=True, center_crop=False)[source]
Load an image for foveated sampling demos.
By default keeps the native aspect ratio. Optionally center-crops to a square, matching
get_image_as_batch.- Parameters:
- Returns:
- (batch, display_rgb, height, width) where batch has shape
(1, 3, H, W), display_rgb is (H, W, 3) float in [0, 1].
- Return type: