All Projects → windowsub0406 → Vehicle Detection Yolo Ver

windowsub0406 / Vehicle Detection Yolo Ver

real-time Vehicle Detection( tiny YOLO ver) and HOG+SVM method

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Vehicle Detection Yolo Ver

vehicle-detection
Detect vehicles in a video
Stars: ✭ 88 (-20.72%)
Mutual labels:  yolo, vehicle-detection
Vehicle Detection
Created vehicle detection pipeline with two approaches: (1) deep neural networks (YOLO framework) and (2) support vector machines ( OpenCV + HOG).
Stars: ✭ 462 (+316.22%)
Mutual labels:  svm, vehicle-detection
YOLO-Object-Counting-API
The code of the Object Counting API, implemented with the YOLO algorithm and with the SORT algorithm
Stars: ✭ 131 (+18.02%)
Mutual labels:  yolo, vehicle-detection
Yolo Vehicle Counter
This project aims to count every vehicle (motorcycle, bus, car, cycle, truck, train) detected in the input video using YOLOv3 object-detection algorithm.
Stars: ✭ 28 (-74.77%)
Mutual labels:  yolo, vehicle-detection
Carnd Vehicle Detection
Vehicle detection using YOLO in Keras runs at 21FPS
Stars: ✭ 367 (+230.63%)
Mutual labels:  yolo, vehicle-detection
Vehicle counting hog svm
Vehicle detection, tracking and counting by SVM is trained with HOG features using OpenCV on c++.
Stars: ✭ 82 (-26.13%)
Mutual labels:  svm, vehicle-detection
Spots
🎍 Spots is a cross-platform view controller framework for building component-based UIs
Stars: ✭ 1,310 (+1080.18%)
Mutual labels:  yolo
Yolo2 Pytorch
YOLOv2 in PyTorch
Stars: ✭ 1,393 (+1154.95%)
Mutual labels:  yolo
Yolo Darknet On Jetson Tx2
How to run YOLO on Jetson TX2
Stars: ✭ 89 (-19.82%)
Mutual labels:  yolo
Tracknpred
This is the code base for our ACM CSCS 2019 paper: "RobustTP: End-to-End Trajectory Prediction for Heterogeneous Road-Agents in Dense Traffic with Noisy Sensor Inputs". This codebase contains implementations for several trajectory prediction methods including Social-GAN and TraPHic.
Stars: ✭ 88 (-20.72%)
Mutual labels:  yolo
Mnist Classification
Pytorch、Scikit-learn实现多种分类方法,包括逻辑回归(Logistic Regression)、多层感知机(MLP)、支持向量机(SVM)、K近邻(KNN)、CNN、RNN,极简代码适合新手小白入门,附英文实验报告(ACM模板)
Stars: ✭ 109 (-1.8%)
Mutual labels:  svm
Keras Yolo3
Training and Detecting Objects with YOLO3
Stars: ✭ 1,532 (+1280.18%)
Mutual labels:  yolo
Ios camera object detection
Realtime mobile visualize based Object Detection based on TensorFlow and YOLO model
Stars: ✭ 100 (-9.91%)
Mutual labels:  yolo
Holocron
PyTorch implementations of recent Computer Vision tricks
Stars: ✭ 95 (-14.41%)
Mutual labels:  yolo
Textclf
TextClf :基于Pytorch/Sklearn的文本分类框架,包括逻辑回归、SVM、TextCNN、TextRNN、TextRCNN、DRNN、DPCNN、Bert等多种模型,通过简单配置即可完成数据处理、模型训练、测试等过程。
Stars: ✭ 105 (-5.41%)
Mutual labels:  svm
Defect Detection Classifier
Visual Defect Detection on Boiler Water Wall Tube Using Small Dataset
Stars: ✭ 91 (-18.02%)
Mutual labels:  svm
Yolov5
YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
Stars: ✭ 19,914 (+17840.54%)
Mutual labels:  yolo
Text Detection Using Yolo Algorithm In Keras Tensorflow
Implemented the YOLO algorithm for scene text detection in keras-tensorflow (No object detection API used) The code can be tweaked to train for a different object detection task using YOLO.
Stars: ✭ 87 (-21.62%)
Mutual labels:  yolo
Augmentedgaussianprocesses.jl
Gaussian Process package based on data augmentation, sparsity and natural gradients
Stars: ✭ 99 (-10.81%)
Mutual labels:  svm
Yolov5 Rt Stack
Yet another yolov5, with its runtime stack for libtorch, onnx, tvm and specialized accelerators. You like torchvision's retinanet? You like yolov5? You love yolort!
Stars: ✭ 107 (-3.6%)
Mutual labels:  yolo

Vehicle Detection(tiny YOLO ver, HOG & SVM ver )

main_image
result image(watch the full video below)

Introduction

This is Vehicle Detection project of Udacity's Self-Driving Car Engineering Nanodegree. In this project, I approached with 2 methods for a vehicle detection. HOG + SVM approach and YOLO approach. In HOG + SVM approach, we classified vehicle using hog feature and color feature. And to search a position of vehicles, we implement a sliding window search. In YOLO approach, YOLO applies a single neural network to the full image.

