{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"!pip install lyft-dataset-sdk -q","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"#First import:  \nfrom lyft_dataset_sdk.lyftdataset import LyftDataset  #Assuming you have already installed it\nimport pandas as pd\nimport json\nimport plotly\nimport plotly.graph_objs as go\nfrom lyft_dataset_sdk.utils.data_classes import LidarPointCloud","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"DATA_PATH = \"/kaggle/input/samplyft/sampLyft/\"\nlyft_dataset = LyftDataset(data_path=DATA_PATH, json_path=DATA_PATH+'data')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def plotCloud(lidar_pointcloud):#Code taken from StackOverFlow, sadly forgot the link\n    # Configure Plotly to be rendered inline in the notebook.\n    plotly.offline.init_notebook_mode()\n    # Configure the trace.\n    trace = go.Scatter3d(\n        x=-lidar_pointcloud.points[0,],\n        y=lidar_pointcloud.points[1,],  # <-- Put your data instead\n        z=-lidar_pointcloud.points[2,],  # <-- Put your data instead\n        mode='markers',\n        marker={\n        'size': 1,\n        'opacity': 0.8,\n        }\n    )\n    # Configure the layout.\n    layout = go.Layout(\n        margin={'l': 0, 'r': 0, 'b': 0, 't': 0},\n         scene =dict(\n        xaxis = dict(title=\"x\", range = [-200,200]),\n        yaxis = dict(title=\"y\", range = [-200,200]),\n        zaxis = dict(title=\"z\", range = [-200,200])\n         )\n    )\n    data = [trace]\n    plot_figure = go.Figure(data=data, layout=layout)\n    plotly.offline.iplot(plot_figure)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lidar_filepath = lyft_dataset.get_sample_data_path('5c3d79e1cf8c8182b2ceefa33af96cbebfc71f92e18bf64eb8d4e0bf162e01d4')\nlidar_pointcloud = LidarPointCloud.from_file(lidar_filepath)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"plotCloud(lidar_pointcloud)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lyft_dataset.render_sample_data(\"f47a5d143bcebb24efc269b1a40ecb09440003df2c381a69e67cd2a726b27a0c\", with_anns=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lyft_dataset.render_sample_data(\"f47a5d143bcebb24efc269b1a40ecb09440003df2c381a69e67cd2a726b27a0c\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lyft_dataset.render_sample_data(\"ec9950f7b5d4ae85ae48d07786e09cebbf4ee771d054353f1e24a95700b4c4af\", with_anns=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lyft_dataset.render_sample_data(\"ec9950f7b5d4ae85ae48d07786e09cebbf4ee771d054353f1e24a95700b4c4af\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":1}