Datasets:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,35 +1,132 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
-
|
| 7 |
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
dtype: image
|
| 14 |
-
splits:
|
| 15 |
-
- name: train
|
| 16 |
-
num_bytes: 371281123
|
| 17 |
-
num_examples: 2710
|
| 18 |
-
- name: extra
|
| 19 |
-
num_bytes: 70697560
|
| 20 |
-
num_examples: 579
|
| 21 |
-
- name: test
|
| 22 |
-
num_bytes: 33643740
|
| 23 |
-
num_examples: 813
|
| 24 |
-
download_size: 435116512
|
| 25 |
-
dataset_size: 475622423
|
| 26 |
configs:
|
| 27 |
-
- config_name: default
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- glass-surface-detection
|
| 7 |
+
- segmentation
|
| 8 |
+
- reflection
|
| 9 |
+
- computer-vision
|
| 10 |
+
pretty_name: Glass Surface Detection (GSD)
|
| 11 |
+
size_categories:
|
| 12 |
+
- 1K<n<10K
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
configs:
|
| 14 |
+
- config_name: default
|
| 15 |
+
data_files:
|
| 16 |
+
- split: train
|
| 17 |
+
path: train/metadata.jsonl
|
| 18 |
+
- split: extra
|
| 19 |
+
path: extra/metadata.jsonl
|
| 20 |
+
- split: test
|
| 21 |
+
path: test/metadata.jsonl
|
| 22 |
---
|
| 23 |
+
|
| 24 |
+
# Glass Surface Detection (GSD) Dataset
|
| 25 |
+
|
| 26 |
+
Dataset from the CVPR 2021 paper:
|
| 27 |
+
|
| 28 |
+
> **Rich Context Aggregation with Reflection Prior for Glass Surface Detection**
|
| 29 |
+
> Jiaying Lin, Zebang He, Rynson W.H. Lau
|
| 30 |
+
> *Proceedings of CVPR 2021*
|
| 31 |
+
> Project page: https://jiaying.link/cvpr2021-gsd/
|
| 32 |
+
|
| 33 |
+
## Dataset Summary
|
| 34 |
+
|
| 35 |
+
GSD is a large-scale benchmark for glass surface detection in the wild. The dataset contains three splits:
|
| 36 |
+
|
| 37 |
+
- **train** — 2,710 images with full annotations (mask, reflection, edge). This is the split used to train GlassNet.
|
| 38 |
+
- **extra** — 579 additional images with mask and edge annotations but no reflections. Not used to train GlassNet.
|
| 39 |
+
- **test** — 813 images with mask annotations for evaluation.
|
| 40 |
+
|
| 41 |
+
## Dataset Structure
|
| 42 |
+
|
| 43 |
+
| Split | Images | Masks | Reflections | Edges |
|
| 44 |
+
|-------|-------:|------:|------------:|------:|
|
| 45 |
+
| train | 2,710 | 2,710 | 2,710 | 2,710 |
|
| 46 |
+
| extra | 579 | 579 | — | 579 |
|
| 47 |
+
| test | 813 | 813 | — | — |
|
| 48 |
+
|
| 49 |
+
### Fields
|
| 50 |
+
|
| 51 |
+
- **image_id** — original filename stem (e.g. `glass_0001`), unique within each split
|
| 52 |
+
- **image** — RGB photograph containing glass surfaces
|
| 53 |
+
- **mask** — binary segmentation mask (white = glass)
|
| 54 |
+
- **reflections** — RGB reflection image paired with the scene (train only; `None` otherwise)
|
| 55 |
+
- **edge** — edge annotation map (train and extra only; `None` for test)
|
| 56 |
+
|
| 57 |
+
## Usage
|
| 58 |
+
|
| 59 |
+
```python
|
| 60 |
+
from datasets import load_dataset
|
| 61 |
+
|
| 62 |
+
ds = load_dataset("garrying/GSD")
|
| 63 |
+
sample = ds["train"][0]
|
| 64 |
+
sample["image_id"] # original filename stem, e.g. "glass_0001"
|
| 65 |
+
sample["image"] # PIL Image
|
| 66 |
+
sample["mask"] # PIL Image (binary mask)
|
| 67 |
+
sample["reflections"] # PIL Image (None for extra/test)
|
| 68 |
+
sample["edge"] # PIL Image (None for test)
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Converting Back to Raw Files
|
| 72 |
+
|
| 73 |
+
A helper script [`parquet_to_raw.py`](parquet_to_raw.py) is included in this repository to convert the dataset back to a folder of raw image files:
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
# download the script
|
| 77 |
+
huggingface-cli download garrying/GSD parquet_to_raw.py --repo-type dataset --local-dir .
|
| 78 |
+
|
| 79 |
+
# convert all splits to raw PNG files
|
| 80 |
+
python parquet_to_raw.py --repo garrying/GSD --out GSD
|
| 81 |
+
|
| 82 |
+
# optionally re-upload the raw files to another HF dataset repo
|
| 83 |
+
python parquet_to_raw.py --repo garrying/GSD --out GSD --upload-to your-username/GSD-raw
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Output layout:
|
| 87 |
+
```
|
| 88 |
+
GSD/
|
| 89 |
+
train/ image/ mask/ reflections/ edge/ metadata.jsonl
|
| 90 |
+
extra/ image/ mask/ edge/ metadata.jsonl
|
| 91 |
+
test/ image/ mask/ metadata.jsonl
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## Pretrained Model
|
| 95 |
+
|
| 96 |
+
A pretrained **GlassNet** checkpoint (`GSD.pth`) is available in the companion model repository:
|
| 97 |
+
|
| 98 |
+
👉 [garrying/GSD-GlassNet](https://huggingface.co/garrying/GSD-GlassNet)
|
| 99 |
+
|
| 100 |
+
### Inference
|
| 101 |
+
|
| 102 |
+
```bash
|
| 103 |
+
# download the checkpoint
|
| 104 |
+
huggingface-cli download garrying/GSD-GlassNet GSD.pth --local-dir .
|
| 105 |
+
|
| 106 |
+
# run inference
|
| 107 |
+
python infer.py
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
## Model Architecture
|
| 111 |
+
|
| 112 |
+
**GlassNet** uses a ResNeXt-101 backbone with:
|
| 113 |
+
|
| 114 |
+
- **DenseContrastModule** — multi-scale dilated convolutions (rates 1/2/4/8) with pairwise feature subtraction to capture cross-context contrast
|
| 115 |
+
- **SELayer** — grouped squeeze-and-excitation for context-aware channel reweighting
|
| 116 |
+
- **RefNet** — a lightweight U-Net-style decoder that jointly predicts the binary glass mask and reconstructs the reflection image as auxiliary output
|
| 117 |
+
- **CRF post-processing** — dense CRF refinement of predicted masks at inference time
|
| 118 |
+
|
| 119 |
+
## Citation
|
| 120 |
+
|
| 121 |
+
```bibtex
|
| 122 |
+
@inproceedings{GSD:2021,
|
| 123 |
+
title = {Rich Context Aggregation with Reflection Prior for Glass Surface Detection},
|
| 124 |
+
author = {Lin, Jiaying and He, Zebang and Lau, Rynson W.H.},
|
| 125 |
+
booktitle = {Proc. CVPR},
|
| 126 |
+
year = {2021}
|
| 127 |
+
}
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Contact
|
| 131 |
+
|
| 132 |
+
jiayinlin5-c@my.cityu.edu.hk
|