preprocess_image

Function preprocess_image 

Source
pub fn preprocess_image(
    data_uri: &str,
    vcfg: &VisionConfig,
) -> Result<(Vec<f32>, usize, usize)>
Expand description

Preprocess a single base64-encoded image for the Qwen3-VL encoder.

Returns:

  • pixels: flat f32 tensor shaped [P, C × T × H_p × W_p] where:
    • P = (H/patch_size) × (W/patch_size) — number of patches
    • C = 3 channels, T = temporal_patch_size (image duplicated), H_p = W_p = patch_size
  • grid_h: number of patches along height
  • grid_w: number of patches along width