Git Product home page Git Product logo

carvideotospeedprediction's Introduction

SPEED PREDICTION

Predicting speed of a car, given car-perspective, recorded video.

Final model:

  • Converts MP4 File to series of JPEG frames
  • Extract Features from frames using pre-trained Residual Network 50
  • Performs Ridge Regression to predict speed at each frame
  • Smooths resulting speed prediction vector via a moving average method
  • Test Set (~1 min video) MSE of 4.22 (2.05 RMSE m/s)
  • Train Set (~5 min video) MSE of 2.97 (1.72 RMSE m/s)

Notes on the approach:

  • This is a small data, deep learning approach to this problem.
  • An alternative, effective approach using more classical CV would be Optical Flow.
  • An alternative, effective approach for large data using deep learning would be to use an RNN over the extracted features.

Be sure to check out cool_viz.mp4 for a cool visualization!

Here are the main modules I used to produce proper runs and results:

  • Keras 1.1.0 Important: Some other versions (particularly 1.2) do not extract features identically. You have been warned :)
  • Tensorflow 0.10.0 for Keras backend. Potentially same story as above.
  • Python 2.7
  • Numpy 1.11.1
  • SKLearn 0.18
  • CV2 2.4.11 Other versions (particularly for the last four) might work as well but haven't been tested.

To verify running properly:

  • Please do this if possible to confirm feature extraction is working as expected under your environment
  • Run "python test.py -v"
  • This will run the model over the combined training and testing data used originally.
  • Should receive message "Test MSE: 3.17" printed to terminal.
  • If not, use Keras 1.1.0 and Tensorflow 0.10.0 as Keras backend. Again, feature extraction with pre-trained model is sensitive to these.

To test on new data:

  • Name the video file "drive_test.mp4"
  • Name the accompanying speed labels file "drive_test.json"
  • From project's top level directory, run "python test.py"
  • Download and change versions of required packages as necessary if errors occur
  • If execution is interrupted while converting "drive_test.mp4" into the folder of JPEG's "drive/", please delete the created "drive/" folder and run "python test.py" again.

To reproduce final run:

  • Run "python predict.py"

Credit Due To:

  • Joseph Redmon's YOLO Darknet repo for help generating the visualization.
  • Keras, SKLearn, Numpy, etc. Documentation
  • Lots of Stack Overflow
  • Specific functions built off code from elsewhere is cited in comments and docstrings.

carvideotospeedprediction's People

Contributors

ethanjperez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.