Coder Social home page Coder Social logo

how_to_simulate_a_self_driving_car's Introduction

How_to_simulate_a_self_driving_car

This is the code for "How to Simulate a Self-Driving Car" by Siraj Raval on Youtube

This video will be released on Wednesday, May 17th at 10 AM PST. This code is a work in progress.

Overview

This is the code for this video on Youtube by Siraj Raval. We're going to use Udacity's self driving car simulator as a testbed for training an autonomous car.

Dependencies

You can install all dependencies by running one of the following commands

You need a anaconda or miniconda to use the environment setting.

# Use TensorFlow without GPU
conda env create -f environments.yml 

# Use TensorFlow with GPU
conda env create -f environment-gpu.yml

Or you can manually install the required libraries (see the contents of the environemnt*.yml files) using pip.

Usage

Run the pretrained model

Start up the Udacity self-driving simulator, choose a scene and press the Autonomous Mode button. Then, run the model as follows:

python drive.py model.h5

To train the model

You'll need the data folder which contains the training images.

python model.py

This will generate a file model-<epoch>.h5 whenever the performance in the epoch is better than the previous best. For example, the first epoch will generate a file called model-000.h5.

Credits

The credits for this code go to naokishibuya. I've merely created a wrapper to get people started.

how_to_simulate_a_self_driving_car's People

Contributors

iambedant avatar llsourcell avatar planetceres avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

how_to_simulate_a_self_driving_car's Issues

Trained models (model-009.h5) doesn't run while pretrained model runs but car crashes into water.

I'm having 2 problems.

The first is that my trained models (model-006.h5,model-009.h5 etc) don't run. When I type python drive.py model-009.h5 the terminal just says "Running TensorFlow Backend" and then it goes back to command line:

bigproblem

When I run python drive.py model.h5 however (on the pretrained model) it runs the car autonomously, though it drives off course into water after about 5-10 seconds of driving.

I've tried changing the name of model-009.h5 to model.h5 and removing the pretrained problem, but the same problem occurs as what first happened.

I'd love some advice or help from anyone who think they know what might be happening!
Thanks!

Keras 2

Please update model.py and drive.py to run on keras 2 api

pretrained model not working

Hi Siraj,

I am trying to run your pretrained model on my system. But unlucky I am getting these error, Can you please help me?
python drive.py model.h5 Using TensorFlow backend. Traceback (most recent call last): File "drive.py", line 124, in <module> model = load_model(args.model) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 240, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 304, in model_from_config return layer_module.deserialize(config, custom_objects=custom_objects) File "/usr/local/lib/python2.7/dist-packages/keras/layers/__init__.py", line 54, in deserialize printable_module_name='layer') File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 140, in deserialize_keras_object list(custom_objects.items()))) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 1202, in from_config layer = layer_module.deserialize(conf, custom_objects=custom_objects) File "/usr/local/lib/python2.7/dist-packages/keras/layers/__init__.py", line 54, in deserialize printable_module_name='layer') File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 140, in deserialize_keras_object list(custom_objects.items()))) File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 706, in from_config function = func_load(config['function'], globs=globs) File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 198, in func_load code = marshal.loads(code.encode('raw_unicode_escape')) ValueError: bad marshal data (unknown type code)

I am using python 2.7 and manual installation.

Model.py giving error on training the new model

Hi Siraj !!
Thanks a lot for this video

Sir when i am trying to train the model for my newly created data using this command

python model.py

Using TensorFlow backend.
------------------------------
Parameters
------------------------------
data_dir             := data
samples_per_epoch    := 20000
nb_epoch             := 10
learning_rate        := 0.0001
save_best_only       := True
test_size            := 0.2
keep_prob            := 0.5
batch_size           := 40
------------------------------
Traceback (most recent call last):
  File "model.py", line 162, in <module>
    main()
  File "model.py", line 154, in main
    data = load_data(args)
  File "model.py", line 33, in load_data
    X = data_df[['center', 'left', 'right']].values
  File "/home/vinayak/miniconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/pandas/core/frame.py", line 2056, in __getitem__
    return self._getitem_array(key)
  File "/home/vinayak/miniconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/pandas/core/frame.py", line 2100, in _getitem_array
    indexer = self.loc._convert_to_indexer(key, axis=1)
  File "/home/vinayak/miniconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/pandas/core/indexing.py", line 1231, in _convert_to_indexer
    raise KeyError('%s not in index' % objarr[mask])
KeyError: "['center' 'left' 'right'] not in index"

Please suggest me where i am wrong

I am using Ubuntu 16.04 and the data folder is in my home directory (containing file driving_log.csv and IMG folder)
and my model.py is also in my home directory

Problem with pre-trained model

When I try to run the pre-trained-model I get the following error:

