For class imbalance, one aspect to consider is that each batch has enough signal to provide some coverage of all the classes, even the unbalanced ones. Otherwise, it may degenerate during training.
When evaluating test performance though, you will need to keep the real proportions as you would observe in the real world.