Struct nuscenes_data::base::WithDataset
source · pub struct WithDataset<'a, T> { /* private fields */ }Expand description
A wrapper struct that wraps around a base type with a reference to dataset.
Implementations§
source§impl<'a> WithDataset<'a, CalibratedSensor>
impl<'a> WithDataset<'a, CalibratedSensor>
pub fn sensor(&self) -> WithDataset<'a, Sensor>
source§impl<'a> WithDataset<'a, InstanceInternal>
impl<'a> WithDataset<'a, InstanceInternal>
pub fn category(&self) -> WithDataset<'a, Category>
pub fn sample_annotation_iter( &self ) -> Iter<'a, SampleAnnotation, SliceIter<'a, LongToken>> ⓘ
source§impl<'a> WithDataset<'a, Map>
impl<'a> WithDataset<'a, Map>
source§impl<'a> WithDataset<'a, SampleInternal>
impl<'a> WithDataset<'a, SampleInternal>
sourcepub fn sample_annotation_iter(
&self
) -> Iter<'a, SampleAnnotation, SliceIter<'a, LongToken>> ⓘ
pub fn sample_annotation_iter( &self ) -> Iter<'a, SampleAnnotation, SliceIter<'a, LongToken>> ⓘ
Examples found in repository?
examples/main.rs (line 29)
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(())
}sourcepub fn sample_data_iter(&self) -> Iter<'a, SampleData, SliceIter<'a, LongToken>> ⓘ
pub fn sample_data_iter(&self) -> Iter<'a, SampleData, SliceIter<'a, LongToken>> ⓘ
Examples found in repository?
examples/main.rs (line 37)
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(())
}sourcepub fn scene(&self) -> WithDataset<'a, SceneInternal>
pub fn scene(&self) -> WithDataset<'a, SceneInternal>
Examples found in repository?
examples/main.rs (line 26)
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 prev(&self) -> Option<WithDataset<'a, SampleInternal>>
pub fn next(&self) -> Option<WithDataset<'a, SampleInternal>>
source§impl<'a> WithDataset<'a, SampleAnnotation>
impl<'a> WithDataset<'a, SampleAnnotation>
pub fn sample(&self) -> WithDataset<'a, SampleInternal>
pub fn instance(&self) -> WithDataset<'a, InstanceInternal>
pub fn attribute_iter(&self) -> Iter<'a, Attribute, SliceIter<'a, LongToken>> ⓘ
pub fn prev(&self) -> Option<WithDataset<'a, SampleAnnotation>>
pub fn next(&self) -> Option<WithDataset<'a, SampleAnnotation>>
source§impl<'a> WithDataset<'a, SampleData>
impl<'a> WithDataset<'a, SampleData>
pub fn open(&self) -> IoResult<File>
pub fn load_raw(&self) -> NuScenesDataResult<Vec<u8>>
sourcepub fn load(&self) -> NuScenesDataResult<LoadedSampleData>
pub fn load(&self) -> NuScenesDataResult<LoadedSampleData>
Examples found in repository?
examples/main.rs (line 41)
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 sample(&self) -> WithDataset<'a, SampleInternal>
pub fn ego_pose(&self) -> WithDataset<'a, EgoPose>
pub fn calibrated_sensor(&self) -> WithDataset<'a, CalibratedSensor>
pub fn prev(&self) -> Option<WithDataset<'a, SampleData>>
pub fn next(&self) -> Option<WithDataset<'a, SampleData>>
source§impl<'a> WithDataset<'a, SceneInternal>
impl<'a> WithDataset<'a, SceneInternal>
sourcepub fn log(&self) -> WithDataset<'a, Log>
pub fn log(&self) -> WithDataset<'a, Log>
Examples found in repository?
examples/main.rs (line 14)
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(())
}sourcepub fn sample_iter(&self) -> Iter<'a, SampleInternal, SliceIter<'a, LongToken>> ⓘ
pub fn sample_iter(&self) -> Iter<'a, SampleInternal, SliceIter<'a, LongToken>> ⓘ
Examples found in repository?
examples/main.rs (line 18)
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(())
}Trait Implementations§
source§impl<'a, T: Clone> Clone for WithDataset<'a, T>
impl<'a, T: Clone> Clone for WithDataset<'a, T>
source§fn clone(&self) -> WithDataset<'a, T>
fn clone(&self) -> WithDataset<'a, T>
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 moresource§impl<'a, T: Debug> Debug for WithDataset<'a, T>
impl<'a, T: Debug> Debug for WithDataset<'a, T>
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for WithDataset<'a, T>where T: RefUnwindSafe,
impl<'a, T> Send for WithDataset<'a, T>where T: Sync,
impl<'a, T> Sync for WithDataset<'a, T>where T: Sync,
impl<'a, T> Unpin for WithDataset<'a, T>
impl<'a, T> UnwindSafe for WithDataset<'a, T>where T: RefUnwindSafe,
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.