Oulu-IMEDS / solt

Streaming over lightweight data transformations
https://oulu-imeds.github.io/solt/
MIT License
263 stars 19 forks source link

Crashed without clear error message when tranforming multiple images with different shapes #72

Closed hoanghng closed 2 years ago

hoanghng commented 4 years ago

Code to reproduce:

import solt
import solt.transforms as slt
import numpy as np

if __name__ == "__main__":
    trf = solt.Stream([slt.Resize(resize_to=(50, 50)),
                       slt.Flip()])
    img1 = np.ones((100, 100, 3), dtype=np.int32)
    img2 = np.ones((110, 110, 3), dtype=np.int32)
    trf_img = trf({'images': (img1, img2)})
    print('Done')

Adding a resize transformation at the beginning doesn't help. A clear error message is needed for this case.

lext commented 4 years ago

This functionality is not supported, because it is not clear how to align the coordinate systems of those images. @hoanghng Could you make a pull request to close this issue?

soupault commented 4 years ago

@hoanghng your usecase is conceptually different from the one meant by the currently library design. We currently assume that one piece of the data (image+..+mask+mask+...+keypoints) has a consistent spatial/coordinate frame. I think we could also support the example you provided, but the issue is a bit deeper than it seems. I will take a look if this could be easily implemented without breaking the usability of the library.

hoanghng commented 4 years ago

I think at least the lib should check and raise an explicit error message for that assumption violation.

soupault commented 4 years ago

@hoanghng there is already a nice error message for this case in master (although, I do not recommend to update to it just yet).