-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fc4e979
Showing
12 changed files
with
31,613 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.mp4 filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.mp4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Predict Car Speed from Dashcam video | ||
|
||
## 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 | ||
```bash | ||
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. <br> | ||
If any modifications are made to the optical flow part of the model then `--wipe` must be used to reprocess the data | ||
|
||
#### For Evaluate | ||
```bash | ||
python main.py data/train.mp4 data/train.txt --mode=eval | ||
``` | ||
This will print the mean squared error. | ||
|
||
#### For Play | ||
```bash | ||
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 | ||
```bash | ||
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. <br> | ||
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 | ||
 <br> | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
# coding: utf-8 | ||
|
||
# In[9]: | ||
|
||
|
||
import numpy as np | ||
import os | ||
import pandas as pd | ||
from sklearn.metrics import mean_squared_error | ||
|
||
|
||
# In[10]: | ||
|
||
|
||
y_true = np.array(pd.read_csv("train.txt", header=None, squeeze=True)) | ||
y_pred = np.array(pd.read_csv("test.txt", header=None, squeeze=True)) | ||
|
||
|
||
# In[11]: | ||
|
||
|
||
mean_squared_error(y_true, y_pred) | ||
|
||
|
||
# In[ ]: | ||
|
||
|
||
|
||
|
Oops, something went wrong.