BGLab commited on
Commit
8b6259d
·
verified ·
1 Parent(s): 24ca575

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +81 -91
README.md CHANGED
@@ -96,54 +96,73 @@ For each dataset type, we also provide pretrained generative model weights:
96
 
97
  ---
98
 
99
- ## 📥 Download Examples
100
 
101
- ### Using Python
102
- ```python
103
- from huggingface_hub import hf_hub_download
104
 
105
- # Download sample dataset
106
- hf_hub_download(
107
- repo_id="BGLab/microgen3D",
108
- filename="data/experimental.tar.gz",
109
- repo_type="dataset",
110
- local_dir=""
111
- )
112
 
113
- # Download experimental pretrained weights
114
- import os
115
- weights_local_dir = ""
116
- os.makedirs(weights_local_dir, exist_ok=True)
117
 
118
- files = {
119
- "weights/experimental/vae.pt": "vae.pt",
120
- "weights/experimental/fp.pt": "fp.pt",
121
- "weights/experimental/ddpm.pt": "ddpm.pt"
122
- }
123
 
124
- for remote_path, local_name in files.items():
125
- downloaded_path = hf_hub_download(
126
- repo_id="BGLab/microgen3D",
127
- filename=remote_path,
128
- repo_type="dataset"
129
- )
130
- ```
 
131
 
132
  ## 📁 Repository Structure
133
 
134
  ```
135
  microgen3D/
136
  ├── data/
137
- └── sample_data.h5 # Experimental or synthetic HDF5 microstructure file
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  ├── models/
139
  │ └── weights/
140
  │ ├── experimental/
141
- │ │ ├── vae.ckpt
142
- │ │ ├── fp.ckpt
143
- │ │ └── ddpm.ckpt
144
- │ ├── two_phase/
145
- └── three_phase/
 
 
 
 
 
 
146
  └── ...
 
147
  ```
148
 
149
  ---
@@ -168,70 +187,41 @@ pip install -r requirements.txt
168
  # Make sure HF CLI is installed and you're logged in: `huggingface-cli login`
169
  ```
170
 
 
 
 
 
171
  ```python
172
  from huggingface_hub import hf_hub_download
 
 
 
 
 
 
 
 
 
173
 
174
- # Download sample data
175
- hf_hub_download(repo_id="BGLab/microgen3D", filename="sample_data.h5", repo_type="dataset", local_dir="data")
176
 
177
- # Download model weights
178
- hf_hub_download(repo_id="BGLab/microgen3D", filename="vae.ckpt", local_dir="models/weights/experimental")
179
- hf_hub_download(repo_id="BGLab/microgen3D", filename="fp.ckpt", local_dir="models/weights/experimental")
180
- hf_hub_download(repo_id="BGLab/microgen3D", filename="ddpm.ckpt", local_dir="models/weights/experimental")
 
 
 
 
 
181
  ```
182
-
183
- ## ⚙️ Configuration
184
-
185
- ### Training Config (`config.yaml`)
186
- - **task**: Auto-generated if left null
187
- - **data_path**: Path to training dataset (`../data/sample_train.h5`)
188
- - **model_dir**: Directory to save model weights
189
- - **batch_size**: Batch size for training
190
- - **image_shape**: Shape of the 3D images `[C, D, H, W]`
191
-
192
- #### VAE Settings:
193
- - `latent_dim_channels`: Latent space channels size.
194
- - `kld_loss_weight`: Weight of KL divergence loss
195
- - `max_epochs`: Training epochs
196
- - `pretrained`: Whether to use pretrained VAE
197
- - `pretrained_path`: Path to pretrained VAE model
198
-
199
- #### FP Settings:
200
- - `dropout`: Dropout rate
201
- - `max_epochs`: Training epochs
202
- - `pretrained`: Whether to use pretrained FP
203
- - `pretrained_path`: Path to pretrained FP model
204
-
205
- #### DDPM Settings:
206
- - `timesteps`: Number of diffusion timesteps
207
- - `n_feat`: Number of feature channels for Unet. Higher the channels more model capacity.
208
- - `learning_rate`: Learning rate
209
- - `max_epochs`: Training epochs
210
-
211
- ### Inference Parameters (`params.yaml`)
212
- - **data_path**: Path to inference/test dataset (`../data/sample_test.h5`)
213
-
214
- #### Training (for model init only):
215
- - `batch_size`, `num_batches`, `num_timesteps`, `learning_rate`, `max_epochs` : Optional parameters
216
-
217
- #### Model:
218
- - `latent_dim_channels`: Latent space channels size.
219
- - `n_feat`: Number of feature channels for Unet.
220
- - `image_shape`: Expected image input shape
221
-
222
- #### Attributes:
223
- - List of features/targets to predict:
224
- - `ABS_f_D`
225
- - `CT_f_D_tort1`
226
- - `CT_f_A_tort1`
227
-
228
- #### Paths:
229
- - `ddpm_path`: Path to trained DDPM model
230
- - `vae_path`: Path to trained VAE model
231
- - `fc_path`: Path to trained FP model
232
- - `output_dir`: Where to store inference results
233
 
234
  ## 🏋️ Training
 
235
 
236
  Navigate to the training folder and run:
237
  ```bash
@@ -240,6 +230,7 @@ python training.py
240
  ```
241
 
242
  ## 🧠 Inference
 
243
 
244
  After training, switch to the inference folder and run:
245
  ```bash
@@ -269,4 +260,3 @@ If you use this dataset or models, please cite:
269
  This project is licensed under the **MIT License**.
