Skip to content

Commit b85f4c7

Browse files
committed
Fix pipeline issues
1 parent aa53a1a commit b85f4c7

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.github/workflows/pipeline.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ jobs:
3131
sudo apt update && sudo apt install -y --no-install-recommends \
3232
xvfb
3333
pip install -r setup/requirements_3_12_lock.txt
34-
- name: Run tests
34+
- name: Run Python unit tests
3535
run: |
3636
python -m unittest discover python-sdk
37+
- name: Run Jupyter notebook tests
38+
run: |
39+
pip install jupyter
40+
export PYTHONPATH="${PYTHONPATH}:$(pwd)/python-sdk"
3741
./setup/test_tutorial.sh --ci

python-sdk/nuscenes/map_expansion/map_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,8 +1820,8 @@ def mask_for_polygons(polygons: MultiPolygon, mask: np.ndarray) -> np.ndarray:
18201820
def int_coords(x):
18211821
# function to round and convert to int
18221822
return np.array(x).round().astype(np.int32)
1823-
exteriors = [int_coords(poly.exterior.coords) for poly in polygons]
1824-
interiors = [int_coords(pi.coords) for poly in polygons for pi in poly.interiors]
1823+
exteriors = [int_coords(poly.exterior.coords) for poly in polygons.geoms]
1824+
interiors = [int_coords(pi.coords) for poly in polygons.geoms for pi in poly.interiors]
18251825
cv2.fillPoly(mask, exteriors, 1)
18261826
cv2.fillPoly(mask, interiors, 0)
18271827
return mask
@@ -1885,7 +1885,7 @@ def _polygon_geom_to_mask(self,
18851885
[1.0, 0.0, 0.0, 1.0, trans_x, trans_y])
18861886
new_polygon = affinity.scale(new_polygon, xfact=scale_width, yfact=scale_height, origin=(0, 0))
18871887

1888-
if new_polygon.geom_type is 'Polygon':
1888+
if new_polygon.geom_type == 'Polygon':
18891889
new_polygon = MultiPolygon([new_polygon])
18901890
map_mask = self.mask_for_polygons(new_polygon, map_mask)
18911891

@@ -1922,7 +1922,7 @@ def _line_geom_to_mask(self,
19221922

19231923
map_mask = np.zeros(canvas_size, np.uint8)
19241924

1925-
if layer_name is 'traffic_light':
1925+
if layer_name == 'traffic_light':
19261926
return None
19271927

19281928
for line in layer_geom:
@@ -1968,7 +1968,7 @@ def _get_layer_polygon(self,
19681968
origin=(patch_x, patch_y), use_radians=False)
19691969
new_polygon = affinity.affine_transform(new_polygon,
19701970
[1.0, 0.0, 0.0, 1.0, -patch_x, -patch_y])
1971-
if new_polygon.geom_type is 'Polygon':
1971+
if new_polygon.geom_type == 'Polygon':
19721972
new_polygon = MultiPolygon([new_polygon])
19731973
polygon_list.append(new_polygon)
19741974

@@ -1983,7 +1983,7 @@ def _get_layer_polygon(self,
19831983
origin=(patch_x, patch_y), use_radians=False)
19841984
new_polygon = affinity.affine_transform(new_polygon,
19851985
[1.0, 0.0, 0.0, 1.0, -patch_x, -patch_y])
1986-
if new_polygon.geom_type is 'Polygon':
1986+
if new_polygon.geom_type == 'Polygon':
19871987
new_polygon = MultiPolygon([new_polygon])
19881988
polygon_list.append(new_polygon)
19891989

@@ -2003,7 +2003,7 @@ def _get_layer_line(self,
20032003
if layer_name not in self.map_api.non_geometric_line_layers:
20042004
raise ValueError("{} is not a line layer".format(layer_name))
20052005

2006-
if layer_name is 'traffic_light':
2006+
if layer_name == 'traffic_light':
20072007
return None
20082008

20092009
patch_x = patch_box[0]

python-sdk/tutorials/map_expansion_tutorial.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@
197197
"source": [
198198
"# Init nuScenes. Requires the dataset to be stored on disk.\n",
199199
"from nuscenes.nuscenes import NuScenes\n",
200-
"nusc = NuScenes(version='v1.0-mini', verbose=False)\n",
200+
"nusc = NuScenes(version='v1.0-mini', dataroot='/data/sets/nuscenes', verbose=False)\n",
201201
"\n",
202202
"# Pick a sample and render the front camera image.\n",
203203
"sample_token = nusc.sample[9]['token']\n",
@@ -222,7 +222,7 @@
222222
"source": [
223223
"# Init NuScenes. Requires the dataset to be stored on disk.\n",
224224
"from nuscenes.nuscenes import NuScenes\n",
225-
"nusc = NuScenes(version='v1.0-mini', verbose=False)\n",
225+
"nusc = NuScenes(version='v1.0-mini', dataroot='/data/sets/nuscenes', verbose=False)\n",
226226
"\n",
227227
"# Render ego poses.\n",
228228
"nusc_map_bos = NuScenesMap(dataroot='/data/sets/nuscenes', map_name='boston-seaport')\n",

setup/test_tutorial.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ sed -i.bak "/get_ipython.*/d; s/\(plt.imshow.*\)/#\1/" python-sdk/tutorials/pre
3333
# Use "data/sets/nuscenes" instead of "/data/sets/nuscenes"
3434
# Use "data/sets/nuimages" instead of "/data/sets/nuimages"
3535
if [[ ${RUNNING_IN_CI} == "True" ]]; then
36+
echo "Running in CI. Replacing path to dataroot as: data/sets/nuimages"
3637
sed -i 's/\/data\/sets\/nuscenes/data\/sets\/nuscenes/g' python-sdk/tutorials/nuscenes_tutorial.py
3738
sed -i 's/\/data\/sets\/nuscenes/data\/sets\/nuscenes/g' python-sdk/tutorials/nuimages_tutorial.py
3839
sed -i 's/\/data\/sets\/nuimages/data\/sets\/nuimages/g' python-sdk/tutorials/nuimages_tutorial.py
@@ -45,5 +46,5 @@ fi
4546
xvfb-run python python-sdk/tutorials/nuscenes_tutorial.py
4647
xvfb-run python python-sdk/tutorials/nuimages_tutorial.py
4748
xvfb-run python python-sdk/tutorials/can_bus_tutorial.py
48-
# xvfb-run python python-sdk/tutorials/map_expansion_tutorial.py # Failing with MultiPolygon issue
49-
# xvfb-run python python-sdk/tutorials/prediction_tutorial.py # Failing with MultiPolygon issue
49+
xvfb-run python python-sdk/tutorials/map_expansion_tutorial.py
50+
xvfb-run python python-sdk/tutorials/prediction_tutorial.py

0 commit comments

Comments
 (0)