File size: 4,547 Bytes
9ad3a2b
 
 
 
 
6e34066
 
9ad3a2b
 
6e34066
 
 
 
 
6a4a59d
 
 
 
 
c48fb85
6a4a59d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfb9116
6a4a59d
 
 
 
 
 
 
3d5094a
 
 
 
 
6a4a59d
 
bfb9116
3d5094a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfb9116
 
 
c48fb85
 
 
bfb9116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c48fb85
bfb9116
c48fb85
 
 
bfb9116
6e34066
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
license: apache-2.0
task_categories:
- image-feature-extraction
- image-classification
- image-to-image
- text-to-image
size_categories:
- n<1K
tags:
- humans
- glasses
- eyewear
- retrieval
---


# 📸 Persons with Spectacles

A curated image dataset of human faces annotated for the presence of spectacles (eyeglasses).

---

## Dataset Card for `hkanade/persons_with_spectacles`

| **Feature**           | **Detail**                                                           |
|-----------------------|----------------------------------------------------------------------|
| **Dataset name**      | `persons_with_spectacles`                                            |
| **Repository**        | https://huggingface.co/datasets/hkanade/persons_with_spectacles      |
| **License**           | apache-2.0                                                           |
| **Languages**         | —                                                                    |
| **Tasks**             | Text to Image, Image classification                                  |
| **Size**              | 120                                                                  |
| **File format**       | Parquet                                                              |
| **Dataset version**   | 1.0.0                                                                |

---

## 1. Dataset Source

All samples were collected from wikimedia/wit_base.

---

## 2. Usage

```python
from datasets import load_dataset
from PIL import Image
import os
import matplotlib.pyplot as plt
import math, itertools
import io
from IPython.display import display
import cv2

# load full dataset
 ds = load_dataset("hkanade/persons_with_spectacles")


def rec_to_pil(rec):
    """
    Accepts either
      • dict/StructValue holding the raw bytes, or
      • raw bytes themselves, or
      • a PIL.Image already
    Returns a PIL.Image.Image
    """
    if isinstance(rec, Image.Image):
        return rec                       # already a PIL image
    if isinstance(rec, (bytes, bytearray)):
        return Image.open(io.BytesIO(rec))
    if isinstance(rec, dict):            # pandas case
        # try common key names – adjust if yours differ
        for k in ("bytes", "data", 0):
            if k in rec:
                return Image.open(io.BytesIO(rec[k]))
        # fall‑back: take first value
        return Image.open(io.BytesIO(next(iter(rec.values()))))
    # pyarrow StructValue when you skip .to_pandas()
    if hasattr(rec, "values"):           # StructValue → tuple
        return Image.open(io.BytesIO(rec.values()[0]))
    raise TypeError(f"Unsupported type: {type(rec)}")

plt.imshow(rec_to_pil(ds["train"][0]["image"]))
plt.plot()
```

---

## 3. Columns

| Column                            | Datatype                                 | Description                                |
| --------------------------------- | ---------------------------------------- | ------------------------------------------ |
| `Image`                           | `struct<bytes: binary, path: string>`    | Image                |
| `image_url`                       | `string`                                 | URL of the Wikipedia page                  |
| `embedding`                       | `fixed_size_list<element: double>[2048]` | ResNet‑50 embedding                        |
| `caption_attribution_description` | `string`                                 | Caption text                               |
| `clip_emb`                        | `fixed_size_list<element: float>[512]`   | CLIP embedding of the image                |
| `h`                               | `fixed_size_list<element: double>[32]`   | Hue‑channel histogram                      |
| `s`                               | `fixed_size_list<element: double>[32]`   | Saturation‑channel histogram               |
| `v`                               | `fixed_size_list<element: double>[32]`   | Value‑channel histogram                    |
| `face_ok`                         | `bool`                                   | Placeholder flag indicating face validity  |
| `sim`                             | `float`                                  | Cosine similarity with the query embedding |

---

## 4. Citation

```bibtex
@misc{persons_with_spectacles_2025,
  author       = {Hrishikesh Kanade (hkanade)},
  title        = {Persons with Spectacles Dataset},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/datasets/hkanade/persons_with_spectacles}}
}
```