def parse_torch_transforms(dictionary):
    """
    Parse a dictionary of image transformations defined in torchvision.transforms.

    Arguments:
        dictionary {dict} -- dictionary for a transform, with keys `name` and `args`

    Returns:
        a callable torchvision transform pipeline
    """

    name = eval(f"""torchvision.transforms.{dictionary["name"]}""")
    args = dict(dictionary["args"])

    # Recursively parse transforms if the current transform is a composition
    if any(
        issubclass(name, eval(f"torchvision.transforms.transforms.{x}"))
        for x in ["Compose", "RandomTransforms"]
    ):
        args["transforms"] = list(map(parse_torch_transforms, args["transforms"]))

    return name(**args)