import tensorflow as tf
from dnnlib import tflib
from training import dataset

tflib.init_tf()
dset = dataset.TFRecordDataset('../datasets/car_images_256', label_file='../datasets/car_labels/cars_v5-rxx.labels', max_label_size='full', repeat=False, shuffle_mb=0)
minibatch_size = 20
dset.configure(minibatch_size=minibatch_size)
rotation_offset = 108

x, labels = dset.get_minibatch_tf()

random_index = tf.cast(tf.floor(tf.random_uniform([tf.shape(x)[0]], minval=0, maxval=8)), dtype=tf.int32)
random_one_hot = tf.one_hot(random_index, depth=8)

labels_uniform = tf.concat([
    labels[:, :rotation_offset],
    random_one_hot,
    labels[:, rotation_offset + 8:]
], axis=-1)

labels, labels_uniform, random_index, random_one_hot = tflib.run([labels, labels_uniform, random_index, random_one_hot])
print()

import tensorflow as tf
from dnnlib import tflib
from training import dataset

tflib.init_tf()
dset = dataset.TFRecordDataset('../datasets/car_images_256', label_file='../datasets/car_labels/cars_v5-rxx.labels', max_label_size='full', repeat=False, shuffle_mb=0)
minibatch_size = 20
dset.configure(minibatch_size=minibatch_size)
rotation_offset = 108

x, labels = dset.get_minibatch_tf()

random_index = tf.cast(tf.floor(tf.random_uniform([tf.shape(x)[0]], minval=0, maxval=8)), dtype=tf.int32)
random_one_hot = tf.one_hot(random_index, depth=8)

labels_uniform = tf.concat([
    labels[:, :rotation_offset],
    random_one_hot,
    labels[:, rotation_offset + 8:]
], axis=-1)

labels, labels_uniform, random_index, random_one_hot = tflib.run([labels, labels_uniform, random_index, random_one_hot])
print()
