• Stars
    star
    425
  • Rank 102,094 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Starting files for the Udacity CarND Behavioral Cloning Project

Behavioral Cloning Project

Udacity - Self-Driving Car NanoDegree

Overview

This repository contains starting files for the Behavioral Cloning Project.

In this project, you will use what you've learned about deep neural networks and convolutional neural networks to clone driving behavior. You will train, validate and test a model using Keras. The model will output a steering angle to an autonomous vehicle.

We have provided a simulator where you can steer a car around a track for data collection. You'll use image data and steering angles to train a neural network and then use this model to drive the car autonomously around the track.

We also want you to create a detailed writeup of the project. Check out the writeup template for this project and use it as a starting point for creating your own writeup. The writeup can be either a markdown file or a pdf document.

To meet specifications, the project will require submitting five files:

  • model.py (script used to create and train the model)
  • drive.py (script to drive the car - feel free to modify this file)
  • model.h5 (a trained Keras model)
  • a report writeup file (either markdown or pdf)
  • video.mp4 (a video recording of your vehicle driving autonomously around the track for at least one full lap)

This README file describes how to output the video in the "Details About Files In This Directory" section.

Creating a Great Writeup

A great writeup should include the rubric points as well as your description of how you addressed each point. You should include a detailed description of the code used (with line-number references and code snippets where necessary), and links to other supporting documents or external references. You should include images in your writeup to demonstrate how your code works with examples.

All that said, please be concise! We're not looking for you to write a book here, just a brief description of how you passed each rubric point, and references to the relevant code :).

You're not required to use markdown for your writeup. If you use another method please just submit a pdf of your writeup.

The Project

The goals / steps of this project are the following:

  • Use the simulator to collect data of good driving behavior
  • Design, train and validate a model that predicts a steering angle from image data
  • Use the model to drive the vehicle autonomously around the first track in the simulator. The vehicle should remain on the road for an entire loop around the track.
  • Summarize the results with a written report

Dependencies

This lab requires:

The lab enviroment can be created with CarND Term1 Starter Kit. Click here for the details.

The following resources can be found in this github repository:

  • drive.py
  • video.py
  • writeup_template.md

The simulator can be downloaded from the classroom. In the classroom, we have also provided sample data that you can optionally use to help train your model.

Details About Files In This Directory

drive.py

Usage of drive.py requires you have saved the trained model as an h5 file, i.e. model.h5. See the Keras documentation for how to create this file using the following command:

model.save(filepath)

Once the model has been saved, it can be used with drive.py using this command:

python drive.py model.h5

The above command will load the trained model and use the model to make predictions on individual images in real-time and send the predicted angle back to the server via a websocket connection.

Note: There is known local system's setting issue with replacing "," with "." when using drive.py. When this happens it can make predicted steering values clipped to max/min values. If this occurs, a known fix for this is to add "export LANG=en_US.utf8" to the bashrc file.

Saving a video of the autonomous agent

python drive.py model.h5 run1

The fourth argument, run1, is the directory in which to save the images seen by the agent. If the directory already exists, it'll be overwritten.

ls run1

