pub struct ImageInputOp<Context> { /* private fields */ }
Expand description

| Imports and processes images from a | database. For each run of the operator, | batch_size images will be processed. | GPUs can optionally be used for part | of the processing. | | The following transformations are | applied to the image | | - A bounding box is applied to the initial | image (optional) | | - The image is rescaled either up or down | (with the scale argument) or just up | (with the minsize argument) | | - The image is randomly cropped (crop | size is passed as an argument but the | location of the crop is random except | if is_test is passed in which case the | image in cropped at the center) | | - The image is normalized. Each of its | color channels can have separate normalization | values | | The dimension of the output image will | always be cropxcrop |

Implementations§

source§

impl<Context> ImageInputOp<Context>

source

pub fn new(operator_def: &OperatorDef, ws: *mut Workspace) -> Self

source

pub fn get_image_and_label_and_info_from_dbvalue( &mut self, value: &String, img: *mut Mat, info: &mut PerImageArg, item_id: i32, randgen: *mut MT19937 ) -> bool

source

pub fn saturation( &mut self, img: *mut f32, img_size: i32, alpha_rand: f32, randgen: *mut MT19937 )

assume HWC order and color channels BGR

source

pub fn brightness( &mut self, img: *mut f32, img_size: i32, alpha_rand: f32, randgen: *mut MT19937 )

assume HWC order and color channels BGR

source

pub fn contrast( &mut self, img: *mut f32, img_size: i32, alpha_rand: f32, randgen: *mut MT19937 )

assume HWC order and color channels BGR

source

pub fn color_jitter( &mut self, img: *mut f32, img_size: i32, saturation: f32, brightness: f32, contrast: f32, randgen: *mut MT19937 )

assume HWC order and color channels BGR

source

pub fn color_lighting( &mut self, img: *mut f32, img_size: i32, alpha_std: f32, eigvecs: &Vec<Vec<f32>>, eigvals: &Vec<f32>, randgen: *mut MT19937 )

assume HWC order and color channels BGR

source

pub fn color_normalization( &mut self, img: *mut f32, img_size: i32, channels: i32, mean: &Vec<f32>, std: &Vec<f32> )

| assume HWC order and color channels | BGR mean subtraction and scaling. |

source

pub fn decode_and_transform( &mut self, value: &mut String, image_data: *mut f32, item_id: i32, channels: i32, thread_index: usize )

| Parse datum, decode image, perform | transform | | Intended as entry point for binding | to thread pool |

source

pub fn decode_and_transpose_only( &mut self, value: &String, image_data: *mut u8, item_id: i32, channels: i32, thread_index: usize )

source

pub fn prefetch(&mut self) -> bool

source

pub fn copy_prefetched(&mut self) -> bool

source§

impl ImageInputOp<CPUContext>

source

pub fn apply_transform_onGPU(&mut self, x: &Vec<i64>, device: &Device) -> bool

source§

impl ImageInputOp<CUDAContext>

source

pub fn apply_transform_on_gpu(&mut self, dims: &Vec<i64>, ty: &Device) -> bool

Trait Implementations§

source§

impl<Context> Drop for ImageInputOp<Context>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<Context> !RefUnwindSafe for ImageInputOp<Context>

§

impl<Context> !Send for ImageInputOp<Context>

§

impl<Context> !Sync for ImageInputOp<Context>

§

impl<Context> Unpin for ImageInputOp<Context>where Context: Unpin,

§

impl<Context> !UnwindSafe for ImageInputOp<Context>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V