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

Improve data augmentation with shifted images #14

Closed
wroscoe opened this issue Dec 30, 2016 · 6 comments
Closed

Improve data augmentation with shifted images #14

wroscoe opened this issue Dec 30, 2016 · 6 comments

Comments

@wroscoe
Copy link
Collaborator

wroscoe commented Dec 30, 2016

Here is a great example: https://chatbotslife.com/using-augmentation-to-mimic-human-driving-496b569760a9#.b6jyrypqu

@wroscoe wroscoe self-assigned this Feb 13, 2017
@alanswx
Copy link
Contributor

alanswx commented Feb 13, 2017

I don't know if this improves things, or if this augmentation is quite right, but you can do a lot of it with one call:

         X_train, X_validation, y_train, y_validation = train_test_split(X, Y, test_size=0.20, random_state=42)
         datagen = ImageDataGenerator(
            rotation_range=1,
                width_shift_range=0.2,
                height_shift_range=0.2,
                shear_range=0.2,
                zoom_range=0.02,
                horizontal_flip=False)


         # compute quantities required for featurewise normalization
         # (std, mean, and principal components if ZCA whitening is applied)
         datagen.fit(X_train)

         # fits the model on batches with real-time data augmentation:
         m.fit_generator(datagen.flow(X_train, y_train, batch_size=32, shuffle=True),
                samples_per_epoch=len(X_train)*3, nb_epoch=20,callbacks=callbacks_list,
                validation_data=(X_validation, y_validation)
                )

@wroscoe
Copy link
Collaborator Author

wroscoe commented Feb 13, 2017

Parts of that will work. We'll want to validate on non-augmented data.

@alanswx
Copy link
Contributor

alanswx commented Feb 13, 2017

That snippet does validate on non-augmented data. (I believe)

@wroscoe
Copy link
Collaborator Author

wroscoe commented Feb 17, 2017

You're right @alanswx but it doesn't switch the steering angles when you flip the image horizontally.

@alanswx
Copy link
Contributor

alanswx commented Feb 17, 2017

that is why i turned off the flipping code -- once i get my car driving i will check in a class that does all the augmentation

@wroscoe
Copy link
Collaborator Author

wroscoe commented Nov 27, 2018

I've moved the augmentation code to the donkeybarn repo. https://github.com/autorope/donkeybarn/blob/master/donkeybarn/cv/augment.py

@wroscoe wroscoe closed this as completed Nov 27, 2018
tawnkramer added a commit that referenced this issue Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants