llSourcell / How_to_simulate_a_self_driving_car

This is the code for "How to Simulate a Self-Driving Car" by Siraj Raval on Youtube
430 stars 306 forks source link

running model.py is having issues #27

Open indrajeetgajbhiye opened 6 years ago

indrajeetgajbhiye commented 6 years ago

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

vedsarkar commented 6 years ago

I a also getting the error.....did you find any solution ?

ihteshamraza commented 6 years ago

replace

mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1 with mask[np.where((ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0)] = 1

in utils.py

nh17937 commented 5 years ago

My colleague had this problem and this is because the images generated by the Udacity simulator now have different sizes. In the utils.py the authors of this repo set the image height and width on the 6th line. In the code it is 66 and 200. But the images that are generated are now 160X320, so just change this in the utils.py.

quangduygtvt commented 5 years ago

I had solved my issue. Thanks, Pro.