AllanK24 commited on
Commit
4cd940e
·
verified ·
1 Parent(s): d7e959f

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +132 -78
README.md CHANGED
@@ -1,4 +1,26 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  dataset_info:
3
  features:
4
  - name: image
@@ -9,126 +31,158 @@ dataset_info:
9
  dtype: string
10
  splits:
11
  - name: train
12
- num_bytes: 6251674501
13
  num_examples: 22492
14
  - name: validation
15
- num_bytes: 2584262537
16
  num_examples: 9412
17
  - name: test
18
- num_bytes: 2581775314
19
  num_examples: 9492
20
- download_size: 11729195090
21
- dataset_size: 11417712352
22
- configs:
23
- - config_name: default
24
- data_files:
25
- - split: train
26
- path: data/train-*
27
- - split: validation
28
- path: data/validation-*
29
- - split: test
30
- path: data/test-*
31
  ---
32
 
 
33
 
34
- ```markdown
35
- ---
36
- license: cc-by-nc-4.0
37
- task_categories:
38
- - image-segmentation
39
- - semantic-segmentation
40
- language:
41
- - en
42
- tags:
43
- - material-segmentation
44
- - apple-dms
45
- - scene-parsing
46
- - segformer
47
- size_categories:
48
- - 10k<n<100k
49
- ---
50
 
51
- # Apple Dense Material Segmentation (DMS) Dataset
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- This dataset is a reconstructed version of the **Apple Dense Material Segmentation (DMS)** dataset, originally introduced in the ECCV 2022 paper *"A Dense Material Segmentation Dataset for Indoor and Outdoor Scene Parsing"*.
 
 
 
 
 
54
 
55
- It pairs high-quality dense material masks (provided by Apple) with the corresponding real-world images from the Open Images dataset.
56
 
57
- **Repository:** [AllanK24/apple-dms-materials](https://huggingface.co/datasets/AllanK24/apple-dms-materials)
58
 
59
- ## Dataset Summary
 
60
 
61
- - **Total Samples:** ~41,385 image-mask pairs
62
- - **Classes:** 46 material categories (e.g., Wood, Glass, Plastic, Metal, Fabric)
63
- - **Task:** Semantic Segmentation
64
- - **Origin:** Reassembled from [Apple's Official Repository](https://github.com/apple/ml-dms-dataset) and Open Images archives.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- ### Missing Data Note
67
- This dataset was reconstructed in 2026. Due to "internet rot" (images being deleted from Flickr and Open Images S3 buckets over the years), approximately **~6% of the original images are permanently lost**.
68
- - **Original Dataset Size:** ~44,500 images
69
- - **Current Dataset Size:** ~41,385 images
70
- - **Status:** The dataset is ~94% complete and fully functional for training state-of-the-art segmentation models.
71
 
72
  ## Usage
73
 
74
- You can load this dataset directly using the Hugging Face `datasets` library.
75
 
76
  ```python
77
  from datasets import load_dataset
78
 
79
- # Load the dataset
80
  dataset = load_dataset("AllanK24/apple-dms-materials")
81
 
82
- # Inspect a single example
83
- example = dataset["train"][0]
84
- image = example["image"]
85
- mask = example["label"]
86
- image_id = example["image_id"]
87
-
88
- print(f"Loaded image {image_id} with size {image.size}")
89
 
 
 
 
 
 
90
  ```
91
 
92
- ### Class Labels & Taxonomy
93
-
94
- The dataset includes a `class_info.json` file containing the mapping between label IDs and material names.
95
-
96
- * **Background/Void:** Depending on the configuration, ID 0 or 255 is often used for void. Check `class_info.json` for the exact ID mapping.
97
- * **Classes:** 46 standard materials.
98
 
99
- ## Dataset Structure
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
 
101
- The dataset is divided into three standard splits:
102
 
103
- | Split | Samples |
104
- | --- | --- |
105
- | `train` | ~30,000 |
106
- | `validation` | ~5,000 |
107
- | `test` | ~6,000 |
 
108
 
109
- ## Licensing
 
110
 
111
- This dataset is a composite of two sources with different licenses:
112
 
113
- 1. **Annotations (Masks):** Created by Apple. Distributed under the license specified in the [Apple ML-DMS Repository](https://github.com/apple/ml-dms-dataset) (Copyright © 2022 Apple Inc.).
114
- 2. **Images:** Sourced from Open Images (Flickr). These images retain their original Creative Commons licenses (typically CC-BY 2.0 or CC-BY 4.0) as defined by their original photographers.
115
 
116
- **Disclaimer:** This repository is a redistribution of the reconstructed dataset for research convenience. Users are responsible for adhering to the licenses of both the image sources and the annotation providers.
 
 
117
 
118
  ## Citation
119
 
120
  If you use this dataset, please cite the original Apple paper:
121
 
122
  ```bibtex
