Skip to content

Speed estimation from a dash camera's feed using optical flow and CNN on Keras

Notifications You must be signed in to change notification settings

SatyamGaba/speed_estimate_optflow_cnn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Predict Car Speed from Dashcam video (Odometry)

Goal

Basically, the goal is to predict the speed of a car from a video.

data/train.mp4 is a video of driving containing 20400 frames. Video is shot at 20 fps. data/train.txt contains the speed of the car at each frame, one speed on each line.

data/test.mp4 is a different driving video containing 10798 frames. Video is shot at 20 fps. The deliverable is test.txt

Usage:

For Train

python main.py data/train.mp4 data/train.txt --mode=train --split=0.3

If you'd like to continue training using the pretrained network then add the --resume flag to that line.
If any modifications are made to the optical flow part of the model then --wipe must be used to reprocess the data

For Evaluate

python main.py data/train.mp4 data/train.txt --mode=eval

This will print the mean squared error.

For Play

python main.py data/train.mp4 data/train.txt --mode=play

If you want a more graphical display you can use the play mode. This will output the Optical Flow video with prediction overlay.

For Test/Inference

python main.py data/test.mp4 data/test.txt --mode=test

It will infer the model and save the predicted value to test.txt file.

Results

I divided flow_data in 70-30 ratio in train and validation set.
I got a MSE of around 2.5 on train data and 0.45 on validation data. MSE on entire train data is 0.55.

Visualization of Results

output1

output2

About

Speed estimation from a dash camera's feed using optical flow and CNN on Keras

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages