def build_clevr_dataset(
    args, configs, image_root, depth_root, scenes_json, questions_json
):
    import jactorch.transforms.bbox as T

    image_transform = T.Compose(
        [
            # T.NormalizeBbox(),
            # T.Resize(configs.data.image_size),
            # T.DenormalizeBbox(),
            T.ToTensor(),
            T.Lambda(lambda x, y: (x - 0.5, y))
            # T.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]),
        ]
    )

    from nscl.datasets.datasets import NSCLDataset

    dataset = NSCLDataset(
        scenes_json,
        questions_json,
        image_root=image_root,
        image_transform=image_transform,
        depth_root=depth_root,
        vocab_json=args.data_vocab_json,
    )

    return dataset
Example #2
0
def build_symbolic_clevr_dataset(args):
    from nscl.datasets.datasets import NSCLDataset
    dataset = NSCLDataset(
        args.data_scenes_json, args.data_questions_json,
        image_root=None, image_transform=None,
        vocab_json=args.data_vocab_json
    )

    return dataset