Why set_rectangle pads an extra stride by default? #12751
Mactarvish
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm reading data process code in
ultralytics/data/base.py
,set_rectangle
is shown below:As my understanding this function is used for padding images in a batch according to their ratio so as to concat them and save GPU memory.
My confusion is this line:
self.pad
is default set to 0.5, so that ifself.imgsz / self.stride >= 0.5
, the batch will be extraly pad a stride (e.g. ifnp.array(shapes) * self.imgsz / self.stride
is 6.5, thennp.ceil(np.array(shapes) * self.imgsz / self.stride + self.pad).astype(int)
will be 8), is this redundant? Seems setself.pad
to 0 is enuogh.Beta Was this translation helpful? Give feedback.
All reactions