[−][src]Struct neuro::data::ImageDataSetBuilder
Methods
impl ImageDataSetBuilder
[src]
pub fn from_dir(
path: &'static Path,
image_size: (u32, u32)
) -> ImageDataSetBuilder
[src]
path: &'static Path,
image_size: (u32, u32)
) -> ImageDataSetBuilder
Creates a dataset builder from a directory tree.
The images must be in folders named after the corresponding class in a train top-level directory. Optionally, if a test directory exists, its content will be used to create a test set. For instance:
pets/ train/ cats/ img1.jpg img2.jpg ... dogs/ img1.jpg img2.jpg ... test/ cats/ img1.jpg img2.jpg ... dogs/ img1.jpg img2.jpg ...
The images are resized to the given size using nearest-neighbor interpolation. The aspect ratio is not conserved.
Example
let path = Path::new("dataset/pets"); let data = ImageDataSetBuilder::from_dir(&path, (32, 32)) .one_hot_encode() .valid_split(0.2) .scale(1./255.) .rotate(10, 0.1) .build()?;
pub fn build(self) -> Result<ImageDataSet, Error>
[src]
Builds an ImageDataSet from the image dataset builder.
pub fn hflip(self, prob: f64) -> ImageDataSetBuilder
[src]
Flips the images horizontally with the given probability.
pub fn vflip(self, prob: f64) -> ImageDataSetBuilder
[src]
Flips the images vertically with the given probability.
pub fn one_hot_encode(self) -> ImageDataSetBuilder
[src]
One hot encodes the labels.
pub fn rotate(self, angle: i32, prob: f64) -> ImageDataSetBuilder
[src]
Rotates the images by an angle drawn from a uniform distribution with bounds ±angle
(in degrees). A rotation is applied with the given probability.
pub fn valid_split(self, valid_frac: f64) -> ImageDataSetBuilder
[src]
Splits the data into a training and validation sets.
pub fn scale(self, factor: PrimitiveType) -> ImageDataSetBuilder
[src]
Scales the images by multiplying each pixel by the given factor.
Auto Trait Implementations
impl RefUnwindSafe for ImageDataSetBuilder
impl Send for ImageDataSetBuilder
impl Sync for ImageDataSetBuilder
impl Unpin for ImageDataSetBuilder
impl UnwindSafe for ImageDataSetBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,