nemo_automodel.components.models.muse_spark.image_processing
nemo_automodel.components.models.muse_spark.image_processing
Native image and video preprocessing for Muse Spark Open.
Module Contents
Classes
Functions
API
Bases: BaseImageProcessor
Resize, normalize, and flatten Muse Spark Open image/video patches.
Return the pixel side represented by one post-shuffle token.
Return the visual placeholder count for an unprocessed image.
Preprocess a flat image list into patch and grid tensors.
Parameters:
One image or a flat list of PIL/NumPy/Tensor images.
Optional Transformers tensor type.
Unused standard image-processor overrides.
Returns: BatchFeature
pixel_values has layout [sum(h*w),3*t*p*p] and
Preprocess one video into flattened temporal clips.
Parameters:
A [frames,channels,height,width] tensor, a sequence of
frames, or (frames, metadata) where metadata may contain
fps and frames_indices.
Returns: MuseSparkVideoFeatures
Flattened patches, one [clips,h,w] grid, tokens per clip, and
Preprocessed flattened video patches and their placeholder metadata.
Convert one PIL/NumPy/Tensor image to contiguous uint8 [3,H,W].
Find the closest positive integer grid inside a token-count interval.
Choose an integer grid near the ideal size with minimum aspect error.
Flatten [temporal,3,H,W] into row-major temporal patch vectors.
Lanczos-resize one image and return float32 normalized [3,H,W].
Return an aspect-preserving aligned canvas and visual-token count.
Parameters:
Source image height in pixels.
Source image width in pixels.
Pixel extent represented by one post-shuffle token.
Minimum number of visual tokens.
Maximum number of visual tokens.
Returns: int
(height, width, tokens) with height and width aligned to