Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datasets #1708

Open
casperdcl opened this issue Feb 14, 2024 · 1 comment
Open

datasets #1708

casperdcl opened this issue Feb 14, 2024 · 1 comment
Assignees
Labels
discussion This is a discussion thread for enhancements documentation

Comments

@casperdcl
Copy link
Member

casperdcl commented Feb 14, 2024

something like this1 (for use in notebook demos such as TomographicImaging/CIL-Demos#144):

data = cil.datasets.walnut.load()

btw internal logic could be roughly:

class Dataset:
    cache = os.getenv("CIL_DATASETS", "~/.cache/cil")
    @classmethod
    def load(cls):
        filename = brainweb.get_file(
            cls.source.rsplit("/", 1)[-1],
            cls.source,
            cache_dir=cls.cache)
        if filename.endswith(".zip"):
            return cls.load_from_zip(filename)
        raise ValueError(f"{filename}: unknown extension")

class walnut(Dataset):
    source = "https://zenodo.org/record/4822516/files/walnut.zip"

Footnotes

  1. loosely inspired by https://keras.io/api/datasets approach

@casperdcl casperdcl added discussion This is a discussion thread for enhancements documentation labels Feb 14, 2024
@paskino
Copy link
Contributor

paskino commented Feb 14, 2024

We have a structure for data which could be used.

class DATA(object):
@classmethod
def dfile(cls):
return None
@classmethod
def get(cls, size=None, scale=(0,1), **kwargs):
ddir = kwargs.get('data_dir', data_dir)
loader = TestData(data_dir=ddir)
return loader.load(cls.dfile(), size, scale, **kwargs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This is a discussion thread for enhancements documentation
Projects
No open projects
Status: ToDo
Development

No branches or pull requests

3 participants