Customizable classification

Hello all !
I need to classify images in supervised training, I have 500 classes in my training dataset with sometimes tens of images sometimes thousands of images. Have you a code in ResNet 101 or 152 which could do the job (so customizable) and which take account of classes of different number of images please ? (an expert told me about class_weights).
Thank you
Best regards

Hello !
Noone has answer ?
Thank you
Best regards

I’m not sure the number of classes affects the model definition itself beyond specifying num_classes when declaring the model: torchvision.models.resnet — Torchvision 0.12 documentation.

If you are referring to splitting the dataset for evaluation, you might need to write a little custom code to do the stratified sampling e.g., How to do a stratified split - PyTorch Forums

I don’t talk about the number of classes but the number of images per class wich vary a lot