Lidar Car Detection
Solution for submission 156597
A detailed solution for submission 156597 submitted for challenge Lidar Car Detection
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 [4]:
!pip install aicrowd-cli
%load_ext aicrowd.magic
In [5]:
%aicrowd login
In [3]:
!rm -rf data
!mkdir data
%aicrowd ds dl -c lidar-car-detection -o data
Importing Libraries¶
In [6]:
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
%matplotlib notebook
import tensorflow as tf
from tensorflow.keras.layers import *
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.utils import to_categorical
import tensorflow.keras.backend as K
In [ ]:
# !pip install catboost
Reading the dataset¶
In [ ]:
# Reading the training dataset
# Reading the training dataset
train_data = np.load("data/train.npz", allow_pickle=True)
test_data = np.load("data/test.npz", allow_pickle=True)
train_data = train_data['train']
test_data = test_data['test']
train_data.shape, test_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] - 1)
# 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()