123
- @inproceedings{upchurch2022dense,
124
- title={A Dense Material Segmentation Dataset for Indoor and Outdoor Scene Parsing},
125
  author={Upchurch, Paul and Niu, Ransen},
126
- booktitle={European Conference on Computer Vision (ECCV)},
127
- year={2022}
128
  }
129
-
130
  ```
131
 
132
- ```
133
 
134
- ```
 
1
  ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language:
5
+ - en
6
+ license: apple-ascl
7
+ multilinguality: monolingual
8
+ pretty_name: Apple Dense Material Segmentation (DMS)
9
+ size_categories:
10
+ - 10K<n<100K
11
+ source_datasets:
12
+ - extended|open-images-v7
13
+ tags:
14
+ - material-segmentation
15
+ - semantic-segmentation
16
+ - dense-prediction
17
+ - materials
18
+ - segformer
19
+ - mask2former
20
+ task_categories:
21
+ - image-segmentation
22
+ task_ids:
23
+ - semantic-segmentation
24
  dataset_info:
25
  features:
26
  - name: image
 
31
  dtype: string
32
  splits:
33
  - name: train
 
34
  num_examples: 22492
35
  - name: validation
 
36
  num_examples: 9412
37
  - name: test
 
38
  num_examples: 9492
 
 
 
 
 
 
 
 
 
 
 
39
  ---
40
 
41
+ # Apple Dense Material Segmentation (DMS) Dataset
42
 
43
+ A **pixel-level material segmentation** dataset containing ~41K images with dense annotations across **57 material categories**. Originally released by Apple as part of the [Dense Material Segmentation (DMS)](https://machinelearning.apple.com/research/dense-material-segmentation) research project.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ > **Note**: This is a mirror prepared for direct use with the HuggingFace 🤗 `datasets` library. The source images originate from [Open Images V7](https://storage.googleapis.com/openimages/web/index.html), and material annotations were created by Apple. Some images (~6%) from the original dataset could not be retrieved from Open Images and are therefore absent.
46
+
47
+ ## Dataset Description
48
+
49
+ Each sample consists of:
50
+
51
+ | Field | Type | Description |
52
+ |-------|------|-------------|
53
+ | `image` | `PIL.Image` | RGB input image |
54
+ | `label` | `PIL.Image` | Single-channel segmentation mask (pixel values = class indices 0–56) |
55
+ | `image_id` | `string` | Unique image identifier |
56
+
57
+ ### Splits
58
 
59
+ | Split | Samples | Percentage |
60
+ |-------|---------|------------|
61
+ | Train | 22,492 | 54.3% |
62
+ | Validation | 9,412 | 22.7% |
63
+ | Test | 9,492 | 22.9% |
64
+ | **Total** | **41,396** | **100%** |
65
 
66
+ The split assignments follow the original Apple DMS partition.
67
 
68
+ ### Material Classes (57)
69
 
70
+ <details>
71
+ <summary>Click to expand full class list</summary>
72
 
73
+ | ID | Material | ID | Material | ID | Material |
74
+ |----|----------|----|----------|----|----------|
75
+ | 0 | No label | 19 | Gemstone/quartz | 38 | Sky |
76
+ | 1 | Animal skin | 20 | Glass | 39 | Snow |
77
+ | 2 | Bone/teeth/horn | 21 | Hair | 40 | Soap |
78
+ | 3 | Brickwork | 22 | I cannot tell | 41 | Soil/mud |
79
+ | 4 | Cardboard | 23 | Ice | 42 | Sponge |
80
+ | 5 | Carpet/rug | 24 | Leather | 43 | Stone, natural |
81
+ | 6 | Ceiling tile | 25 | Liquid, non-water | 44 | Stone, polished |
82
+ | 7 | Ceramic | 26 | Metal | 45 | Styrofoam |
83
+ | 8 | Chalkboard/blackboard | 27 | Mirror | 46 | Tile |
84
+ | 9 | Clutter | 28 | Not on list | 47 | Wallpaper |
85
+ | 10 | Concrete | 29 | Paint/plaster/enamel | 48 | Water |
86
+ | 11 | Cork/corkboard | 30 | Paper | 49 | Wax |
87
+ | 12 | Engineered stone | 31 | Pearl | 50 | Whiteboard |
88
+ | 13 | Fabric/cloth | 32 | Photograph/painting | 51 | Wicker |
89
+ | 14 | Fiberglass wool | 33 | Plastic, clear | 52 | Wood |
90
+ | 15 | Fire | 34 | Plastic, non-clear | 53 | Wood, tree |
91
+ | 16 | Foliage | 35 | Rubber/latex | 54 | Bad polygon |
92
+ | 17 | Food | 36 | Sand | 55 | Multiple materials |
93
+ | 18 | Fur | 37 | Skin/lips | 56 | Asphalt |
94
 
95
+ </details>
 
 
 
 
96
 
97
  ## Usage
98
 
99
+ ### Loading the Dataset
100
 
101
  ```python
