-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Description
Hello !
I encounter a problem when using aloscene.Frame and aloscene.Mask. aloception-oss is not able to handle correctly the temporal dimension of Mask. It's possibly due to the fact that Mask is not mergeable.
>>> from aloscene import Frame, Mask
>>> import torch
>>> x = torch.zeros((1, 1, 128, 128))
>>> frame1 = Frame(x, names=("T", "C", "H", "W"))
>>> y = torch.zeros((4, 128, 128))
>>> mask1 = Mask(y, names=("N","H","W")).temporal()
>>> frame1.append_segmentation(mask1)
>>> frame1
tensor(
distortion=1.0
normalization=255
projection=pinhole
segmentation=torch.Size([1, 4, 128, 128])
[[[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]]]])
>>> frame2 = frame1.clone()
>>> frame2
tensor(
distortion=1.0
normalization=255
projection=pinhole
segmentation=torch.Size([1, 4, 128, 128])
[[[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]]]])
>>> merge = torch.cat([frame1, frame2], dim=0)
>>> merge
tensor(
distortion=1.0
normalization=255
projection=pinhole
segmentation=[1, 1]
[[[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]]],
[[[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]]]])
>>> merge[0].segmentation.names
('T', 'N', 'H', 'W')
>>> merge[0].segmentation.shape
torch.Size([1, 4, 128, 128])
>>> merge[0].names
('C', 'H', 'W')
Thanks VB Team for the support !