Solved a bug with the random generator in data_augmentation.py
@@ -3,6 +3,7 @@ Created by Marcel Santos - Intel Intelligent Systems Lab - 2021
This script implements several routines for data augmentation.
"""
import tensorflow as tf
+import numpy as np
def augment_img(img):
@@ -33,7 +34,7 @@ def augment_cmd(cmd):
cmd: augmented command
"""
if not (cmd > 0 or cmd < 0):
- coin = tf.random.uniform(shape=[1], minval=0, maxval=1, dtype=tf.dtypes.float32)
+ coin = np.random.default_rng().uniform(low=0.0, high=1.0, size=None)
if coin < 0.25:
cmd = -1.0
elif coin < 0.5:
@@ -42,7 +43,7 @@ def augment_cmd(cmd):
def flip_sample(img, cmd, label):
- coin = tf.random.uniform(shape=[1], minval=0, maxval=1, dtype=tf.dtypes.float32)
+ coin = np.random.default_rng().uniform(low=0.0, high=1.0, size=None)
if coin < 0.5:
img = tf.image.flip_left_right(img)
cmd = -cmd
