Update README.md
Browse files
README.md
CHANGED
|
@@ -140,6 +140,10 @@ Each material in the dataset comes with rich metadata, including information on
|
|
| 140 |
and, when available, descriptions and physical size.
|
| 141 |
This comprehensive metadata facilitates precise material selection and usage, catering to the specific needs of users.
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
## 📂 Dataset Structure
|
| 144 |
|
| 145 |
The MatSynth dataset is divided into two splits: the test split, containing 89 materials, and the train split, consisting of 3,980 materials.
|
|
@@ -182,14 +186,32 @@ presented as the length of the edge in centimeters (358).
|
|
| 182 |
## 🧑💻 Usage
|
| 183 |
|
| 184 |
MatSynth is accessible through the datasets python library.
|
|
|
|
| 185 |
|
| 186 |
```python
|
| 187 |
from datasets import load_dataset
|
|
|
|
| 188 |
|
|
|
|
| 189 |
ds = load_dataset(
|
| 190 |
"gvecchio/MatSynth",
|
| 191 |
streaming = True,
|
| 192 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
```
|
| 194 |
|
| 195 |
## 📜 Citation
|
|
|
|
| 140 |
and, when available, descriptions and physical size.
|
| 141 |
This comprehensive metadata facilitates precise material selection and usage, catering to the specific needs of users.
|
| 142 |
|
| 143 |
+
<center>
|
| 144 |
+
<img src="https://gvecchio.com/matsynth/static/images/data.png" style="border-radius:10px">
|
| 145 |
+
</center>
|
| 146 |
+
|
| 147 |
## 📂 Dataset Structure
|
| 148 |
|
| 149 |
The MatSynth dataset is divided into two splits: the test split, containing 89 materials, and the train split, consisting of 3,980 materials.
|
|
|
|
| 186 |
## 🧑💻 Usage
|
| 187 |
|
| 188 |
MatSynth is accessible through the datasets python library.
|
| 189 |
+
Following a usage example:
|
| 190 |
|
| 191 |
```python
|
| 192 |
from datasets import load_dataset
|
| 193 |
+
from torch.utils.data import DataLoader
|
| 194 |
|
| 195 |
+
# load the dataset in streaming mode
|
| 196 |
ds = load_dataset(
|
| 197 |
"gvecchio/MatSynth",
|
| 198 |
streaming = True,
|
| 199 |
)
|
| 200 |
+
|
| 201 |
+
# remove unnecessary columns to reduce downloaded data
|
| 202 |
+
ds = ds.remove_columns(["diffuse", "specular", "displacement", "opacity", "blend_mask"])
|
| 203 |
+
# keep only specified columns
|
| 204 |
+
ds = ds.select_columns(["basecolor", "normal", "roughness", " metallic"])
|
| 205 |
+
|
| 206 |
+
# filter data matching a specific criteria, e.g.: only CC0 materials
|
| 207 |
+
ds = ds.filter(lambda x: x["metadata"]["license"] == "CC0")
|
| 208 |
+
|
| 209 |
+
# shuffle data
|
| 210 |
+
ds = ds.shuffle(buffer_size=100)
|
| 211 |
+
|
| 212 |
+
# set format for usage in torch
|
| 213 |
+
ds = ds.with_format("torch")
|
| 214 |
+
dl = DataLoader(ds, batch_size=8)
|
| 215 |
```
|
| 216 |
|
| 217 |
## 📜 Citation
|