JeffreyJsam commited on
Commit
455200e
·
verified ·
1 Parent(s): 6dc0ffe

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -16
README.md CHANGED
@@ -26,38 +26,70 @@ A large-scale instance segmentation dataset of nearly 64k annotated spacecraft i
26
  The dataset contains over 63,917 annotated images with instance masks for varied spacecraft. It's structured for YOLO and segmentation applications, and chunked to stay within Hugging Face's per-folder file limits.
27
 
28
 
29
- ## How to Use
30
  ### Directory Structure Note
31
 
32
  Due to Hugging Face Hub's per-directory file limit (10,000 files), this dataset is chunked: each logical split (like `train/labels/`) is subdivided into folders (`000/`, `001/`, ...) containing no more than 5,000 files each.
33
 
34
  **Example Structure:**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- labels/
37
- ├── 000/
38
- │ ├── img_0.png
39
- │ └── ...
40
- ├── 001/
41
- └── ...
42
 
43
- If you're using models/tools like **YOLO** or others that expect a **flat directory**, you may need to **merge these subfolders at load-time or during preprocessing**.
44
 
45
- ## Utility Scripts
46
 
47
- ### 1. Setup
48
 
49
- Create your virtual environment:
50
 
 
 
 
 
51
  python -m venv env
52
 
53
  source env/bin/activate # On Windows: env\Scripts\activate
54
 
55
  pip install -r requirements.txt
 
 
 
 
 
56
 
 
 
57
 
58
- ### 2. Sample 500 items from a specific chunk:
 
 
 
 
 
59
 
60
- python sample_swim.py
 
 
61
 
62
  --repo-id JeffreyJsam/SWiM-SpacecraftWithMasks
63
 
@@ -68,10 +100,36 @@ Create your virtual environment:
68
  --output-dir ./Sampled-SWiM
69
 
70
  --count 500
 
 
71
 
72
- ### 3. Download the entire dataset (optionally flatten chunks):
73
 
74
- python download_swim.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  --repo-id JeffreyJsam/SWiM-SpacecraftWithMasks
77
 
@@ -82,7 +140,7 @@ Create your virtual environment:
82
  --output-dir ./SWiM
83
 
84
  --flatten
85
-
86
 
87
  **Arguments are all configurable—see `--help` for details.**
88
 
 
26
  The dataset contains over 63,917 annotated images with instance masks for varied spacecraft. It's structured for YOLO and segmentation applications, and chunked to stay within Hugging Face's per-folder file limits.
27
 
28
 
29
+ ## How to Use/Download
30
  ### Directory Structure Note
31
 
32
  Due to Hugging Face Hub's per-directory file limit (10,000 files), this dataset is chunked: each logical split (like `train/labels/`) is subdivided into folders (`000/`, `001/`, ...) containing no more than 5,000 files each.
33
 
34
  **Example Structure:**
35
+ '''
36
+ Baseline
37
+ ├──train/
38
+ ├──images/
39
+ ├── 000/
40
+ │ ├── img_0.png
41
+ │ └── ...
42
+ ├── 001/
43
+ └── ...
44
+
45
+ '''
46
+ If you're using models/tools like **YOLO** or others that expect a **flat directory**, you may need to **merge these subfolders at load-time or during preprocessing**.
47
+
48
+ **YOLO Example Structure:**
49
+ '''
50
+ Baseline
51
+ ├──train/
52
+ ├──images/
53
+ ├── img_0.png
54
+ ├── imag_99.png
55
+ └── ...
56
 
57
+ '''
 
 
 
 
 
58
 
 
59
 
60
+ ### Utility Scripts
61
 
62
+ The following scripts help you with the download of this dataset. Due to the large nature of the data and the custom directory structure, it is recommended to use the following scripts to either sample or to download the entire dataset.
63
 
 
64
 
65
+ #### 1. Setup
66
+
67
+ Create your virtual environment to help manage dependencies and prevent conflicts:
68
+ '''
69
  python -m venv env
70
 
71
  source env/bin/activate # On Windows: env\Scripts\activate
72
 
73
  pip install -r requirements.txt
74
+ '''
75
+
76
+ #### 2. Sample 500 items from a specific chunk:
77
+
78
+ This script is useful for quick local inspection, prototyping, or lightweight evaluation without downloading the full dataset.
79
 
80
+ Usage:
81
+ python3 utils/sample_swim.py --output-dir ./samples --count 100
82
 
83
+ Arguments:
84
+ --repo-id Hugging Face dataset repository ID
85
+ --image-subdir Path to image subdirectory inside the dataset repo
86
+ --label-subdir Path to corresponding label subdirectory
87
+ --output-dir Directory to save downloaded files
88
+ --count Number of samples to download
89
 
90
+ Example Usage with all args:
91
+ '''
92
+ python3 sample_swim.py
93
 
94
  --repo-id JeffreyJsam/SWiM-SpacecraftWithMasks
95
 
 
100
  --output-dir ./Sampled-SWiM
101
 
102
  --count 500
103
+ '''
104
+ #### 3. Download the entire dataset (optionally flatten chunks for YOLO format):
105
 
106
+ Streams and downloads the full paired dataset (images + label txt files) from a Hugging Face Hub repository. It recursively processes all available chunk subfolders (e.g., '000', '001', ...) under given parent paths.
107
 
108
+ Features:
109
+ - Recursively discovers subdirs (chunks) using HfFileSystem
110
+ - Optionally flattens the directory structure by removing the deepest chunk level
111
+ - Saves each .png image with its corresponding .txt label
112
+
113
+ Use this script if you want to download the complete dataset for model training or offline access.
114
+
115
+ Usage:
116
+ # Download all chunks (flattened/ YOLO format)
117
+ python utils/download_swim.py --output-dir ./SWiM --flatten
118
+
119
+ # Download specific chunks
120
+ python3 utils/download_swim.py --chunks 000 001 002 --flatten False
121
+
122
+ Arguments:
123
+ --repo-id Hugging Face dataset repository ID
124
+ --images-parent Parent directory for image chunks (e.g., Baseline/images/train)
125
+ --labels-parent Parent directory for label chunks (e.g., Baseline/labels/train)
126
+ --output-dir Where to save the downloaded dataset
127
+ --flatten Remove final 'chunk' subdir in output paths (default: True)
128
+ --chunks Specific chunk names (e.g., 000 001); omit to download all
129
+
130
+ Example usage with all args:
131
+ '''
132
+ python3 download_swim.py
133
 
134
  --repo-id JeffreyJsam/SWiM-SpacecraftWithMasks
135
 
 
140
  --output-dir ./SWiM
141
 
142
  --flatten
143
+ '''
144
 
145
  **Arguments are all configurable—see `--help` for details.**
146