Traceback (most recent call last):
File "drive.py", line 124, in
model = load_model(args.model)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\models.py", line 291, in load_model
model.optimizer.set_weights(optimizer_weight_values)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\optimizers.py", line 103, in set_weights
'provided weight shape ' + str(w.shape))
ValueError: Optimizer weight shape (24,) not compatible with provided weight shape (5, 5, 3, 24)

Can someone help me please?

running model.py is having issues

Using TensorFlow backend.

Parameters

data_dir := data
test_size := 0.2
keep_prob := 0.5
nb_epoch := 10
samples_per_epoch := 20000
batch_size := 40
save_best_only := True
learning_rate := 0.0001

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 66
model.add(Conv2D(24, 5, 5, activation='elu', subsample=(2, 2)))
UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (5, 5), activation="elu", strides=(2, 2))

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 67
model.add(Conv2D(36, 5, 5, activation='elu', subsample=(2, 2)))
UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(36, (5, 5), activation="elu", strides=(2, 2))

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 68
model.add(Conv2D(48, 5, 5, activation='elu', subsample=(2, 2)))
UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(48, (5, 5), activation="elu", strides=(2, 2))

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 69
model.add(Conv2D(64, 3, 3, activation='elu'))
UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="elu")

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 70
model.add(Conv2D(64, 3, 3, activation='elu'))
UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="elu")


Layer (type) Output Shape Param #

lambda_1 (Lambda) (None, 66, 200, 3) 0


conv2d_1 (Conv2D) (None, 31, 98, 24) 1824


conv2d_2 (Conv2D) (None, 14, 47, 36) 21636


conv2d_3 (Conv2D) (None, 5, 22, 48) 43248


conv2d_4 (Conv2D) (None, 3, 20, 64) 27712


conv2d_5 (Conv2D) (None, 1, 18, 64) 36928


dropout_1 (Dropout) (None, 1, 18, 64) 0


flatten_1 (Flatten) (None, 1152) 0


dense_1 (Dense) (None, 100) 115300


dense_2 (Dense) (None, 50) 5050


dense_3 (Dense) (None, 10) 510


dense_4 (Dense) (None, 1) 11

Total params: 252,219
Trainable params: 252,219
Non-trainable params: 0


Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 120
verbose=1)
UserWarning: The semantics of the Keras 2 argument steps_per_epoch is not the same as the Keras 1 argument samples_per_epoch. steps_per_epoch is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarly nb_val_samples->validation_steps and val_samples->steps arguments have changed. Update your method calls accordingly.

Warning (from warnings module):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 120
verbose=1)
UserWarning: Update your fit_generator call to the Keras 2 API: fit_generator(<generator..., 20000, 10, validation_data=<generator..., callbacks=[<keras.ca..., verbose=1, validation_steps=746, max_queue_size=1)
Epoch 1/10
Traceback (most recent call last):
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 163, in
main()
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 159, in main
train_model(model, args, *data)
File "E:\How_to_simulate_a_self_driving_car-master\model.py", line 120, in train_model
verbose=1)
File "C:\python\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "C:\python\lib\site-packages\keras\engine\training.py", line 1426, in fit_generator
initial_epoch=initial_epoch)
File "C:\python\lib\site-packages\keras\engine\training_generator.py", line 155, in fit_generator
generator_output = next(output_generator)
File "C:\python\lib\site-packages\keras\utils\data_utils.py", line 793, in get
six.reraise(value.class, value, value.traceback)
File "C:\python\lib\site-packages\six.py", line 693, in reraise
raise value
File "C:\python\lib\site-packages\keras\utils\data_utils.py", line 658, in _data_generator_task
generator_output = next(self._generator)
File "E:\How_to_simulate_a_self_driving_car-master\utils.py", line 149, in batch_generator
image, steering_angle = augument(data_dir, center, left, right, steering_angle)
File "E:\How_to_simulate_a_self_driving_car-master\utils.py", line 131, in augument
image = random_shadow(image)
File "E:\How_to_simulate_a_self_driving_car-master\utils.py", line 100, in random_shadow
mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1
IndexError: boolean index did not match indexed array along dimension 0; dimension is 160 but corresponding boolean dimension is 66

its my output when i run model.py

ValueError: bad marshal data (unknown type code)

when i'm running dive.py model.h5 code, i'm getting this error!
i upgraded my tensorflow and keras. Still things are not wroking.
Could anyone help me out ?

