pub struct ImageFolderDataset { /* private fields */ }Available on crate features
std and dataset only.Expand description
A generic dataset to load images from disk.
Implementations§
Source§impl ImageFolderDataset
impl ImageFolderDataset
Sourcepub fn new_classification<P>(
root: P,
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_classification<P>( root: P, ) -> Result<ImageFolderDataset, ImageLoaderError>
Sourcepub fn new_classification_with<P, S>(
root: P,
extensions: &[S],
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_classification_with<P, S>( root: P, extensions: &[S], ) -> Result<ImageFolderDataset, ImageLoaderError>
Sourcepub fn new_classification_with_items<P, S>(
items: Vec<(P, String)>,
classes: &[S],
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_classification_with_items<P, S>( items: Vec<(P, String)>, classes: &[S], ) -> Result<ImageFolderDataset, ImageLoaderError>
Sourcepub fn new_multilabel_classification_with_items<P, S>(
items: Vec<(P, Vec<String>)>,
classes: &[S],
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_multilabel_classification_with_items<P, S>( items: Vec<(P, Vec<String>)>, classes: &[S], ) -> Result<ImageFolderDataset, ImageLoaderError>
Sourcepub fn new_segmentation_with_items<P, S>(
items: Vec<(P, P)>,
classes: &[S],
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_segmentation_with_items<P, S>( items: Vec<(P, P)>, classes: &[S], ) -> Result<ImageFolderDataset, ImageLoaderError>
Sourcepub fn new_coco_detection<A, I>(
annotations_json: A,
images_path: I,
) -> Result<ImageFolderDataset, ImageLoaderError>
pub fn new_coco_detection<A, I>( annotations_json: A, images_path: I, ) -> Result<ImageFolderDataset, ImageLoaderError>
Create a COCO detection dataset based on the annotations JSON and image directory.
§Arguments
-
annotations_json- Path to the JSON file containing annotations in COCO format (for example instances_train2017.json). -
images_path- Path containing the images matching the annotations JSON.
§Returns
A new dataset instance.
Trait Implementations§
Source§impl Dataset<ImageDatasetItem> for ImageFolderDataset
impl Dataset<ImageDatasetItem> for ImageFolderDataset
Auto Trait Implementations§
impl Freeze for ImageFolderDataset
impl RefUnwindSafe for ImageFolderDataset
impl Send for ImageFolderDataset
impl Sync for ImageFolderDataset
impl Unpin for ImageFolderDataset
impl UnwindSafe for ImageFolderDataset
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<I, T> Windows<I> for Twhere
T: Dataset<I>,
impl<I, T> Windows<I> for Twhere
T: Dataset<I>,
Source§fn windows(&self, size: usize) -> WindowsIterator<'_, I> ⓘ
fn windows(&self, size: usize) -> WindowsIterator<'_, I> ⓘ
Is empty if the Dataset is shorter than size.
§Panics
Panics if size is 0.
§Examples
use crate::burn_dataset::{
transform::{Windows, WindowsDataset},
Dataset, InMemDataset,
};
let items = [1, 2, 3, 4].to_vec();
let dataset = InMemDataset::new(items.clone());
for window in dataset.windows(2) {
// do sth with window
}