Skip to main content

preprocess_input

Function preprocess_input 

Source
pub fn preprocess_input(img: &RgbImage) -> Vec<f32>
Expand description

Resize img to SIDE×SIDE (bilinear, aligned to docling’s half-pixel centers) and normalize, laid out (C, W, H) as the exported encoder expects — the raw [1,3,SIDE,SIDE] float buffer. The native path wraps this in an ort tensor; the browser path hands it to ONNX Runtime Web directly.