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:
  • path (str, optional) – Path to the image file. Defaults to ‘shark.png’.

  • device (str, optional) – Device to place the tensor on. Defaults to ‘cuda’.

Returns:

Normalized image tensor of shape (1, 3, H, W) where

H and W are equal (square crop of the minimum dimension).

Return type:

torch.Tensor