-
Notifications
You must be signed in to change notification settings - Fork 694
Description
Hello,
Summary :
With the new version of python 3.12 the code also updates shapely to 2.0.3 but the problem is it's still using old version of descartes that creates mismatch. This code was working on 3.9 version but now it doesn't.
fig, ax = nusc_map.render_map_patch(patch_box,
layer_names=['walkway', 'drivable_area', 'road_segment'],
figsize=(10, 10),
alpha=0.5)
There are no ways to downgrade partially due to python 3.12 doesn't support old version of shapely so the only way to downgrade is rollback to the python version 3.9.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
More detailed :
Dependancies on colab latest environment:
!pip install nuscenes-devkit
Requirement already satisfied: nuscenes-devkit in /usr/local/lib/python3.12/dist-packages (1.2.0)
Requirement already satisfied: cachetools in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (5.5.2)
Requirement already satisfied: descartes in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (1.1.0)
Requirement already satisfied: fire in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (0.7.1)
Requirement already satisfied: matplotlib>=3.6.0 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (3.10.0)
Requirement already satisfied: numpy<2.0.0,>=1.22.0 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (1.26.4)
Requirement already satisfied: opencv-python-headless>=4.5.4.58 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (4.11.0.86)
Requirement already satisfied: Pillow>6.2.1 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (11.3.0)
Requirement already satisfied: pyquaternion>=0.9.5 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (0.9.9)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (1.6.1)
Requirement already satisfied: scipy in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (1.16.3)
Requirement already satisfied: Shapely~=2.0.3 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (2.0.7)
Requirement already satisfied: tqdm in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (4.67.1)
Requirement already satisfied: parameterized in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (0.9.0)
Requirement already satisfied: pycocotools>=2.0.1 in /usr/local/lib/python3.12/dist-packages (from nuscenes-devkit) (2.0.10)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (1.3.3)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (4.60.1)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (1.4.9)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (25.0)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (3.2.5)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.12/dist-packages (from matplotlib>=3.6.0->nuscenes-devkit) (2.9.0.post0)
Requirement already satisfied: termcolor in /usr/local/lib/python3.12/dist-packages (from fire->nuscenes-devkit) (3.2.0)
Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->nuscenes-devkit) (1.5.2)
Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.12/dist-packages (from scikit-learn->nuscenes-devkit) (3.6.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.7->matplotlib>=3.6.0->nuscenes-devkit) (1.17.0)
Error :
IndexError Traceback (most recent call last)
[/tmp/ipython-input-421536422.py](https://localhost:8080/#) in <cell line: 0>()
228 # === Execute enrichment ===
229 processed_tracks = enrich_tracks_with_map_features(processed_tracks, nusc)
--> 230 plot_random_tracks_from_map(processed_tracks, 'singapore-onenorth', n=5)
231
232
7 frames
[/usr/local/lib/python3.12/dist-packages/descartes/patch.py](https://localhost:8080/#) in PolygonPath(polygon)
61
62 vertices = concatenate([
---> 63 concatenate([asarray(t.exterior)[:, :2]] +
64 [asarray(r)[:, :2] for r in t.interiors])
65 for t in polygon])
IndexError: too many indices for array: array is 0-dimensional, but 2 were indexed
Whole function that gives error:
def plot_partial_map_for_track(track, map_name):
nusc_map = NuScenesMap(dataroot=DATAROOT, map_name=map_name)
xy = np.array(track['raw_xy'])
if len(xy) < 2:
print("[WARNING] Not enough points to plot track.")
return
center = np.mean(xy, axis=0)
buffer = 40
x_min, y_min = center - buffer
x_max, y_max = center + buffer
patch_box = [x_min, y_min, x_max, y_max]
fig, ax = nusc_map.render_map_patch(patch_box,
layer_names=['walkway', 'drivable_area', 'road_segment'],
figsize=(10, 10),
alpha=0.5)
x, y = xy[:, 0], xy[:, 1]
ax.plot(x, y, color='blue', linewidth=5, alpha=1.0, label='Trajectory')
ax.set_title(f"Trajectory Context | {map_name} | Crossroad: {track.get('crossroad')} | Illegal: {track.get('illegal_crossing')}")
ax.legend()
plt.grid(True)
plt.show()
The plot is totaly blank now but Expected output :
