pub struct Pipeline {
pub ops: Vec<AugOp>,
}Expand description
A sequence of augmentation operations applied in order.
Pipeline owns a Vec<AugOp> and threads (img, channels, h, w) through
each operation, updating the spatial dimensions as needed (e.g., after a
crop or resize).
§Example
ⓘ
let pipeline = Pipeline::new()
.push(AugOp::Resize { target: 256 })
.push(AugOp::RandomCrop { crop_size: 224 })
.push(AugOp::HorizontalFlip { prob: 0.5 })
.push(AugOp::Normalize { mean: IMAGENET_MEAN, std: IMAGENET_STD });Fields§
§ops: Vec<AugOp>Ordered list of augmentation operations.
Implementations§
Source§impl Pipeline
impl Pipeline
Sourcepub fn apply(
&self,
img: &[f32],
channels: usize,
h: usize,
w: usize,
rng: &mut LcgRng,
) -> VisionResult<(Vec<f32>, usize, usize)>
pub fn apply( &self, img: &[f32], channels: usize, h: usize, w: usize, rng: &mut LcgRng, ) -> VisionResult<(Vec<f32>, usize, usize)>
Apply all operations in sequence, threading the output through.
Returns the final (image, h, w) after all augmentations, or the
first error encountered. If the pipeline is empty the image and
dimensions are returned unchanged (cloning the input slice).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pipeline
impl RefUnwindSafe for Pipeline
impl Send for Pipeline
impl Sync for Pipeline
impl Unpin for Pipeline
impl UnsafeUnpin for Pipeline
impl UnwindSafe for Pipeline
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