From 150aec11761a95c14e7cfcbed74872c471893107 Mon Sep 17 00:00:00 2001 From: Heethesh Vhavle Date: Mon, 16 Feb 2026 06:49:44 -0800 Subject: [PATCH] Support running via Python 3.8 --- aevascenes/aevascenes.py | 37 ++++++++++++++++++++++--------- aevascenes/configs.py | 21 ++++++++++++++++++ aevascenes/utils/utils.py | 11 +++++---- aevascenes/visualizer/__init__.py | 5 ++++- pyproject.toml | 9 ++++---- 5 files changed, 62 insertions(+), 21 deletions(-) diff --git a/aevascenes/aevascenes.py b/aevascenes/aevascenes.py index 19fff27..784fa61 100644 --- a/aevascenes/aevascenes.py +++ b/aevascenes/aevascenes.py @@ -11,7 +11,6 @@ import cv2 import numpy as np -import rerun as rr from PIL import Image from tqdm import tqdm @@ -21,7 +20,6 @@ import aevascenes.configs as configs from aevascenes import utils -from aevascenes.visualizer import RRVisualizer class AevaScenes: @@ -42,7 +40,7 @@ def __init__(self, dataroot: str) -> None: dataroot: Path to the root directory of the AevaScenes dataset """ self.dataroot = dataroot - self.rr_visualizer = RRVisualizer() + self.rr_visualizer = None metadata_path = os.path.join(self.dataroot, "metadata.json") if os.path.exists(metadata_path): self.metadata = utils.read_file(metadata_path) @@ -211,7 +209,13 @@ def visualize_frame( semantic_labels=semantic_labels, ) - pcds.append({"lidar_id": lidar_id, "pcd": rr.Points3D(xyz, colors=colors, labels=labels)}) + pcd_data = {"lidar_id": lidar_id, "xyz": xyz, "colors": colors, "labels": labels} + try: + import rerun as rr + pcd_data["pcd"] = rr.Points3D(xyz, colors=colors, labels=labels) + except ImportError: + pass + pcds.append(pcd_data) # Load camera metadata camera_ids = sequence_metadata["sensors"]["cameras"] @@ -268,16 +272,25 @@ def visualize_frame( ), interpolation=cv2.INTER_LINEAR, ) - images.append({"camera_id": camera_id, "image": rr.Image(undistorted_image_resized)}) + img_data = {"camera_id": camera_id, "image_np": undistorted_image_resized} + try: + import rerun as rr + img_data["image"] = rr.Image(undistorted_image_resized) + except ImportError: + pass + images.append(img_data) # Load object detection boxes boxes_serialized = frame["boxes"] boxes = utils.deserialize_boxes(boxes_serialized) - boxes_rr = utils.convert_boxes_to_rr(boxes, color_map=configs.class_color_map) - arrows_rr = utils.convert_box_velocity_arrows_rr(boxes) - # Send to rerun visualizer - self.rr_visualizer.add_data(pcds=pcds, images=images, boxes=boxes_rr, arrows=arrows_rr) + # Send to rerun visualizer (if available) + if self.rr_visualizer is not None: + boxes_rr = utils.convert_boxes_to_rr(boxes, color_map=configs.class_color_map) + arrows_rr = utils.convert_box_velocity_arrows_rr(boxes) + self.rr_visualizer.add_data(pcds=pcds, images=images, boxes=boxes_rr, arrows=arrows_rr) + + return {"pcds": pcds, "images": images, "boxes": boxes} def visualize_sampled_frames_from_dataset( self, pcd_color_mode: str = "velocity", project_points_on_image: bool = False, image_downsample_factor: int = 1 @@ -303,7 +316,8 @@ def visualize_sampled_frames_from_dataset( sampled_frame_id = random.randint(0, len(frames) - 1) - self.rr_visualizer.set_frame_counter(frame_idx=sequence_idx) + if self.rr_visualizer is not None: + self.rr_visualizer.set_frame_counter(frame_idx=sequence_idx) self.visualize_frame( frames[sampled_frame_id], sequence_data["metadata"], @@ -332,7 +346,8 @@ def visualize_sequence( frames = sequence_data["frames"] for frame_idx in tqdm(range(len(frames)), desc="Visualizing frames"): - self.rr_visualizer.set_frame_counter(frame_idx=frame_idx, timestamp_ns=frames[frame_idx]["timestamp_ns"]) + if self.rr_visualizer is not None: + self.rr_visualizer.set_frame_counter(frame_idx=frame_idx, timestamp_ns=frames[frame_idx]["timestamp_ns"]) self.visualize_frame( frames[frame_idx], sequence_data["metadata"], diff --git a/aevascenes/configs.py b/aevascenes/configs.py index d5b66aa..9d6ee3b 100644 --- a/aevascenes/configs.py +++ b/aevascenes/configs.py @@ -50,3 +50,24 @@ "sidewalk": [85, 0, 100], # purple "other_ground": [150, 100, 0], # brown } + +# ── Semantic class groupings ───────────────────────────────────────── + +ground_classes = { + "road", "lane_boundary", "road_marking", "reflective_marker", + "sidewalk", "other_ground", +} + +lane_classes = { + "lane_boundary", "road_marking", "reflective_marker", +} + +vehicle_classes = { + "car", "bus", "truck", "trailer", "vehicle_on_rails", "other_vehicle", +} + +dynamic_classes = { + "car", "bus", "truck", "trailer", "vehicle_on_rails", "other_vehicle", + "bicycle", "motorcycle", "motorcyclist", "bicyclist", + "pedestrian", "animal", +} diff --git a/aevascenes/utils/utils.py b/aevascenes/utils/utils.py index 48298c1..28ca2c3 100644 --- a/aevascenes/utils/utils.py +++ b/aevascenes/utils/utils.py @@ -13,10 +13,8 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd -import rerun as rr import transformations as tf import yaml -from rerun.datatypes import Quaternion from scipy.spatial.transform import Rotation as scipy_rot from aevascenes.utils import colormaps @@ -260,7 +258,7 @@ def deserialize_boxes(boxes: List[Dict[str, Any]]) -> List[Dict[str, Any]]: return boxes -def convert_boxes_to_rr(boxes: List[Dict[str, Any]], color_map: Optional[Dict[str, List[int]]] = None) -> rr.Boxes3D: +def convert_boxes_to_rr(boxes: List[Dict[str, Any]], color_map: Optional[Dict[str, List[int]]] = None): """ Convert bounding boxes to Rerun Boxes3D format for 3D visualization. Transforms a list of bounding boxes in AevaScenes format to a Rerun Boxes3D @@ -280,6 +278,9 @@ def convert_boxes_to_rr(boxes: List[Dict[str, Any]], color_map: Optional[Dict[st Returns: Rerun Boxes3D object configured for visualization """ + import rerun as rr + from rerun.datatypes import Quaternion + boxes_rr = {} boxes_rr["half_sizes"] = np.array([box["dimensions"] / 2 for box in boxes]) boxes_rr["centers"] = np.array([box["center"] for box in boxes]) @@ -305,7 +306,7 @@ def convert_boxes_to_rr(boxes: List[Dict[str, Any]], color_map: Optional[Dict[st def convert_box_velocity_arrows_rr( boxes: List[Dict[str, Any]], color_map: Optional[Dict[str, List[int]]] = None -) -> rr.Arrows3D: +): """ Convert bounding box velocity data to Rerun Arrows3D format for motion visualization. Creates 3D arrow vectors representing the linear velocity of bounding boxes, @@ -324,6 +325,8 @@ def convert_box_velocity_arrows_rr( Returns: Rerun Arrows3D object configured for velocity visualization with: """ + import rerun as rr + arrows_rr = {} arrows_rr["centers"] = np.array([box["center"] for box in boxes]) diff --git a/aevascenes/visualizer/__init__.py b/aevascenes/visualizer/__init__.py index 7c89bc6..543bba0 100644 --- a/aevascenes/visualizer/__init__.py +++ b/aevascenes/visualizer/__init__.py @@ -4,4 +4,7 @@ # The AevaScenes dataset is licensed separately under the AevaScenes Dataset License. # See https://scenes.aeva.com/license for the full license text. -from .visualizer import RRVisualizer +try: + from .visualizer import RRVisualizer +except ImportError: + RRVisualizer = None diff --git a/pyproject.toml b/pyproject.toml index 8881e98..2aa4783 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description = "AevaScenes Python SDK" authors = [{name = "Aeva, Inc", email = "research@aeva.ai"}] license = {file = "LICENSE-CODE"} readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.8" dependencies = [ "tqdm", "numpy", @@ -17,7 +17,6 @@ dependencies = [ "pillow", "scipy", "opencv-python", - "rerun-sdk==0.24.1", "rich", ] keywords = ["aeva", "aevascenes", "lidar", "fmcw", "sdk"] @@ -35,12 +34,12 @@ classifiers = [ "Topic :: Software Development :: Libraries", ] -[tool.setuptools] -packages = ["aevascenes"] +[tool.setuptools.packages.find] +where = ["."] [tool.black] line-length = 120 -target-version = ["py310"] +target-version = ["py38"] [tool.isort] profile = "black"