Skip to content

Commit

Permalink
Enable solid 3D boxes for nuscenes (#7021)
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc authored Jul 31, 2024
1 parent ff26b3a commit 8d8dc76
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
11 changes: 10 additions & 1 deletion examples/python/nuscenes_dataset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,16 @@ rr.log(f"world/ego_vehicle/{sensor_name}", rr.Points3D(points, colors=point_colo

Annotations are logged as [`Boxes3D`](https://www.rerun.io/docs/reference/types/archetypes/boxes3d), containing details such as object positions, sizes, and rotation.
```python
rr.log("world/anns", rr.Boxes3D(sizes=sizes, centers=centers, rotations=rotations, class_ids=class_ids))
rr.log(
"world/anns",
rr.Boxes3D(
sizes=sizes,
centers=centers,
rotations=rotations,
class_ids=class_ids,
fill_mode=rr.components.FillMode.Solid,
),
)
```

### Setting up the default blueprint
Expand Down
27 changes: 23 additions & 4 deletions examples/python/nuscenes_dataset/nuscenes_dataset/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def log_radars(first_radar_tokens: list[str], nusc: nuscenes.NuScenes, max_times
points = pointcloud.points[:3].T # shape after transposing: (num_points, 3)
point_distances = np.linalg.norm(points, axis=1)
point_colors = cmap(norm(point_distances))
rr.log(f"world/ego_vehicle/{sensor_name}", rr.Points3D(points, colors=point_colors))
rr.log(
f"world/ego_vehicle/{sensor_name}",
rr.Points3D(points, colors=point_colors),
)
current_camera_token = sample_data["next"]


Expand Down Expand Up @@ -204,7 +207,16 @@ def log_annotations(first_sample_token: str, nusc: nuscenes.NuScenes, max_timest
label2id[ann["category_name"]] = len(label2id)
class_ids.append(label2id[ann["category_name"]])

rr.log("world/anns", rr.Boxes3D(sizes=sizes, centers=centers, rotations=rotations, class_ids=class_ids))
rr.log(
"world/anns",
rr.Boxes3D(
sizes=sizes,
centers=centers,
rotations=rotations,
class_ids=class_ids,
fill_mode=rr.components.FillMode.Solid,
),
)
current_sample_token = sample_data["next"]

# skipping for now since labels take too much space in 3D view (see https://github.com/rerun-io/rerun/issues/4451)
Expand Down Expand Up @@ -255,7 +267,10 @@ def main() -> None:
)
parser.add_argument("--dataset-version", type=str, default="v1.0-mini", help="Scene id to visualize")
parser.add_argument(
"--seconds", type=float, default=float("inf"), help="If specified, limits the number of seconds logged"
"--seconds",
type=float,
default=float("inf"),
help="If specified, limits the number of seconds logged",
)
rr.script_add_args(parser)
args = parser.parse_args()
Expand Down Expand Up @@ -291,7 +306,11 @@ def main() -> None:

rr.script_setup(args, "rerun_example_nuscenes", default_blueprint=blueprint)

rr.log("description", rr.TextDocument(DESCRIPTION, media_type=rr.MediaType.MARKDOWN), timeless=True)
rr.log(
"description",
rr.TextDocument(DESCRIPTION, media_type=rr.MediaType.MARKDOWN),
timeless=True,
)

log_nuscenes(nusc, args.scene_name, max_time_sec=args.seconds)

Expand Down

0 comments on commit 8d8dc76

Please sign in to comment.