This might be a minor issue, but why can’t you use the same batch size in your PyTorch code?
Also, could you explain, how you’ve implemented the transformation?
I assume you’ve transformed the input image first and then you’ve used the same transformation on the bounding box?