-
Notifications
You must be signed in to change notification settings - Fork 0
Models
Gaurav14cs17 edited this page Jun 21, 2026
·
1 revision
The core FlashFusion class wraps multiple vision models and applies a fusion strategy to combine their outputs.
Input Image
│
├── Model A (e.g., FlashDet-S) ──┐
├── Model B (e.g., FlashDet-M) ──┼── Fusion Strategy ── Fused Output
└── Model C (e.g., FlashDet-L) ──┘
from flashfusion import FlashFusion
from flashfusion.strategies import WeightedBoxFusion
# From nn.Module instances
model = FlashFusion(
models=[detector_a, detector_b],
strategy=WeightedBoxFusion(weights=[0.6, 0.4]),
input_size=(320, 320),
)
# From model file paths
model = FlashFusion.from_models(
model_paths=["flashdet_s.pt", "flashdet_m.pt", "flashdet_l.pt"],
strategy="wbf",
weights=[0.25, 0.35, 0.40],
)import torch
x = torch.randn(1, 3, 320, 320)
output = model(x)
# output: {"boxes": Tensor, "scores": Tensor, "labels": Tensor}FlashFusion supports parameter-efficient fine-tuning via LoRA:
from flashfusion.models.lora import apply_lora, merge_lora_weights
# Apply LoRA to fusion layers
model = apply_lora(model, rank=8, alpha=16)
# After training, merge weights for inference
model = merge_lora_weights(model)| Property | Description |
|---|---|
num_models |
Number of models in the fusion |
model_names |
List of model name strings |
input_size |
Input resolution (H, W) |
device |
Current device |
weights |
Per-model fusion weights |
FlashFusion can wrap any nn.Module that returns a dictionary with detection outputs:
- FlashDet (S/M/L/X)
- FlashCls
- FlashSeg
- FlashOCR
- Any custom PyTorch model
FlashFusion — Multi-model vision fusion | PyPI | MIT License