pub mod onnx;
pub mod tflite;
pub use onnx::{ExecutionProvider, ModelMetadata, OnnxModel, SessionConfig};
#[cfg(not(feature = "tflite"))]
pub use tflite::{Delegate, QuantizationParams, TensorDataType, TensorInfo, TfLiteConfig};
#[cfg(feature = "tflite")]
pub use tflite::{
Delegate, QuantizationParams, TensorDataType, TensorInfo, TfLiteConfig, TfLiteModel,
};
use crate::error::{InferenceError, Result};
use oxigdal_core::buffer::{MultiBandBuffer, RasterBuffer};
pub trait Model: Send + Sync {
fn metadata(&self) -> &ModelMetadata;
fn predict(&mut self, input: &RasterBuffer) -> Result<RasterBuffer>;
fn predict_batch(&mut self, inputs: &[RasterBuffer]) -> Result<Vec<RasterBuffer>>;
fn predict_multiband(&mut self, input: &MultiBandBuffer) -> Result<MultiBandBuffer> {
let _ = input;
Err(InferenceError::Failed {
reason: "Multi-band prediction is not supported by this model".to_string(),
}
.into())
}
fn predict_batch_multiband(
&mut self,
inputs: &[MultiBandBuffer],
) -> Result<Vec<MultiBandBuffer>> {
let _ = inputs;
Err(InferenceError::Failed {
reason: "Multi-band batch prediction is not supported by this model".to_string(),
}
.into())
}
fn input_shape(&self) -> (usize, usize, usize);
fn output_shape(&self) -> (usize, usize, usize);
}