How to expand tf.data.Dataset with additional example transformations in Tensorflow
I would like to double the size of an existing dataset I'm using to train a neural network in tensorflow on the fly by adding random noise to it. So when I'm done I'll have all the existing example...
stackoverflow.com
def generate_permutations(features, labels):
regular_ds = tf.data.Dataset.from_tensors((features, labels))
noisy_ds = tf.data.Dataset.from_tensors((add_noise(features), labels))
return regular_ds.concatenate(noisy_ds)
dataset = dataset.flat_map(generate_permutations)
└ regular_ds에 noisy_ds를 합치어 dataset을 만들어 내는 방법
(* noisy_ds가 후방위치)
'AI > tensorflow' 카테고리의 다른 글
[keras] predict_on_batch 와 predict의 차이 ? (0) | 2023.02.01 |
---|---|
AttributeError: 'Functional' object has no attribute 'predict_proba' (0) | 2023.01.27 |
자주 사용하는 Tensor함수 정리 (0) | 2022.12.22 |
텐서플로우 전이학습 (0) | 2022.12.16 |
take, skip => train, val, test (0) | 2022.12.07 |