270
 
271
  ---
272
-
 
96
 
97
  ---
98
 
99
+ ### Pretrained Weights (.pt)
100
 
101
+ We provide three pretrained weight packs aligned with the dataset families:
 
 
102
 
 
 
 
 
 
 
 
103
 
104
+ - `vae.pt` Variational Autoencoder weights
105
+ - `fp.pt` — Feature Predictor weights
106
+ - `ddpm.pt` — Latent Diffusion Model weights
 
107
 
108
+ ### Model/Weights Summary
 
 
 
 
109
 
110
+ | Pack | Input shape | VAE latent size | FP input (flattened) | FP output size (# predicted attrs) | Conditioning params | Manufacturing params | DDPM max features (`n_feat`) |
111
+ |--------------:|:----------------|:----------------|----------------------:|:-----------------------------------:|:-------------------:|:--------------------:|:----------------------------:|
112
+ | CH 2-Phase | `1,128,128,64` | `4,8,8,4` | `1024` | `7` | `3` | `0` | `512` |
113
+ | CH 3-Phase | `1,128,128,64` | `4,8,8,4` | `1024` | `7` | `4` | `3` | `512` |
114
+ | Experimental | `64,64,64` | `1,8,8,8` | `512` | `3` | `3` | `0` | `512` |
115
+
116
+
117
+ To learn more about the attributes and their meanings, see this [link](https://owodolab.github.io/graspi/listOfDescriptors.html).
118
 
119
  ## 📁 Repository Structure
120
 
121
  ```
122
  microgen3D/
123
  ├── data/
124
+ ├── experimental.tar.gz
125
+ │ ├── ch_2phase.tar.gz
126
+ │ ├── ch_3phase.tar.gz
127
+ │ ├── sample_CH_two_phase.tar.gz
128
+ │ ├── sample_CH_three_phase.tar.gz
129
+ │ ├── experimental/ # after extracting experimental.tar.gz
130
+ │ │ ├── dataset_info.txt
131
+ │ │ ├── train.h5
132
+ │ │ ├── val.h5
133
+ │ │ └── sample_train.h5
134
+ │ ├── ch_2phase/ # after extracting ch_2phase.tar.gz
135
+ │ │ ├── dataset_info.txt
136
+ │ │ ├── train/ # training split (HDF5 shards/files)
137
+ │ │ └── val/ # validation split
138
+ │ ├── ch_3phase/ # after extracting ch_3phase.tar.gz
139
+ │ │ ├── dataset_info.txt
140
+ │ │ ├── train/
141
+ │ │ └── val/
142
+ │ ├── ch_2phase_sample/ # after extracting sample_CH_two_phase.tar.gz
143
+ │ │ ├── dataset_info.txt
144
+ │ │ ├── train/
145
+ │ │ └── val/
146
+ │ └── ch_3phase_sample/ # after extracting sample_CH_three_phase.tar.gz
147
+ │ ├── dataset_info.txt
148
+ │ ├── train/
149
+ │ └── val/
150
  ├── models/
151
  │ └── weights/
152
  │ ├── experimental/
153
+ │ │ ├── vae.pt
154
+ │ │ ├── fp.pt
155
+ │ │ └── ddpm.pt
156
+ │ ├── ch_2phase/
157
+ │ ├── vae.pt
158
+ │ │ ├── fp.pt
159
+ │ │ └── ddpm.pt
160
+ │ └── ch_3phase/
161
+ │ ├── vae.pt
162
+ │ ├── fp.pt
163
+ │ └── ddpm.pt
164
  └── ...
165
+
166
  ```
167
 
168
  ---
 
187
  # Make sure HF CLI is installed and you're logged in: `huggingface-cli login`
188
  ```
189
 
190
+
191
+ ## 📥 Download Examples
192
+
193
+ ### Using Python
194
  ```python
195
  from huggingface_hub import hf_hub_download
196
+ import os
197
+
198
+ # Download sample dataset
199
+ hf_hub_download(
200
+ repo_id="BGLab/microgen3D",
201
+ filename="data/experimental.tar.gz", # correct remote path
202
+ repo_type="dataset",
203
+ local_dir=""
204
+ )
205
 
206
+ # Download experimental pretrained weights
 
207
 
208
+ for fname in ["weights/experimental/vae.pt",
209
+ "weights/experimental/fp.pt",
210
+ "weights/experimental/ddpm.pt"]:
211
+ hf_hub_download(
212
+ repo_id="BGLab/microgen3D",
213
+ filename=fname, # correct remote path
214
+ repo_type="dataset",
215
+ local_dir=""
216
+ )
217
  ```
218
+ ### 📂 Extract Dataset
219
+ ```bash
220
+ tar -xzvf data/experimental.tar.gz -C data/
221
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
222
 
223
  ## 🏋️ Training
224
+ For inference details refer to the GitHub repository README. [![Code](https://img.shields.io/badge/GitHub-Code-black?logo=github)](https://github.com/baskargroup/MicroGen3D)
225
 
226
  Navigate to the training folder and run:
227
  ```bash
 
230
  ```
231
 
232
  ## 🧠 Inference
233
+ For inference details refer to the GitHub repository README. [![Code](https://img.shields.io/badge/GitHub-Code-black?logo=github)](https://github.com/baskargroup/MicroGen3D)
234
 
235
  After training, switch to the inference folder and run:
236
  ```bash
 
260
  This project is licensed under the **MIT License**.
261
 
262
  ---