Tensorflow Allocation Memory: Allocation of 38535168 exceeds 10% of system memory

Try reducing batch_size attribute to a small number(like 1,2 or 3).
Example:

train_generator = data_generator.flow_from_directory(
    'path_to_the_training_set',
    target_size = (IMG_SIZE,IMG_SIZE),
    batch_size = 2,
    class_mode="categorical"
    )

Leave a Comment