coreClock: 1.189GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 37.33GiB/s
2021-03-11 12:10:37.056793: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-03-11 12:10:37.059796: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cublas64_11.dll'; dlerror: cublas64_11.dll not found
2021-03-11 12:10:37.062219: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cublasLt64_11.dll'; dlerror: cublasLt64_11.dll not found
2021-03-11 12:10:37.064931: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2021-03-11 12:10:37.068493: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2021-03-11 12:10:37.071181: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2021-03-11 12:10:37.073680: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cusparse64_11.dll'; dlerror: cusparse64_11.dll not found
2021-03-11 12:10:37.076105: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-03-11 12:10:37.079439: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1757] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2021-03-11 12:10:37.081789: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-03-11 12:10:37.085081: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-03-11 12:10:37.085401: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]
2021-03-11 12:10:37.086478: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
Traceback (most recent call last):
File "drive.py", line 105, in
model = load_model(args.model)
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\saving\save.py", line 206, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects,
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\saving\hdf5_format.py", line 183, in load_model_from_hdf5
model = model_config_lib.model_from_config(model_config,
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 64, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 173, in deserialize
return generic_utils.deserialize_keras_object(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 354, in deserialize_keras_object
return cls.from_config(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\engine\sequential.py", line 492, in from_config
layer = layer_module.deserialize(layer_config,
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 173, in deserialize
return generic_utils.deserialize_keras_object(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 354, in deserialize_keras_object
return cls.from_config(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\layers\core.py", line 1019, in from_config
function = cls._parse_function_from_config(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\layers\core.py", line 1071, in _parse_function_from_config
function = generic_utils.func_load(
File "D:\Anaconda\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 457, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)

'driving_log.csv' not found

I have "driving_log.csv" file in the same folder still getting an error.
FileNotFoundError: File b'D:\Projects\Artificial Intelligance\UdacitySDC\data\driving_log.csv' does not exist

Comparing Steering angle

Hey Guys,

i want to compare the steering angle of the pretrained modell and my own trained modell. But i don´t know how i can do this. It would be nice if someone could help me with this issue.

I tried to calculate the steering angle of the pretrained modell but its always the false result.
If someone knows how to calculate the steering angle then pls help me out. I really need it for a projekt.

Running the Pre-trained model, getting error on keras. can't figure out what the problem is. also where do i need to put the simulator? in the same folder where the drive scripts are?

Traceback (most recent call last):
File "drive.py", line 124, in
model = load_model(args.model)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\models.py", line 243, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\models.py", line 317, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\layers_init_.py", line 55, in deserialize
printable_module_name='layer')
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\models.py", line 1373, in from_config
model.add(layer)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\models.py", line 467, in add
layer(x)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\engine\topology.py", line 619, in call
output = self.call(inputs, **kwargs)
File "C:\Users\ihtes\Anaconda3\lib\site-packages\keras\layers\core.py", line 663, in call
return self.function(inputs, **arguments)
File "model.py", line 34, in
#and our steering commands as our output data
SystemError: unknown opcode

Can anyone guide me on how to run this? some basic stuff?

Hy, i'm basically new to these things. I just want to run this and need basic guidelines on how to? which path should i choose? where should i put pre-trained model? and where would be the location of the simulator? Help please

Training model causes a generator output error

When I execute the command python model.py while the car-behavioral-cloning environment (for CPU version) is activated I get the following error:

Using TensorFlow backend.
------------------------------
Parameters
------------------------------
batch_size           := 40
data_dir             := data
samples_per_epoch    := 20000
learning_rate        := 0.0001
nb_epoch             := 10
test_size            := 0.2
save_best_only       := True
keep_prob            := 0.5
------------------------------
____________________________________________________________________________________________________
Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
lambda_1 (Lambda)                (None, 66, 200, 3)    0           lambda_input_1[0][0]             
____________________________________________________________________________________________________
convolution2d_1 (Convolution2D)  (None, 31, 98, 24)    1824        lambda_1[0][0]                   
____________________________________________________________________________________________________
convolution2d_2 (Convolution2D)  (None, 14, 47, 36)    21636       convolution2d_1[0][0]            
____________________________________________________________________________________________________
convolution2d_3 (Convolution2D)  (None, 5, 22, 48)     43248       convolution2d_2[0][0]            
____________________________________________________________________________________________________
convolution2d_4 (Convolution2D)  (None, 3, 20, 64)     27712       convolution2d_3[0][0]            
____________________________________________________________________________________________________
convolution2d_5 (Convolution2D)  (None, 1, 18, 64)     36928       convolution2d_4[0][0]            
____________________________________________________________________________________________________
dropout_1 (Dropout)              (None, 1, 18, 64)     0           convolution2d_5[0][0]            
____________________________________________________________________________________________________
flatten_1 (Flatten)              (None, 1152)          0           dropout_1[0][0]                  
____________________________________________________________________________________________________
dense_1 (Dense)                  (None, 100)           115300      flatten_1[0][0]                  
____________________________________________________________________________________________________
dense_2 (Dense)                  (None, 50)            5050        dense_1[0][0]                    
____________________________________________________________________________________________________
dense_3 (Dense)                  (None, 10)            510         dense_2[0][0]                    
____________________________________________________________________________________________________
dense_4 (Dense)                  (None, 1)             11          dense_3[0][0]                    
====================================================================================================
Total params: 252,219
Trainable params: 252,219
Non-trainable params: 0
____________________________________________________________________________________________________
Epoch 1/10
Traceback (most recent call last):
  File "model.py", line 163, in <module>
    main()
  File "model.py", line 159, in main
    train_model(model, args, *data)
  File "model.py", line 120, in train_model
    verbose=1)
  File "/home/arthur/anaconda2/envs/car-behavioral-cloning/lib/python3.5/site-packages/keras/models.py", line 924, in fit_generator
    pickle_safe=pickle_safe)
  File "/home/arthur/anaconda2/envs/car-behavioral-cloning/lib/python3.5/site-packages/keras/engine/training.py", line 1481, in fit_generator
    str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

The only thing I changed about the source code is line 29:
data_df = pd.read_csv(os.path.join(args.data_dir, 'driving_log.csv'))
into:
data_df = pd.read_csv(os.path.join(args.data_dir, 'driving_log.csv'), names=['center', 'left', 'right', 'steering', 'throttle', 'reverse', 'speed'])
because I had also an issue with loading the data because the columns weren't named.

Does anyone know how to fix this issue?

i have this problem:

drive.py: error: the following arguments are required: model.h5
i have this problem,and i cant download model.h5 dont know why

Trained model drives car into the water

I have cloned this repo, generated my own data using the training mode on the simulator and used these images to retrain my model. When I run drive.py, the car drives into the water after a while even though I did not drive into the water while training. What could be the issue?

I have no errors on my terminal while running model.py and drive.py.

What could be the issue?

Failed to load the native TensorFlow runtime.

(car-behavioral-cloning) C:\Users\91900>python drive.py model.h5
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "drive.py", line 27, in
from keras.models import load_model
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras_init_.py", line 2, in
from . import backend
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\backend_init_.py", line 67, in
from .tensorflow_backend import *
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in
import tensorflow as tf
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python_init_.py", line 51, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\91900\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

I GET THIS ERROR WHEN I TRY TO RUN THIS COMMAND"python drive.py model.h5"
CAN ANYONE HELP?

Running the model.py gives error

I try to run the model.py in my local machine. I have make sure the conda env is installed correctly. I have created the 'Data' folder as required. The driving_log.csv has the right format. But after I run "python model.py", I am meeting the following error:

Epoch 1/10
Traceback (most recent call last):
File "model.py", line 163, in
main()
File "model.py", line 159, in main
train_model(model, args, *data)
File "model.py", line 120, in train_model
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/rui/anaconda3/envs/car-behavioral-cloning/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/home/rui/anaconda3/envs/car-behavioral-cloning/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/home/rui/anaconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/keras/engine/training.py", line 409, in data_generator_task
generator_output = next(generator)
File "/home/rui/Desktop/Udacity/SelfDrivingCar/Term-1/Project3/CarND-Behavioral-Cloning-P3-master/utils.py", line 153, in batch_generator
image, steering_angle = augument(data_dir, center, left, right, steering_angle)
File "/home/rui/Desktop/Udacity/SelfDrivingCar/Term-1/Project3/CarND-Behavioral-Cloning-P3-master/utils.py", line 132, in augument
image, steering_angle = choose_image(data_dir, center, left, right, steering_angle)
File "/home/rui/Desktop/Udacity/SelfDrivingCar/Term-1/Project3/CarND-Behavioral-Cloning-P3-master/utils.py", line 55, in choose_image
return load_image(data_dir, left), steering_angle + 0.2
TypeError: Can't convert 'float' object to str implicitly

verbose=1)

File "/home/rui/anaconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/keras/models.py", line 924, in fit_generator
pickle_safe=pickle_safe)
File "/home/rui/anaconda3/envs/car-behavioral-cloning/lib/python3.5/site-packages/keras/engine/training.py", line 1481, in fit_generator
str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

Can you please help what could be the reason? I have not change the source code. Thanks

Failed to load the native TensorFlow runtime. (Problem while running model.py)

C:\Users\Arnon>python model.py
Using TensorFlow backend.
Traceback (most recent call last):
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "model.py", line 6, in
from keras.models import Sequential
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras_init_.py", line 2, in
from . import backend
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\backend_init_.py", line 67, in
from .tensorflow_backend import *
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in
import tensorflow as tf
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import *
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python_init_.py", line 51, in
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow_internal')
File "C:\Users\Arnon\Anaconda3\envs\car-behavioral-cloning\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

run model.py get error when training model

Run model.py and get successfully output for parameters and model summary.
However, get error below when training the model:

Epoch 1/10
Traceback (most recent call last):
  File "model.py", line 167, in <module>
    main()
  File "model.py", line 163, in main
    train_model(model, args, *data)
  File "model.py", line 124, in train_model
    verbose=1)
  File "xxx\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\models.py", line 924, in fit_generator
    pickle_safe=pickle_safe)
  File "xxx\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\keras\engine\training.py", line 1481, in fit_generator
    str(generator_output))
