Fix image position when adding padding
When training and validating using batches, we currently pad the images on the four sides: top, bottom, left and right, but the img_position used during the decoding stage is wrong as it is not updated based on the position of the padding. We need to update the img_position values during images padding.