Multiclass classification without changing image sizes

hi all,
my problem is quite difficult:
I have multiclass classification problem.
my images are:

  1. very different shapes and sizes, which I want to keep
  2. the data is unbalanced

different image sizes work when I fintune with “resnet18” for example, but I cannot use batches.
so my idea was to use “virtual” batches. meaning, train 1 by 1 but calculate the gradients every 16 iterations, which will create the effect of training batched. (in this case I am deactivating batchnorm btw).

My training works ok (meaning Loss curves behave normal), but my results are poor.
the other thing I tried doing is adding weights to my cross entropy loss to deal with the unbalanced data, but the results are EXACTLY the same as training without any weights at all.
any ideas?

any ideas?