Visual-Behavior / aloception-oss

Aloception is a set of package for computer vision: aloscene, alodataset, alonet.
Other
93 stars 7 forks source link

Choice of required properties during call to batch_list #272

Open jsalotti opened 1 year ago

jsalotti commented 1 year ago

Description

When using a dataset from alodataset, the items of the dataset are instances of aloscene.Frame and have often a lot properties. When solving a problem, we might :

Simple example : merging two datasets

We want to train a flow model using data from multiple datasets.

Original datasets

dataset1 : stereo dataset with flow

dataset2 : monocular flow

Merged dataset

This can be done by creating an alodataset.MergeDataset to sample frames from both dataset. But when batching the frame, with aloscene.batch_list, we will encounter an error because of property baseline and child disparity.

Example of failing code

In the following code, the disparity and the occlusion of the flow are presented in only one of two datasets. This leads to an error during batch_list if the elements of the batch comes from both datasets.

from torch.utils.data.sampler import Sampler
from alodataset import FlyingThings3DSubsetDataset, MergeDataset
import aloscene

d1 = FlyingThings3DSubsetDataset(labels=["flow", "disp", "flow_occ"])
d2 = FlyingThings3DSubsetDataset(labels=["flow"])
d = MergeDataset([d1, d2])
for data in d.train_loader(batch_size=10):
    break
data = aloscene.batch_list(data)