python 读取mxnet recordio

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 读取mxnet recordio相关的知识,希望对你有一定的参考价值。

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)

以上是关于python 读取mxnet recordio的主要内容,如果未能解决你的问题,请参考以下文章

pytorch加速加载方案

MxNet C++和python环境配置

Win10 + Python + MXNet + VS2015配置

MXNet im2rec.py使用教程

MXNet im2rec.py使用教程

python Mxnet Viz