If the number of samples could be “approx. 50% class4 and class 6 vs. the rest”, you could use a WeigthedRandomSampler as described in this post 29.
The sampler would accept the sample weights and uses these to draw each sample.
Since this is a random process, the exact number of class samples is not exactly defined.