Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding frame to a multiple of an integer n #23

Open
thibo73800 opened this issue Sep 7, 2021 · 3 comments
Open

Padding frame to a multiple of an integer n #23

thibo73800 opened this issue Sep 7, 2021 · 3 comments
Assignees

Comments

@thibo73800
Copy link
Contributor

The method SpatialAugmentedTensor.pad() could accept a multiple argument. This argument would result in padding the tensor spatial dimensions to a multiple of multiple.

Some flag(s) should indicate if we should pad the labels or not. We could have one boolean flag pad_label, or make it possible to specify which labels should be padded.

Unpadding
Padding to a multiple is often used before performing inference with a model. Given the type of outputs of the model, it is sometimes necessary to unpad the outputs. We should provide a method to unpad too.

@thibo73800 thibo73800 added the aloscene aloscene label Sep 7, 2021
@tflahaul tflahaul self-assigned this Nov 17, 2022
@tflahaul
Copy link
Contributor

@thibo73800 Can you give me more explanations on how the multiple argument should be used ? I guess its different than a scale factor ?

@thibo73800
Copy link
Contributor Author

Ok, this is the case in RAFT inference. Padding is currently achieve using an external transformation because in the model input should be a multiple of 8.

padder = Padder() # pads inputs to multiple of 8

Once the inference is done, the padder will unpad the the prediction.
flow_pred = padder.unpad(flow_pred)[0]

Note that this PR could be hard to implement completely if you want to properly handle all scenearios

  • The attached labels
  • Padding multiple time an already padded tensor
  • Unpadding or not the labels...

Proper unit test must be done to complete it. You can start by exploring padding unit test implemented for the boxes here
https://github.com/Visual-Behavior/aloception-oss/blob/master/unittest/test_boxes.py

@tflahaul
Copy link
Contributor

tflahaul commented Nov 18, 2022

  • padding to the next multiple of arg multiple
  • unit tests for the tensor
  • unit tests for the children
  • unpadding to the original shape (using a _pad_parameters ATen stack attribute?)
  • unpadding unit tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants