Hi @abhiksark,
You are almost there!
According to my pass projects, I still haven’t been able to train batch cnn with different image size.
What I did is to suggest you to do the following:
Step 1. Resize the image into at least one same dimension (aka, you could try to make the width/height into the same size like width=800, while leaving the other w.r.t their resized-aspect ratio size).
Step 2. Pick the highest aspect ratio that might be possible for your case (in my case it is w:h -> 16:9). Hence, w:h -> 800:450).
Step 3. While doing step. 1, you will find that there is a little bit of missing pixels to match them into your highest aspect ratio. Then, we will fill it with zero padding for the rest.
Note:

Some hack for step 3, I will create a new zero image with w:h according to your aspect ratio, which in this case is 800:450, fill the 0:800 width and 0:X height with your image, then leave the rest as zero.
Don’t forget to adjust your mask or annotations w.r.t. your changes.

Hope it helps, cheers~