That is quite impossible, even for datasets with fewer targets/classes (like 1000 for ImageNet). Also, there are a few people advocating for not-too-large batch sizes like 32 and 64 like you said. Not only it fits in the memory of most consumer GPUs now, but it is also better for… reasons. I’ll let you read On Large-Batch Training for Deep Learning: Generalization Gap and Sharp Minima for more details!
So in practice you would keep those 32/64 batch sizes, but for that kind of problem (most classification problems really), you’ll probably want to maximize the number of identities in a mini-batch, or even guarantee that there are no duplicate identities in the batch.
Some ideas to get you started:

You can represent your dataset as lists of variable length for each identity, then shuffle those lists and their order randomly at each epoch and select samples from both the list of identities and each identity’s samples list.
If the dataset does not fit in your memory (RAM, not GPU), this very random access will be very slow and training also. One option is to shuffle the dataset as previously but offline. It won’t be random but randomness is often impractical with large complex datasets.