ValueError: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

running the model.py gives the error " unable to create file (unable to open file) "

unable to create file (unable to open file: name = 'model-001.h5', errno = 2, error message = 'No such file or directory', flags =13, o_flags = 302)

I'm getting this error after completion of first epoch, once 20000/20000 is completed, it gives this error that it was unable to create model file. I have tried running this as administrator as well, but it won't help, for some reasons it won't create model file. is it some kind of directory or permission issue? Please help

syntax error

I am using python version 3.7 on windows 10, all i did is I installed the dependencies and in next cell I tried activating car-behavioral-cloning but it is continuously giving my syntax errors immediately
image
I have tried a few different commands but none seems to work

Error while running the model

I have a few things to clarify. When I run the drive.py file with the model.h5 file, though it says 'Recording this run' and starting wsgi, nothing happens after that.

  1. Do we need Unity Engine and load the Udacity Simulator on that?
    if yes, then does Unity work on Ubuntu 16.04

  2. The python files, the .exe of the simulator and also the image folder which contains the data is in the same folder. The driving_log.csv has the absolute paths of the images. Where should each component be present? Is there some directory problem here the reason for my problem?

  3. What are the arguments needed to be provided by us while running the drive.py and train.py file?
    will the drive.py file work even when the model is not saved as a .h5 and saved as .ckpt?

