Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def batchGenerator(imgs, steerings, batchSize, isTraining):
- while True:
- batchImg = []
- batchSteering = []
- for i in range(batchSize):
- randIndex = random.randint(0, len(imgs) - 1)
- if isTraining:
- img, steering = randomAugment(imgs[randIndex], steerings[randIndex])
- else:
- img = imgs[randIndex]
- steering = steerings[randIndex]
- img = imgPreprocess(img)
- batchImg.append(img)
- batchSteering.append(steering)
- yield (np.asarray(batchImg), np.asarray(batchSteering))
- history = model.fit_generator(batchGenerator(X_train, y_train, 300, 1),
- steps_per_epoch = 300,
- epochs = 10,
- validation_data = batchGenerator(X_valid, y_valid, 200, 0),
- validation_steps = 200,
- verbose = 1,
- shuffle = 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement