train_dataset = get_dataset(mode="train", data_dir=data_dir)
# shuffle의 인자로 buffer_size가 필요한데 이는 전체 데이터셋 갯수로 하는게 좋습니다.
N = BUFFER_SIZE = len(list(train_dataset))
train_dataset = train_dataset.shuffle(BUFFER_SIZE)
train_dataset.map()
print(train_dataset.map(load_image_train, num_parallel_calls=16))
train_dataset = train_dataset.map(load_image_train, num_parallel_calls=16)
train_dataset = train_dataset.batch(batch_size)
이 부분에서 계속 오류가 나는데요,
ValueError Traceback (most recent call last)
<ipython-input-91-29c7628414c1> in <module>() 3 N = BUFFER_SIZE = len(list(train_dataset)) 4 train_dataset = train_dataset.shuffle(BUFFER_SIZE) ----> 5 print(train_dataset.map(load_image_train, num_parallel_calls=16)) 6 train_dataset = train_dataset.map(load_image_train, num_parallel_calls=16) 7 train_dataset = train_dataset.batch(batch_size)
14 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/image_ops_impl.py in _resize_images_common(images, resizer_fn, size, preserve_aspect_ratio, name, skip_resize_if_same) 1034 images = array_ops.expand_dims(images, 0) 1035 elif images.get_shape().ndims != 4: -> 1036 raise ValueError('\'images\' must have either 3 or 4 dimensions.') 1037 1038 _, height, width, _ = images.get_shape().as_list()
ValueError: 'images' must have either 3 or 4 dimensions.
이와 같은 오류가 납니다.
어디서 잘못한 걸까요?
comment