Skip to content

JABS Vision Backbones

Backbone modules for jabs-vision models.

TimmBackbone

Bases: Module

Wrapper around timm models for multi-scale feature extraction.

This module creates a feature extractor from any timm model that supports features_only=True, returning feature maps at multiple scales.

Example
cfg = TimmBackboneConfig(name="mobilenetv3_small_100", pretrained=True)
backbone = TimmBackbone(cfg)
x = torch.randn(1, 3, 256, 256)
features = backbone(x)  # List of feature tensors
print([f.shape for f in features])

channels property

Number of channels at each feature level.

strides property

Spatial reduction (stride) at each feature level.

forward(x)

Extract multi-scale features.

Parameters:

Name Type Description Default
x Tensor

Input tensor of shape (B, C, H, W).

required

Returns:

Type Description
list[Tensor]

List of feature tensors, one per output index.

TimmBackboneConfig dataclass

Configuration for TimmBackbone.

Attributes:

Name Type Description
name str

Name of the timm model to use.

pretrained bool

Whether to load pretrained weights.

out_indices tuple[int, ...]

Which feature stages to return (0=stem, 1-4=stages).