Thanks

Please add a license

Please add a license allowing us to clone your repository

From https://choosealicense.com/no-permission/

If you find software that doesn’t have a license, that generally means you have no permission from the creators of the software to use, modify, or share the software. Although a code host such as GitHub may allow you to view and fork the code, this does not imply that you are permitted to use, modify, or share the software for any purpose.

Model request

Any body have the model.h5 file for the current image size of unity simulator because the model he trained was with image size 60* something but now the simulator returns images with 320*160 anybody have trained model for this please share

Running PreTrained model Issue

C:\Users\krish\OneDrive\Documents\GitHub\Behavioral-Cloning> python drive.py model.json
Using TensorFlow backend.
XXX lineno: 58, opcode: 0
Traceback (most recent call last):
File "drive.py", line 80, in
model = model_from_json(json.load(jfile))
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\models.py", line 345, in model_from_json
return layer_module.deserialize(config, custom_objects=custom_objects)
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\layers_init_.py", line 54, in deserialize
printable_module_name='layer')
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 139, in deserialize_keras_object
list(custom_objects.items())))
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\models.py", line 1214, in from_config
model.add(layer)
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\models.py", line 442, in add
layer(x)
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\engine\topology.py", line 602, in call
output = self.call(inputs, **kwargs)
File "C:\Users\krish\Anaconda3\lib\site-packages\keras\layers\core.py", line 650, in call
return self.function(inputs, **arguments)
File "model_nv.py", line 58, in
SystemError: unknown opcode

can you please tell me why I'm getting it wrong?

Issue with importing OpenCV (ImportError: /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates)

I'm getting following issue while running model:
import cv2,os
The error showing is:
ImportError: /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates

Steps taken leading to issue:

  1. Installed Ubuntu 18.10
  2. Installed Anaconda
  3. Run "git clone https://github.com/llSourcell/How_to_simulate_a_self_driving_car.git" in terminal.
  4. Downloaded Udacity Self-Driving Car Simulator (binary version 1).
  5. Run "conda env create -f environments.yml" inside cloned folder.
  6. Run "conda activate car-behavioral-cloning"
  7. Opened Udacity Self-Driving Car Simulator into autonomous mode.
  8. Run "python drive.py model.h5"

After step 8 I've run into issued mentioned above. I've seen 2 similar issues (#32, #35) on this repo, but both were closed by the authors without any explanation about how to fix this issue or what is the cause of it.

Issue can be easily reproduced inside virtual machine with any recent Ubuntu build.

car-behavioral-cloning

how to resolve this error

Sn_drive.py:127: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(24, (5, 5), strides=(2, 2), activation="elu")
cnn.add(Conv2D(24, 5, 5, activation='elu', subsample=(2, 2)))
Sn_drive.py:128: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(36, (5, 5), strides=(2, 2), activation="elu")
cnn.add(Conv2D(36, 5, 5, activation='elu', subsample=(2, 2)))
Sn_drive.py:129: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(48, (5, 5), strides=(2, 2), activation="elu")
cnn.add(Conv2D(48, 5, 5, activation='elu', subsample=(2, 2)))
Sn_drive.py:130: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="elu")
cnn.add(Conv2D(64, 3, 3, activation='elu'))
Sn_drive.py:131: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="elu")
cnn.add(Conv2D(64, 3, 3, activation='elu'))
Traceback (most recent call last):
File "C:\Users\Dell\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\tensorflow\python\framework\ops.py", line 1628, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 28224 and 1152. Shapes are [28224,100] and [1152,100]. for 'Assign_10' (op: 'Assign') with input shapes: [28224,100], [1152,100].