[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_424.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_451.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_477.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_528.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_573.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_618.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_697.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_723.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_749.jpg
[2017-01-09 16:10:23 EST]  12KiB 2017_01_09_21_10_23_817.jpg
...

The image file name is a timestamp of when the image was seen. This information is used by video.py to create a chronological video of the agent driving.

video.py

python video.py run1

Creates a video based on images found in the run1 directory. The name of the video will be the name of the directory followed by '.mp4', so, in this case the video will be run1.mp4.

Optionally, one can specify the FPS (frames per second) of the video:

python video.py run1 --fps 48

Will run the video at 48 FPS. The default FPS is 60.

Why create a video

  1. It's been noted the simulator might perform differently based on the hardware. So if your model drives succesfully on your machine it might not on another machine (your reviewer). Saving a video is a solid backup in case this happens.
  2. You could slightly alter the code in drive.py and/or video.py to create a video of what your model sees after the image is processed (may be helpful for debugging).

Tips

  • Please keep in mind that training images are loaded in BGR colorspace using cv2 while drive.py load images in RGB to predict the steering angles.

How to write a README

A well written README file can enhance your project and portfolio. Develop your abilities to create professional README files by completing this free course.

More Repositories

1

self-driving-car

The Udacity open source self-driving car project
Jupyter Notebook
6,072
star
2

deep-learning-v2-pytorch

Projects and exercises for the latest Deep Learning ND program https://www.udacity.com/course/deep-learning-nanodegree--nd101
Jupyter Notebook
4,963
star
3

deep-reinforcement-learning

Repo for the Deep Reinforcement Learning Nanodegree program
Jupyter Notebook
4,528
star
4

deep-learning

Repo for the Deep Learning Nanodegree Foundations program.
Jupyter Notebook
3,940
star
5

machine-learning

Content for Udacity's Machine Learning curriculum
Jupyter Notebook
3,825
star
6

self-driving-car-sim

A self-driving car simulator built with Unity
C#
3,810
star
7

Sunshine-Version-2

The official repository for Developing Android Apps
Java
2,886
star
8

ud851-Exercises

Java
2,048
star
9

ud851-Sunshine

Java
2,014
star
10

ud120-projects

Starter project code for students taking Udacity ud120
DIGITAL Command Language
1,586
star
11

cs344

Introduction to Parallel Programming class code
Cuda
1,227
star
12

frontend-nanodegree-resume

This repository is used for one of the projects in Udacity's Front-End Web Developer Nanodegree program. Learn how to become a Front-End Developer today with line-by-line code reviewed projects and get a job with career services!
JavaScript
1,183
star
13

course-collaboration-travel-plans

CSS
1,162
star
14

DSND_Term2

Contains files related to content and project of DSND Term 2
Jupyter Notebook
1,095
star
15

CarND-LaneLines-P1

Lane Finding Project for Self-Driving Car ND
Jupyter Notebook
779
star
16

CVND_Exercises

Exercise notebooks for CVND.
Jupyter Notebook
744
star
17

ud777-writing-readmes

Supplemental material for Udacity's "Writing READMEs" course
698
star
18

ud839_Miwok

Java
696
star
19

ud867

Course code repository for Gradle for Android and Java
Java
664
star
20

artificial-intelligence-for-trading

Content for Udacity's AI in Trading NanoDegree.
Jupyter Notebook
646
star
21

ud862-samples

Java
585
star
22

AIPND

Code and associated files for the AI Programming with Python Nanodegree Program
Jupyter Notebook
541
star
23

ud891

Google and Udacity course on Accessibility.
JavaScript
505
star
24

create-your-own-adventure

This is example repo illustrates the concept of a "Pull Request", created as part of the course How to Use Git and GitHub
Shell
503
star
25

CarND-Term1-Starter-Kit

Python
497
star
26

Just-Java

The official repository for the second Android Development for Beginners App : Just Java
Java
497
star
27

sagemaker-deployment

Code and associated files for the deploying ML models within AWS SageMaker
Jupyter Notebook
468
star
28

CarND-Advanced-Lane-Lines

Shell
454
star
29

private-ai

Repo for Udacity's Secure & Private AI course
Jupyter Notebook
449
star
30

artificial-intelligence

Python
441
star
31

ud839_CustomAdapter_Example

Java
439
star
32

Advanced_Android_Development

Repo for the Advanced Android App Development course
Java
429
star
33

cn-deep-learning

Jupyter Notebook
421
star
34

Full-Stack-Foundations

Solution Code to Full Stack Foundations (ud088)
Python
400
star
35

fullstack-nanodegree-vm

Python
372
star
36

CarND-Traffic-Sign-Classifier-Project

Classify Traffic Signs.
Jupyter Notebook
362
star
37

DL_PyTorch

Code for the Deep Learning with PyTorch lesson
Jupyter Notebook
358
star
38

ML_SageMaker_Studies

Case studies, examples, and exercises for learning to deploy ML models using AWS SageMaker.
Jupyter Notebook
355
star
39

ud843-QuakeReport

Discover earthquake activity around the world.
Java
350
star
40

frontend-nanodegree-mobile-portfolio

JavaScript
344
star
41

ud615

Course code for Scalable Microservices with Kubernetes
Go
338
star
42

cs291

Interactive 3D Graphics class code
JavaScript
319
star
43

CarND-Extended-Kalman-Filter-Project

Self-Driving Car Nanodegree Program Starter Code for the Extended Kalman Filter Project
C++
315
star
44

SFND_Lidar_Obstacle_Detection

C++
307
star
45

CarND-Path-Planning-Project

Create a path planner that is able to navigate a car safely around a virtual highway
C++
306
star
46

and-nd-firebase

Course code repository for Firebase in a Weekend by Google: Android
Java
299
star
47

robot_pose_ekf

The robot_pose_ekf ROS package applies sensor fusion on the robot IMU and odometry values to estimate its 3D pose.
C++
293
star
48

frontend-nanodegree-arcade-game

JavaScript
284
star
49

fend

General Front End Nanodegree Content Resources
CSS
276
star
50

FSND

Public repository for the Full-Stack Nanodegree program.
Python
272
star
51

devops-intro-project

Project files for Intro to DevOps class
Shell
269
star
52

rl-cheatsheet

RL Notation and Pseudocode for Udacity's MLND program
TeX
269
star
53

Court-Counter

The official repository for the third Android Development for Beginners App : CourtCounter
Java
264
star
54

Android_Me

App that lets you style your own Android! This uses Fragments to create a flexible and responsive UI.
Java
260
star
55

APIs

Code Repo for API course in Fullstack ND
Python
257
star
56

CarND-Vehicle-Detection

Vehicle Detection Project
Shell
252
star
57

reactnd-project-myreads-starter

Starter Code for the React MyReads Project
JavaScript
251
star
58

CarND-MPC-Project

CarND Term 2 Model Predictive Control (MPC) Project
C++
251
star
59

nd064_course_1

Python
248
star
60

DSND_Term1

Contains files related to content and project of DSND
Jupyter Notebook
247
star
61

ud845-Pets

Java
243
star
62

data-analyst

Content for Udacity's Data Analyst curriculum
HTML
240
star
63

AIND-NLP

Coding exercises for the Natural Language Processing concentration, part of Udacity's AIND program.
Jupyter Notebook
239
star
64

P1_Facial_Keypoints

First project for CVND: facial keypoint detection.
Jupyter Notebook
220
star
65

frontend-nanodegree-styleguide

Official FEND style guides
HTML
220
star
66

dermatologist-ai

Python
208
star
67

NLP-Exercises

Jupyter Notebook
198
star
68

nd1309-work-code

Include for each Part in the ND Program the applications code.
JavaScript
193
star
69

CarND-Camera-Calibration

Images and notebook for camera calibration
Jupyter Notebook
192
star
70

frontend-nanodegree-styleguide-zh

优达学城(Udacity)前端样式指南
HTML
192
star
71

nd9991-c2-Infrastructure-as-Code-v1

Repository for starter code and supporting material
Shell
191
star
72

andfun-kotlin-android-trivia

Kotlin
189
star
73

CarND-Capstone

CMake
188
star
74

ud864

Public repository for code examples used in Udacity's Google Maps APIs course (https://www.udacity.com/course/google-maps-apis--ud864).
HTML
188
star
75

CarND-Semantic-Segmentation

Python
186
star
76

dog-project

Jupyter Notebook
182
star
77

DevOps_Microservices

Supporting material and projects for a course on Cloud DevOps: Microservices.
Jupyter Notebook
181
star
78

ud811

Course materials for Udacity's Intro to Progressive Web Apps course at https://www.udacity.com/course/intro-to-progressive-web-apps--ud811
JavaScript
178
star
79

ShoppingListPlusPlus

ShoppingListPlusPlus is the companion Android app for the Udacity course Firebase Essentials : Build a Collaborative Shopping List App. https://www.udacity.com/course/firebase-essentials-for-android--ud009
Java
176
star
80

CppND-Route-Planning-Project

C++
173
star
81

reactnd-contacts-complete

Code-along project for the Contacts app
JavaScript
171
star
82

ud405

Code supporting the free Udacity class 2D Game Development with LibGDX.
Java
171
star
83

course-git-blog-project

Sample repo of a blog for the Git course
HTML
170
star
84

ud859

Course code for Building Scalable Apps with Google App Engine class
Java
170
star
85

ios-nd-networking

Resources for Udacity's iOS Networking with Swift course.
Swift
168
star
86

intro-to-ml-tensorflow

Projects and exercises for the Udacity Intro to Machine Learning with TensorFlow course
Jupyter Notebook
159
star
87

course-JS-and-the-DOM

JavaScript
158
star
88

CarND-Mercedes-SF-Utilities

Tools for Sensor Fusion processing.
Jupyter Notebook
158
star
89

AIND-Sudoku

Python
156
star
90

didi-competition

Resources for the Udacity/Didi $100k competition
Python
153
star
91

exoplanet-explorer

Learn more about Exoplanets! (built for Promises course)
HTML
146
star
92

ud989-cat-clicker-premium-vanilla

ud989-cat-clicker-premium-vanilla
JavaScript
146
star
93

ud989-retain

JavaScript
146
star
94

CVND---Image-Captioning-Project

Jupyter Notebook
145
star
95

JDND

Public repository for the Java Developer Nanodegree program.
Java
144
star
96

nd9991-c2-Infrastructure-as-Code-v1-Exercises_Solution

This repository contains the solution to the exercises given in the last concept of each Lesson 1 to Lesson 5.
142
star
97

nd027-c3-data-lakes-with-spark

Python
142
star
98

AdvancedAndroid_Emojify

Java
141
star
99

CppND-Capstone-Snake-Game

A 2D Snake game using C++ and SDL
C++
139
star
100

cloudflare-typescript-workers

Types and mocks for building a tested Typescript Cloudflare Worker, generates three NPM packages
TypeScript
139
star