GBI-16-2D / README.md
rithwiks's picture
add streaming
0de30d4 verified
|
raw
history blame
1.85 kB
metadata
license: cc-by-4.0
pretty_name: Ground-based Imaging data
tags:
  - astronomy
  - compression
  - images

GBI-16-2D Dataset

SGBI-16-2D is a dataset which is part of the AstroCompress project. It contains data assembled from the Keck Telescope. Describe data format

Usage

You first need to install the datasets and astropy packages:

pip install datasets astropy

There are two datasets: tiny and full, each with train and test splits. The tiny dataset has 2 2D images in the train and 1 in the test. The full dataset contains all the images in the data/ directory.

Local Use (RECOMMENDED)

Alternatively, you can clone this repo and use directly without connecting to hf:

git clone https://huggingface.co/datasets/AstroCompress/GBI-16-2D
git lfs pull

Then cd SBI-16-3D and start python like:

from datasets import load_dataset
dataset = load_dataset("./GBI-16-2D.py", "tiny", data_dir="./data/", streaming=True, trust_remote_code=True)
ds = dataset.with_format("np")

Now you should be able to use the ds variable like:

ds["test"][0]["image"].shape # -> (TBD)

Note of course that it will take a long time to download and convert the images in the local cache for the full dataset. Afterward, the usage should be quick as the files are memory-mapped from disk.

Use from Huggingface Directly

To directly use from this data from Huggingface, you'll want to log in on the command line before starting python:

huggingface-cli login

or

import huggingface_hub
huggingface_hub.login(token=token)

Then in your python script:

from datasets import load_dataset
dataset = load_dataset("AstroCompress/GBI-16-2D", "tiny", streaming=True, trust_remote_code=True)
ds = dataset.with_format("np")