During handling of the above exception, another exception occurred:

Can't run pretrained model on Windows

Hi Siraj, i'm trying to run the pretrained model on my PC. I started up the Udacity self-driving simulator, choose a scene and press the Autonomous Mode button. Then, run the model as python drive.py model.h5. But Python crashed and i got this error

nh ch p man hinh 20

Here is the log:
C:\Users\Admin\Downloads\How_to_simulate_a_self_driving_car-master\How_to_simulate_a_self_driving_car-master>python drive.py model.h5 Using TensorFlow backend. 2017-06-08 16:13:51.588745: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2017-06-08 16:13:51.588821: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2017-06-08 16:13:51.589144: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2017-06-08 16:13:51.589173: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2017-06-08 16:13:51.589227: W c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2017-06-08 16:13:52.107390: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:887] Found device 0 with properties: name: GeForce GTX 750 Ti major: 5 minor: 0 memoryClockRate (GHz) 1.2805 pciBusID 0000:01:00.0 Total memory: 2.00GiB Free memory: 1.65GiB 2017-06-08 16:13:52.107474: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:908] DMA: 0 2017-06-08 16:13:52.112770: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:918] 0: Y 2017-06-08 16:13:52.113692: I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\common_runtime\gpu\gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 750 Ti, pci bus id: 0000:01:00.0) NOT RECORDING THIS RUN ... (8624) wsgi starting up on http://0.0.0.0:4567 (8624) accepted ('127.0.0.1', 51496) connect c98ff781994844a6aa545a78314a4374 2017-06-08 16:14:01.034618: E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:359] could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED 2017-06-08 16:14:01.035909: E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:366] error retrieving driver version: Unimplemented: kernel reported driver version not implemented on Windows 2017-06-08 16:14:01.036502: E c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:326] could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM 2017-06-08 16:14:01.037345: F c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\core\kernels\conv_ops.cc:659] Check failed: stream->parent()->GetConvolveAlgorithms(&algorithms)

How can i fix this problem, i installed all dependencies by manually using pip, BTW, i'm using GPU version of TensorFlow and my GPU is GTX 750Ti. Thanks you <3

Issue with importing cv2.

@AbhishekPatnaik While trying to run the pre-trained model.I am getting the error on first line of the util.py.
import cv2,os
The error showing is..
ImportError: /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Get_Var_Blend_Coordinates

how to solve this???

Error while running drive.py

i am getting this error while running the pre-trained model
Using TensorFlow backend. 2018-12-28 10:32:58.783787: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-28 10:32:58.784058: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-28 10:32:58.784186: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2018-12-28 10:32:58.784379: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2018-12-28 10:32:58.784515: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. NOT RECORDING THIS RUN ... (5055) wsgi starting up on http://0.0.0.0:4567 (5055) accepted ('127.0.0.1', 39475) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.134300 (5055) accepted ('127.0.0.1', 43889) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.002767 (5055) accepted ('127.0.0.1', 36847) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.003323 (5055) accepted ('127.0.0.1', 39143) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.002371 (5055) accepted ('127.0.0.1', 38583) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.002959 (5055) accepted ('127.0.0.1', 46107) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.017572 (5055) accepted ('127.0.0.1', 39951) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.002816 (5055) accepted ('127.0.0.1', 36385) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.001522 (5055) accepted ('127.0.0.1', 42685) 127.0.0.1 - - [28/Dec/2018 10:33:01] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.001352 (5055) accepted ('127.0.0.1', 40539)

how to solve this issue???@AbhishekPatnaik

Error running the drive.py script

After training, when I use the model-001.h5 file to run the drive.py script I get the following Key error:
Using TensorFlow backend.
Traceback (most recent call last): File "drive.py", line 124, in model = load_model(args.model) File "C:\Users\onkar\Miniconda3\envs\car\lib\site-packages\keras\models.py", line 140, in load_model model = model_from_config(model_config, custom_objects=custom_objects) File "C:\Users\onkar\Miniconda3\envs\car\lib\site-packages\keras\models.py", line 190, in model_from_config return layer_from_config(config, custom_objects=custom_objects) File "C:\Users\onkar\Miniconda3\envs\car\lib\site-packages\keras\utils\layer_utils.py", line 40, in layer_from_config return layer_class.from_config(config['config']) File "C:\Users\onkar\Miniconda3\envs\car\lib\site-packages\keras\models.py", line 1062, in from_config first_layer = config[0] KeyError: 0

How to tackle this issue please . Error while running model.py AttributeError: 'numpy.ndarray' object has no attribute 'strip'

