pub struct SuperResolution { /* private fields */ }Expand description
Super-resolution model using ONNX Runtime
Implementations§
Source§impl SuperResolution
impl SuperResolution
Sourcepub fn from_file<P: AsRef<Path>>(
path: P,
config: SuperResConfig,
) -> Result<Self>
pub fn from_file<P: AsRef<Path>>( path: P, config: SuperResConfig, ) -> Result<Self>
Load a super-resolution model from an ONNX file
§Arguments
path- Path to the ONNX model fileconfig- Super-resolution configuration
§Errors
Returns an error if the model file cannot be loaded or is invalid
§Example
use oxigdal_ml::superres::{SuperResolution, SuperResConfig};
let config = SuperResConfig::default();
let model = SuperResolution::from_file("real_esrgan_2x.onnx", config)?;Sourcepub fn upscale(&mut self, input: &RasterBuffer) -> Result<RasterBuffer>
pub fn upscale(&mut self, input: &RasterBuffer) -> Result<RasterBuffer>
Upscale a raster using the super-resolution model
§Arguments
input- Input raster buffer
§Errors
Returns an error if inference fails or input validation fails
§Example
use oxigdal_ml::superres::{SuperResolution, SuperResConfig};
use oxigdal_core::buffer::RasterBuffer;
use oxigdal_core::types::RasterDataType;
let config = SuperResConfig::default();
let mut model = SuperResolution::from_file("real_esrgan_2x.onnx", config)?;
let input = RasterBuffer::zeros(512, 512, RasterDataType::Float32);
let output = model.upscale(&input)?;Auto Trait Implementations§
impl Freeze for SuperResolution
impl !RefUnwindSafe for SuperResolution
impl Send for SuperResolution
impl Sync for SuperResolution
impl Unpin for SuperResolution
impl UnsafeUnpin for SuperResolution
impl !UnwindSafe for SuperResolution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more