segmentation_models.pytorch icon indicating copy to clipboard operation
segmentation_models.pytorch copied to clipboard

Variable image size and padding

Open MosGeo opened this issue 1 year ago • 1 comments

Hi All,

From a technical perpsective, is there a specific reason why smp is not implementing unet with padding "same" to ensure applicability to different image sizes? as I understand it, this will not have an effect on already "correctly" sized images and it will enable variable image size. Is that correct?

MosGeo avatar Oct 07 '24 06:10 MosGeo

Hi, thanks for the issue, you are right 👍

One more solution might be to change the interpolation from scale factor to target size. Historically, there was an issue converting model to ONNX with size specified instead of scale factor, but I suppose it's no longer an issue.

In case you would like to contribute, I would appreciate a help on this feature! This should be split into two separate PRs to avoid regression

  • add test for output equivalence (I can add it shortly)
  • change interpolation/add padding, both could be added

qubvel avatar Oct 07 '24 07:10 qubvel