use crate::idx::IdxSplit;
use crate::pack::{FetchProgress, Pack, PackFile};
use oa::{Engine, Result};
use std::path::PathBuf;
pub(crate) const STL10_PACK: Pack = Pack {
name: "stl10",
version: "1.0.0",
license: "unspecified",
files: &[PackFile {
name: "stl10_binary.tar.gz",
size: 2_640_397_119,
shake256: "7cc3c2e49b06e72f77d77d4c788a9177f6ee6035e5a4689e0c04582269f90d9e",
urls: &["http://ai.stanford.edu/~acoates/stl10/stl10_binary.tar.gz"],
}],
};
pub const CLASSES: [&str; 10] = [
"airplane", "bird", "car", "cat", "deer", "dog", "horse", "monkey", "ship", "truck",
];
pub const IMAGE_SIDE: usize = 96;
pub type Stl10Split = IdxSplit;
#[derive(Clone, Debug)]
pub struct Stl10Config {
pub split: Stl10Split,
pub cache_dir: Option<PathBuf>,
pub normalize: bool,
}
impl Default for Stl10Config {
fn default() -> Self {
Self {
split: Stl10Split::Train,
cache_dir: None,
normalize: true,
}
}
}
impl Stl10Config {
#[inline]
#[must_use]
pub fn new() -> Self {
Self::default()
}
}
impl super::Stl10 {
#[inline]
pub fn load(config: &Stl10Config) -> Result<Self> {
Self::load_on(&Engine::current()?, config)
}
#[inline]
pub fn load_on(engine: &Engine, config: &Stl10Config) -> Result<Self> {
Self::load_with_progress_on(engine, config, &mut |_| true)
}
#[inline]
pub fn load_with_progress(
config: &Stl10Config,
progress: &mut impl FnMut(FetchProgress) -> bool,
) -> Result<Self> {
Self::load_with_progress_on(&Engine::current()?, config, progress)
}
}