Struct SpeechItem
pub struct SpeechItem {
pub audio_samples: Vec<f32>,
pub sample_rate: usize,
pub label: SpeechCommandClass,
}
Expand description
Speech item with audio samples and label.
The audio samples are floats in the range [-1.0, 1.0].
The sample rate is in Hz.
The label is the class index (see SpeechCommandClass).
To convert to usize simply use as usize
. To convert label to string use .to_string()
.
The original label is also stored in the label_original
field for debugging and remapping if needed.
Fields§
§audio_samples: Vec<f32>
Audio samples in the range [-1.0, 1.0].
sample_rate: usize
The sample rate of the audio.
label: SpeechCommandClass
The label of the audio.
Trait Implementations§
§impl Clone for SpeechItem
impl Clone for SpeechItem
§fn clone(&self) -> SpeechItem
fn clone(&self) -> SpeechItem
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Dataset<SpeechItem> for SpeechCommandsDataset
impl Dataset<SpeechItem> for SpeechCommandsDataset
§fn get(&self, index: usize) -> Option<SpeechItem>
fn get(&self, index: usize) -> Option<SpeechItem>
Gets the item at the given index.
§fn iter(&self) -> DatasetIterator<'_, I> ⓘwhere
Self: Sized,
fn iter(&self) -> DatasetIterator<'_, I> ⓘwhere
Self: Sized,
Returns an iterator over the dataset.
§impl Debug for SpeechItem
impl Debug for SpeechItem
§impl<'de> Deserialize<'de> for SpeechItem
impl<'de> Deserialize<'de> for SpeechItem
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpeechItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SpeechItem, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for SpeechItem
impl Serialize for SpeechItem
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for SpeechItem
impl RefUnwindSafe for SpeechItem
impl Send for SpeechItem
impl Sync for SpeechItem
impl Unpin for SpeechItem
impl UnwindSafe for SpeechItem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more