Merge branch 'main' of https://huggingface.co/datasets/AstroCompress/SBI-16-2D into main
Browse files
README.md
CHANGED
@@ -21,50 +21,54 @@ pip install datasets astropy
|
|
21 |
|
22 |
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.
|
23 |
|
24 |
-
## Use
|
25 |
|
26 |
-
|
27 |
|
28 |
```bash
|
29 |
-
huggingface-
|
30 |
```
|
31 |
|
32 |
-
|
33 |
-
|
34 |
```
|
35 |
-
|
36 |
-
huggingface_hub.login(token=token)
|
37 |
```
|
38 |
|
39 |
-
Then
|
40 |
|
41 |
```python
|
42 |
from datasets import load_dataset
|
43 |
-
dataset = load_dataset("
|
44 |
ds = dataset.with_format("np")
|
45 |
```
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
Alternatively, you can clone this repo and use directly without connecting to hf:
|
50 |
|
51 |
-
```
|
52 |
-
|
53 |
```
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
|
|
61 |
```
|
62 |
|
63 |
-
|
64 |
|
65 |
-
```
|
66 |
-
|
|
|
67 |
```
|
68 |
|
69 |
-
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
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.
|
23 |
|
24 |
+
## Local Use (RECOMMENDED)
|
25 |
|
26 |
+
Alternatively, you can clone this repo and use directly without connecting to hf:
|
27 |
|
28 |
```bash
|
29 |
+
git clone https://huggingface.co/datasets/AstroCompress/SBI-16-2D
|
30 |
```
|
31 |
|
32 |
+
To pull all data files:
|
|
|
33 |
```
|
34 |
+
git lfs pull
|
|
|
35 |
```
|
36 |
|
37 |
+
Then `cd SBI-16-3D` and start python like:
|
38 |
|
39 |
```python
|
40 |
from datasets import load_dataset
|
41 |
+
dataset = load_dataset("./SBI-16-2D.py", "tiny", data_dir="./data/")
|
42 |
ds = dataset.with_format("np")
|
43 |
```
|
44 |
|
45 |
+
Now you should be able to use the `ds` variable like:
|
|
|
|
|
46 |
|
47 |
+
```python
|
48 |
+
ds["test"][0]["image"].shape # -> (TBD)
|
49 |
```
|
50 |
|
51 |
+
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.
|
52 |
|
53 |
+
## Use from Huggingface Directly
|
54 |
+
|
55 |
+
To directly use from this data from Huggingface, you'll want to log in on the command line before starting python:
|
56 |
+
|
57 |
+
```bash
|
58 |
+
huggingface-cli login
|
59 |
```
|
60 |
|
61 |
+
or
|
62 |
|
63 |
+
```
|
64 |
+
import huggingface_hub
|
65 |
+
huggingface_hub.login(token=token)
|
66 |
```
|
67 |
|
68 |
+
Then in your python script:
|
69 |
|
70 |
+
```python
|
71 |
+
from datasets import load_dataset
|
72 |
+
dataset = load_dataset("AstroCompress/SBI-16-2D", "tiny")
|
73 |
+
ds = dataset.with_format("np")
|
74 |
+
```
|