Epoch 1/10
Traceback (most recent call last):
File "model.py", line 164, in
main()
File "model.py", line 160, in main
train_model(model, args, *data)
File "model.py", line 121, in train_model
verbose=1)
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/engine/training.py", line 1732, in fit_generator
initial_epoch=initial_epoch)
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/engine/training_generator.py", line 185, in fit_generator
generator_output = next(output_generator)
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/utils/data_utils.py", line 742, in get
six.reraise(*sys.exc_info())
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/utils/data_utils.py", line 711, in get
inputs = future.get(timeout=30)
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/dell/anaconda3/envs/Automata-nali/lib/python3.6/site-packages/keras/utils/data_utils.py", line 650, in next_sample
return six.next(_SHARED_SEQUENCES[uid])
File "/Lun3/nali/How_to_simulate_a_self_driving_car-master/utils.py", line 51, in batch_generator
image = load_image(data_dir, center)
File "/Lun3/nali/How_to_simulate_a_self_driving_car-master/utils.py", line 10, in load_image
return mpimg.imread(os.path.join(data_dir, image_file.strip()))
AttributeError: 'numpy.ndarray' object has no attribute 'strip'

problems with keras 2.0 + tf. 1.4 and python3 on Ubuntu 16.04

Just checkin this code after some months again .. and Keras changed the generator, iterator function in 2.0?? Anyway this code does not work for me with Keras 2.0 and tf 1.4. So just in case, I decided to provide a working configuration:
with python 2.7 and tensorflow 1.0-gpu, I installed the following requirements.txt via pip with:
pip install -r requirements.txt
and copy paste the following dependencies in the requirements.txt file.

jupyter
pillow
scikit-learn
scikit-image
scipy
h5py
eventlet
flask-socketio
seaborn
pandas
imageio
moviepy
keras==1.2
opencv-contrib-python
matplotlib==2.0.2

Also make sure that you that you change the below line of code in the random_shadow function in utils.py.
mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1 replace below by np.where
mask[np.where((ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0)] = 1

This is at least a config which worked for me.

"GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404

I just open up the udacity simulator, and clone this repo trying to get a test run
when i run
python drive.py model.h5
I got this printing all over the terminal:
127.0.0.1 - - [06/Dec/2018 23:56:52] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 404 342 0.002979
(17772) accepted ('127.0.0.1', 56738)
and its keep printing like this

Please kindly help to tell me what am i be wrong with?

AttributeError: module 'secrets' has no attribute 'token_bytes' (when I run the file drive.py with model.h5)

Hello. everyone here.

I just download the files from here.

and after model training,

I'm facing very difficult error.

command:
python drive.py model-008.h5

result :
Traceback (most recent call last):
File "drive.py", line 8, in
import socketio
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\socketio_init_.py", line 3, in
from .client import Client
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\socketio\client.py", line 7, in
import engineio
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio_init_.py", line 5, in
from .server import Server
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio\server.py", line 6, in
import secrets
ImportError: No module named 'secrets'

so, I install python-ldap file (download from web sie)

and secrets (secrets requires python-ldap, but pip install is not working for it)

python ldap : https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-ldap
python_ldap-3.2.0-cp35-cp35m-win_amd64.whl

and I used the command 'pip install secrets'
finally it is working. secrets install is success.

but finally, when I put the command

'python drive.py model.h5'

the result is below.

################################
127.0.0.1 - - [25/Dec/2020 18:36:56] "GET /socket.io/?EIO=4&transport=websocket HTTP/1.1" 500 1324 0.001998
(3888) accepted ('127.0.0.1', 54090)
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\eventlet\wsgi.py", line 573, in handle_one_response
result = self.application(self.environ, start_response)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio\middleware.py", line 60, in call
return self.engineio_app.handle_request(environ, start_response)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\socketio\server.py", line 563, in handle_request
return self.eio.handle_request(environ, start_response)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio\server.py", line 380, in handle_request
transport, jsonp_index)
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio\server.py", line 529, in _handle_connect
sid = self.generate_id()
File "C:\ProgramData\Anaconda3\envs\car-behavioral-cloning\lib\site-packages\engineio\server.py", line 503, in generate_id
secrets.token_bytes(12) + self.sequence_number.to_bytes(3, 'big'))
AttributeError: module 'secrets' has no attribute 'token_bytes'

###########################################