102
  from datasets import load_dataset
103
 
 
104
  dataset = load_dataset("AllanK24/apple-dms-materials")
105
 
106
+ # Access splits
107
+ train_ds = dataset["train"]
108
+ val_ds = dataset["validation"]
109
+ test_ds = dataset["test"]
 
 
 
110
 
111
+ # View a sample
112
+ sample = train_ds[0]
113
+ print(sample["image_id"]) # e.g. "22491"
114
+ sample["image"].show() # RGB image
115
+ sample["label"].show() # Segmentation mask
116
  ```
117
 
118
+ ### Training with SegFormer
 
 
 
 
 
119
 
120
+ ```python
121
+ from transformers import SegformerForSemanticSegmentation, SegformerImageProcessorFast
122
+ import json
123
+
124
+ # Load class info
125
+ from huggingface_hub import hf_hub_download
126
+ class_info_path = hf_hub_download(
127
+ repo_id="AllanK24/apple-dms-materials",
128
+ filename="class_info.json",
129
+ repo_type="dataset",
130
+ )
131
+ with open(class_info_path) as f:
132
+ class_info = json.load(f)
133
+
134
+ id2label = {int(k): v for k, v in class_info["id2label"].items()}
135
+ label2id = class_info["label2id"]
136
+ num_labels = class_info["num_labels"]
137
+
138
+ # Initialize model
139
+ model = SegformerForSemanticSegmentation.from_pretrained(
140
+ "nvidia/segformer-b2-finetuned-ade-512-512",
141
+ num_labels=num_labels,
142
+ id2label=id2label,
143
+ label2id=label2id,
144
+ ignore_mismatched_sizes=True,
145
+ )
146
+
147
+ # Initialize processor
148
+ processor = SegformerImageProcessorFast.from_pretrained(
149
+ "nvidia/segformer-b2-finetuned-ade-512-512"
150
+ )
151
+ ```
152
 
153
+ ### Applying Transforms
154
 
155
+ ```python
156
+ def transforms(batch):
157
+ images = [x.convert("RGB") for x in batch["image"]]
158
+ labels = [x for x in batch["label"]]
159
+ inputs = processor(images=images, segmentation_maps=labels, return_tensors="pt")
160
+ return inputs
161
 
162
+ train_ds.set_transform(transforms)
163
+ ```
164
 
165
+ ## Dataset Preparation
166
 
167
+ This dataset was prepared from the original Apple DMS release using the following pipeline:
 
168
 
169
+ 1. **Download** Source images retrieved from Open Images V7 using URLs in Apple's metadata.
170
+ 2. **Resize & align** – Images resized to match label dimensions using Apple's [`prepare_images.py`](https://github.com/apple/ml-dms-dataset).
171
+ 3. **Validation** – Image–label consistency verified with Apple's `check_images.py` (41,385 / 41,396 passed; 11 minor rotation warnings).
172
 
173
  ## Citation
174
 
175
  If you use this dataset, please cite the original Apple paper:
176
 
177
  ```bibtex
178
+ @article{upchurch2022dense,
179
+ title={Dense Material Segmentation with Context-Aware Network},
180
  author={Upchurch, Paul and Niu, Ransen},
181
+ year={2022},
182
+ url={https://machinelearning.apple.com/research/dense-material-segmentation}
183
  }
 
184
  ```
185
 
186
+ ## License
187
 
188
+ This dataset is released under the [Apple Sample Code License (ASCL)](https://developer.apple.com/sample-code/license/apple-sample-code-license/). The source images are from Open Images V7 and are subject to their respective licenses (primarily CC BY 2.0). Please refer to the [original repository](https://github.com/apple/ml-dms-dataset) for full licensing details.