Skip to content

Instantly share code, notes, and snippets.

View alanwells's full-sized avatar

Alan Wells alanwells

View GitHub Profile
@alanwells
alanwells / custom_train.py
Last active October 20, 2017 17:30
Donkey2 custom train script, updated to work when records have been removed
def custom_train(cfg, tub_names, model_name):
'''
use the specified data in tub_names to train an artifical neural network
saves the output trained model as model_name
'''
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import random
from PIL import Image
@alanwells
alanwells / custom_train.py
Last active October 15, 2017 03:16
Modified training function for Donkey2 that skips a percentage of zero angle records and augments by flipping non-zero angle records
def custom_train(cfg, tub_names, model_name):
'''
use the specified data in tub_names to train an artifical neural network
saves the output trained model as model_name
'''
import sklearn
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import random
from PIL import Image