Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render the future ego_pose for CAM_FRONT #1130

Open
arvindks89 opened this issue Dec 21, 2024 · 0 comments
Open

Render the future ego_pose for CAM_FRONT #1130

arvindks89 opened this issue Dec 21, 2024 · 0 comments

Comments

@arvindks89
Copy link

Given an instance, want to visualize the ego pose on CAM_FRONT image for the next 12 time steps:

from nuscenes.nuscenes import NuScenes
nusc = NuScenes(version='v1.0-trainval', dataroot='/data/nuscenes/', verbose=True)

sample_token = "3950bd41f74548429c0f7700ff3d8269"
sd_rec = nusc.get('sample', sample_token)
lidar_top_data_start = nusc.get('sample_data', sd_rec['data']['CAM_FRONT'])
ego_pose_start = nusc.get('ego_pose', lidar_top_data_start['ego_pose_token'])

sdc_fut_traj =[]
for _ in range(12):
    next_annotation_token = sd_rec['next']
    if next_annotation_token=='':
        break
    sd_rec = nusc.get('sample', next_annotation_token)
    lidar_top_data_next = nusc.get('sample_data', sd_rec['data']['CAM_FRONT'])
    ego_pose_next = nusc.get('ego_pose', lidar_top_data_next['ego_pose_token'])
    sdc_fut_traj.append(ego_pose_next['translation'][:2])

Now i plot the future trajectory on the image:

x= [i[0] for i in sdc_fut_traj]
y= [i[1] for i in sdc_fut_traj]
from PIL import Image
import matplotlib.pyplot as plt

file_path = lidar_top_data_start["filename"]
img = Image.open("/mnt/ai_testing/02_datasets/UniAD/data/nuscenes/" + file_path)
plt.imshow(img)
plt.scatter(y,x)
plt.show()

But that makes no meaning, the trajectory is not meaningful
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant