Given the sample token, how do I access instance token for the ego-vehicle?
It seems to be easy to access the instance token for each object present in the scene (using the helper.get_annotations_for_sample(sample_token)
API), but I couldn’t find a way to access an instance token specifically for the ego-vehicle.
How to access instance token given sample token?
The “instance” of the ego is simply the sample itself, which you easily access as follows:
my_sample = nusc.get('sample', some_sample_token)
Do check out our tutorial for more details: https://www.nuscenes.org/nuscenes?tutorial=nuscenes
So are you saying that my_sample['token']
in the snippet above will give me the instance token?
It does not seem to be correct though. What I want to be able to do is to cross-reference the samples between the full nuScenes dataset and the prediction challenge split.
If what you are saying is true, then the following code must pass correct?
self.nuscenes = NuScenes(dataset_ver, dataroot=root_path)
self.nuscenes_challenge_split = get_prediction_challenge_split("train", dataroot=root_path)
# get a reference instance and sample token
ref_instance_token, ref_sample_token = self.nuscenes_challenge_split[0].split("_")
# go through each sample
for scene in self.nuscenes.scene:
sample_token = scene['first_sample_token']
while sample_token != '':
sample = self.nuscenes.get('sample', sample_token)
if sample_token == ref_sample_token:
assert sample['token'] == ref_instance_token