Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def image_data_generator(image_paths, steering_angles, batch_size, is_training):
- while True:
- batch_images = []
- batch_steering_angles = []
- for i in range(batch_size):
- random_index = random.randint(0, len(image_paths) - 1)
- image_path = image_paths[random_index]
- image = my_imread(image_paths[random_index])
- steering_angle = steering_angles[random_index]
- if is_training:
- # training: augment image
- image, steering_angle = random_augment(image, steering_angle)
- image = img_preprocess(image)
- batch_images.append(image)
- batch_steering_angles.append(steering_angle)
- yield( np.asarray(batch_images), np.asarray(batch_steering_angles))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement