Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in train.ipynb #89

Open
hrishikeshtawade04 opened this issue Feb 12, 2019 · 14 comments
Open

Error in train.ipynb #89

hrishikeshtawade04 opened this issue Feb 12, 2019 · 14 comments

Comments

@hrishikeshtawade04
Copy link

On running the Train model code in Autonomous Driving cookbook I am getting following error in the third code cell. It seems there is an error in the Generators.py code. Kindly help.


ValueError Traceback (most recent call last)
in ()
----> 1 data_generator = DriveDataGenerator(rescale=1./255., horizontal_flip=True, brighten_range = (0.4,0.0))
2 train_generator = data_generator.flow (train_dataset['image'], train_dataset['previous_state'], train_dataset['label'], batch_size=batch_size, zero_drop_percentage=0.95, roi=[76,135,0,255])
3 eval_generator = data_generator.flow (eval_dataset['image'], eval_dataset['previous_state'], eval_dataset['label'], batch_size=batch_size, zero_drop_percentage=0.95, roi=[76,135,0,255])

~/enpm-809k/AutonomousDrivingCookbook/AirSimE2EDeepLearning/Generator.py in init(self, featurewise_center, samplewise_center, featurewise_std_normalization, samplewise_std_normalization, zca_whitening, zca_epsilon, rotation_range, width_shift_range, height_shift_range, shear_range, zoom_range, channel_shift_range, fill_mode, cval, horizontal_flip, vertical_flip, rescale, preprocessing_function, data_format, brighten_range)
45 rescale,
46 preprocessing_function,
---> 47 data_format)
48 self.brighten_range = brighten_range
49

~/anaconda3/envs/airsim/lib/python3.5/site-packages/keras/preprocessing/image.py in init(self, featurewise_center, samplewise_center, featurewise_std_normalization, samplewise_std_normalization, zca_whitening, zca_epsilon, rotation_range, width_shift_range, height_shift_range, brightness_range, shear_range, zoom_range, channel_shift_range, fill_mode, cval, horizontal_flip, vertical_flip, rescale, preprocessing_function, data_format, validation_split, dtype)
464 data_format=data_format,
465 validation_split=validation_split,
--> 466 **kwargs)
467
468

~/anaconda3/envs/airsim/lib/python3.5/site-packages/keras_preprocessing/image/image_data_generator.py in init(self, featurewise_center, samplewise_center, featurewise_std_normalization, samplewise_std_normalization, zca_whitening, zca_epsilon, rotation_range, width_shift_range, height_shift_range, brightness_range, shear_range, zoom_range, channel_shift_range, fill_mode, cval, horizontal_flip, vertical_flip, rescale, preprocessing_function, data_format, validation_split, interpolation_order, dtype)
360 raise ValueError(
361 '`brightness_range should be tuple or list of two floats. '
--> 362 'Received: %s' % (brightness_range,))
363 self.brightness_range = brightness_range
364

ValueError: `brightness_range should be tuple or list of two floats. Received: 0.0

@Misslindalian
Copy link

Hello, I have encountered the same problem. Have you solved this problem?Thanks a lot!

@hrishikeshtawade04
Copy link
Author

hrishikeshtawade04 commented Feb 16, 2019 via email

@Misslindalian
Copy link

So how to solve it? Just upgrade keras version?Thanks a lot!

@hrishikeshtawade04
Copy link
Author

hrishikeshtawade04 commented Feb 16, 2019 via email

@Misslindalian
Copy link

Airsim?Can you tell me in detail?

@hrishikeshtawade04
Copy link
Author

hrishikeshtawade04 commented Feb 16, 2019 via email

@Misslindalian
Copy link

Hello! How about your trained models? My tested result is not good. When I trained the models, it stopped when the iterator = 45. But in fact, it needs to run 500 iterators. What I mean is that it "stopped early". Thank you for your patience!

@hrishikeshtawade04
Copy link
Author

What error did it show when it stopped at 45?

@mitchellspryn
Copy link
Contributor

For the initial keras error, make sure you are using version 2.1.2. See this issue as to why.

It probably stopped early because of the EarlyStopping Callback. Here is why you want to use that callback.

If it actually showed an error, open a new issue. Please use the issue template and fill out all relevant forms.

@Misslindalian
Copy link

Thank you for your answer! However, the model does not perform well. It can only run normally in the first few seconds. When it turns, it will collide and rush into the grass.

@mitchellspryn
Copy link
Contributor

Try retraining with a different RNG seed. There isn't enough data to guarantee that the network fully converges every time. But after a few attempts, you should get one that works.

@OrSh1234
Copy link

OrSh1234 commented Apr 9, 2019

Can we go back please to the original post about Keras brightness_range ?
I have the same problem (I moved the notebook to a simple py file and run it) :

C:\AirSim_RL>python TrainModel.py
Using TensorFlow backend.
Traceback (most recent call last):
File "TrainModel.py", line 44, in
data_generator = DriveDataGenerator(rescale=1./255., horizontal_flip=True, brighten_range=(0.0,0.0))#brighten_range=0.4)
File "C:\AirSim_RL\Generator.py", line 93, in init
data_format)
File "C:\Python\Python35\lib\site-packages\keras\preprocessing\image.py", line 466, in init
**kwargs)
File "C:\Python\Python35\lib\site-packages\keras_preprocessing\image\image_data_generator.py", line 362, in init
'Received: %s' % (brightness_range,))
ValueError: `brightness_range should be tuple or list of two floats. Received: 0.0

Any help will be appreciated...

@hrishikeshtawade04
Copy link
Author

@OrSh1234 just change the keras version to 2.1.2 using the command conda install keras==2.1.2 and it solves the problem

@OrSh1234
Copy link

hrishikeshtawade04 - thanks. It solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants