From e9e3276971500fb33188f5005ff83e334fa5953a Mon Sep 17 00:00:00 2001 From: Oscar Beijbom Date: Wed, 7 Nov 2018 20:46:26 +0800 Subject: [PATCH] cleanup of imports and Typing --- python-sdk/export/export_pointclouds_as_obj.py | 7 +++++-- python-sdk/nuscenes_utils/data_classes.py | 9 ++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/python-sdk/export/export_pointclouds_as_obj.py b/python-sdk/export/export_pointclouds_as_obj.py index 814058a7..a2c0974f 100644 --- a/python-sdk/export/export_pointclouds_as_obj.py +++ b/python-sdk/export/export_pointclouds_as_obj.py @@ -1,3 +1,8 @@ +""" +Export fused point clouds of a scene to a Wavefront OBJ file. +This point-cloud can be viewed in your favorite 3D rendering tool, e.g. Meshlab or Maya. +""" + import os import os.path as osp import argparse @@ -16,8 +21,6 @@ def export_scene_pointcloud(nusc: NuScenes, out_path: str, scene_token: str, channel: str='LIDAR_TOP', min_dist: float=3.0, max_dist: float=30.0, verbose: bool=True) -> None: """ - Export fused point clouds of a scene to a Wavefront OBJ file. - This point-cloud can be viewed in your favorite 3D rendering tool, e.g. Meshlab or Maya. :param nusc: NuScenes instance. :param out_path: Output path to write the point-cloud to. :param scene_token: Unique identifier of scene to render. diff --git a/python-sdk/nuscenes_utils/data_classes.py b/python-sdk/nuscenes_utils/data_classes.py index 9f5846c4..e33d9573 100644 --- a/python-sdk/nuscenes_utils/data_classes.py +++ b/python-sdk/nuscenes_utils/data_classes.py @@ -9,8 +9,7 @@ import cv2 import numpy as np from pyquaternion import Quaternion -import cv2 as Axes -from matplotlib.axes._axes import Axes +from matplotlib.axes import Axes from nuscenes_utils.geometry_utils import view_points @@ -114,7 +113,7 @@ def load_pcd_bin(file_name: str) -> np.ndarray: return points @classmethod - def from_file(cls, file_name: str): # -> PointCloud + def from_file(cls, file_name: str) -> PointCloud: """ Instantiate from a .pcl, .pdc, .npy, or .bin file. :param file_name: Path of the pointcloud file on disk. @@ -276,7 +275,7 @@ def encode(self) -> List[float]: self.label] + [self.score] + self.velocity.tolist() + [self.name] @classmethod - def decode(cls, data: List[float]): # -> Box: + def decode(cls, data: List[float]) -> Box: """ Instantiates a Box instance from encoded vector representation. :param data: [: 16]. Output from encode. @@ -343,7 +342,7 @@ def bottom_corners(self) -> np.ndarray: return self.corners()[:, [2, 3, 7, 6]] def render(self, axis: Axes, view: np.ndarray=np.eye(3), normalize: bool=False, colors: Tuple=('b', 'r', 'k'), - linewidth:float=2): + linewidth: float=2): """ Renders the box in the provided Matplotlib axis. :param axis: Axis onto which the box should be drawn.