Update README.md
Browse files
README.md
CHANGED
|
@@ -78,7 +78,20 @@ You're training models repeatedly on the same data
|
|
| 78 |
|
| 79 |
This approach downloads the dataset files as you see them on Hugging Face. This is useful when you need only parts of the data, want to explore the structure, or already have logic to read and process `.nii.gz` files.
|
| 80 |
|
|
|
|
|
|
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
This offers maximum flexibility since you can also easily filter specific files from `urls` and download these. Mind to convert these to actual urls before downloading.
|
| 84 |
|
|
|
|
| 78 |
|
| 79 |
This approach downloads the dataset files as you see them on Hugging Face. This is useful when you need only parts of the data, want to explore the structure, or already have logic to read and process `.nii.gz` files.
|
| 80 |
|
| 81 |
+
```python
|
| 82 |
+
from huggingface_hub import snapshot_download
|
| 83 |
|
| 84 |
+
# Download entire repository
|
| 85 |
+
local_dir = snapshot_download(
|
| 86 |
+
repo_id="alexanderdann/CTSpine1K",
|
| 87 |
+
repo_type="dataset",
|
| 88 |
+
cache_dir="/your/cache/dir" # optional
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
# Now you can access files directly:
|
| 92 |
+
# local_dir/rawdata/volumes/[dataset]/*.nii.gz
|
| 93 |
+
# local_dir/rawdata/labels/[dataset]/*_seg.nii.gz
|
| 94 |
+
```
|
| 95 |
|
| 96 |
This offers maximum flexibility since you can also easily filter specific files from `urls` and download these. Mind to convert these to actual urls before downloading.
|
| 97 |
|