@@ -0,0 +1,1730 @@
+import scipy.misc%0Aimport random%0A%0A# augmentation of image%0Aaugmentation = %22center%22%0A%0Axs = %5B%5D%0Ays = %5B%5D%0A%0A# points to the end of the last batch%0Atrain_batch_pointer = 0%0Aval_batch_pointer = 0%0A%0A# read data.txt%0Awith open(%22/Volumes/Untitled/h5imgs/%22+augmentation+%22/data.txt%22) as f:%0A    for line in f:%0A        xs.append(line.split()%5B0%5D)%0A        # the paper by Nvidia uses the inverse of the turning radius,%0A        # but steering wheel angle is proportional to the inverse of turning radius%0A        # so the steering wheel angle in radians is used as the output%0A        ys.append(float(line.split()%5B1%5D))%0A%0A# get number of images%0Anum_images = len(xs)%0A%0A# shuffle list of images%0Ac = list(zip(xs, ys))%0Arandom.shuffle(c)%0Axs, ys = zip(*c)%0A%0Atrain_xs = xs%5B:int(len(xs) * 0.8)%5D%0Atrain_ys = ys%5B:int(len(xs) * 0.8)%5D%0A%0Aval_xs = xs%5B-int(len(xs) * 0.2):%5D%0Aval_ys = ys%5B-int(len(xs) * 0.2):%5D%0A%0Anum_train_images = len(train_xs)%0Anum_val_images = len(val_xs)%0A%0Adef LoadTrainBatch(batch_size):%0A    global train_batch_pointer%0A    x_out = %5B%5D%0A    y_out = %5B%5D%0A    for i in range(0, batch_size):%0A        x_out.append(scipy.misc.imresize(scipy.misc.imread(train_xs%5B(train_batch_pointer + i) %25 num_train_images%5D)%5B-150:%5D, %5B66, 200%5D) / 255.0)%0A        y_out.append(%5Btrain_ys%5B(train_batch_pointer + i) %25 num_train_images%5D%5D)%0A    train_batch_pointer += batch_size%0A    return x_out, y_out%0A%0Adef LoadValBatch(batch_size):%0A    global val_batch_pointer%0A    x_out = %5B%5D%0A    y_out = %5B%5D%0A    for i in range(0, batch_size):%0A        x_out.append(scipy.misc.imresize(scipy.misc.imread(val_xs%5B(val_batch_pointer + i) %25 num_val_images%5D)%5B-150:%5D, %5B66, 200%5D) / 255.0)%0A        y_out.append(%5Bval_ys%5B(val_batch_pointer + i) %25 num_val_images%5D%5D)%0A    val_batch_pointer += batch_size%0A    return x_out, y_out%0A

prepare dataset