Previously, In the server.py file, I put the code of token_byte().
(source code from here :
https://github.com/python/cpython/blob/master/Lib/secrets.py
https://fossies.org/linux/Python/Lib/secrets.py )

because, server.py has a code of it.
l

def generate_id(self):
"""Generate a unique session id."""
id = base64.b64encode(
token_bytes(12) + self.sequence_number.to_bytes(3, 'big'))
self.sequence_number = (self.sequence_number + 1) & 0xffffff
return id.decode('utf-8').replace('/', '_').replace('+', '-')

The above def in the server.py using token_bytes() from secrets module.
so, I just put a code into server.py which I got it from the web site.
Finally, error is gone.

but nothing happen.

The car doesn't move.

Please help me!

New Ideas

Introduction

Hi Siraj, nice video I'm also investigating the subject and I'm looking for these improvements

  • Include acceleration/brake as part of the model
  • Improve dataset balance (Most of the time we have the steering angle at zero)
  • Use a different loss function (Huber Loss?)
  • Implement the second paper from Nvidia (Done with my colleagues here at work)
  • Segmentation with FCN or segnet

I'm posting my findings on this reddit post

Btw are you going to Nips 2017?

Error in random_shadow method in Utils.py Index Error line no 101

Hello Siraj thanks a lot for wonderful video but there is an error coming while training the dataset.

# Using TensorFlow backend.
------------------------------
Parameters
------------------------------
learning_rate        := 0.0001
keep_prob            := 0.5
nb_epoch             := 10
save_best_only       := True
samples_per_epoch    := 20000
test_size            := 0.2
batch_size           := 40
data_dir             := data
------------------------------
model.py:66: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(24, (5, 5), activation="elu", strides=(2, 2))`
  model.add(Conv2D(24, 5, 5, activation='elu', subsample=(2, 2)))
model.py:67: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(36, (5, 5), activation="elu", strides=(2, 2))`
  model.add(Conv2D(36, 5, 5, activation='elu', subsample=(2, 2)))
model.py:68: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(48, (5, 5), activation="elu", strides=(2, 2))`
  model.add(Conv2D(48, 5, 5, activation='elu', subsample=(2, 2)))
model.py:69: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), activation="elu")`
  model.add(Conv2D(64, 3, 3, activation='elu'))
model.py:70: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), activation="elu")`
  model.add(Conv2D(64, 3, 3, activation='elu'))
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
lambda_1 (Lambda)            (None, 66, 200, 3)        0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 31, 98, 24)        1824      
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 14, 47, 36)        21636     
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 5, 22, 48)         43248     
_________________________________________________________________
conv2d_4 (Conv2D)            (None, 3, 20, 64)         27712     
_________________________________________________________________
conv2d_5 (Conv2D)            (None, 1, 18, 64)         36928     
_________________________________________________________________
dropout_1 (Dropout)          (None, 1, 18, 64)         0         
_________________________________________________________________
flatten_1 (Flatten)          (None, 1152)              0         
_________________________________________________________________
dense_1 (Dense)              (None, 100)               115300    
_________________________________________________________________
dense_2 (Dense)              (None, 50)                5050      
_________________________________________________________________
dense_3 (Dense)              (None, 10)                510       
_________________________________________________________________
dense_4 (Dense)              (None, 1)                 11        
=================================================================
Total params: 252,219
Trainable params: 252,219
Non-trainable params: 0
_________________________________________________________________
model.py:120: UserWarning: The semantics of the Keras 2 argument `steps_per_epoch` is not the same as the Keras 1 argument `samples_per_epoch`. `steps_per_epoch` is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarly `nb_val_samples`->`validation_steps` and `val_samples`->`steps` arguments have changed. Update your method calls accordingly.
  verbose=2)
model.py:120: UserWarning: Update your `fit_generator` call to the Keras 2 API: `fit_generator(<generator..., 20000, 10, validation_data=<generator..., max_queue_size=1, verbose=2, validation_steps=956, callbacks=[<keras.ca...)`
  verbose=2)
Epoch 1/10
mask is here [[0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 ..., 
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]
 [0 0 0 ..., 0 0 0]]
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/lib/python3.4/site-packages/keras/utils/data_utils.py", line 568, in data_generator_task
    generator_output = next(self._generator)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/Car/utils.py", line 150, in batch_generator
    image, steering_angle = augument(data_dir, center, left, right, steering_angle)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/Car/utils.py", line 132, in augument
    image = random_shadow(image)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/Car/utils.py", line 101, in random_shadow
    mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1
IndexError: boolean index did not match indexed array along dimension 0; dimension is 160 but corresponding boolean dimension is 66

Traceback (most recent call last):
  File "model.py", line 163, in <module>
    main()
  File "model.py", line 159, in main
    train_model(model, args, *data)
  File "model.py", line 120, in train_model
    verbose=2)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/lib/python3.4/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/lib/python3.4/site-packages/keras/models.py", line 1121, in fit_generator
    initial_epoch=initial_epoch)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/lib/python3.4/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/Users/sskadit/Desktop/neuralnetworks/neuralnetworks/lib/python3.4/site-packages/keras/engine/training.py", line 2011, in fit_generator
    generator_output = next(output_generator)
StopIteration

Pre-trained model issue and training model input data issue

Pre-trained model issue : I ran the pre-trained model, the car always ran out of the track, does anyone meet the same problem?

training model input data issue: I built a folder called 'data', and put the images and driver_log file in the folder, but it doesn't work. Was it wrong? Could you give me some advice? Thanks

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.