Environment

software

Windows 10(x64), Python 3.5, OpenCV 3.1.0

hardware

CPU : i5-6500 3.20GHz, GPU : GTX 980Ti, Memory : 8GB

Files

YOLO ver
main.py : main code
tiny.py : main code of tiny yolo
yolo_small.py : yolo model composition
yolo_tiny.py : tiny yolo model composition
calibration.py : get calibration matrix
threshold.py : sobel edge & hls color
finding_lines.py : find & draw lane lines with sliding widow search

HOG + SVM ver
main_hog.py : main code
svc_save.py : extract feature & save SVM classifier result
feature_extract.py : hog & color feature extraction
find_car.py : sliding window search method
svc_save.p : saved SVM result


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.

Dataset

In this project, I used the labeled data for vehicle and non-vehicle examples to train your classifier. These example images come from a combination of the GTI vehicle image database, the KITTI vision benchmark suite.

dataset

Histogram of Oriented Gradients (HOG)

HOG feature Extraction

The code for this step is contained in the feature_extract.py and save_svc.py
The histogram of oriented gradients (HOG) is a feature descriptor used in computer vision and image processing for the purpose of object detection. The technique counts occurrences of gradient orientation in localized portions of an image.

This is my final choice of parameters of HOG

color_space = 'HLS'
spatial_size = (16, 16)
hist_bins = 32
orient = 9
pix_per_cell = 8
cell_per_block = 2
hog_channel = 'ALL'
spatial_feat = True
hist_feat = True
hog_feat = True

hog

Training a classifier

Extracted features using hog info & color info

car_features = extract_features(cars, color_space, spatial_size, hist_bins, orient, pix_per_cell,
                        cell_per_block, hog_channel, spatial_feat, hist_feat, hog_feat)
notcar_features = extract_features(notcars, color_space, spatial_size, hist_bins, orient, pix_per_cell,
                        cell_per_block, hog_channel, spatial_feat, hist_feat, hog_feat)

To normalize a difference in magnitude between the color-based and gradient-based feature, I used StandardScaler() function of Python's sklearn package.

# Create an array stack of feature vectors
X = np.vstack((car_features, notcar_features)).astype(np.float64)
# Fit a per-column scaler
X_scaler = StandardScaler().fit(X)
# Apply the scaler to X
scaled_X = X_scaler.transform(X)

Trained using LinearSVM classifier

# Split up data into randomized training and test sets
rand_state = np.random.randint(0, 100)
X_train, X_test, y_train, y_test = train_test_split(
    scaled_X, y, test_size=0.2, random_state=rand_state)

svc = LinearSVC()
svc.fit(X_train, y_train)

And according to svc.score(X_test, y_test), my Testest Accuracy was 0.9896

Sliding Window Search

The code for this step is contained in the find_car.py I used 3 square window sizes of 128x128, 96x96, 64x64 pixels size. And each adjacent sliding windows have an ovelap of 75%. Also upper half of image and lower bonnet's position are ignored to search vehicles. Each windows check the Hog features and compared with SVM result.

window

Heatmap

During sliding window search, there are many false positives and Multiple Detections. To resolve this problem I used heatmap. Simply added "heat" (+=1) for all pixels within windows where a positive detection is reported by your classifier.

This is my result of test images.

result


Extra Works (YOLO & add Lane finding result)

YOLO

When I use a SVM + Hog method, the elapsed time for a vehicle detection was about 4.28 second per 1 frame. detection result was not bad but we never detect vehicles in real-time with 4.28s/frame. That's why I searched a YOLO. YOLO(You Only Look it Once) is famous real-time object detection technique. Originally YOLO is codded with C language but I found a tensorflow version of YOLO and I revised it.
My code does not support training. Used darknet's weight file. On average, I could get 0.035 second per 1 frame with YOLO_small(GPU : GTX 980Ti) and about 0.025 second per frame in tiny YOLO model.

yolo

Yolo's approach is really impressive. Prior detection systems(e.g. faster-R-CNN) apply the model to an image at multiple locations and scales. High scoring regions of the image are considered detections. but YOLO applies a single neural network to the full image. This network divides the image into regions and predicts bounding boxes and probabilities for each region. These bounding boxes are weighted by the predicted probabilities.
To understand how yolo works, please watch this youtube video. Language is Russian but you can understand easily.

Merge with Lane finding project

By using YOLO, i could real-time detect vehicles in video. To check a real-time lane-finding & vehicle detection, I merged this project with advanced lane finding project. This is the result.

merge

Result

result
Final real-time Result (click for full video)


Reflection

I could learn and implement SVM classifier and yolo. Before starting this project, I had decided to use a YOLO for vehicle detection because I was really interested in YOLO. But I did't have experience about SVM-based detection and wondered the result. That's why I used both methods in this project. SVM classifier could detect vehicle well but the elapsed time was terrible. To search a position of object, I needed to search almost every frame using sliding window search. But I could resolve it by using YOLO.
In this project, I didn't retrain a model and used tiny YOLO. So, according to my result, it couldn't detect small vehicles and showed some of false positives. For a best result, I'll fine-tune yolo or ssd method to mine. That's my future work.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].