Lidar Car Detection
[Getting Started Notebook] Lidar Car Detection
A Getting Started notebook for Car Detection using Lidar Puzzle of BlitzXI.
Starter Code for Lidar Car Detection
What we are going to Learn¶
- Learning about how lidar works
- Using scikit-learn for binary classification.
Note : Create a copy of the notebook and use the copy for submission. Go to File > Save a Copy in Drive to create a new copy
Downloading Dataset¶
Installing aicrowd-cli
In [ ]:
!pip install aicrowd-cli
%load_ext aicrowd.magic
In [ ]:
%aicrowd login
In [ ]:
!rm -rf data
!mkdir data
%aicrowd ds dl -c lidar-car-detection -o data
Importing Libraries¶
In [ ]:
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
import os
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import random
Reading the dataset¶
In [ ]:
# Reading the training dataset
train_data = np.load("/content/data/train.npz", allow_pickle=True)
train_data = train_data['train']
train_data.shape
Out[ ]:
Visualizing the dataset¶
In this section, we will be visualizing a sample 3D lidar data
In [ ]:
# Getting a random 3D lidar sample data
INDEX = random.randint(0, train_data.shape[0])
# Getting the individual x,y and z points.
x = train_data[INDEX][0][:, 0].tolist()
y = train_data[INDEX][0][:, 1].tolist()
z = train_data[INDEX][0][:, 2].tolist()
# Label for the corrosponding sample ( no. of cars )
label = train_data[INDEX][1]
# Generating the 3D graph
fig = go.Figure(data=[go.Scatter3d(x=x, y=y, z=z,
mode='markers',
marker=dict(
size=1,
colorscale='Viridis',
opacity=0.8))])
print("No. of cars : ", label)
fig.show()