Struct nuscenes_data::base::NuScenesDataset
source · pub struct NuScenesDataset { /* private fields */ }Implementations§
source§impl NuScenesDataset
impl NuScenesDataset
sourcepub fn load<S, P>(version: S, dir: P) -> NuScenesDataResult<Self>where
S: AsRef<str>,
P: AsRef<Path>,
pub fn load<S, P>(version: S, dir: P) -> NuScenesDataResult<Self>where S: AsRef<str>, P: AsRef<Path>,
Load the dataset directory.
use nuscenes_data::NuScenesDataset;
fn main() -> NuscenesDataResult<()> {
let dataset = NuScenesDataset::load("1.02", "/path/to/your/dataset")?;
OK(())
}Examples found in repository?
examples/main.rs (line 7)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
fn main() -> NuScenesDataResult<()> {
// Change the path to your dataset directory
let dataset = NuScenesDataset::load("1.02", "/some/path/v1.02-train")?;
// Iterate over scenes chronologically
for scene in dataset.scene_iter() {
println!("read scene {}", scene.token);
// Get associated log
let log = scene.log();
println!("captured at {}", log.date_captured);
// Iterate over associated samples
for sample in scene.sample_iter() {
println!(
"found sample {} in scene {} with timestamp {}",
sample.token, scene.token, sample.timestamp
);
// Get the related scene back from sample
assert_eq!(scene.token, sample.scene_token);
assert_eq!(scene.token, sample.scene().token);
// Iterate over associated annotations
for annotation in sample.sample_annotation_iter() {
println!(
"found annotation {} in sample {}",
annotation.token, sample.token,
);
}
// Iterate over associated data
for data in sample.sample_data_iter() {
println!("found data {} in sample {}", data.token, sample.token);
// Load data
match data.load()? {
LoadedSampleData::PointCloud(matrix) => {
println!(
"get point cloud from data {} with {} points",
data.token,
matrix.nrows()
);
}
LoadedSampleData::Image(image) => {
println!(
"get image from data {} with shape {}x{}",
data.token,
image.width(),
image.height()
);
}
}
}
}
}
Ok(())
}pub fn attribute_iter( &self ) -> Iter<'_, Attribute, HashMapKeys<'_, LongToken, Attribute>> ⓘ
pub fn calibrated_sensor_iter( &self ) -> Iter<'_, CalibratedSensor, HashMapKeys<'_, LongToken, CalibratedSensor>> ⓘ
pub fn category_iter( &self ) -> Iter<'_, Category, HashMapKeys<'_, LongToken, Category>> ⓘ
pub fn ego_pose_iter(&self) -> Iter<'_, EgoPose, SliceIter<'_, LongToken>> ⓘ
pub fn instance_iter( &self ) -> Iter<'_, Instance, HashMapKeys<'_, LongToken, InstanceInternal>>
pub fn log_iter(&self) -> Iter<'_, Log, HashMapKeys<'_, LongToken, Log>> ⓘ
pub fn map_iter(&self) -> Iter<'_, Map, HashMapKeys<'_, ShortToken, Map>> ⓘ
pub fn sample_iter(&self) -> Iter<'_, SampleInternal, SliceIter<'_, LongToken>> ⓘ
pub fn sample_annotation_iter( &self ) -> Iter<'_, SampleAnnotation, HashMapKeys<'_, LongToken, SampleAnnotation>> ⓘ
pub fn sample_data_iter(&self) -> Iter<'_, SampleData, SliceIter<'_, LongToken>> ⓘ
sourcepub fn scene_iter(&self) -> Iter<'_, SceneInternal, SliceIter<'_, LongToken>> ⓘ
pub fn scene_iter(&self) -> Iter<'_, SceneInternal, SliceIter<'_, LongToken>> ⓘ
Examples found in repository?
examples/main.rs (line 10)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
fn main() -> NuScenesDataResult<()> {
// Change the path to your dataset directory
let dataset = NuScenesDataset::load("1.02", "/some/path/v1.02-train")?;
// Iterate over scenes chronologically
for scene in dataset.scene_iter() {
println!("read scene {}", scene.token);
// Get associated log
let log = scene.log();
println!("captured at {}", log.date_captured);
// Iterate over associated samples
for sample in scene.sample_iter() {
println!(
"found sample {} in scene {} with timestamp {}",
sample.token, scene.token, sample.timestamp
);
// Get the related scene back from sample
assert_eq!(scene.token, sample.scene_token);
assert_eq!(scene.token, sample.scene().token);
// Iterate over associated annotations
for annotation in sample.sample_annotation_iter() {
println!(
"found annotation {} in sample {}",
annotation.token, sample.token,
);
}
// Iterate over associated data
for data in sample.sample_data_iter() {
println!("found data {} in sample {}", data.token, sample.token);
// Load data
match data.load()? {
LoadedSampleData::PointCloud(matrix) => {
println!(
"get point cloud from data {} with {} points",
data.token,
matrix.nrows()
);
}
LoadedSampleData::Image(image) => {
println!(
"get image from data {} with shape {}x{}",
data.token,
image.width(),
image.height()
);
}
}
}
}
}
Ok(())
}pub fn sensor_iter( &self ) -> Iter<'_, Sensor, HashMapKeys<'_, LongToken, Sensor>> ⓘ
pub fn visibility_iter( &self ) -> Iter<'_, Visibility, HashMapKeys<'_, String, Visibility>> ⓘ
Trait Implementations§
source§impl Clone for NuScenesDataset
impl Clone for NuScenesDataset
source§fn clone(&self) -> NuScenesDataset
fn clone(&self) -> NuScenesDataset
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 moreAuto Trait Implementations§
impl RefUnwindSafe for NuScenesDataset
impl Send for NuScenesDataset
impl Sync for NuScenesDataset
impl Unpin for NuScenesDataset
impl UnwindSafe for NuScenesDataset
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
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
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
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.