In this project a software pipeline is designed to identify vehicles in a video from a front-facing camera on a car.
Tools Used: python (sci-kit-learn, cv2)
.
Link to the output of this project.
Build a pipeline using test images and validate it with test_video.mp4. Finally test it with project_video.mp4.
-
I started by reading in all the
vehicle
andnon-vehicle
images dataset. Here is an example of one of each of thevehicle
andnon-vehicle
classes: -
I then explored different color spaces and different
skimage.hog()
parameters (orientations
,pixels_per_cell
, andcells_per_block
). I grabbed random images from each of the two classes and displayed them to get a feel for what theskimage.hog()
output looks like. Here is an example using theYCrCb
color space and HOG parameters oforientations=8
,pixels_per_cell=(8, 8)
andcells_per_block=(2, 2)
:Finalized parameters are shown in the table:
finalized Parameters | Values |
---|---|
orientations | 9 |
pixels_per_cell | (8,8) |
cell_per_block | (2,2) |
spatial_size | (32,32) |
color_space | YCrCb |
-
I tried various choice of parameters and highest training accuracy is achieved when all the features are used (i.e. hog and color). Feature extraction is done in the code cell 5.
-
I trained a linear SVM (in code cell 6) using HOG features along with color features (spatial and histogram). Data set is split into 80% training set and 20% test set to validate the accuracy of the classifier. Accuracy of the classifier is 98.9%.
-
Variable sliding window is used to find if a car is present in the area window. I experimented with scales and y_start_stop values in the code cell 9 and finalized them for the video pipeline in cell 10. Working of pipeline on test images provided is shown the figure 3. First image shows positive detections, followed by heatmap and thresholding. Lablels for the thresholded heat map is created in 4th image using scipy.ndimage.measurements.label() which is followed by drawing bounding boxes in 5th image.