Insightface: What kind of type train.rec file?

Created on 21 Mar 2018  路  7Comments  路  Source: deepinsight/insightface

Hello. I want to try this module on pytorch. And I want use cropped images for train network. What kind of type train.rec? Maybe you know, how can I use it on pytorch?

Most helpful comment

@Allloginsbusy
Here is one example: https://github.com/deepinsight/insightface/issues/65
Another example of my own is as following:

from mxnet import recordio
import mxnet as mx
import matplotlib.pyplot as plt
path_imgidx = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.idx'
path_imgrec = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.rec'

imgrec = recordio.MXIndexedRecordIO(path_imgidx, path_imgrec, 'r')
#%% 1 ~ 3804847
for i in range(3804846):
    header, s = recordio.unpack(imgrec.read_idx(i+1))
    img = mx.image.imdecode(s).asnumpy() 
    plt.imshow(img)
    plt.title('id=' + str(i) + 'label=' + str(header.label))
    plt.pause(0.1)

All 7 comments

I don't know much about pytorch. Maybe you can write a new pytorch data loader to read face images from our rec files.

So .rec is archive, or binary, or smth else?

local k-v storage.

Thanks. Could You Say What instrument should I use to read this storage?Any k-v db like mongo?

@Allloginsbusy
Here is one example: https://github.com/deepinsight/insightface/issues/65
Another example of my own is as following:

from mxnet import recordio
import mxnet as mx
import matplotlib.pyplot as plt
path_imgidx = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.idx'
path_imgrec = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.rec'

imgrec = recordio.MXIndexedRecordIO(path_imgidx, path_imgrec, 'r')
#%% 1 ~ 3804847
for i in range(3804846):
    header, s = recordio.unpack(imgrec.read_idx(i+1))
    img = mx.image.imdecode(s).asnumpy() 
    plt.imshow(img)
    plt.title('id=' + str(i) + 'label=' + str(header.label))
    plt.pause(0.1)

@ymcasky

Here is one example: #65
Another example of my own is as following:

from mxnet import recordio
import mxnet as mx
import matplotlib.pyplot as plt
path_imgidx = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.idx'
path_imgrec = 'D:/code/DeepLearning/Face/InsightFace/insightface/datasets/faces_ms1m_112x112/train.rec'

imgrec = recordio.MXIndexedRecordIO(path_imgidx, path_imgrec, 'r')
#%% 1 ~ 3804847
for i in range(3804846):
    header, s = recordio.unpack(imgrec.read_idx(i+1))
    img = mx.image.imdecode(s).asnumpy() 
    plt.imshow(img)
    plt.title('id=' + str(i) + 'label=' + str(header.label))
    plt.pause(0.1)

How to get the list of index in imgrec as mentioned here ?> #%% 1 ~ 3804847

Thanks.

Thanks for this code, with which I could able to determine the different classes form the data set.

Was this page helpful?
0 / 5 - 0 ratings