pub struct TilingConfig {
pub tile_w: usize,
pub tile_h: usize,
pub overlap_ratio: f32,
/* private fields */
}Expand description
Static tiling configuration for one model. Independent of frame size.
Fields§
§tile_w: usizeTile width = model input width.
tile_h: usizeTile height = model input height.
overlap_ratio: f32Minimum overlap ratio between adjacent tiles, 0.0 <= r < 1.0
(default 0.2). The realized overlap is redistributed evenly and is
always >= this.
Implementations§
Source§impl TilingConfig
impl TilingConfig
Sourcepub fn new(tile_w: usize, tile_h: usize) -> Self
pub fn new(tile_w: usize, tile_h: usize) -> Self
Tile size = model input; overlap 0.2, tiles stretched to the model input (identity for the full-size tiles the grid produces) with the default pixel mapping.
Sourcepub fn with_overlap(self, overlap_ratio: f32) -> Self
pub fn with_overlap(self, overlap_ratio: f32) -> Self
Set the minimum overlap ratio (builder).
Sourcepub fn with_options(self, options: ConvertOptions) -> Self
pub fn with_options(self, options: ConvertOptions) -> Self
Set the options every tile is converted with: fit, letterbox
placement and pad, normalization and interpolation, e.g. from
ConvertOptions::from_spec. Each tile replaces the source crop
with its own. Rotation and flip are refused by validate,
since tiles could not be lifted back to the frame.
Sourcepub fn options(&self) -> ConvertOptions
pub fn options(&self) -> ConvertOptions
The options every tile is converted with.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the config: overlap_ratio in [0.0, 1.0), non-zero tile
size, and options without rotation or flip. Called by every tiling
method, and exposed so callers (e.g. the language bindings) can reject
bad input before generating a grid.
§Errors
Returns Error::CropInvalid if the overlap is out of range or a tile
dimension is zero, and Error::InvalidOptions for a rotation or flip.
Trait Implementations§
Source§impl Clone for TilingConfig
impl Clone for TilingConfig
impl Copy for TilingConfig
Source§impl Debug for TilingConfig
impl Debug for TilingConfig
Source§impl PartialEq for TilingConfig
impl PartialEq for TilingConfig
impl StructuralPartialEq for TilingConfig
Auto Trait Implementations§
impl Freeze for TilingConfig
impl RefUnwindSafe for TilingConfig
impl Send for TilingConfig
impl Sync for TilingConfig
impl Unpin for TilingConfig
impl UnsafeUnpin for TilingConfig
impl UnwindSafe for TilingConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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