Class BaseSessionAbstract Constructors constructor new Base Session ( modelName , options ? ) : BaseSession Parameters modelName : string options : SessionOptions = {} Methods initialize initialize ( ) : Promise < void > Returns Promise < void > prepare Input prepare Input ( imageCanvas ) : { [inputName : string ]: ort.Tensor ; } Parameters imageCanvas : HTMLCanvasElement Returns { [inputName : string ]: ort.Tensor ; } [ inputName : string ]: ort.Tensor run Inference run Inference ( input ) : Promise < OnnxValueMapType > Parameters input : { [inputName : string ]: ort.Tensor ; } [ inputName : string ]: ort.Tensor Returns Promise < OnnxValueMapType > predict predict ( imageCanvas ) : Promise < HTMLCanvasElement [] > Parameters imageCanvas : HTMLCanvasElement Returns Promise < HTMLCanvasElement [] > output To Mask Array output To Mask Array ( outputs ) : Float32Array < ArrayBufferLike > [] Parameters outputs : OnnxValueMapType Returns Float32Array < ArrayBufferLike > [] [Mask array]
mask Array To Mask Canvas mask Array To Mask Canvas ( maskArray , originalSize ) : HTMLCanvasElement Parameters maskArray : Float32Array < ArrayBufferLike > originalSize : { width : number ; height : number ; } width : number height : number Returns HTMLCanvasElement HTMLCanvasElement
Static get Name get Name ( ) : string Returns string get Name get Name ( ) : string Returns string get Options get Options ( ) : SessionOptions Returns SessionOptions dispose dispose ( ) : Promise < void > Returns Promise < void > Static clear Cache clear Cache ( ) : Promise < void > Returns Promise < void > Static clear Model Cache clear Model Cache ( modelName ) : Promise < void > Returns Promise < void >
Abstract base class for all ONNX model sessions.
Provides common functionality for model loading, caching, and inference. All specific model implementations (U2Net, ISNet, etc.) extend this class.
Example