ms1mv3-recordio / README.md
gaunernst's picture
Create README.md
cdcc9b8 verified
|
raw
history blame
No virus
1.32 kB
---
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
```