File size: 1,318 Bytes
cdcc9b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
size_categories:
- 1M<n<10M
task_categories:
- image-classification
---
# MS-Celeb-1M (v3)

This dataset is introduced in the Lightweight Face Recognition Challenge at ICCV 2019. [Paper](https://openaccess.thecvf.com/content_ICCVW_2019/papers/LSR/Deng_Lightweight_Face_Recognition_Challenge_ICCVW_2019_paper.pdf).

There are 5,179,510 images and 93,431 ids. All images are aligned based on facial landmarks predicted by RetinaFace and resized to 112x112.

This was downloaded from `https://github.com/deepinsight/insightface/tree/master/recognition/_datasets_` (MS1M-RetinaFace). The dataset is stored in MXNet RecordIO format.

## Usage

```python
import io
import numpy as np
from PIL import Image

np.bool = bool  # fix for mxnet
from mxnet.recordio import MXIndexedRecordIO, unpack

record = MXIndexedRecordIO("ms1m-retinaface-t1/train.idx", "ms1m-retinaface-t1/train.rec", "r")

header, _ = unpack(record.read_idx(0))
size = int(header.label[0]) - 1
n_classes = int(open("ms1m-retinaface-t1/property").read().split(",")[0])

sample_idx = 100  # from 0 to size-1
header, raw_img = unpack(self.record.read_idx(sample_idx + 1))

label = header.label
if not isinstance(label, (int, float)):
    label = label[0]
label = int(label)

img = Image.open(io.BytesIO(raw_img))  # using cv2.imdecode is also possible
```