Giter Club home page Giter Club logo

suiron's Introduction

Suiron for Cozmo

Vision-based, autonomous driving for Cozmo

Dependencies

Virtual Python environment

ln -s /usr/lib/python2.7/dist-packages/cv2.so ~/env2.7/lib/python2.7/site-packages/cv2.so
ln -s /usr/lib/python2.7/dist-packages/cv.py ~/env2.7/lib/python2.7/site-packages/cv.py
ln -s /usr/lib/python2.7/dist-packages/cv.pyc ~/env2.7/lib/python2.7/site-packages/cv.pyc
python -c 'import cv2'

Python 2.7 is needed on the Suiron end

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-opencv python-dev

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0-cp27-none-linux_x86_64.whl
pip install --upgrade $TF_BINARY_URL

pip install -r requirements.txt

Python 3.5 is needed to use the Cozmo API

pip install cozmo[camera]

Collecting data from a USB camera (using OpenCV)

python collect.py
  • Data are stored as data/output_foo.csv

Collecting data from Cozmo (using a browser-based GUI)

./remote_control_cozmo.py
  • Once started, data are immediately collected into a memory buffer. Click the Record button at the top of the GUI to save buffered data to a file as data/cozmoData_foo.csv. The buffer is then reset and data collection continues.

Visualizing collected data

python visualize_collect.py data/cozmoData_foo.csv
  • Press q to quit the visualization at anytime

Training

vim settings.json # change training parameters, including output model name, here
python train.py
  • All data under data/ are used for training/testing/validation. Let foo.ckpt be a trained model.

  • Exception ~/env2.7/lib/python2.7/site-packages/tflearn/helpers/trainer.py@134, tf.train.Saver (tensorflow/tensorflow/python/training/saver.py): No variables to save.

    • Set allow_empty=True option in the Saver constructor (this is new in tf, resulting in a bug in tflearn).
  • AWS instances can be used for training.

AMI ID AMI name
ami-85c26de5 tensorflow-cuda8-cudnn5.1-opencv
ami-789e3118 dnn-ami-backup-11-23-2016

Visualizing the predicted data

vim settings.json # choose the model to be used for prediction here
python visualize_predict.py data/foo.csv
  • A foo.gif is generated at the end or on termination of the visualizer.
  • Prediction visualization (green = actual, blue = prediction)

Closing the loop

./remote_control_cozmo.py
  • Auto-drive can be toggled using the 'AUTODRIVE' button at the top of the GUI. NOTE: Drive commands (WASD) still need to be transmitted to Cozmo for actuation. However, their values are ignore. Instead, the outputs of DNN are used to drive and steer Cozmo.

References

Blog Post detailing how the hardware and software communicate - Communicating between RC Car and the On-board Computer - Jabelone

Communication between hardware and software repo - car-controller

Neural Network architecture was based on NVIDIA's Self-driving car paper - End-To-End Learning for Self-Driving Cars

suiron's People

Contributors

kendricktan avatar longle2718 avatar jabelone avatar

Stargazers

 avatar

Watchers

James Cloos avatar  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.