def raw_data_centre_left_right_image_crop(): # crop_images=True was the only difference data_set = DriveDataSet.from_csv( "datasets/udacity-sample-track-1/driving_log.csv", crop_images=True, all_cameras_images=True, filter_method=drive_record_filter_include_all) allocator = RecordRandomAllocator(data_set) generator = image_itself data_generator = DataGenerator(allocator.allocate, generator) model = nvidia(input_shape=data_set.output_shape(), dropout=0.5) Trainer(model, learning_rate=0.0001, epoch=10, custom_name=inspect.stack()[0][3]).fit_generator( data_generator.generate(batch_size=128))
def raw_data_centre_left_right_crop_shift_flip(): data_set = DriveDataSet.from_csv( "datasets/udacity-sample-track-1/driving_log.csv", crop_images=True, all_cameras_images=True, filter_method=drive_record_filter_include_all) allocator = RecordRandomAllocator(data_set) # shift_image_generator was the only difference generator = pipe_line_generators( shift_image_generator(angle_offset_pre_pixel=0.002), flip_generator) data_generator = DataGenerator(allocator.allocate, generator) model = nvidia(input_shape=data_set.output_shape(), dropout=0.5) Trainer(model, learning_rate=0.0001, epoch=20, multi_process=use_multi_process, custom_name=inspect.stack()[0][3]).fit_generator( data_generator.generate(batch_size=128))
def raw_data_centre_image_no_dropout(): # Create DriveDataSet from csv file, you can specify crop image, using all cameras and which data will included in data_set = DriveDataSet.from_csv( "datasets/udacity-sample-track-1/driving_log.csv", crop_images=False, all_cameras_images=False, filter_method=drive_record_filter_include_all) # What the data distribution will be, below example just randomly return data from data set, so that the # distribution will be same with what original data set have allocator = RecordRandomAllocator(data_set) # what's the data augment pipe line have, this have no pipe line, just the image itself augment = image_itself # connect allocator and augment together data_generator = DataGenerator(allocator.allocate, augment) # create the model model = nvidia(input_shape=data_set.output_shape(), dropout=0.0) # put everthing together, start a real Keras training process with fit_generator Trainer(model, learning_rate=0.0001, epoch=10, custom_name=inspect.stack()[0][3]).fit_generator( data_generator.generate(batch_size=128))