Instructions to use nvidia/Flora-TempSeg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use nvidia/Flora-TempSeg with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "nvidia/Flora-TempSeg") - Notebooks
- Google Colab
- Kaggle
File size: 1,263 Bytes
a4ba82a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from PIL import Image, ImageOps
from typing import Any
VIEWS = ('ego', 'left_wrist', 'right_wrist')
CAPTION_TOP_SIZE = (768, 432)
CAPTION_WRIST_SIZE = (384, 216)
CAPTION_MOSAIC_WIDTH = 768
CAPTION_MOSAIC_HEIGHT = 648
def compose_frame(frames, views):
canvas = Image.new('RGB', (640, 720))
for view, (x, y, w, h) in zip(VIEWS, [(0, 0, 640, 480), (0, 480, 320, 240), (320, 480, 320, 240)]):
if view in views:
panel = ImageOps.contain(frames[view].convert('RGB'), (w, h), Image.Resampling.BICUBIC)
canvas.paste(panel, (x + (w - panel.width) // 2, y + (h - panel.height) // 2))
return canvas
def compose_top_dominant_mosaic(top: Any, left: Any, right: Any) -> Any:
from PIL import Image
top_panel = top.convert('RGB').resize(CAPTION_TOP_SIZE, Image.Resampling.BICUBIC)
left_panel = left.convert('RGB').resize(CAPTION_WRIST_SIZE, Image.Resampling.BICUBIC)
right_panel = right.convert('RGB').resize(CAPTION_WRIST_SIZE, Image.Resampling.BICUBIC)
output = Image.new('RGB', (CAPTION_MOSAIC_WIDTH, CAPTION_MOSAIC_HEIGHT))
output.paste(top_panel, (0, 0))
output.paste(left_panel, (0, CAPTION_TOP_SIZE[1]))
output.paste(right_panel, (CAPTION_WRIST_SIZE[0], CAPTION_TOP_SIZE[1]))
return output
|