File size: 1,892 Bytes
004806b
 
 
 
 
 
 
 
 
 
 
 
 
 
71607d0
 
 
 
 
 
 
 
 
 
004806b
 
 
 
 
 
 
 
 
 
 
 
 
 
71607d0
 
 
 
 
 
 
 
 
 
 
 
 
 
004806b
 
 
 
 
 
 
 
 
 
 
71607d0
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
license: cc-by-nc-4.0
tags:
  - glass-surface-detection
  - segmentation
  - pytorch
datasets:
  - garrying/GSD
---

# GlassNet — pretrained on GSD

Pretrained checkpoint for **GlassNet** from the CVPR 2021 paper:

> **Rich Context Aggregation with Reflection Prior for Glass Surface Detection**  
> Jiaying Lin, Zebang He, Rynson W.H. Lau  
> *Proceedings of CVPR 2021*  
> Project page: https://jiaying.link/cvpr2021-gsd/

## Files

| File | Description |
|------|-------------|
| `GSD.pth` | GlassNet weights trained on the GSD training split |

## Usage

```python
import torch
from huggingface_hub import hf_hub_download
from model import GlassNet

ckpt = hf_hub_download("garrying/GSD-GlassNet", "GSD.pth")
net = GlassNet()
net.load_state_dict(torch.load(ckpt, map_location="cpu"))
net.eval()
```

For full inference code (data loading, CRF post-processing, saving outputs) see `infer.py` in the original release.

## Model Architecture

**GlassNet** uses a ResNeXt-101 backbone with:

- **DenseContrastModule** — multi-scale dilated convolutions (rates 1/2/4/8) with pairwise feature subtraction to capture cross-context contrast
- **SELayer** — grouped squeeze-and-excitation for context-aware channel reweighting
- **RefNet** — a lightweight U-Net-style decoder that jointly predicts the binary glass mask and reconstructs the reflection image as auxiliary output
- **CRF post-processing** — dense CRF refinement of predicted masks at inference time

## Dataset

The GSD dataset is available at [garrying/GSD](https://huggingface.co/datasets/garrying/GSD).

## Citation

```bibtex
@inproceedings{GSD:2021,
    title     = {Rich Context Aggregation with Reflection Prior for Glass Surface Detection},
    author    = {Lin, Jiaying and He, Zebang and Lau, Rynson W.H.},
    booktitle = {Proc. CVPR},
    year      = {2021}
}
```

## Contact

jiayinlin5-c@my.cityu.edu.hk