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
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm reading data process code in
ultralytics/data/base.py,set_rectangleis 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.padis 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.strideis 6.5, thennp.ceil(np.array(shapes) * self.imgsz / self.stride + self.pad).astype(int)will be 8), is this redundant? Seems setself.padto 0 is enuogh.Beta Was this translation helpful? Give feedback.
All reactions