Skip to content

Latest commit

 

History

History
101 lines (57 loc) · 6.15 KB

writeup_template.md

File metadata and controls

101 lines (57 loc) · 6.15 KB

Writeup Template

You can use this file as a template for your writeup if you want to submit it as a markdown file, but feel free to use some other method and submit a pdf if you prefer.


Vehicle Detection Project

The goals / steps of this project are the following:

  • Perform a Histogram of Oriented Gradients (HOG) feature extraction on a labeled training set of images and train a classifier Linear SVM classifier
  • Optionally, you can also apply a color transform and append binned color features, as well as histograms of color, to your HOG feature vector.
  • Note: for those first two steps don't forget to normalize your features and randomize a selection for training and testing.
  • Implement a sliding-window technique and use your trained classifier to search for vehicles in images.
  • Run your pipeline on a video stream (start with the test_video.mp4 and later implement on full project_video.mp4) and create a heat map of recurring detections frame by frame to reject outliers and follow detected vehicles.
  • Estimate a bounding box for vehicles detected.

Rubric Points

Here I will consider the rubric points individually and describe how I addressed each point in my implementation.


Writeup / README

1. Provide a Writeup / README that includes all the rubric points and how you addressed each one. You can submit your writeup as markdown or pdf. Here is a template writeup for this project you can use as a guide and a starting point.

You're reading it!

Histogram of Oriented Gradients (HOG)

1. Explain how (and identify where in your code) you extracted HOG features from the training images.

The code for this step is contained in the third code cell of the IPython notebook P5_vehicle_detection.ipynb (in lines #3 through #18).

I started by reading in all the vehicle and non-vehicle images. Here is an example of one of each of the vehicle and non-vehicle classes:

alt text

I then explored different skimage.hog() parameters (orientations, pixels_per_cell, and cells_per_block). I grabbed one image from each of the two classes and displayed them to get a feel for what the skimage.hog() output looks like.

Here is an example using HOG parameters of orientations=9, pixels_per_cell=(8, 8) and cells_per_block=(2, 2):

alt text

2. Explain how you settled on your final choice of HOG parameters.

I tried various combinations of parameters and finally went ahead with HOG parameters of orientations=11, pixels_per_cell=(16, 16) and cells_per_block=(2, 2):

3. Describe how (and identify where in your code) you trained a classifier using your selected HOG features (and color features if you used them).

I trained a linear SVM in fifth code cell using colorspace of YUV

Sliding Window Search

1. Describe how (and identify where in your code) you implemented a sliding window search. How did you decide what scales to search and how much to overlap windows?

Window blocks are calculated in sixth code cell where we do find_cars. If the prediction is true, we add to the array rectangles. I used lower half of the images which would focus on the road more.

2. Show some examples of test images to demonstrate how your pipeline is working. What did you do to optimize the performance of your classifier?

Ultimately I searched on ALL channel HOG features. I used lower half of the images which would focus on the road more. Once cars were detected, I used heatmap and thresholding technique, after which drew boxes around the cars.

alt text

Video Implementation

1. Provide a link to your final video output. Your pipeline should perform reasonably well on the entire project video (somewhat wobbly or unstable bounding boxes are ok as long as you are identifying the vehicles most of the time with minimal false positives.)

Here's a link to my video result

2. Describe how (and identify where in your code) you implemented some kind of filter for false positives and some method for combining overlapping bounding boxes.

I recorded the positions of positive detections in each frame of the video. From the positive detections I created a heatmap and then thresholded that map to identify vehicle positions. I then used scipy.ndimage.measurements.label() to identify individual blobs in the heatmap. I then assumed each blob corresponded to a vehicle. I constructed bounding boxes to cover the area of each blob detected. Only kept recent 15 positive detections.

Here's an example result showing the heatmap from a test frame, the result of scipy.ndimage.measurements.label() and the bounding boxes then overlaid on a frame of video:

Here is example of a frame with heatmaps and threshold and then boxed:

alt text


Discussion

1. Briefly discuss any problems / issues you faced in your implementation of this project. Where will your pipeline likely fail? What could you do to make it more robust?

Very far away cars and cars from other side of the divider are not detected properly. I tried using the standard scaler fit and transform, but when I did that, non cars were also getting detected, so had to avoid using that while extracting features. I struggled a bit for the ystart, ystop and scale for find_cars, then referred how others successfully did it and with courtesy of jeremy-shannon used particular values, which helped, along with using a class and track prev 15 sets of rectangles. One way I can think of making it robust can be to detect the road horizon (meeting the sky) then use that much part of the frame to detect all cars, so that far away and other side cars can also fall in place. Also using perspective transform can help with far away cars.